Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions lib/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,30 @@ const Users = {
new User(client, json, ip_address, fingerprint, callback);
}
});
},

/** Update a user - Calling the Patch on User
* @param client [Object]
* @param fingerprint [String] : the device that is trying to access a user's information
* @param ip_address [String] : ip address of user
* @param payload [Object] : Look at docs for format (https://docs.synapsepay.com/docs/create-a-user)
* @param userID [String] : User Object ID
* @param callback [function(error, userResponseObj)]
**/
update(client, fingerprint, ip_address, payload, userID, callback) {
const config = {
client: client,
fingerprint: fingerprint,
ip_address: ip_address
};
const url = client.baseUrl + '/users/' + userID;
APIClient.patch(url, config, payload, (err, json) => {
if (err) {
callback(err);
} else {
new User(client, json, ip_address, fingerprint, callback);
}
});
}
};

Expand Down