From 6989d0d94dbb849eeb06d72b2a1c3f68e2f366af Mon Sep 17 00:00:00 2001 From: nsoni3 <80480978+nsoni3@users.noreply.github.com> Date: Fri, 8 Oct 2021 15:49:44 +0530 Subject: [PATCH] #v6.4.2110.0-rc - Add missing properties in models (#77) - Invoice - PayoutInstruction - PayoutInfo --- .../com/bitpay/sdk/model/Invoice/Invoice.java | 137 +++++++++++++++++- .../sdk/model/Payout/PayoutInstruction.java | 12 ++ .../sdk/model/Settlement/PayoutInfo.java | 7 + src/test/java/test/BitPayTestMerchant.java | 6 +- 4 files changed, 157 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/bitpay/sdk/model/Invoice/Invoice.java b/src/main/java/com/bitpay/sdk/model/Invoice/Invoice.java index 35050e32..4a2dc15a 100644 --- a/src/main/java/com/bitpay/sdk/model/Invoice/Invoice.java +++ b/src/main/java/com/bitpay/sdk/model/Invoice/Invoice.java @@ -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 = ""; @@ -41,6 +42,7 @@ public class Invoice { private InvoiceTransactionDetails _transactionDetails; private InvoiceUniversalCodes _universalCodes; private List _itemizedDetails; + private boolean _autoRedirect = false; private String _id; private String _url; @@ -64,10 +66,20 @@ public class Invoice { private boolean _extendedNotifications = false; private String _transactionCurrency; private BigDecimal _amountPaid; + private BigDecimal _displayAmountPaid; private Hashtable> _exchangeRates; private boolean _isCancelled = false; private boolean _bitpayIdRequired = false; - + private Hashtable _paymentSubtotals; + private Hashtable _paymentTotals; + private Hashtable _paymentDisplayTotals; + private Hashtable _paymentDisplaySubTotals; + private boolean _nonPayProPaymentReceived; + private boolean _jsonPayProRequired = false; + private BigDecimal _underpaidAmount; + private BigDecimal _overpaidAmount; + private Hashtable> _paymentCodes; + /** * Constructor, create an empty Invoice object. */ @@ -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() { @@ -351,6 +374,16 @@ public void setItemizedDetails(List _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() { @@ -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> getExchangeRates() { return _exchangeRates; @@ -619,4 +662,94 @@ public boolean getIsCancelled() { public void setIsCancelled(boolean _isCancelled) { this._isCancelled = _isCancelled; } -} + + @JsonIgnore + public Hashtable getPaymentSubTotals() { + return _paymentSubtotals; + } + + @JsonProperty("paymentSubtotals") + public void setPaymentSubTotals(Hashtable _paymentSubtotals) { + this._paymentSubtotals = _paymentSubtotals; + } + + @JsonIgnore + public Hashtable getPaymentTotals() { + return _paymentTotals; + } + + @JsonProperty("paymentTotals") + public void setPaymentTotals(Hashtable _paymentTotals) { + this._paymentTotals = _paymentTotals; + } + + @JsonIgnore + public Hashtable getPaymentDisplayTotals() { + return _paymentDisplayTotals; + } + + @JsonProperty("paymentDisplayTotals") + public void setPaymentDisplayTotals(Hashtable _paymentDisplayTotals) { + this._paymentDisplayTotals = _paymentDisplayTotals; + } + + @JsonIgnore + public Hashtable getPaymentDisplaySubTotals() { + return _paymentDisplaySubTotals; + } + + @JsonProperty("paymentDisplaySubTotals") + public void setPaymentDisplaySubTotals(Hashtable _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> getPaymentCodes() { + return _paymentCodes; + } + + @JsonProperty("paymentCodes") + public void setPaymentCodes(Hashtable> _paymentCodes) { + this._paymentCodes = _paymentCodes; + } +} \ No newline at end of file diff --git a/src/main/java/com/bitpay/sdk/model/Payout/PayoutInstruction.java b/src/main/java/com/bitpay/sdk/model/Payout/PayoutInstruction.java index b6a8653c..2fc88d10 100644 --- a/src/main/java/com/bitpay/sdk/model/Payout/PayoutInstruction.java +++ b/src/main/java/com/bitpay/sdk/model/Payout/PayoutInstruction.java @@ -23,6 +23,7 @@ public class PayoutInstruction { private PayoutInstructionBtcSummary _btc; private List _transactions; private String _status; + private String _address; /** * Constructor, create an empty PayoutInstruction object. @@ -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; + } } diff --git a/src/main/java/com/bitpay/sdk/model/Settlement/PayoutInfo.java b/src/main/java/com/bitpay/sdk/model/Settlement/PayoutInfo.java index 8a2ddcf2..c7c8ad27 100644 --- a/src/main/java/com/bitpay/sdk/model/Settlement/PayoutInfo.java +++ b/src/main/java/com/bitpay/sdk/model/Settlement/PayoutInfo.java @@ -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; @@ -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; } diff --git a/src/test/java/test/BitPayTestMerchant.java b/src/test/java/test/BitPayTestMerchant.java index 18385a40..76d41afd 100644 --- a/src/test/java/test/BitPayTestMerchant.java +++ b/src/test/java/test/BitPayTestMerchant.java @@ -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()); @@ -240,7 +240,7 @@ public void testShouldGetInvoice() { public void testShouldCreateInvoiceWithAdditionalParams() { Buyer buyer = new Buyer(); buyer.setName("Satoshi"); -// buyer.setEmail("satoshi@buyeremaildomain.com"); + buyer.setEmail("satoshi@buyeremaildomain.com"); Invoice invoice = new Invoice(100.0, "USD"); invoice.setBuyer(buyer); @@ -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(); }