-
Notifications
You must be signed in to change notification settings - Fork 32
Changes for handling transfer refund in v4 endpoint #62
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
15 commits
Select commit
Hold shift + click to select a range
df364dd
Changes for handling Transfer refund use case in v4 endpoint
ramahalingam 908e724
Source changes for handling Transfer refund use case in v4 endpoint
ramahalingam 0e6f1d8
Merge branch 'V4' of github.com:hyperwallet/java-sdk into feature/HW-…
ramahalingam 14becde
Test failure fix
ramahalingam ed5888f
Comment change in pom
ramahalingam 04f77a8
Review comments and merge conflicts fix
ramahalingam 9a9dcd2
Merge conflict changes
ramahalingam 7c14cc3
Merge conflicts changes
ramahalingam 2691667
Changes for getting the links
ramahalingam d91a15c
Changes for getting the links
ramahalingam 1906c2f
merge conflicts fix
ramahalingam d1ff3dd
review comments fix
ramahalingam 281745b
merge conflicts fix
ramahalingam 4a00061
merge conflicts fix
ramahalingam af4f238
merge conflicts fix
ramahalingam 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1038,6 +1038,74 @@ public HyperwalletStatusTransition createTransferStatusTransition(String transfe | |
return apiClient.post(url + "/transfers/" + transferToken + "/status-transitions", transition, HyperwalletStatusTransition.class); | ||
} | ||
|
||
//-------------------------------------- | ||
// Transfer refunds | ||
//-------------------------------------- | ||
|
||
/** | ||
* Create Transfer Refund | ||
* | ||
* @param transferToken Transfer token assigned | ||
* @param transferRefund Transfer Refund object to create | ||
* @return Created Transfer Refund | ||
*/ | ||
public HyperwalletTransferRefund createTransferRefund(String transferToken, HyperwalletTransferRefund transferRefund) { | ||
if (transferRefund == null) { | ||
throw new HyperwalletException("Transfer Refund is required"); | ||
} | ||
if (StringUtils.isEmpty(transferToken)) { | ||
throw new HyperwalletException("Transfer token is required"); | ||
} | ||
if (StringUtils.isEmpty(transferRefund.getClientRefundId())) { | ||
throw new HyperwalletException("ClientRefundId is required"); | ||
} | ||
|
||
transferRefund = copy(transferRefund); | ||
transferRefund.clearStatus(); | ||
transferRefund.clearCreatedOn(); | ||
return apiClient.post(url + "/transfers/" + transferToken + "/refunds", transferRefund, HyperwalletTransferRefund.class); | ||
} | ||
|
||
/** | ||
* Get Transfer Refund | ||
* | ||
* @param transferToken Transfer token assigned | ||
* @param transferRefundToken Transfer Refund token assigned | ||
* @return Transfer Refund object | ||
*/ | ||
public HyperwalletTransferRefund getTransferRefund(String transferToken, String transferRefundToken) { | ||
if (StringUtils.isEmpty(transferToken)) { | ||
throw new HyperwalletException("Transfer token is required"); | ||
} | ||
if (StringUtils.isEmpty(transferRefundToken)) { | ||
throw new HyperwalletException("Transfer Refund token is required"); | ||
} | ||
|
||
return apiClient.get(url + "/transfers/" + transferToken + "/refunds/" + transferRefundToken, HyperwalletTransferRefund.class); | ||
} | ||
|
||
/** | ||
* List Transfer Refund Requests | ||
* | ||
* @param options List filter option | ||
* @param transferToken Transfer token assigned | ||
* @return HyperwalletList of HyperwalletTransferRefund | ||
*/ | ||
public HyperwalletList<HyperwalletTransferRefund> listTransferRefunds(String transferToken, HyperwalletTransferRefundListOptions options) { | ||
if (StringUtils.isEmpty(transferToken)) { | ||
throw new HyperwalletException("Transfer token is required"); | ||
} | ||
|
||
String url = paginate(this.url + "/transfers/" + transferToken + "/refunds", options); | ||
if (options != null) { | ||
url = addParameter(url, "clientRefundId", options.getClientRefundId()); | ||
url = addParameter(url, "sourceToken", options.getSourceToken()); | ||
url = addParameter(url, "status", options.getStatus()); | ||
} | ||
return apiClient.get(url, new TypeReference<HyperwalletList<HyperwalletTransferRefund>>() { | ||
}); | ||
} | ||
|
||
//-------------------------------------- | ||
// PayPal Accounts | ||
//-------------------------------------- | ||
|
@@ -2283,8 +2351,11 @@ private HyperwalletPayPalAccount copy(HyperwalletPayPalAccount payPalAccount) { | |
return payPalAccount; | ||
} | ||
|
||
private HyperwalletTransferRefund copy(HyperwalletTransferRefund transferRefund) { | ||
return HyperwalletJsonUtil.fromJson(HyperwalletJsonUtil.toJson(transferRefund), HyperwalletTransferRefund.class); | ||
} | ||
|
||
private HyperwalletVenmoAccount copy(HyperwalletVenmoAccount venmoAccount) { | ||
return HyperwalletJsonUtil.fromJson(HyperwalletJsonUtil.toJson(venmoAccount), HyperwalletVenmoAccount.class); | ||
} | ||
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. Can be changed to: return HyperwalletJsonUtil.fromJson(HyperwalletJsonUtil.toJson(transferRefund), HyperwalletTransferRefund.class); 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. Done |
||
|
||
} |
305 changes: 305 additions & 0 deletions
305
src/main/java/com/hyperwallet/clientsdk/model/HyperwalletTransferRefund.java
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 |
---|---|---|
@@ -0,0 +1,305 @@ | ||
package com.hyperwallet.clientsdk.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFilter; | ||
import com.hyperwallet.clientsdk.util.HyperwalletJsonConfiguration; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
@JsonFilter(HyperwalletJsonConfiguration.INCLUSION_FILTER) | ||
@XmlRootElement | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
public class HyperwalletTransferRefund extends HyperwalletBaseMonitor { | ||
|
||
public static enum Status {PENDING, FAILED, COMPLETED} | ||
|
||
private String token; | ||
private Status status; | ||
private String clientRefundId; | ||
private String sourceToken; | ||
private Double sourceAmount; | ||
private String sourceCurrency; | ||
private String destinationToken; | ||
private Double destinationAmount; | ||
private String destinationCurrency; | ||
private Date createdOn; | ||
private String notes; | ||
private String memo; | ||
private List<HyperwalletLink> links; | ||
|
||
public String getToken() { | ||
return token; | ||
} | ||
|
||
public void setToken(String token) { | ||
addField("token", token); | ||
this.token = token; | ||
} | ||
|
||
public HyperwalletTransferRefund token(String token) { | ||
addField("token", token); | ||
this.token = token; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearToken() { | ||
clearField("token"); | ||
this.token = null; | ||
return this; | ||
} | ||
|
||
public Status getStatus() { | ||
return status; | ||
} | ||
|
||
public void setStatus(Status status) { | ||
addField("status", status); | ||
this.status = status; | ||
} | ||
|
||
public HyperwalletTransferRefund status(Status status) { | ||
addField("status", status); | ||
this.status = status; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearStatus() { | ||
clearField("status"); | ||
this.status = null; | ||
return this; | ||
} | ||
|
||
public String getClientRefundId() { | ||
return clientRefundId; | ||
} | ||
|
||
public void setClientRefundId(String clientRefundId) { | ||
addField("clientRefundId", clientRefundId); | ||
this.clientRefundId = clientRefundId; | ||
} | ||
|
||
public HyperwalletTransferRefund clientRefundId(String clientRefundId) { | ||
addField("clientRefundId", clientRefundId); | ||
this.clientRefundId = clientRefundId; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearClientRefundId() { | ||
clearField("clientRefundId"); | ||
this.clientRefundId = null; | ||
return this; | ||
} | ||
|
||
public String getSourceToken() { | ||
return sourceToken; | ||
} | ||
|
||
public void setSourceToken(String sourceToken) { | ||
addField("sourceToken", sourceToken); | ||
this.sourceToken = sourceToken; | ||
} | ||
|
||
public HyperwalletTransferRefund sourceToken(String sourceToken) { | ||
addField("sourceToken", sourceToken); | ||
this.sourceToken = sourceToken; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearSourceToken() { | ||
clearField("sourceToken"); | ||
this.sourceToken = null; | ||
return this; | ||
} | ||
|
||
public Double getSourceAmount() { | ||
return sourceAmount; | ||
} | ||
|
||
public void setSourceAmount(Double sourceAmount) { | ||
addField("sourceAmount", sourceAmount); | ||
this.sourceAmount = sourceAmount; | ||
} | ||
|
||
public HyperwalletTransferRefund sourceAmount(Double sourceAmount) { | ||
addField("sourceAmount", sourceAmount); | ||
this.sourceAmount = sourceAmount; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearSourceAmount() { | ||
clearField("sourceAmount"); | ||
this.sourceAmount = null; | ||
return this; | ||
} | ||
|
||
public String getSourceCurrency() { | ||
return sourceCurrency; | ||
} | ||
|
||
public void setSourceCurrency(String sourceCurrency) { | ||
addField("sourceCurrency", sourceCurrency); | ||
this.sourceCurrency = sourceCurrency; | ||
} | ||
|
||
public HyperwalletTransferRefund sourceCurrency(String sourceCurrency) { | ||
addField("sourceCurrency", sourceCurrency); | ||
this.sourceCurrency = sourceCurrency; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearSourceCurrency() { | ||
clearField("sourceCurrency"); | ||
this.sourceCurrency = null; | ||
return this; | ||
} | ||
|
||
public String getDestinationToken() { | ||
return destinationToken; | ||
} | ||
|
||
public void setDestinationToken(String destinationToken) { | ||
addField("destinationToken", destinationToken); | ||
this.destinationToken = destinationToken; | ||
} | ||
|
||
public HyperwalletTransferRefund destinationToken(String destinationToken) { | ||
addField("destinationToken", destinationToken); | ||
this.destinationToken = destinationToken; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearDestinationToken() { | ||
clearField("destinationToken"); | ||
this.destinationToken = null; | ||
return this; | ||
} | ||
|
||
public Double getDestinationAmount() { | ||
return destinationAmount; | ||
} | ||
|
||
public void setDestinationAmount(Double destinationAmount) { | ||
addField("destinationAmount", destinationAmount); | ||
this.destinationAmount = destinationAmount; | ||
} | ||
|
||
public HyperwalletTransferRefund destinationAmount(Double destinationAmount) { | ||
addField("destinationAmount", destinationAmount); | ||
this.destinationAmount = destinationAmount; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearDestinationAmount() { | ||
clearField("destinationAmount"); | ||
this.destinationAmount = null; | ||
return this; | ||
} | ||
|
||
public String getDestinationCurrency() { | ||
return destinationCurrency; | ||
} | ||
|
||
public void setDestinationCurrency(String destinationCurrency) { | ||
addField("destinationCurrency", destinationCurrency); | ||
this.destinationCurrency = destinationCurrency; | ||
} | ||
|
||
public HyperwalletTransferRefund destinationCurrency(String destinationCurrency) { | ||
addField("destinationCurrency", destinationCurrency); | ||
this.destinationCurrency = destinationCurrency; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearDestinationCurrency() { | ||
clearField("destinationCurrency"); | ||
this.destinationCurrency = null; | ||
return this; | ||
} | ||
|
||
public Date getCreatedOn() { | ||
return createdOn; | ||
} | ||
|
||
public void setCreatedOn(Date createdOn) { | ||
addField("createdOn", createdOn); | ||
this.createdOn = createdOn; | ||
} | ||
|
||
public HyperwalletTransferRefund createdOn(Date createdOn) { | ||
addField("createdOn", createdOn); | ||
this.createdOn = createdOn; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearCreatedOn() { | ||
clearField("createdOn"); | ||
this.createdOn = null; | ||
return this; | ||
} | ||
|
||
public String getNotes() { | ||
return notes; | ||
} | ||
|
||
public void setNotes(String notes) { | ||
addField("notes", notes); | ||
this.notes = notes; | ||
} | ||
|
||
public HyperwalletTransferRefund notes(String notes) { | ||
addField("notes", notes); | ||
this.notes = notes; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearNotes() { | ||
clearField("notes"); | ||
this.notes = null; | ||
return this; | ||
} | ||
|
||
public String getMemo() { | ||
return memo; | ||
} | ||
|
||
public void setMemo(String memo) { | ||
addField("memo", memo); | ||
this.memo = memo; | ||
} | ||
|
||
public HyperwalletTransferRefund memo(String memo) { | ||
addField("memo", memo); | ||
this.memo = memo; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearMemo() { | ||
clearField("memo"); | ||
this.memo = null; | ||
return this; | ||
} | ||
|
||
public List<HyperwalletLink> getLinks() { | ||
return links; | ||
} | ||
|
||
public void setLinks(List<HyperwalletLink> links) { | ||
addField("links", links); | ||
this.links = links; | ||
} | ||
|
||
public HyperwalletTransferRefund links(List<HyperwalletLink> links) { | ||
addField("links", links); | ||
this.links = links; | ||
return this; | ||
} | ||
|
||
public HyperwalletTransferRefund clearLinks() { | ||
clearField("links"); | ||
this.links = null; | ||
return this; | ||
} | ||
} |
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.
Pls remove extra spaces
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