Skip to content

Commit

Permalink
Merge 503463c into b58aa01
Browse files Browse the repository at this point in the history
  • Loading branch information
madhankumar3103 committed Oct 30, 2020
2 parents b58aa01 + 503463c commit 9b93a3d
Show file tree
Hide file tree
Showing 3 changed files with 588 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -5,14 +5,14 @@ node_js:
- '6.15.1' #boron
- '8.14.0' #carbon
- '10.14.2' #dubnium
- stable
- '14.13.1' #stable

script:
- npm run prepublish-prod

after_success:
- if [ $TRAVIS_NODE_VERSION = 'stable' ] && [ $TRAVIS_BRANCH = 'master' ] && [ $TRAVIS_PULL_REQUEST = 'false' ]; then sh ./scripts/travisPublishDocs.sh; fi
- if [ $TRAVIS_NODE_VERSION = 'stable' ]; then npm run coveralls; fi
- if [ $TRAVIS_NODE_VERSION = '14.13.1' ] && [ $TRAVIS_BRANCH = 'master' ] && [ $TRAVIS_PULL_REQUEST = 'false' ]; then sh ./scripts/travisPublishDocs.sh; fi
- if [ $TRAVIS_NODE_VERSION = '14.13.1' ]; then npm run coveralls; fi

env:
global:
Expand Down
177 changes: 177 additions & 0 deletions src/Hyperwallet.js
Expand Up @@ -1799,4 +1799,181 @@ export default class Hyperwallet {
}
this.client.doGet(`users/${encodeURIComponent(userToken)}/venmo-accounts/${encodeURIComponent(venmoAccountToken)}/status-transitions`, options, Hyperwallet.handle204Response(callback));
}
//--------------------------------------
// Business StakeHolder
//--------------------------------------

/**
* Create a Business Stakeholder
*
* @param {string} userToken - The Stakeholder token
* @param {Object} data - The Stakeholder data
* @param {api-callback} callback - The callback for this call
*
* @throws Will throw an error if userToken is not provided
*/
createBusinessStakeholder(userToken, data, callback) {
if (!userToken) {
throw new Error("userToken is required");
}
this.client.doPost(`users/${encodeURIComponent(userToken)}/business-stakeholders`, data, {}, callback);
}
/**
* Update a Business Stakeholder
*
* @param {string} userToken - The user token
* @param {string} stakeholderToken - The user token
* @param {Object} data - The Stakeholder data that should be updated
* @param {api-callback} callback - The callback for this call
*
* @throws Will throw an error if userToken is not provided
*/
updateBusinessStakeholder(userToken, stakeholderToken, data, callback) {
if (!userToken) {
throw new Error("userToken is required");
}
if (!stakeholderToken) {
throw new Error("stakeholderToken is required");
}
this.client.doPut(`users/${encodeURIComponent(userToken)}/business-stakeholders/${encodeURIComponent(stakeholderToken)}`, data, {}, callback);
}

/**
* List all Business Stakeholder
*
* @param {string} userToken - The user token
* @param {Object} options - The query parameters to send
* @param {api-callback} callback - The callback for this call
*
* @throws Will throw an error if userToken is not provided
*/
listBusinessStakeholder(userToken, options, callback) {
if (!userToken) {
throw new Error("userToken is required");
}
this.client.doGet(`users/${encodeURIComponent(userToken)}/business-stakeholders`, options, Hyperwallet.handle204Response(callback));
}

/**
* Activate a Business Stakeholder transition
*
* @param {string} userToken - user token
* @param {api-callback} callback - callback for this call
* @throws Will throw an error if userToken is not provided
*/
activateBusinessStakeholder(userToken, stakeholderToken, callback) {
if (!userToken) {
throw new Error("userToken is required");
}
if (!stakeholderToken) {
throw new Error("stakeholderToken is required");
}
const transition = {
transition: "ACTIVATED",
};
this.client.doPost(`users/${encodeURIComponent(userToken)}/business-stakeholders/${encodeURIComponent(stakeholderToken)}/status-transitions`, transition, {}, callback);
}

