diff --git a/README.md b/README.md
index 2e94d0d..d8a789a 100644
--- a/README.md
+++ b/README.md
@@ -38,14 +38,14 @@ For _Maven_, add the following dependency to your `pom.xml`:
me.cryptopay
cryptopay-java
- 2.2.0
+ 3.0.0
```
For _Gradle_, add the following dependency to your `build.gradle`:
```groovy
-implementation group: 'me.cryptopay', name: 'cryptopay-java', version: '2.2.0'
+implementation group: 'me.cryptopay', name: 'cryptopay-java', version: '3.0.0'
```
### Requirements
@@ -380,10 +380,7 @@ InvoiceRecalculationResult result = cryptopay.invoices()
```java
UUID invoiceId = UUID.fromString("7e274430-e20f-4321-8748-20824287ae44");
-InvoiceRefundParams invoiceRefundParams = new InvoiceRefundParams();
-invoiceRefundParams.setAddress("0xf3532c1fd002665ec54d46a50787e0c69c76cd44");
-
-InvoiceRefundResult result = cryptopay.invoices().createRefund(invoiceId, invoiceRefundParams).execute();
+InvoiceRefundResult result = cryptopay.invoices().createRefund(invoiceId).execute();
```
#### List invoices
diff --git a/example/cryptopay-java-test/pom.xml b/example/cryptopay-java-test/pom.xml
index 1d9cf12..f0dfa5c 100644
--- a/example/cryptopay-java-test/pom.xml
+++ b/example/cryptopay-java-test/pom.xml
@@ -14,7 +14,7 @@
11
UTF-8
- 2.2.0
+ 3.0.0
1.2.10
2.7
diff --git a/pom.xml b/pom.xml
index 624022c..eb26606 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
me.cryptopay
cryptopay-java
- 2.2.0
+ 3.0.0
jar
Cryptopay Java
diff --git a/src/main/java/me/cryptopay/Cryptopay.java b/src/main/java/me/cryptopay/Cryptopay.java
index be4ba83..91c17ae 100644
--- a/src/main/java/me/cryptopay/Cryptopay.java
+++ b/src/main/java/me/cryptopay/Cryptopay.java
@@ -28,7 +28,7 @@ public final class Cryptopay {
public static final String API_URL_SANDBOX = "https://business-sandbox.cryptopay.me";
private static final String USER_AGENT = "Cryptopay Java %s";
- private static final String VERSION = "2.2.0";
+ private static final String VERSION = "3.0.0";
private final ApiClient apiClient;
private final JSON json;
diff --git a/src/main/java/me/cryptopay/api/Invoices.java b/src/main/java/me/cryptopay/api/Invoices.java
index 451b59d..caee64f 100644
--- a/src/main/java/me/cryptopay/api/Invoices.java
+++ b/src/main/java/me/cryptopay/api/Invoices.java
@@ -11,7 +11,6 @@
import me.cryptopay.model.InvoiceRecalculationParams;
import me.cryptopay.model.InvoiceRecalculationResult;
import me.cryptopay.model.InvoiceRefundListResult;
-import me.cryptopay.model.InvoiceRefundParams;
import me.cryptopay.model.InvoiceRefundResult;
import me.cryptopay.model.InvoiceResult;
import me.cryptopay.net.ApiClient;
@@ -67,12 +66,10 @@ public CreateRecalculationCall createRecalculation(
* Create invoice refund.
*
* @param invoiceId Invoice ID
- * @param invoiceRefundParams
* @return CreateRefundCall
*/
- public CreateRefundCall createRefund(
- final UUID invoiceId, final InvoiceRefundParams invoiceRefundParams) {
- return new CreateRefundCall(invoiceId, invoiceRefundParams);
+ public CreateRefundCall createRefund(final UUID invoiceId) {
+ return new CreateRefundCall(invoiceId);
}
/**
@@ -183,11 +180,20 @@ public InvoiceRecalculationResult execute() throws ApiException {
public final class CreateRefundCall {
private final ApiRequest request;
- private CreateRefundCall(
- final UUID invoiceId, final InvoiceRefundParams invoiceRefundParams) {
+ private CreateRefundCall(final UUID invoiceId) {
this.request = new ApiRequest("POST", "/api/invoices/{invoice_id}/refunds");
request.addPathParam("invoice_id", invoiceId.toString());
- request.setBody(invoiceRefundParams);
+ }
+
+ /**
+ * Set body.
+ *
+ * @param body
+ * @return createRefundCall
+ */
+ public CreateRefundCall body(final Object body) {
+ request.setBody(body);
+ return this;
}
/**
diff --git a/src/main/java/me/cryptopay/model/CoinWithdrawalParams.java b/src/main/java/me/cryptopay/model/CoinWithdrawalParams.java
index 9a89203..30b5509 100644
--- a/src/main/java/me/cryptopay/model/CoinWithdrawalParams.java
+++ b/src/main/java/me/cryptopay/model/CoinWithdrawalParams.java
@@ -20,12 +20,15 @@ public final class CoinWithdrawalParams {
@SerializedName("network")
private String network;
+ @Deprecated
@SerializedName("charged_amount")
private BigDecimal chargedAmount;
+ @Deprecated
@SerializedName("charged_amount_to_send")
private BigDecimal chargedAmountToSend;
+ @Deprecated
@SerializedName("received_amount")
private BigDecimal receivedAmount;
@@ -47,6 +50,18 @@ public final class CoinWithdrawalParams {
@SerializedName("beneficiary")
private Beneficiary beneficiary;
+ @SerializedName("amount")
+ private BigDecimal amount;
+
+ @SerializedName("amount_currency")
+ private String amountCurrency;
+
+ @SerializedName("amount_includes_processing_fee")
+ private Boolean amountIncludesProcessingFee;
+
+ @SerializedName("amount_includes_network_fee")
+ private Boolean amountIncludesNetworkFee;
+
/** Creates a new instance of CoinWithdrawalParams. */
public CoinWithdrawalParams() {}
@@ -126,7 +141,9 @@ public void setNetwork(final String network) {
* Get chargedAmount.
*
* @return chargedAmount
+ * @deprecated
*/
+ @Deprecated
public BigDecimal getChargedAmount() {
return chargedAmount;
}
@@ -135,7 +152,9 @@ public BigDecimal getChargedAmount() {
* Set chargedAmount.
*
* @param chargedAmount chargedAmount
+ * @deprecated
*/
+ @Deprecated
public void setChargedAmount(final BigDecimal chargedAmount) {
this.chargedAmount = chargedAmount;
}
@@ -144,7 +163,9 @@ public void setChargedAmount(final BigDecimal chargedAmount) {
* Get chargedAmountToSend.
*
* @return chargedAmountToSend
+ * @deprecated
*/
+ @Deprecated
public BigDecimal getChargedAmountToSend() {
return chargedAmountToSend;
}
@@ -153,7 +174,9 @@ public BigDecimal getChargedAmountToSend() {
* Set chargedAmountToSend.
*
* @param chargedAmountToSend chargedAmountToSend
+ * @deprecated
*/
+ @Deprecated
public void setChargedAmountToSend(final BigDecimal chargedAmountToSend) {
this.chargedAmountToSend = chargedAmountToSend;
}
@@ -162,7 +185,9 @@ public void setChargedAmountToSend(final BigDecimal chargedAmountToSend) {
* Get receivedAmount.
*
* @return receivedAmount
+ * @deprecated
*/
+ @Deprecated
public BigDecimal getReceivedAmount() {
return receivedAmount;
}
@@ -171,7 +196,9 @@ public BigDecimal getReceivedAmount() {
* Set receivedAmount.
*
* @param receivedAmount receivedAmount
+ * @deprecated
*/
+ @Deprecated
public void setReceivedAmount(final BigDecimal receivedAmount) {
this.receivedAmount = receivedAmount;
}
@@ -284,6 +311,78 @@ public void setBeneficiary(final Beneficiary beneficiary) {
this.beneficiary = beneficiary;
}
+ /**
+ * Get amount.
+ *
+ * @return amount
+ */
+ public BigDecimal getAmount() {
+ return amount;
+ }
+
+ /**
+ * Set amount.
+ *
+ * @param amount amount
+ */
+ public void setAmount(final BigDecimal amount) {
+ this.amount = amount;
+ }
+
+ /**
+ * Get amountCurrency.
+ *
+ * @return amountCurrency
+ */
+ public String getAmountCurrency() {
+ return amountCurrency;
+ }
+
+ /**
+ * Set amountCurrency.
+ *
+ * @param amountCurrency amountCurrency
+ */
+ public void setAmountCurrency(final String amountCurrency) {
+ this.amountCurrency = amountCurrency;
+ }
+
+ /**
+ * Get amountIncludesProcessingFee.
+ *
+ * @return amountIncludesProcessingFee
+ */
+ public Boolean getAmountIncludesProcessingFee() {
+ return amountIncludesProcessingFee;
+ }
+
+ /**
+ * Set amountIncludesProcessingFee.
+ *
+ * @param amountIncludesProcessingFee amountIncludesProcessingFee
+ */
+ public void setAmountIncludesProcessingFee(final Boolean amountIncludesProcessingFee) {
+ this.amountIncludesProcessingFee = amountIncludesProcessingFee;
+ }
+
+ /**
+ * Get amountIncludesNetworkFee.
+ *
+ * @return amountIncludesNetworkFee
+ */
+ public Boolean getAmountIncludesNetworkFee() {
+ return amountIncludesNetworkFee;
+ }
+
+ /**
+ * Set amountIncludesNetworkFee.
+ *
+ * @param amountIncludesNetworkFee amountIncludesNetworkFee
+ */
+ public void setAmountIncludesNetworkFee(final Boolean amountIncludesNetworkFee) {
+ this.amountIncludesNetworkFee = amountIncludesNetworkFee;
+ }
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -300,7 +399,11 @@ public String toString() {
sb.append("networkFeeLevel=").append(networkFeeLevel).append(", ");
sb.append("forceCommit=").append(forceCommit).append(", ");
sb.append("travelRuleCompliant=").append(travelRuleCompliant).append(", ");
- sb.append("beneficiary=").append(beneficiary);
+ sb.append("beneficiary=").append(beneficiary).append(", ");
+ sb.append("amount=").append(amount).append(", ");
+ sb.append("amountCurrency=").append(amountCurrency).append(", ");
+ sb.append("amountIncludesProcessingFee=").append(amountIncludesProcessingFee).append(", ");
+ sb.append("amountIncludesNetworkFee=").append(amountIncludesNetworkFee);
sb.append(")");
return sb.toString();
}
diff --git a/src/test/java/me/cryptopay/api/InvoicesTest.java b/src/test/java/me/cryptopay/api/InvoicesTest.java
index 9cbefe8..37f8948 100644
--- a/src/test/java/me/cryptopay/api/InvoicesTest.java
+++ b/src/test/java/me/cryptopay/api/InvoicesTest.java
@@ -95,11 +95,7 @@ public void createRecalculationTest() throws ApiException {
public void createRefundTest() throws ApiException {
UUID invoiceId = UUID.fromString("7e274430-e20f-4321-8748-20824287ae44");
- InvoiceRefundParams invoiceRefundParams = new InvoiceRefundParams();
- invoiceRefundParams.setAddress("0xf3532c1fd002665ec54d46a50787e0c69c76cd44");
-
- InvoiceRefundResult result =
- cryptopay.invoices().createRefund(invoiceId, invoiceRefundParams).execute();
+ InvoiceRefundResult result = cryptopay.invoices().createRefund(invoiceId).execute();
assertThat(result.getData(), notNullValue());
}
diff --git a/src/test/resources/mappings/api/invoices/create_refund.json b/src/test/resources/mappings/api/invoices/create_refund.json
index ae0a33a..cd9c092 100644
--- a/src/test/resources/mappings/api/invoices/create_refund.json
+++ b/src/test/resources/mappings/api/invoices/create_refund.json
@@ -13,9 +13,7 @@
"contains": "Cryptopay Java"
}
},
- "bodyPatterns": [{
- "equalToJson": "{\"address\":\"0xf3532c1fd002665ec54d46a50787e0c69c76cd44\"}"
- }]
+ "bodyPatterns": []
},
"response": {
"status": 201,