diff --git a/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletTransferRefund.java b/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletTransferRefund.java index 04c207405..ba5521744 100644 --- a/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletTransferRefund.java +++ b/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletTransferRefund.java @@ -1,12 +1,14 @@ package com.hyperwallet.clientsdk.model; import com.fasterxml.jackson.annotation.JsonFilter; +import com.hyperwallet.clientsdk.model.HyperwalletTransfer.ForeignExchange; 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 @@ -24,6 +26,7 @@ public static enum Status {PENDING, FAILED, COMPLETED} private String destinationToken; private Double destinationAmount; private String destinationCurrency; + private List foreignExchanges; private Date createdOn; private String notes; private String memo; @@ -279,4 +282,25 @@ public HyperwalletTransferRefund clearMemo() { this.memo = null; return this; } + + public List getForeignExchanges() { + return foreignExchanges; + } + + public void setForeignExchanges(List foreignExchanges) { + addField("foreignExchanges", foreignExchanges); + this.foreignExchanges = foreignExchanges; + } + + public HyperwalletTransferRefund foreignExchanges(List foreignExchanges) { + addField("foreignExchanges", foreignExchanges); + this.foreignExchanges = foreignExchanges; + return this; + } + + public HyperwalletTransferRefund clearForeignExchanges() { + clearField("foreignExchanges"); + this.foreignExchanges = null; + return this; + } } diff --git a/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java b/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java index 13ff3988f..80d44002b 100644 --- a/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java +++ b/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java @@ -9,17 +9,14 @@ import static com.hyperwallet.clientsdk.model.HyperwalletStatusTransition.Status.RECALLED; import static com.hyperwallet.clientsdk.model.HyperwalletStatusTransition.Status.SCHEDULED; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasItems; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.nullValue; +import static org.hamcrest.Matchers.*; import static org.mockserver.integration.ClientAndServer.startClientAndServer; import static org.mockserver.model.Header.header; import static org.mockserver.model.JsonBody.json; import static org.testng.Assert.fail; import com.hyperwallet.clientsdk.model.*; +import com.hyperwallet.clientsdk.model.HyperwalletTransfer.ForeignExchange; import com.hyperwallet.clientsdk.model.HyperwalletTransferRefund.Status; import org.mockserver.integration.ClientAndServer; import org.mockserver.model.HttpRequest; @@ -653,10 +650,46 @@ public void testCreateTransfer() throws Exception { assertThat(returnValue.getForeignExchanges().get(0).getSourceAmount(), is(equalTo(100.00))); assertThat(returnValue.getForeignExchanges().get(0).getSourceCurrency(), is(equalTo("USD"))); assertThat(returnValue.getForeignExchanges().get(0).getDestinationAmount(), is(equalTo(63.49))); - assertThat(returnValue.getForeignExchanges().get(0).getDestinationCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getForeignExchanges().get(0).getDestinationCurrency(), is(equalTo("CAD"))); assertThat(returnValue.getForeignExchanges().get(0).getRate(), is(equalTo(0.79))); } + @Test + public void testCreateTransferWithoutForeignExchange() throws Exception { + String functionality = "createTransferWithoutForeignExchange"; + initMockServer(functionality); + + HyperwalletTransfer transfer = new HyperwalletTransfer() + .sourceToken("usr-c4292f1a-866f-4310-a289-b916853939de") + .destinationToken("trm-ff53d939-49c3-412f-8d83-ab4f7e83d553") + .clientTransferId("clientTransferId"); + + HyperwalletTransfer returnValue; + try { + returnValue = client.createTransfer(transfer); + } catch (Exception e) { + mockServer.verify(parseRequest(functionality)); + throw e; + } + + assertThat(returnValue.getToken(), is(equalTo("trm-59f67c62-fd06-497e-a9ea-99d6eb38b12b"))); + assertThat(returnValue.getStatus(), is(equalTo(HyperwalletTransfer.Status.QUOTED))); + assertThat(returnValue.getCreatedOn(), is(equalTo(dateFormat.parse("2017-10-31T22:32:57 UTC")))); + assertThat(returnValue.getClientTransferId(), is(equalTo("clientTransferId"))); + assertThat(returnValue.getSourceToken(), is(equalTo("usr-c4292f1a-866f-4310-a289-b916853939de"))); + assertThat(returnValue.getSourceAmount(), is(equalTo(200.4))); + assertThat(returnValue.getSourceFeeAmount(), is(equalTo(20.3))); + assertThat(returnValue.getSourceCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getDestinationToken(), is(equalTo("usr-c4292f1a-866f-4310-a289-b916853939de"))); + assertThat(returnValue.getDestinationAmount(), is(equalTo(100.2))); + assertThat(returnValue.getDestinationFeeAmount(), is(equalTo(30.5))); + assertThat(returnValue.getDestinationCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getNotes(), is(equalTo("notes"))); + assertThat(returnValue.getMemo(), is(equalTo("memo"))); + assertThat(returnValue.getExpiresOn(), is(equalTo(dateFormat.parse("2017-10-31T22:32:57 UTC")))); + assertThat(returnValue.getForeignExchanges(), is(nullValue())); + } + @Test public void testGetTransfer() throws Exception { String functionality = "getTransfer"; @@ -688,10 +721,41 @@ public void testGetTransfer() throws Exception { assertThat(returnValue.getForeignExchanges().get(0).getSourceAmount(), is(equalTo(100.00))); assertThat(returnValue.getForeignExchanges().get(0).getSourceCurrency(), is(equalTo("USD"))); assertThat(returnValue.getForeignExchanges().get(0).getDestinationAmount(), is(equalTo(63.49))); - assertThat(returnValue.getForeignExchanges().get(0).getDestinationCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getForeignExchanges().get(0).getDestinationCurrency(), is(equalTo("CAD"))); assertThat(returnValue.getForeignExchanges().get(0).getRate(), is(equalTo(0.79))); } + @Test + public void testGetTransferWithoutForeignExchange() throws Exception { + String functionality = "getTransferWithoutForeignExchange"; + initMockServer(functionality); + + HyperwalletTransfer returnValue; + try { + returnValue = client.getTransfer("usr-c4292f1a-866f-4310-a289-b916853939de"); + } catch (Exception e) { + mockServer.verify(parseRequest(functionality)); + throw e; + } + + assertThat(returnValue.getToken(), is(equalTo("trm-59f67c62-fd06-497e-a9ea-99d6eb38b12b"))); + assertThat(returnValue.getStatus(), is(equalTo(HyperwalletTransfer.Status.QUOTED))); + assertThat(returnValue.getCreatedOn(), is(equalTo(dateFormat.parse("2017-10-31T22:32:57 UTC")))); + assertThat(returnValue.getClientTransferId(), is(equalTo("clientTransferId"))); + assertThat(returnValue.getSourceToken(), is(equalTo("usr-c4292f1a-866f-4310-a289-b916853939de"))); + assertThat(returnValue.getSourceAmount(), is(equalTo(200.4))); + assertThat(returnValue.getSourceFeeAmount(), is(equalTo(20.3))); + assertThat(returnValue.getSourceCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getDestinationToken(), is(equalTo("usr-c4292f1a-866f-4310-a289-b916853939de"))); + assertThat(returnValue.getDestinationAmount(), is(equalTo(100.2))); + assertThat(returnValue.getDestinationFeeAmount(), is(equalTo(30.5))); + assertThat(returnValue.getDestinationCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getNotes(), is(equalTo("notes"))); + assertThat(returnValue.getMemo(), is(equalTo("memo"))); + assertThat(returnValue.getExpiresOn(), is(equalTo(dateFormat.parse("2017-10-31T22:32:57 UTC")))); + assertThat(returnValue.getForeignExchanges(), is(nullValue())); + } + @Test public void testListTransfer() throws Exception { String functionality = "listTransfers"; @@ -724,10 +788,42 @@ public void testListTransfer() throws Exception { assertThat(returnValue.getData().get(0).getForeignExchanges().get(0).getSourceAmount(), is(equalTo(100.00))); assertThat(returnValue.getData().get(0).getForeignExchanges().get(0).getSourceCurrency(), is(equalTo("USD"))); assertThat(returnValue.getData().get(0).getForeignExchanges().get(0).getDestinationAmount(), is(equalTo(63.49))); - assertThat(returnValue.getData().get(0).getForeignExchanges().get(0).getDestinationCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getData().get(0).getForeignExchanges().get(0).getDestinationCurrency(), is(equalTo("CAD"))); assertThat(returnValue.getData().get(0).getForeignExchanges().get(0).getRate(), is(equalTo(0.79))); } + @Test + public void testListTransferWithoutForeignExchange() throws Exception { + String functionality = "listTransfersWithoutForeignExchange"; + initMockServer(functionality); + + HyperwalletList returnValue; + try { + returnValue = client.listTransfers(); + } catch (Exception e) { + mockServer.verify(parseRequest(functionality)); + throw e; + } + + assertThat(returnValue.getCount(), is(equalTo(1))); + assertThat(returnValue.getData().get(0).getToken(), is(equalTo("trm-59f67c62-fd06-497e-a9ea-99d6eb38b12b"))); + assertThat(returnValue.getData().get(0).getStatus(), is(equalTo(HyperwalletTransfer.Status.QUOTED))); + assertThat(returnValue.getData().get(0).getCreatedOn(), is(equalTo(dateFormat.parse("2017-10-31T22:32:57 UTC")))); + assertThat(returnValue.getData().get(0).getClientTransferId(), is(equalTo("clientTransferId"))); + assertThat(returnValue.getData().get(0).getSourceToken(), is(equalTo("usr-c4292f1a-866f-4310-a289-b916853939de"))); + assertThat(returnValue.getData().get(0).getSourceAmount(), is(equalTo(200.4))); + assertThat(returnValue.getData().get(0).getSourceFeeAmount(), is(equalTo(20.3))); + assertThat(returnValue.getData().get(0).getSourceCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getData().get(0).getDestinationToken(), is(equalTo("usr-c4292f1a-866f-4310-a289-b916853939de"))); + assertThat(returnValue.getData().get(0).getDestinationAmount(), is(equalTo(100.2))); + assertThat(returnValue.getData().get(0).getDestinationFeeAmount(), is(equalTo(30.5))); + assertThat(returnValue.getData().get(0).getDestinationCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getData().get(0).getNotes(), is(equalTo("notes"))); + assertThat(returnValue.getData().get(0).getMemo(), is(equalTo("memo"))); + assertThat(returnValue.getData().get(0).getExpiresOn(), is(equalTo(dateFormat.parse("2017-10-31T22:32:57 UTC")))); + assertThat(returnValue.getData().get(0).getForeignExchanges(), is(nullValue())); + } + @Test public void testCreateTransferStatusTransition() throws Exception { String functionality = "createTransferStatusTransition"; @@ -790,6 +886,43 @@ public void testCreateTransferRefund() throws Exception { .createdOn(dateFormat.parse("2019-11-11T19:04:43 UTC")); checkTransferRefund(returnValue, expectedValue); + checkForeignExchange(returnValue, expectedValue); + } + + @Test + public void testCreateTransferRefundWithoutForeignExchange() throws Exception { + String functionality = "createTransferRefundWithoutForeignExchange"; + initMockServer(functionality); + + HyperwalletTransferRefund transferRefund = new HyperwalletTransferRefund() + .clientRefundId("clientRefundId") + .notes("Merchant Payment return to Wallet Balance") + .memo("TransferReturn123456"); + + HyperwalletTransferRefund returnValue; + try { + returnValue = client.createTransferRefund("trf-dc6a19f7-1d24-434d-87ce-f1a960f3fbce", transferRefund); + } catch (Exception e) { + mockServer.verify(parseRequest(functionality)); + throw e; + } + + HyperwalletTransferRefund expectedValue = new HyperwalletTransferRefund() + .token("trd-a159dc18-eb29-4530-8733-060c7feaad0f") + .status(Status.COMPLETED) + .clientRefundId("clientRefundId") + .sourceToken("act-ba4e8fdd-614b-11e5-af23-0faa28ca7c0f") + .sourceAmount(20.0) + .sourceCurrency("USD") + .destinationToken("usr-3deb34a0-ffd1-487d-8860-6d69435cea6c") + .destinationAmount(20.0) + .destinationCurrency("USD") + .notes("Merchant Payment return to Wallet Balance") + .memo("TransferReturn123456") + .createdOn(dateFormat.parse("2019-11-11T19:04:43 UTC")); + + checkTransferRefund(returnValue, expectedValue); + assertThat(expectedValue.getForeignExchanges(), is(nullValue())); } private void checkTransferRefund(HyperwalletTransferRefund actual, HyperwalletTransferRefund expected) { @@ -807,6 +940,15 @@ private void checkTransferRefund(HyperwalletTransferRefund actual, HyperwalletTr assertThat(actual.getCreatedOn(), is(expected.getCreatedOn())); } + private void checkForeignExchange(HyperwalletTransferRefund actual, HyperwalletTransferRefund expected) { + ForeignExchange foreignExchange = actual.getForeignExchanges().get(0); + assertThat(foreignExchange.getSourceAmount(), is(equalTo(100.00))); + assertThat(foreignExchange.getSourceCurrency(), is(equalTo("USD"))); + assertThat(foreignExchange.getDestinationAmount(), is(equalTo(63.49))); + assertThat(foreignExchange.getDestinationCurrency(), is(equalTo("CAD"))); + assertThat(foreignExchange.getRate(), is(equalTo(0.79))); + } + @Test public void testGetTransferRefund() throws Exception { String functionality = "getTransferRefund"; @@ -835,6 +977,38 @@ public void testGetTransferRefund() throws Exception { .createdOn(dateFormat.parse("2019-11-12T11:51:05 UTC")); checkTransferRefund(returnValue, expectedValue); + checkForeignExchange(returnValue, expectedValue); + } + + @Test + public void testGetTransferRefundWithoutForeignExchange() throws Exception { + String functionality = "getTransferRefundWithoutForeignExchange"; + initMockServer(functionality); + + HyperwalletTransferRefund returnValue; + try { + returnValue = client.getTransferRefund("trf-639579d9-4fe8-4fbf-8e34-827d27697f64", "trd-19156720-01e8-4f1c-8ef3-7ced80672128"); + } catch (Exception e) { + mockServer.verify(parseRequest(functionality)); + throw e; + } + + HyperwalletTransferRefund expectedValue = new HyperwalletTransferRefund() + .token("trd-19156720-01e8-4f1c-8ef3-7ced80672128") + .status(Status.COMPLETED) + .clientRefundId("1573548663") + .sourceToken("act-ba4e8fdd-614b-11e5-af23-0faa28ca7c0f") + .sourceAmount(50.0) + .sourceCurrency("USD") + .destinationToken("usr-3deb34a0-ffd1-487d-8860-6d69435cea6c") + .destinationAmount(50.0) + .destinationCurrency("USD") + .notes("Merchant Payment return to Wallet Balance") + .memo("TransferReturn123456") + .createdOn(dateFormat.parse("2019-11-12T11:51:05 UTC")); + + checkTransferRefund(returnValue, expectedValue); + assertThat(expectedValue.getForeignExchanges(), is(nullValue())); } @Test @@ -867,6 +1041,40 @@ public void testListTransferRefunds() throws Exception { .createdOn(dateFormat.parse("2019-11-12T16:44:30 UTC")); checkTransferRefund(returnValue.getData().get(0), expectedValue); + checkForeignExchange(returnValue.getData().get(0), expectedValue); + } + + @Test + public void testListTransferRefundsWithoutForeignExchange() throws Exception { + String functionality = "listTransferRefundsWithoutForeignExchange"; + initMockServer(functionality); + + HyperwalletList returnValue; + try { + returnValue = client.listTransferRefunds("trf-fdbc1f59-ef5f-4b9f-94e5-7e15797bcefb", null); + } catch (Exception e) { + mockServer.verify(parseRequest(functionality)); + throw e; + } + + assertThat(returnValue.getCount(), is(equalTo(2))); + + HyperwalletTransferRefund expectedValue = new HyperwalletTransferRefund() + .token("trd-e59d19d4-eccb-4160-b04c-4f11c83f99f0") + .status(Status.COMPLETED) + .clientRefundId("1573566270") + .sourceToken("act-ba4e8fdd-614b-11e5-af23-0faa28ca7c0f") + .sourceAmount(50.0) + .sourceCurrency("USD") + .destinationToken("usr-3deb34a0-ffd1-487d-8860-6d69435cea6c") + .destinationAmount(50.0) + .destinationCurrency("USD") + .notes("Merchant Payment return to Wallet Balance") + .memo("TransferReturn123456") + .createdOn(dateFormat.parse("2019-11-12T16:44:30 UTC")); + + checkTransferRefund(returnValue.getData().get(0), expectedValue); + assertThat(returnValue.getData().get(0).getForeignExchanges(), is(nullValue())); } // diff --git a/src/test/java/com/hyperwallet/clientsdk/HyperwalletTest.java b/src/test/java/com/hyperwallet/clientsdk/HyperwalletTest.java index 815b9928b..49fc51452 100644 --- a/src/test/java/com/hyperwallet/clientsdk/HyperwalletTest.java +++ b/src/test/java/com/hyperwallet/clientsdk/HyperwalletTest.java @@ -6,6 +6,7 @@ import com.hyperwallet.clientsdk.model.HyperwalletDocument.EDocumentCategory; import com.hyperwallet.clientsdk.model.HyperwalletDocument.EIdentityVerificationType; import com.hyperwallet.clientsdk.model.HyperwalletDocument.EKycDocumentVerificationStatus; +import com.hyperwallet.clientsdk.model.HyperwalletTransfer.ForeignExchange; import com.hyperwallet.clientsdk.model.HyperwalletUser.VerificationStatus; import com.hyperwallet.clientsdk.util.HyperwalletApiClient; import com.sun.jersey.multipart.FormDataMultiPart; @@ -2959,11 +2960,19 @@ public void testCreateTransferRefund_successful() throws Exception { String notes = "notes"; String memo = "memo"; + ForeignExchange foreignExchange = new ForeignExchange(); + foreignExchange.setSourceAmount(200.0); + foreignExchange.setSourceCurrency("USD"); + foreignExchange.setDestinationAmount(100.0); + foreignExchange.setDestinationCurrency("CAD"); + foreignExchange.setRate(2.3); + HyperwalletTransferRefund transferRefund = new HyperwalletTransferRefund(); transferRefund.setClientRefundId(clientRefundId); transferRefund.setSourceAmount(sourceAmount); transferRefund.setNotes(notes); transferRefund.setMemo(memo); + transferRefund.setForeignExchanges(Collections.singletonList(foreignExchange)); HyperwalletTransferRefund transferRefundResponse = new HyperwalletTransferRefund(); @@ -2988,6 +2997,12 @@ public void testCreateTransferRefund_successful() throws Exception { assertThat(apiTransfer.getMemo(), is(equalTo(memo))); assertThat(apiTransfer.getCreatedOn(), is(nullValue())); assertThat(apiTransfer.getStatus(), is(nullValue())); + ForeignExchange foreignExchangeResponse= apiTransfer.getForeignExchanges().get(0); + assertThat(foreignExchange.getSourceAmount(), is(equalTo(200.0))); + assertThat(foreignExchange.getSourceCurrency(), is(equalTo("USD"))); + assertThat(foreignExchange.getDestinationAmount(), is(equalTo(100.0))); + assertThat(foreignExchange.getDestinationCurrency(), is(equalTo("CAD"))); + assertThat(foreignExchange.getRate(), is(equalTo(2.3))); } @Test diff --git a/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletTransferRefundTest.java b/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletTransferRefundTest.java index 91baf772e..da15923ba 100644 --- a/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletTransferRefundTest.java +++ b/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletTransferRefundTest.java @@ -1,13 +1,21 @@ package com.hyperwallet.clientsdk.model; +import com.hyperwallet.clientsdk.model.HyperwalletTransfer.ForeignExchange; import com.hyperwallet.clientsdk.model.HyperwalletTransferRefund.Status; +import java.util.Collections; import java.util.Date; public class HyperwalletTransferRefundTest extends BaseModelTest { @Override protected HyperwalletTransferRefund createBaseModel() { + ForeignExchange foreignExchange = new ForeignExchange(); + foreignExchange.setSourceAmount(200.0); + foreignExchange.setSourceCurrency("USD"); + foreignExchange.setDestinationAmount(100.0); + foreignExchange.setDestinationCurrency("CAD"); + foreignExchange.setRate(2.3); HyperwalletTransferRefund transferRefund = new HyperwalletTransferRefund() .token("token") .status(Status.COMPLETED) @@ -20,7 +28,8 @@ protected HyperwalletTransferRefund createBaseModel() { .destinationCurrency("USD") .createdOn(new Date()) .notes("notes") - .memo("memo"); + .memo("memo") + .foreignExchanges(Collections.singletonList(foreignExchange)); return transferRefund; } diff --git a/src/test/resources/integration/createTransfer-response.json b/src/test/resources/integration/createTransfer-response.json index 9dcf69db8..0b52f52b4 100644 --- a/src/test/resources/integration/createTransfer-response.json +++ b/src/test/resources/integration/createTransfer-response.json @@ -19,7 +19,7 @@ "sourceAmount": "100.00", "sourceCurrency": "USD", "destinationAmount": "63.49", - "destinationCurrency": "USD", + "destinationCurrency": "CAD", "rate": "0.79" } ], diff --git a/src/test/resources/integration/createTransferRefund-response.json b/src/test/resources/integration/createTransferRefund-response.json index 26f13d855..f851445e8 100644 --- a/src/test/resources/integration/createTransferRefund-response.json +++ b/src/test/resources/integration/createTransferRefund-response.json @@ -11,6 +11,15 @@ "createdOn": "2019-11-11T19:04:43", "notes": "Merchant Payment return to Wallet Balance", "memo": "TransferReturn123456", + "foreignExchanges": [ + { + "sourceAmount": "100.00", + "sourceCurrency": "USD", + "destinationAmount": "63.49", + "destinationCurrency": "CAD", + "rate": "0.79" + } + ], "links": [ { "params": { diff --git a/src/test/resources/integration/createTransferRefundWithoutForeignExchange-request.txt b/src/test/resources/integration/createTransferRefundWithoutForeignExchange-request.txt new file mode 100644 index 000000000..2c51797a8 --- /dev/null +++ b/src/test/resources/integration/createTransferRefundWithoutForeignExchange-request.txt @@ -0,0 +1,9 @@ +curl -X "POST" "https://api.sandbox.hyperwallet.com/rest/v3/transfers/trf-dc6a19f7-1d24-434d-87ce-f1a960f3fbce/refunds" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-d "{ + "clientRefundId": "clientRefundId", + "notes": "Merchant Payment return to Wallet Balance", + "memo": "TransferReturn123456" +}" \ No newline at end of file diff --git a/src/test/resources/integration/createTransferRefundWithoutForeignExchange-response.json b/src/test/resources/integration/createTransferRefundWithoutForeignExchange-response.json new file mode 100644 index 000000000..26f13d855 --- /dev/null +++ b/src/test/resources/integration/createTransferRefundWithoutForeignExchange-response.json @@ -0,0 +1,22 @@ +{ + "token": "trd-a159dc18-eb29-4530-8733-060c7feaad0f", + "status": "COMPLETED", + "clientRefundId": "clientRefundId", + "sourceToken": "act-ba4e8fdd-614b-11e5-af23-0faa28ca7c0f", + "sourceAmount": "20.00", + "sourceCurrency": "USD", + "destinationToken": "usr-3deb34a0-ffd1-487d-8860-6d69435cea6c", + "destinationAmount": "20.00", + "destinationCurrency": "USD", + "createdOn": "2019-11-11T19:04:43", + "notes": "Merchant Payment return to Wallet Balance", + "memo": "TransferReturn123456", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v3/transfers/trf-dc6a19f7-1d24-434d-87ce-f1a960f3fbce/refunds/trd-a159dc18-eb29-4530-8733-060c7feaad0f" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/createTransferWithoutForeignExchange-request.txt b/src/test/resources/integration/createTransferWithoutForeignExchange-request.txt new file mode 100644 index 000000000..3c1d959db --- /dev/null +++ b/src/test/resources/integration/createTransferWithoutForeignExchange-request.txt @@ -0,0 +1,9 @@ +curl -X "POST" "https://api.sandbox.hyperwallet.com/rest/v3/transfers" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-d "{ + "sourceToken": "usr-c4292f1a-866f-4310-a289-b916853939de", + "destinationToken": "trm-ff53d939-49c3-412f-8d83-ab4f7e83d553", + "clientTransferId": "clientTransferId" +}" \ No newline at end of file diff --git a/src/test/resources/integration/createTransferWithoutForeignExchange-response.json b/src/test/resources/integration/createTransferWithoutForeignExchange-response.json new file mode 100644 index 000000000..bebbe80cf --- /dev/null +++ b/src/test/resources/integration/createTransferWithoutForeignExchange-response.json @@ -0,0 +1,25 @@ +{ + "token": "trm-59f67c62-fd06-497e-a9ea-99d6eb38b12b", + "status": "QUOTED", + "createdOn": "2017-10-31T22:32:57", + "clientTransferId": "clientTransferId", + "sourceToken": "usr-c4292f1a-866f-4310-a289-b916853939de", + "sourceAmount": "200.4", + "sourceFeeAmount": "20.3", + "sourceCurrency": "USD", + "destinationToken": "usr-c4292f1a-866f-4310-a289-b916853939de", + "destinationAmount": "100.2", + "destinationFeeAmount": "30.5", + "destinationCurrency": "USD", + "notes": "notes", + "memo": "memo", + "expiresOn": "2017-10-31T22:32:57", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v3/users/usr-c4292f1a-866f-4310-a289-b916853939de/paper-checks/trm-59f67c62-fd06-497e-a9ea-99d6eb38b12b" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/getTransfer-response.json b/src/test/resources/integration/getTransfer-response.json index 9dcf69db8..0b52f52b4 100644 --- a/src/test/resources/integration/getTransfer-response.json +++ b/src/test/resources/integration/getTransfer-response.json @@ -19,7 +19,7 @@ "sourceAmount": "100.00", "sourceCurrency": "USD", "destinationAmount": "63.49", - "destinationCurrency": "USD", + "destinationCurrency": "CAD", "rate": "0.79" } ], diff --git a/src/test/resources/integration/getTransferRefund-response.json b/src/test/resources/integration/getTransferRefund-response.json index 4b3e1e254..4fcd2cfc9 100644 --- a/src/test/resources/integration/getTransferRefund-response.json +++ b/src/test/resources/integration/getTransferRefund-response.json @@ -11,6 +11,15 @@ "createdOn": "2019-11-12T11:51:05", "notes": "Merchant Payment return to Wallet Balance", "memo": "TransferReturn123456", + "foreignExchanges": [ + { + "sourceAmount": "100.00", + "sourceCurrency": "USD", + "destinationAmount": "63.49", + "destinationCurrency": "CAD", + "rate": "0.79" + } + ], "links": [ { "params": { diff --git a/src/test/resources/integration/getTransferRefundWithoutForeignExchange-request.txt b/src/test/resources/integration/getTransferRefundWithoutForeignExchange-request.txt new file mode 100644 index 000000000..a09c869ec --- /dev/null +++ b/src/test/resources/integration/getTransferRefundWithoutForeignExchange-request.txt @@ -0,0 +1,3 @@ +curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v3/transfers/trf-639579d9-4fe8-4fbf-8e34-827d27697f64/refunds/trd-19156720-01e8-4f1c-8ef3-7ced80672128 +-u testuser@12345678:myAccPassw0rd \ +-H "Accept: application/json" \ No newline at end of file diff --git a/src/test/resources/integration/getTransferRefundWithoutForeignExchange-response.json b/src/test/resources/integration/getTransferRefundWithoutForeignExchange-response.json new file mode 100644 index 000000000..4b3e1e254 --- /dev/null +++ b/src/test/resources/integration/getTransferRefundWithoutForeignExchange-response.json @@ -0,0 +1,22 @@ +{ + "token": "trd-19156720-01e8-4f1c-8ef3-7ced80672128", + "status": "COMPLETED", + "clientRefundId": "1573548663", + "sourceToken": "act-ba4e8fdd-614b-11e5-af23-0faa28ca7c0f", + "sourceAmount": "50.00", + "sourceCurrency": "USD", + "destinationToken": "usr-3deb34a0-ffd1-487d-8860-6d69435cea6c", + "destinationAmount": "50.00", + "destinationCurrency": "USD", + "createdOn": "2019-11-12T11:51:05", + "notes": "Merchant Payment return to Wallet Balance", + "memo": "TransferReturn123456", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/transfers/trf-639579d9-4fe8-4fbf-8e34-827d27697f64/refunds/trd-19156720-01e8-4f1c-8ef3-7ced80672128" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/getTransferWithoutForeignExchange-request.txt b/src/test/resources/integration/getTransferWithoutForeignExchange-request.txt new file mode 100644 index 000000000..39ca0a323 --- /dev/null +++ b/src/test/resources/integration/getTransferWithoutForeignExchange-request.txt @@ -0,0 +1,3 @@ +curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v3/transfers/usr-c4292f1a-866f-4310-a289-b916853939de +-u testuser@12345678:myAccPassw0rd \ +-H "Accept: application/json" \ No newline at end of file diff --git a/src/test/resources/integration/getTransferWithoutForeignExchange-response.json b/src/test/resources/integration/getTransferWithoutForeignExchange-response.json new file mode 100644 index 000000000..bebbe80cf --- /dev/null +++ b/src/test/resources/integration/getTransferWithoutForeignExchange-response.json @@ -0,0 +1,25 @@ +{ + "token": "trm-59f67c62-fd06-497e-a9ea-99d6eb38b12b", + "status": "QUOTED", + "createdOn": "2017-10-31T22:32:57", + "clientTransferId": "clientTransferId", + "sourceToken": "usr-c4292f1a-866f-4310-a289-b916853939de", + "sourceAmount": "200.4", + "sourceFeeAmount": "20.3", + "sourceCurrency": "USD", + "destinationToken": "usr-c4292f1a-866f-4310-a289-b916853939de", + "destinationAmount": "100.2", + "destinationFeeAmount": "30.5", + "destinationCurrency": "USD", + "notes": "notes", + "memo": "memo", + "expiresOn": "2017-10-31T22:32:57", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v3/users/usr-c4292f1a-866f-4310-a289-b916853939de/paper-checks/trm-59f67c62-fd06-497e-a9ea-99d6eb38b12b" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/listTransferRefunds-response.json b/src/test/resources/integration/listTransferRefunds-response.json index 826375269..5d5235560 100644 --- a/src/test/resources/integration/listTransferRefunds-response.json +++ b/src/test/resources/integration/listTransferRefunds-response.json @@ -16,6 +16,15 @@ "createdOn": "2019-11-12T16:44:30", "notes": "Merchant Payment return to Wallet Balance", "memo": "TransferReturn123456", + "foreignExchanges": [ + { + "sourceAmount": "100.00", + "sourceCurrency": "USD", + "destinationAmount": "63.49", + "destinationCurrency": "CAD", + "rate": "0.79" + } + ], "links": [ { "params": { diff --git a/src/test/resources/integration/listTransferRefundsWithoutForeignExchange-request.txt b/src/test/resources/integration/listTransferRefundsWithoutForeignExchange-request.txt new file mode 100644 index 000000000..50e6816e1 --- /dev/null +++ b/src/test/resources/integration/listTransferRefundsWithoutForeignExchange-request.txt @@ -0,0 +1,3 @@ +curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v3/transfers/trf-fdbc1f59-ef5f-4b9f-94e5-7e15797bcefb/refunds" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Accept: application/json" \ No newline at end of file diff --git a/src/test/resources/integration/listTransferRefundsWithoutForeignExchange-response.json b/src/test/resources/integration/listTransferRefundsWithoutForeignExchange-response.json new file mode 100644 index 000000000..826375269 --- /dev/null +++ b/src/test/resources/integration/listTransferRefundsWithoutForeignExchange-response.json @@ -0,0 +1,59 @@ +{ + "count": 2, + "offset": 0, + "limit": 10, + "data": [ + { + "token": "trd-e59d19d4-eccb-4160-b04c-4f11c83f99f0", + "status": "COMPLETED", + "clientRefundId": "1573566270", + "sourceToken": "act-ba4e8fdd-614b-11e5-af23-0faa28ca7c0f", + "sourceAmount": "50.00", + "sourceCurrency": "USD", + "destinationToken": "usr-3deb34a0-ffd1-487d-8860-6d69435cea6c", + "destinationAmount": "50.00", + "destinationCurrency": "USD", + "createdOn": "2019-11-12T16:44:30", + "notes": "Merchant Payment return to Wallet Balance", + "memo": "TransferReturn123456", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://localhost:8181/rest/v3/transfers/trf-fdbc1f59-ef5f-4b9f-94e5-7e15797bcefb/refunds/trd-e59d19d4-eccb-4160-b04c-4f11c83f99f0" + } + ] + }, + { + "token": "trd-686baee1-b56c-49d8-bd57-cd47ee0085f2", + "status": "COMPLETED", + "clientRefundId": "1573566314", + "sourceToken": "act-ba4e8fdd-614b-11e5-af23-0faa28ca7c0f", + "sourceAmount": "50.00", + "sourceCurrency": "USD", + "destinationToken": "usr-3deb34a0-ffd1-487d-8860-6d69435cea6c", + "destinationAmount": "50.00", + "destinationCurrency": "USD", + "createdOn": "2019-11-12T16:45:15", + "notes": "Merchant Payment return to Wallet Balance", + "memo": "TransferReturn123456", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v3/transfers/trf-fdbc1f59-ef5f-4b9f-94e5-7e15797bcefb/refunds/trd-686baee1-b56c-49d8-bd57-cd47ee0085f2" + } + ] + } + ], + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v3/transfers/trf-fdbc1f59-ef5f-4b9f-94e5-7e15797bcefb/refunds?offset=0&limit=10" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/listTransfers-response.json b/src/test/resources/integration/listTransfers-response.json index e59626580..39f7bcecb 100644 --- a/src/test/resources/integration/listTransfers-response.json +++ b/src/test/resources/integration/listTransfers-response.json @@ -24,7 +24,7 @@ "sourceAmount": "100.00", "sourceCurrency": "USD", "destinationAmount": "63.49", - "destinationCurrency": "USD", + "destinationCurrency": "CAD", "rate": "0.79" } ], diff --git a/src/test/resources/integration/listTransfersWithoutForeignExchange-request.txt b/src/test/resources/integration/listTransfersWithoutForeignExchange-request.txt new file mode 100644 index 000000000..79018f65d --- /dev/null +++ b/src/test/resources/integration/listTransfersWithoutForeignExchange-request.txt @@ -0,0 +1,3 @@ +curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v3/transfers" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Accept: application/json" \ No newline at end of file diff --git a/src/test/resources/integration/listTransfersWithoutForeignExchange-response.json b/src/test/resources/integration/listTransfersWithoutForeignExchange-response.json new file mode 100644 index 000000000..2cb298418 --- /dev/null +++ b/src/test/resources/integration/listTransfersWithoutForeignExchange-response.json @@ -0,0 +1,40 @@ +{ + "count": 1, + "offset": 0, + "limit": 10, + "data": [ + { + "token": "trm-59f67c62-fd06-497e-a9ea-99d6eb38b12b", + "status": "QUOTED", + "createdOn": "2017-10-31T22:32:57", + "clientTransferId": "clientTransferId", + "sourceToken": "usr-c4292f1a-866f-4310-a289-b916853939de", + "sourceAmount": "200.4", + "sourceFeeAmount": "20.3", + "sourceCurrency": "USD", + "destinationToken": "usr-c4292f1a-866f-4310-a289-b916853939de", + "destinationAmount": "100.2", + "destinationFeeAmount": "30.5", + "destinationCurrency": "USD", + "notes": "notes", + "memo": "memo", + "expiresOn": "2017-10-31T22:32:57", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v3/users/usr-c4292f1a-866f-4310-a289-b916853939de/paper-checks/trm-59f67c62-fd06-497e-a9ea-99d6eb38b12b" + } + ] + } + ], + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v3/users/usr-c4292f1a-866f-4310-a289-b916853939de/paper-checks?offset=0&limit=10" + } + ] +} \ No newline at end of file