Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,13 @@ user.reinitiateMicroDeposits('<NODE_ID>')
console.log('data ', data);
});
```
#### Reauthorize Account
```
user.reauthorizeAccount('<NODE_ID>')
.then(({ data }) => {
console.log('data ', data);
});
```
#### Update Node
```
user.updateNode('<NODE_ID>', {
Expand Down
8 changes: 8 additions & 0 deletions src/apiReqs/apiReqsUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const {
resetCardNode,
verifyMicroDeposits,
reinitiateMicroDeposits,
reauthorizeAccount,
updateNode,
deleteNode,
generateApplePayToken,
Expand Down Expand Up @@ -188,6 +189,13 @@ module.exports[reinitiateMicroDeposits] = ({ node_id, userInfo }) => {
return axios.patch(url, {}, { headers });
};

module.exports[reauthorizeAccount] = ({ node_id, userInfo }) => {
const { host, headers, id } = userInfo;
const url = `${host}/users/${id}/nodes/${node_id}?reauth=yes`;

return axios.patch(url, {}, { headers });
}

module.exports[updateNode] = ({ node_id, bodyParams, userInfo }) => {
const { host, headers, id } = userInfo;
const url = `${host}/users/${id}/nodes/${node_id}`;
Expand Down
1 change: 1 addition & 0 deletions src/constants/apiReqNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = {
resetCardNode: 'resetCardNode',
verifyMicroDeposits: 'verifyMicroDeposits',
reinitiateMicroDeposits: 'reinitiateMicroDeposits',
reauthorizeAccount: 'reauthorizeAccount',
updateNode: 'updateNode',
deleteNode: 'deleteNode',
generateApplePayToken: 'generateApplePayToken',
Expand Down
9 changes: 9 additions & 0 deletions src/lib/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const {
resetCardNode,
verifyMicroDeposits,
reinitiateMicroDeposits,
reauthorizeAccount,
updateNode,
deleteNode,
generateApplePayToken,
Expand Down Expand Up @@ -275,6 +276,14 @@ class User {
});
}

// PATCH REAUTHORIZE ACCOUNT
reauthorizeAccount(node_id) {
return apiRequests.user[reauthorizeAccount]({
node_id,
userInfo: this
});
}

// PATCH UPDATE NODE
updateNode(node_id, bodyParams) {
return apiRequests.user[updateNode]({
Expand Down
7 changes: 7 additions & 0 deletions test/userTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ describe('User', () => {
}));
});

describe('patch reauthorize account', () => {
it('should reauthoirze account', mochaAsync(async () => {
const response = await testUser.reauthorizeAccount('<NODE_ID>');
expect(response.status).to.equal(200);
}));
});

describe('patch update node', () => {
it('should update node', mochaAsync(async () => {
const response = await testUser.updateNode('<NODE_ID>', {
Expand Down