-
Notifications
You must be signed in to change notification settings - Fork 32
Feature/hw 66628 v4 java sdk venmo account #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
95321b0
HW-66628-V4Java SDK Changes for VenmoAccount
jkurra-hw 8ad471e
HW-66628-Version Changed from V3 to V4.
jkurra-hw fad3d0b
Merge branch 'V4' into feature/HW-66628-V4JavaSDK-VenmoAccount
jkurra-hw d18d58e
HW-66628-Addressed Merge conflicts and Review comments
jkurra-hw 86e2dae
HW-66628-Addressed Review comments
jkurra-hw 2eda449
Merge branch 'V4' into feature/HW-66628-V4JavaSDK-VenmoAccount
jkurra-hw 61e2a11
HW-66628-Resolved Merge conflicts from Pagination changes
jkurra-hw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1199,6 +1199,215 @@ public HyperwalletList<HyperwalletStatusTransition> listPayPalAccountStatusTrans | |
return apiClient.get(url, new TypeReference<HyperwalletList<HyperwalletStatusTransition>>() { | ||
}); | ||
} | ||
//-------------------------------------- | ||
// Venmo Accounts | ||
//-------------------------------------- | ||
|
||
/** | ||
* Create Venmo Account | ||
* | ||
* @param venmoAccount HyperwalletVenmoAccount object to create | ||
* @return HyperwalletVenmoAccount created Venmo account for the specified user | ||
*/ | ||
public HyperwalletVenmoAccount createVenmoAccount(HyperwalletVenmoAccount venmoAccount) { | ||
if (venmoAccount == null) { | ||
throw new HyperwalletException("Venmo Account is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccount.getUserToken())) { | ||
throw new HyperwalletException("User token is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccount.getTransferMethodCountry())) { | ||
throw new HyperwalletException("Transfer Method Country is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccount.getTransferMethodCurrency())) { | ||
throw new HyperwalletException("Transfer Method Currency is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccount.getAccountId())) { | ||
throw new HyperwalletException("Account is required"); | ||
} | ||
if (StringUtils.isNotEmpty(venmoAccount.getToken())) { | ||
throw new HyperwalletException("Venmo Account token may not be present"); | ||
} | ||
if (venmoAccount.getType() == null) { | ||
venmoAccount.setType(HyperwalletTransferMethod.Type.VENMO_ACCOUNT); | ||
} | ||
venmoAccount = copy(venmoAccount); | ||
venmoAccount.setStatus(null); | ||
venmoAccount.setCreatedOn(null); | ||
return apiClient.post(url + "/users/" + venmoAccount.getUserToken() + "/venmo-accounts", venmoAccount, HyperwalletVenmoAccount.class); | ||
} | ||
|
||
/** | ||
* Get Venmo Account | ||
* | ||
* @param userToken User token assigned | ||
* @param venmoAccountToken Venmo Account token assigned | ||
* @return HyperwalletVenmoAccount Venmo Account | ||
*/ | ||
public HyperwalletVenmoAccount getVenmoAccount(String userToken, String venmoAccountToken) { | ||
if (StringUtils.isEmpty(userToken)) { | ||
throw new HyperwalletException("User token is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccountToken)) { | ||
throw new HyperwalletException("venmo Account token is required"); | ||
} | ||
return apiClient.get(url + "/users/" + userToken + "/venmo-accounts/" + venmoAccountToken, HyperwalletVenmoAccount.class); | ||
} | ||
|
||
/** | ||
* List Venmo Accounts | ||
* | ||
* @param userToken User token assigned | ||
* @param options List filter option | ||
* @return HyperwalletList of HyperwalletVenmoAccount | ||
*/ | ||
public HyperwalletList<HyperwalletVenmoAccount> listVenmoAccounts(String userToken, HyperwalletPaginationOptions options) { | ||
if (StringUtils.isEmpty(userToken)) { | ||
throw new HyperwalletException("User token is required"); | ||
} | ||
String url = paginate(this.url + "/users/" + userToken + "/venmo-accounts", options); | ||
return apiClient.get(url, new TypeReference<HyperwalletList<HyperwalletVenmoAccount>>() { | ||
}); | ||
} | ||
|
||
/** | ||
* List Venmo Accounts | ||
* | ||
* @param userToken User token assigned | ||
* @return HyperwalletList of HyperwalletVenmoAccount | ||
*/ | ||
public HyperwalletList<HyperwalletVenmoAccount> listVenmoAccounts(String userToken) { | ||
return listVenmoAccounts(userToken, null); | ||
} | ||
|
||
/** | ||
* Update Venmo Account | ||
* | ||
* @param venmoAccount Venmo Account to Update. | ||
* @return HyperwalletVenmoAccount Updated Venmo Account | ||
*/ | ||
public HyperwalletVenmoAccount updateVenmoAccount(HyperwalletVenmoAccount venmoAccount) { | ||
if (venmoAccount == null) { | ||
throw new HyperwalletException("Venmo Account is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccount.getUserToken())) { | ||
throw new HyperwalletException("User token is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccount.getToken())) { | ||
throw new HyperwalletException("Venmo Account token is required"); | ||
} | ||
return apiClient.put(url + "/users/" + venmoAccount.getUserToken() + "/venmo-accounts/" + venmoAccount.getToken(), venmoAccount, | ||
HyperwalletVenmoAccount.class); | ||
} | ||
|
||
/** | ||
* Deactivate Venmo Account | ||
* | ||
* @param userToken User token | ||
* @param venmoAccountToken Venmo account token | ||
* @return HyperwalletStatusTransition deactivated venmo account | ||
*/ | ||
public HyperwalletStatusTransition deactivateVenmoAccount(String userToken, String venmoAccountToken) { | ||
return deactivateVenmoAccount(userToken, venmoAccountToken, null); | ||
} | ||
|
||
/** | ||
* Deactivate Venmo Account | ||
* | ||
* @param userToken User token | ||
* @param venmoAccountToken Venmo account token | ||
* @param notes Comments regarding the status change | ||
* @return HyperwalletStatusTransition deactivated Venmo account | ||
*/ | ||
public HyperwalletStatusTransition deactivateVenmoAccount(String userToken, String venmoAccountToken, String notes) { | ||
return createVenmoAccountStatusTransition(userToken, | ||
venmoAccountToken, | ||
new HyperwalletStatusTransition(HyperwalletStatusTransition.Status.DE_ACTIVATED).notes(notes)); | ||
} | ||
|
||
/** | ||
* Create Venmo Account Status Transition | ||
* | ||
* @param userToken User token | ||
* @param venmoAccountToken Venmo account token | ||
* @param transition Status transition information | ||
* @return HyperwalletStatusTransition new status for Venmo Account | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uppercase venmo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed to Uppercase |
||
public HyperwalletStatusTransition createVenmoAccountStatusTransition(String userToken, String venmoAccountToken, | ||
HyperwalletStatusTransition transition) { | ||
if (transition == null) { | ||
throw new HyperwalletException("Transition is required"); | ||
} | ||
if (StringUtils.isEmpty(userToken)) { | ||
throw new HyperwalletException("User token is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccountToken)) { | ||
throw new HyperwalletException("Venmo account token is required"); | ||
} | ||
if (!StringUtils.isEmpty(transition.getToken())) { | ||
throw new HyperwalletException("Status Transition token may not be present"); | ||
} | ||
transition = copy(transition); | ||
transition.setCreatedOn(null); | ||
transition.setFromStatus(null); | ||
transition.setToStatus(null); | ||
return apiClient.post(url + "/users/" + userToken + "/venmo-accounts/" + venmoAccountToken + "/status-transitions", transition, | ||
HyperwalletStatusTransition.class); | ||
} | ||
|
||
/** | ||
* Get Venmo Account Status Transition | ||
* | ||
* @param userToken User token | ||
* @param venmoAccountToken Venmo account token | ||
* @param statusTransitionToken Status transition token | ||
* @return HyperwalletStatusTransition | ||
*/ | ||
public HyperwalletStatusTransition getVenmoAccountStatusTransition(String userToken, String venmoAccountToken, String statusTransitionToken) { | ||
if (StringUtils.isEmpty(userToken)) { | ||
throw new HyperwalletException("User token is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccountToken)) { | ||
throw new HyperwalletException("Venmo account token is required"); | ||
} | ||
if (StringUtils.isEmpty(statusTransitionToken)) { | ||
throw new HyperwalletException("Transition token is required"); | ||
} | ||
return apiClient.get(url + "/users/" + userToken + "/venmo-accounts/" + venmoAccountToken + "/status-transitions/" + statusTransitionToken, | ||
HyperwalletStatusTransition.class); | ||
} | ||
|
||
/** | ||
* List All Venmo Account Status Transition information | ||
* | ||
* @param userToken User token | ||
* @param venmoAccountToken Venmo account token | ||
* @return HyperwalletList of HyperwalletStatusTransition | ||
*/ | ||
public HyperwalletList<HyperwalletStatusTransition> listVenmoAccountStatusTransitions(String userToken, String venmoAccountToken) { | ||
return listVenmoAccountStatusTransitions(userToken, venmoAccountToken, null); | ||
} | ||
|
||
/** | ||
* List Venmo Account Status Transition information | ||
* | ||
* @param userToken User token | ||
* @param venmoAccountToken Venmo account token | ||
* @param options List filter option | ||
* @return HyperwalletList of HyperwalletStatusTransition | ||
*/ | ||
public HyperwalletList<HyperwalletStatusTransition> listVenmoAccountStatusTransitions(String userToken, String venmoAccountToken, | ||
HyperwalletPaginationOptions options) { | ||
if (StringUtils.isEmpty(userToken)) { | ||
throw new HyperwalletException("User token is required"); | ||
} | ||
if (StringUtils.isEmpty(venmoAccountToken)) { | ||
throw new HyperwalletException("Venmo account token is required"); | ||
} | ||
String url = paginate(this.url + "/users/" + userToken + "/venmo-accounts/" + venmoAccountToken + "/status-transitions", options); | ||
return apiClient.get(url, new TypeReference<HyperwalletList<HyperwalletStatusTransition>>() { | ||
}); | ||
} | ||
|
||
//-------------------------------------- | ||
// Bank Accounts | ||
|
@@ -1997,4 +2206,9 @@ private HyperwalletPayPalAccount copy(HyperwalletPayPalAccount payPalAccount) { | |
return payPalAccount; | ||
} | ||
|
||
private HyperwalletVenmoAccount copy(HyperwalletVenmoAccount venmoAccount) { | ||
return HyperwalletJsonUtil.fromJson(HyperwalletJsonUtil.toJson(venmoAccount), HyperwalletVenmoAccount.class); | ||
|
||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uppercase venmo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.