Skip to content

Commit

Permalink
#v6.4.2110.0-rc - Add missing properties in models (#77)
Browse files Browse the repository at this point in the history
- Invoice
- PayoutInstruction
- PayoutInfo
  • Loading branch information
nsoni3 authored Oct 8, 2021
1 parent c3a549f commit 6989d0d
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 5 deletions.
137 changes: 135 additions & 2 deletions src/main/java/com/bitpay/sdk/model/Invoice/Invoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class Invoice {
private boolean _fullNotifications = false;
private String _notificationEmail = "";
private String _redirectURL = "";
private String _closeURL = "";
private String _orderId = "";
private String _itemDesc = "";
private String _itemCode = "";
Expand All @@ -41,6 +42,7 @@ public class Invoice {
private InvoiceTransactionDetails _transactionDetails;
private InvoiceUniversalCodes _universalCodes;
private List<InvoiceItemizedDetails> _itemizedDetails;
private boolean _autoRedirect = false;

private String _id;
private String _url;
Expand All @@ -64,10 +66,20 @@ public class Invoice {
private boolean _extendedNotifications = false;
private String _transactionCurrency;
private BigDecimal _amountPaid;
private BigDecimal _displayAmountPaid;
private Hashtable<String, Hashtable<String, String>> _exchangeRates;
private boolean _isCancelled = false;
private boolean _bitpayIdRequired = false;

private Hashtable<String, String> _paymentSubtotals;
private Hashtable<String, String> _paymentTotals;
private Hashtable<String, String> _paymentDisplayTotals;
private Hashtable<String, String> _paymentDisplaySubTotals;
private boolean _nonPayProPaymentReceived;
private boolean _jsonPayProRequired = false;
private BigDecimal _underpaidAmount;
private BigDecimal _overpaidAmount;
private Hashtable<String, Hashtable<String, String>> _paymentCodes;

/**
* Constructor, create an empty Invoice object.
*/
Expand Down Expand Up @@ -249,6 +261,17 @@ public void setRedirectURL(String _redirectURL) {
this._redirectURL = _redirectURL;
}

@JsonProperty("closeURL")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getCloseURL() {
return _closeURL;
}

@JsonProperty("closeURL")
public void setCloseURL(String _closeURL) {
this._closeURL = _closeURL;
}

@JsonProperty("physical")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public boolean getPhysical() {
Expand Down Expand Up @@ -351,6 +374,16 @@ public void setItemizedDetails(List<InvoiceItemizedDetails> _itemizedDetails) {
this._itemizedDetails = _itemizedDetails;
}

@JsonIgnore
public boolean getAutoRedirect() {
return _autoRedirect;
}

@JsonProperty("autoRedirect")
public void setAutoRedirect(boolean _autoRedirect) {
this._autoRedirect = _autoRedirect;
}

@JsonProperty("bitpayIdRequired")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public boolean getBitpayIdRequired() {
Expand Down Expand Up @@ -600,6 +633,16 @@ public void setAmountPaid(BigDecimal _amountPaid) {
this._amountPaid = _amountPaid;
}

@JsonIgnore
public BigDecimal getDisplayAmountPaid() {
return _displayAmountPaid;
}

@JsonProperty("displayAmountPaid")
public void setDisplayAmountPaid(BigDecimal _displayAmountPaid) {
this._displayAmountPaid = _displayAmountPaid;
}

@JsonIgnore
public Hashtable<String, Hashtable<String, String>> getExchangeRates() {
return _exchangeRates;
Expand All @@ -619,4 +662,94 @@ public boolean getIsCancelled() {
public void setIsCancelled(boolean _isCancelled) {
this._isCancelled = _isCancelled;
}
}

@JsonIgnore
public Hashtable<String, String> getPaymentSubTotals() {
return _paymentSubtotals;
}

@JsonProperty("paymentSubtotals")
public void setPaymentSubTotals(Hashtable<String, String> _paymentSubtotals) {
this._paymentSubtotals = _paymentSubtotals;
}

@JsonIgnore
public Hashtable<String, String> getPaymentTotals() {
return _paymentTotals;
}

@JsonProperty("paymentTotals")
public void setPaymentTotals(Hashtable<String, String> _paymentTotals) {
this._paymentTotals = _paymentTotals;
}

@JsonIgnore
public Hashtable<String, String> getPaymentDisplayTotals() {
return _paymentDisplayTotals;
}

@JsonProperty("paymentDisplayTotals")
public void setPaymentDisplayTotals(Hashtable<String, String> _paymentDisplayTotals) {
this._paymentDisplayTotals = _paymentDisplayTotals;
}

@JsonIgnore
public Hashtable<String, String> getPaymentDisplaySubTotals() {
return _paymentDisplaySubTotals;
}

@JsonProperty("paymentDisplaySubTotals")
public void setPaymentDisplaySubTotals(Hashtable<String, String> _paymentDisplaySubTotals) {
this._paymentDisplaySubTotals = _paymentDisplaySubTotals;
}

@JsonIgnore
public boolean getNonPayProPaymentReceived() {
return _nonPayProPaymentReceived;
}

@JsonProperty("nonPayProPaymentReceived")
public void setNonPayProPaymentReceived(boolean _nonPayProPaymentReceived) {
this._nonPayProPaymentReceived = _nonPayProPaymentReceived;
}

@JsonIgnore
public boolean getJsonPayProRequired() {
return _jsonPayProRequired;
}

@JsonProperty("jsonPayProRequired")
public void setJsonPayProRequired(boolean _jsonPayProRequired) {
this._jsonPayProRequired = _jsonPayProRequired;
}

@JsonIgnore
public BigDecimal getUnderPaidAmount() {
return _underpaidAmount;
}

@JsonProperty("underpaidAmount")
public void setUnderPaidAmount(BigDecimal _underpaidAmount) {
this._underpaidAmount = _underpaidAmount;
}

@JsonIgnore
public BigDecimal getOverPaidAmount() {
return _overpaidAmount;
}

@JsonProperty("overpaidAmount")
public void setOverPaidAmount(BigDecimal _overpaidAmount) {
this._overpaidAmount = _overpaidAmount;
}

@JsonIgnore
public Hashtable<String, Hashtable<String, String>> getPaymentCodes() {
return _paymentCodes;
}

@JsonProperty("paymentCodes")
public void setPaymentCodes(Hashtable<String, Hashtable<String, String>> _paymentCodes) {
this._paymentCodes = _paymentCodes;
}
}
12 changes: 12 additions & 0 deletions src/main/java/com/bitpay/sdk/model/Payout/PayoutInstruction.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class PayoutInstruction {
private PayoutInstructionBtcSummary _btc;
private List<PayoutInstructionTransaction> _transactions;
private String _status;
private String _address;

/**
* Constructor, create an empty PayoutInstruction object.
Expand Down Expand Up @@ -164,4 +165,15 @@ public String getStatus() {
public void setStatus(String status) {
this._status = status;
}

@JsonProperty("address")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getAddress() {
return _address;
}

@JsonProperty("address")
public void setAddress(String address) {
this._address = address;
}
}
7 changes: 7 additions & 0 deletions src/main/java/com/bitpay/sdk/model/Settlement/PayoutInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class PayoutInfo {
private String _wire;
private String _bankName;
private String _bankAddress;
private String _bankAddress2;
private String _iban;
private String _additionalInformation;
private String _accountHolderName;
Expand Down Expand Up @@ -147,6 +148,12 @@ public void setBankCountry(String bankCountry) {
@JsonProperty("bankAddress")
public void setBankAddress(String bankAddress) { this._bankAddress = bankAddress; }

@JsonIgnore
public String getBankAddress2() { return _bankAddress2; }

@JsonProperty("bankAddress2")
public void getBankAddress2(String bankAddress2) { this._bankAddress2 = bankAddress2; }

@JsonIgnore
public String getIban() { return _iban; }

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/test/BitPayTestMerchant.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public void testShouldGetInvoice() {
//
// Must use a merchant token to retrieve this invoice since it was not created on the public facade.
String token = this.bitpay.getAccessToken(Facade.Merchant);
retreivedInvoice = this.bitpay.getInvoice("FUfs9crxMuuJLUL1f4hxHf");
retreivedInvoice = this.bitpay.getInvoice(invoice.getId());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
Expand All @@ -240,7 +240,7 @@ public void testShouldGetInvoice() {
public void testShouldCreateInvoiceWithAdditionalParams() {
Buyer buyer = new Buyer();
buyer.setName("Satoshi");
// buyer.setEmail("[email protected]");
buyer.setEmail("[email protected]");

Invoice invoice = new Invoice(100.0, "USD");
invoice.setBuyer(buyer);
Expand Down Expand Up @@ -743,7 +743,7 @@ public void testShouldCreateGetCancelRefundRequestNEW() {
String sevenDaysAgo = sdf.format(dateBefore);
invoices = this.bitpay.getInvoices(sevenDaysAgo, today, InvoiceStatus.Complete, null, null, null);
firstInvoice = invoices.get(0);
updatedInvoice = this.bitpay.updateInvoice(firstInvoice.getId(), "+***********", null);
updatedInvoice = this.bitpay.updateInvoice(firstInvoice.getId(), "+***********", null, null);
} catch (Exception e) {
e.printStackTrace();
}
Expand Down

0 comments on commit 6989d0d

Please sign in to comment.