-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RC-2.0.1 Add support for InvoicePaymet API updates (#45)
# Update # Adding support for `InvoicePayment.Create`, `InvoicePayment.Update` API updates ### Checklist - [x] I acknowledge that all my contributions will be made under the project's license - [x] I have made a material change to the repo (functionality, testing, spelling, grammar) - [x] I have titled the PR appropriately - [x] I have updated my branch with the main branch - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added the necessary documentation about the functionality in the appropriate .md file - [x] I have added inline documentation to the code I modified If you have questions, create a GitHub Issue in this repository.
- Loading branch information
1 parent
17817b7
commit a98d345
Showing
6 changed files
with
220 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
104 changes: 104 additions & 0 deletions
104
src/main/java/com/trolley/types/supporting/InvoicePaymentRequest.java
This file contains 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,104 @@ | ||
package com.trolley.types.supporting; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* Used while creating a new InvoicePayment request | ||
*/ | ||
public class InvoicePaymentRequest{ | ||
private String batchId; | ||
private boolean coverFees; | ||
private String memo; | ||
private String externalId; | ||
private String[] tags; | ||
private InvoicePaymentPart[] ids; | ||
|
||
public InvoicePaymentRequest() { | ||
} | ||
|
||
/** | ||
* Constructor to create a new request when you have more than one Invoices or InvoiceLines to create payment for. | ||
* @param batchId ID of the batch you'd want to add this payment to. If it's {@code null} or {@code ""}, a new payment will be created. | ||
* @param coverFees Denotes whether you want to cover fees with this payment. | ||
* @param memo A recipient viewable Memo that you'd want the created payment to have. | ||
* @param externalId A unique External ID that you'd want to assign to the created payment. | ||
* @param tags A {@code String[]} array where each element is a merchant-viewable tag that you want to assign to the created payment. | ||
* @param ids An {@code InvoicePaymentPart[]} array representing InvoicePaymentPart objects containing IDs and Amounts of Invoices and InvoiceLines you want to create payments for. | ||
*/ | ||
public InvoicePaymentRequest(String batchId, boolean coverFees, String memo, String externalId, | ||
String[] tags, InvoicePaymentPart[] ids) { | ||
this.batchId = batchId; | ||
this.coverFees = coverFees; | ||
this.memo = memo; | ||
this.externalId = externalId; | ||
this.tags = tags; | ||
this.ids = ids; | ||
} | ||
|
||
/** | ||
* Constructor to create a new request when you have only one Invoice/InvoiceLine to create a payment for. | ||
* @param batchId ID of the batch you'd want to add this payment to. If it's {@code null} or {@code ""}, a new payment will be created. | ||
* @param coverFees Denotes whether you want to cover fees with this payment. | ||
* @param memo A recipient viewable Memo that you'd want the created payment to have. | ||
* @param externalId A unique External ID that you'd want to assign to the created payment. | ||
* @param tags A {@code String[]} array where each element is a merchant-viewable tag that you want to assign to the created payment. | ||
* @param ids An {@code InvoicePaymentPart[]} array representing InvoicePaymentPart objects containing IDs and Amounts of Invoices and InvoiceLines you want to create payments for. | ||
*/ | ||
public InvoicePaymentRequest(String batchId, boolean coverFees, String memo, String externalId, | ||
String[] tags, InvoicePaymentPart paymentPart) { | ||
this.batchId = batchId; | ||
this.coverFees = coverFees; | ||
this.memo = memo; | ||
this.externalId = externalId; | ||
this.tags = tags; | ||
this.ids = new InvoicePaymentPart[]{paymentPart}; | ||
} | ||
|
||
public String getBatchId() { | ||
return batchId; | ||
} | ||
|
||
public void setBatchId(String batchId) { | ||
this.batchId = batchId; | ||
} | ||
|
||
public boolean shouldCoverFees() { | ||
return coverFees; | ||
} | ||
|
||
public void setCoverFees(boolean coverFees) { | ||
this.coverFees = coverFees; | ||
} | ||
|
||
public String getMemo() { | ||
return memo; | ||
} | ||
|
||
public void setMemo(String memo) { | ||
this.memo = memo; | ||
} | ||
|
||
public String getExternalId() { | ||
return externalId; | ||
} | ||
|
||
public void setExternalId(String externalId) { | ||
this.externalId = externalId; | ||
} | ||
|
||
public String[] getTags() { | ||
return tags; | ||
} | ||
|
||
public void setTags(String[] tags) { | ||
this.tags = tags; | ||
} | ||
|
||
public InvoicePaymentPart[] getIds() { | ||
return ids; | ||
} | ||
|
||
public void setIds(InvoicePaymentPart[] ids) { | ||
this.ids = ids; | ||
} | ||
} |
This file contains 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