From 13b1c167c401ca3af97d2e3cdac5875c8d1cc7ed Mon Sep 17 00:00:00 2001 From: ramahalingam Date: Mon, 7 Sep 2020 17:02:14 +0530 Subject: [PATCH 1/5] Changes for HW-66706 V4 V4PrepaidCards --- .../model/HyperwalletPrepaidCard.java | 26 ++++++++++++++++++- .../model/HyperwalletPrepaidCardTest.java | 8 +++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletPrepaidCard.java b/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletPrepaidCard.java index 5649e5f0e..40f59e03c 100644 --- a/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletPrepaidCard.java +++ b/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletPrepaidCard.java @@ -1,12 +1,14 @@ package com.hyperwallet.clientsdk.model; import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonFormat; 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 @@ -30,10 +32,11 @@ public enum CardType {PERSONALIZED, INSTANT_ISSUE, VIRTUAL} private String cardPackage; private String cardNumber; private Brand cardBrand; - + @JsonFormat(pattern = "yyyy-MM", timezone = "UTC") private Date dateOfExpiry; private String userToken; + private List links; public HyperwalletTransferMethod.Type getType() { return type; @@ -286,4 +289,25 @@ public HyperwalletPrepaidCard clearUserToken() { this.userToken = null; return this; } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + addField("links", links); + this.links = links; + } + + public HyperwalletPrepaidCard links(List links) { + addField("links", links); + this.links = links; + return this; + } + + public HyperwalletPrepaidCard clearLinks() { + clearField("links"); + this.links = null; + return this; + } } diff --git a/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletPrepaidCardTest.java b/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletPrepaidCardTest.java index b7bf106c0..a0f354513 100644 --- a/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletPrepaidCardTest.java +++ b/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletPrepaidCardTest.java @@ -1,6 +1,8 @@ package com.hyperwallet.clientsdk.model; +import java.util.ArrayList; import java.util.Date; +import java.util.List; /** * @author fkrauthan @@ -8,6 +10,9 @@ public class HyperwalletPrepaidCardTest extends BaseModelTest { protected HyperwalletPrepaidCard createBaseModel() { HyperwalletPrepaidCard prepaidCard = new HyperwalletPrepaidCard(); + List hyperwalletLinkList = new ArrayList<>(); + HyperwalletLink hyperwalletLink = new HyperwalletLink(); + hyperwalletLinkList.add(hyperwalletLink); prepaidCard .token("test-token") .type(HyperwalletTransferMethod.Type.PREPAID_CARD) @@ -23,7 +28,8 @@ protected HyperwalletPrepaidCard createBaseModel() { .cardBrand(HyperwalletPrepaidCard.Brand.VISA) .dateOfExpiry(new Date()) - .userToken("test-user-token"); + .userToken("test-user-token") + .links(hyperwalletLinkList); return prepaidCard; } From 294ff7b46a54fd7d763a47977742563f5104cbdd Mon Sep 17 00:00:00 2001 From: ramahalingam Date: Mon, 7 Sep 2020 18:36:03 +0530 Subject: [PATCH 2/5] IT test for HW-66706 --- .../integration/createPrepaidCard-request.txt | 7 ++++ .../createPrepaidCard-response.json | 13 +++++++ .../integration/getPrepaidCard-request.txt | 3 ++ .../integration/getPrepaidCard-response.json | 22 ++++++++++++ .../integration/listPrepaidCard-request.txt | 3 ++ .../integration/listPrepaidCard-response.json | 36 +++++++++++++++++++ .../integration/updatePrepaidCard-request.txt | 2 +- .../updatePrepaidCard-response.json | 2 +- 8 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/integration/createPrepaidCard-request.txt create mode 100644 src/test/resources/integration/createPrepaidCard-response.json create mode 100644 src/test/resources/integration/getPrepaidCard-request.txt create mode 100644 src/test/resources/integration/getPrepaidCard-response.json create mode 100644 src/test/resources/integration/listPrepaidCard-request.txt create mode 100644 src/test/resources/integration/listPrepaidCard-response.json diff --git a/src/test/resources/integration/createPrepaidCard-request.txt b/src/test/resources/integration/createPrepaidCard-request.txt new file mode 100644 index 000000000..3cb348999 --- /dev/null +++ b/src/test/resources/integration/createPrepaidCard-request.txt @@ -0,0 +1,7 @@ +curl -X "POST" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/prepaid-cards" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-d "{ + "type": "PREPAID_CARD" +}" diff --git a/src/test/resources/integration/createPrepaidCard-response.json b/src/test/resources/integration/createPrepaidCard-response.json new file mode 100644 index 000000000..bb366b243 --- /dev/null +++ b/src/test/resources/integration/createPrepaidCard-response.json @@ -0,0 +1,13 @@ +{ + "token": "trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f", + "type": "BANK_CARD", + "status": "ACTIVATED", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/prepaid-cards/trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f" + } + ] +} diff --git a/src/test/resources/integration/getPrepaidCard-request.txt b/src/test/resources/integration/getPrepaidCard-request.txt new file mode 100644 index 000000000..25edf1cb3 --- /dev/null +++ b/src/test/resources/integration/getPrepaidCard-request.txt @@ -0,0 +1,3 @@ +curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/prepaid-cards/trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Accept: application/json" \ No newline at end of file diff --git a/src/test/resources/integration/getPrepaidCard-response.json b/src/test/resources/integration/getPrepaidCard-response.json new file mode 100644 index 000000000..db120f0f5 --- /dev/null +++ b/src/test/resources/integration/getPrepaidCard-response.json @@ -0,0 +1,22 @@ +{ + "token": "trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f", + "type": "PREPAID_CARD", + "status": "ACTIVATED", + "createdOn": "2020-09-07T18:05:09", + "transferMethodCountry": "US", + "transferMethodCurrency": "USD", + "cardType": "PERSONALIZED", + "cardPackage": "L1", + "cardNumber": "************0727", + "cardBrand": "VISA", + "dateOfExpiry": "2024-09", + "userToken": "usr-c4292f1a-866f-4310-a289-b916853939de", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-d868bf2d-acf1-48de-9806-8cefcb6a40ad/prepaid-cards/trm-38e07e59-69d1-40bc-bebc-af639b847410" + } + ] +} diff --git a/src/test/resources/integration/listPrepaidCard-request.txt b/src/test/resources/integration/listPrepaidCard-request.txt new file mode 100644 index 000000000..934ef27ec --- /dev/null +++ b/src/test/resources/integration/listPrepaidCard-request.txt @@ -0,0 +1,3 @@ +curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/prepaid-cards" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Accept: application/json" \ No newline at end of file diff --git a/src/test/resources/integration/listPrepaidCard-response.json b/src/test/resources/integration/listPrepaidCard-response.json new file mode 100644 index 000000000..484db6b9e --- /dev/null +++ b/src/test/resources/integration/listPrepaidCard-response.json @@ -0,0 +1,36 @@ +{ + "hasNextPage": false, + "hasPreviousPage": false, + "limit": 100, + "data": [ + { + "token": "trm-38e07e59-69d1-40bc-bebc-af639b847410", + "type": "PREPAID_CARD", + "status": "ACTIVATED", + "createdOn": "2020-09-07T18:05:09", + "transferMethodCountry": "US", + "transferMethodCurrency": "USD", + "cardType": "PERSONALIZED", + "cardPackage": "L1", + "cardNumber": "************0727", + "cardBrand": "VISA", + "dateOfExpiry": "2024-09", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-d868bf2d-acf1-48de-9806-8cefcb6a40ad/prepaid-cards/trm-38e07e59-69d1-40bc-bebc-af639b847410" + } + ] + } + ], + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-d868bf2d-acf1-48de-9806-8cefcb6a40ad/prepaid-cards?limit=100" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/updatePrepaidCard-request.txt b/src/test/resources/integration/updatePrepaidCard-request.txt index cf6dbae36..389ba7380 100644 --- a/src/test/resources/integration/updatePrepaidCard-request.txt +++ b/src/test/resources/integration/updatePrepaidCard-request.txt @@ -4,4 +4,4 @@ curl -X "PUT" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-86 -H "Accept: application/json" \ -d "{ "cardPackage": "US8419889B2" -}" +}" \ No newline at end of file diff --git a/src/test/resources/integration/updatePrepaidCard-response.json b/src/test/resources/integration/updatePrepaidCard-response.json index 250c3a18e..5a834d602 100644 --- a/src/test/resources/integration/updatePrepaidCard-response.json +++ b/src/test/resources/integration/updatePrepaidCard-response.json @@ -17,4 +17,4 @@ "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/bank-cards/trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f" } ] -} +} \ No newline at end of file From 7562b70838b2a274eaa1c6330d34b6239b87803c Mon Sep 17 00:00:00 2001 From: ramahalingam Date: Mon, 7 Sep 2020 18:36:56 +0530 Subject: [PATCH 3/5] HyperwalletIT changes for HW-66706 --- .../hyperwallet/clientsdk/HyperwalletIT.java | 142 +++++++++++++++++- 1 file changed, 136 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java b/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java index b782f6b9e..1dd186b54 100644 --- a/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java +++ b/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java @@ -1,6 +1,7 @@ package com.hyperwallet.clientsdk; import com.hyperwallet.clientsdk.model.*; +import com.hyperwallet.clientsdk.model.HyperwalletTransferMethod.Type; import org.mockserver.integration.ClientAndServer; import org.mockserver.model.HttpRequest; import org.mockserver.model.HttpResponse; @@ -13,9 +14,7 @@ import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.HashMap; -import java.util.Map; -import java.util.Scanner; +import java.util.*; import static com.hyperwallet.clientsdk.model.HyperwalletStatusTransition.Status.*; import static org.hamcrest.MatcherAssert.assertThat; @@ -23,6 +22,7 @@ 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.assertEquals; import static org.testng.Assert.fail; public class HyperwalletIT { @@ -101,6 +101,91 @@ public void testGetUserStatusTransition() throws Exception { // // Prepaid Card // + @Test + public void testCreatePrepaidCard() throws Exception { + String functionality = "createPrepaidCard"; + initMockServer(functionality); + + HyperwalletPrepaidCard prepaidCard = new HyperwalletPrepaidCard() + .userToken("usr-c4292f1a-866f-4310-a289-b916853939de") + .type(Type.PREPAID_CARD); + + HyperwalletPrepaidCard returnValue; + try { + returnValue = client.createPrepaidCard(prepaidCard); + } catch (Exception e) { + mockServer.verify(parseRequest(functionality)); + throw e; + } + + List hyperwalletLinks = new ArrayList<>(); + HyperwalletLink hyperwalletLink = new HyperwalletLink(); + hyperwalletLink.setHref( + "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/prepaid-cards/trm-7e915660-8c97-47bf" + + "-8a4f-0c1bc890d46f"); + Map mapParams = new HashMap<>(); + mapParams.put("rel", "self"); + hyperwalletLink.setParams(mapParams); + hyperwalletLinks.add(hyperwalletLink); + + assertThat(returnValue.getToken(), is(equalTo("trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f"))); + assertThat(returnValue.getType(), is(equalTo(HyperwalletTransferMethod.Type.BANK_CARD))); + assertThat(returnValue.getStatus(), is(equalTo(HyperwalletTransferMethod.Status.ACTIVATED))); + + if (returnValue.getLinks() != null) { + HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); + HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); + assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); + assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); + } + } + + @Test + public void testGetPrepaidCard() throws Exception { + String functionality = "getPrepaidCard"; + initMockServer(functionality); + + HyperwalletPrepaidCard prepaidCard = new HyperwalletPrepaidCard() + .userToken("usr-c4292f1a-866f-4310-a289-b916853939de") + .token("trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f"); + + HyperwalletPrepaidCard returnValue; + try { + returnValue = client.getPrepaidCard(prepaidCard.getUserToken(), prepaidCard.getToken()); + } catch (Exception e) { + mockServer.verify(parseRequest(functionality)); + throw e; + } + + List hyperwalletLinks = new ArrayList<>(); + HyperwalletLink hyperwalletLink = new HyperwalletLink(); + hyperwalletLink.setHref( + "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-d868bf2d-acf1-48de-9806-8cefcb6a40ad/prepaid-cards/trm-38e07e59-69d1-40bc" + + "-bebc-af639b847410"); + Map mapParams = new HashMap<>(); + mapParams.put("rel", "self"); + hyperwalletLink.setParams(mapParams); + hyperwalletLinks.add(hyperwalletLink); + + assertThat(returnValue.getToken(), is(equalTo("trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f"))); + assertThat(returnValue.getType(), is(equalTo(Type.PREPAID_CARD))); + assertThat(returnValue.getStatus(), is(equalTo(HyperwalletTransferMethod.Status.ACTIVATED))); + assertThat(returnValue.getCreatedOn(), is(equalTo(dateFormat.parse("2020-09-07T18:05:09 UTC")))); + assertThat(returnValue.getTransferMethodCountry(), is(equalTo("US"))); + assertThat(returnValue.getTransferMethodCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getCardPackage(), is(equalTo("L1"))); + assertThat(returnValue.getCardType(), is(equalTo(HyperwalletPrepaidCard.CardType.PERSONALIZED))); + assertThat(returnValue.getCardNumber(), is(equalTo("************0727"))); + assertThat(returnValue.getCardBrand(), is(equalTo(HyperwalletPrepaidCard.Brand.VISA))); + assertThat(returnValue.getDateOfExpiry(), is(equalTo(dateFormat.parse("2024-09-01T00:00:00 UTC")))); + + if (returnValue.getLinks() != null) { + HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); + HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); + assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); + assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); + } + } @Test public void testUpdatePrepaidCard() throws Exception { @@ -108,9 +193,9 @@ public void testUpdatePrepaidCard() throws Exception { initMockServer(functionality); HyperwalletPrepaidCard prepaidCard = new HyperwalletPrepaidCard() - .userToken("usr-c4292f1a-866f-4310-a289-b916853939de") - .token("trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f") - .cardPackage("US8419889B2"); + .userToken("usr-c4292f1a-866f-4310-a289-b916853939de") + .token("trm-7e915660-8c97-47bf-8a4f-0c1bc890d46f") + .cardPackage("US8419889B2"); HyperwalletPrepaidCard returnValue; try { @@ -133,6 +218,51 @@ public void testUpdatePrepaidCard() throws Exception { assertThat(returnValue.getDateOfExpiry(), is(nullValue())); } + @Test + public void testListPrepaidCard() throws Exception { + String functionality = "listPrepaidCard"; + initMockServer(functionality); + + HyperwalletPrepaidCard prepaidCard = new HyperwalletPrepaidCard() + .userToken("usr-c4292f1a-866f-4310-a289-b916853939de"); + + HyperwalletList returnValue; + try { + returnValue = client.listPrepaidCards(prepaidCard.getUserToken()); + } catch (Exception e) { + mockServer.verify(parseRequest(functionality)); + throw e; + } + + List hyperwalletLinks = new ArrayList<>(); + HyperwalletLink hyperwalletLink = new HyperwalletLink(); + hyperwalletLink.setHref("https://api.sandbox.hyperwallet.com/rest/v4/users/usr-d868bf2d-acf1-48de-9806-8cefcb6a40ad/prepaid-cards?limit=100"); + Map mapParams = new HashMap<>(); + mapParams.put("rel", "self"); + hyperwalletLink.setParams(mapParams); + hyperwalletLinks.add(hyperwalletLink); + + HyperwalletPrepaidCard hyperwalletPrepaidCardResponse = returnValue.getData().get(0); + assertThat(hyperwalletPrepaidCardResponse.getToken(), is(equalTo("trm-38e07e59-69d1-40bc-bebc-af639b847410"))); + assertThat(hyperwalletPrepaidCardResponse.getType(), is(equalTo(Type.PREPAID_CARD))); + assertThat(hyperwalletPrepaidCardResponse.getStatus(), is(equalTo(HyperwalletTransferMethod.Status.ACTIVATED))); + assertThat(hyperwalletPrepaidCardResponse.getCreatedOn(), is(equalTo(dateFormat.parse("2020-09-07T18:05:09 UTC")))); + assertThat(hyperwalletPrepaidCardResponse.getTransferMethodCountry(), is(equalTo("US"))); + assertThat(hyperwalletPrepaidCardResponse.getTransferMethodCurrency(), is(equalTo("USD"))); + assertThat(hyperwalletPrepaidCardResponse.getCardPackage(), is(equalTo("L1"))); + assertThat(hyperwalletPrepaidCardResponse.getCardType(), is(equalTo(HyperwalletPrepaidCard.CardType.PERSONALIZED))); + assertThat(hyperwalletPrepaidCardResponse.getCardNumber(), is(equalTo("************0727"))); + assertThat(hyperwalletPrepaidCardResponse.getCardBrand(), is(equalTo(HyperwalletPrepaidCard.Brand.VISA))); + assertThat(hyperwalletPrepaidCardResponse.getDateOfExpiry(), is(equalTo(dateFormat.parse("2024-09-01T00:00:00 UTC")))); + + if (returnValue.getLinks() != null) { + HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); + HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); + assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); + assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); + } + } + // // Bank Cards // From 69368d54f2f8949860ae2b2271359de4809ca6bc Mon Sep 17 00:00:00 2001 From: ramahalingam Date: Wed, 9 Sep 2020 13:36:29 +0530 Subject: [PATCH 4/5] Review comment fixes --- .../hyperwallet/clientsdk/HyperwalletIT.java | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java b/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java index 1dd186b54..4bc0f04a6 100644 --- a/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java +++ b/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java @@ -132,12 +132,10 @@ public void testCreatePrepaidCard() throws Exception { assertThat(returnValue.getType(), is(equalTo(HyperwalletTransferMethod.Type.BANK_CARD))); assertThat(returnValue.getStatus(), is(equalTo(HyperwalletTransferMethod.Status.ACTIVATED))); - if (returnValue.getLinks() != null) { - HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); - HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); - assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); - assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); - } + HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); + HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); + assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); + assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); } @Test @@ -179,12 +177,10 @@ public void testGetPrepaidCard() throws Exception { assertThat(returnValue.getCardBrand(), is(equalTo(HyperwalletPrepaidCard.Brand.VISA))); assertThat(returnValue.getDateOfExpiry(), is(equalTo(dateFormat.parse("2024-09-01T00:00:00 UTC")))); - if (returnValue.getLinks() != null) { - HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); - HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); - assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); - assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); - } + HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); + HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); + assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); + assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); } @Test @@ -255,12 +251,10 @@ public void testListPrepaidCard() throws Exception { assertThat(hyperwalletPrepaidCardResponse.getCardBrand(), is(equalTo(HyperwalletPrepaidCard.Brand.VISA))); assertThat(hyperwalletPrepaidCardResponse.getDateOfExpiry(), is(equalTo(dateFormat.parse("2024-09-01T00:00:00 UTC")))); - if (returnValue.getLinks() != null) { - HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); - HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); - assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); - assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); - } + HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); + HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); + assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); + assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); } // From 702857bf83e0a6f8a86abcb8b601090c5e3120a8 Mon Sep 17 00:00:00 2001 From: ramahalingam Date: Thu, 10 Sep 2020 17:08:50 +0530 Subject: [PATCH 5/5] Changes for HW-66706-V4PrepaidCards --- .../replacePrepaidCard-request.txt | 10 +++++++++ .../replacePrepaidCard-response.json | 22 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/test/resources/integration/replacePrepaidCard-request.txt create mode 100644 src/test/resources/integration/replacePrepaidCard-response.json diff --git a/src/test/resources/integration/replacePrepaidCard-request.txt b/src/test/resources/integration/replacePrepaidCard-request.txt new file mode 100644 index 000000000..77dc3c6cc --- /dev/null +++ b/src/test/resources/integration/replacePrepaidCard-request.txt @@ -0,0 +1,10 @@ +curl -X "POST" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/prepaid-cards" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-d "{ + "type": "PREPAID_CARD", + "replacementOf":"trm-3e23841c-34fd-41b1-9b81-ac2c3ad5ab84", + "replacementReason":"DAMAGED", + "cardPackage":"L1" +}" diff --git a/src/test/resources/integration/replacePrepaidCard-response.json b/src/test/resources/integration/replacePrepaidCard-response.json new file mode 100644 index 000000000..c9f85ed32 --- /dev/null +++ b/src/test/resources/integration/replacePrepaidCard-response.json @@ -0,0 +1,22 @@ +{ + "token": "trm-3e23841c-34fd-41b1-9b81-ac2c3ad5ab84", + "type": "PREPAID_CARD", + "status": "PRE_ACTIVATED", + "createdOn": "2020-09-10T14:31:43", + "transferMethodCountry": "US", + "transferMethodCurrency": "USD", + "cardType": "PERSONALIZED", + "cardPackage": "L1", + "cardNumber": "************0843", + "cardBrand": "VISA", + "dateOfExpiry": "2024-09", + "userToken": "usr-85e743a2-beec-4817-9a10-2e0aede9afd7", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://localhost-hyperwallet.aws.paylution.net:8181/rest/v4/users/usr-85e743a2-beec-4817-9a10-2e0aede9afd7/prepaid-cards/trm-3e23841c-34fd-41b1-9b81-ac2c3ad5ab84" + } + ] +} \ No newline at end of file