/**
* Deactivate a Business Stakeholder transition
*
* @param {string} userToken - user token
* @param {api-callback} callback - callback for this call
* @throws Will throw an error if userToken is not provided
*/
deactivateBusinessStakeholder(userToken, stakeholderToken, callback) {
if (!userToken) {
throw new Error("userToken is required");
}
if (!stakeholderToken) {
throw new Error("stakeholderToken is required");
}
const transition = {
transition: "DE_ACTIVATED",
};
this.client.doPost(`users/${encodeURIComponent(userToken)}/business-stakeholders/${encodeURIComponent(stakeholderToken)}/status-transitions`, transition, {}, callback);
}

/**
* Create a Business Stakeholder transition
*
* @param {string} userToken - user token
* @param {Object} data - Stakeholder transition data
* @param {api-callback} callback - The callback for this call
* @throws Will throw an error if userToken is not provided
*/
createBusinessStakeholderStatusTransition(userToken, stakeholderToken, data, callback) {
if (!userToken) {
throw new Error("userToken is required");
}
if (!stakeholderToken) {
throw new Error("stakeholderToken is required");
}
this.client.doPost(`users/${encodeURIComponent(userToken)}/business-stakeholders/${encodeURIComponent(stakeholderToken)}/status-transitions`, data, {}, callback);
}
/**
* Get Business Stakeholder status transition
*
* @param {string} userToken -user token
* @param {string} stakeholderToken - The Business Stakeholder token
* @param {string} statusTransitionToken - The Business Stakeholder status transition token
* @param {api-callback} callback - The callback for this call
*
* @throws Will throw an error if userToken or stakeholderToken is not provided
*/
getBusinessStakeholderStatusTransition(userToken, stakeholderToken, statusTransitionToken, callback) {
if (!userToken) {
throw new Error("userToken is required");
}
if (!stakeholderToken) {
throw new Error("stakeholderToken is required");
}
if (!statusTransitionToken) {
throw new Error("statusTransitionToken is required");
}
this.client.doGet(`users/${encodeURIComponent(userToken)}/business-stakeholders/${encodeURIComponent(stakeholderToken)}/status-transitions/${encodeURIComponent(statusTransitionToken)}`,
{},
callback);
}

/**
* List all Business Stakeholder status transitions
*
* @param {string} userToken - user token
* @param {string} stakeholderToken - Business Stakeholder token
* @param {Object} options - query parameters to send
* @param {api-callback} callback - callback for this call
*
* @throws Will throw an error if userToken or stakeholderToken is not provided
*/
listBusinessStakeholderStatusTransition(userToken, stakeholderToken, options, callback) {
if (!userToken) {
throw new Error("userToken is required");
}
if (!stakeholderToken) {
throw new Error("stakeholderToken is required");
}
this.client.doGet(`users/${encodeURIComponent(userToken)}/business-stakeholders/${encodeURIComponent(stakeholderToken)}/status-transitions`, options, Hyperwallet.handle204Response(callback));
}
/**
* Upload Documents to Business Stakeholder
*
* @param {string} userToken - The user token
* @param {Object} data - JSON object of the data and files to be uploaded
* @param {api-callback} callback - The callback for this call
*
* @throws Will throw an error if userToken is not provided
*/
uploadBusinessStakeholderDocuments(userToken, stakeholderToken, data, callback) {
if (!userToken) {
throw new Error("userToken is required");
}
if (!stakeholderToken) {
throw new Error("stakeholderToken is required");
}
if (!data) {
throw new Error("Files for upload are required");
}
this.client.doPutMultipart(`users/${encodeURIComponent(userToken)}/business-stakeholders/${encodeURIComponent(stakeholderToken)}`, data, callback);
}
}

0 comments on commit 9b93a3d

Please sign in to comment.