diff --git a/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletBankAccount.java b/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletBankAccount.java index b21e15188..33fad573b 100644 --- a/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletBankAccount.java +++ b/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletBankAccount.java @@ -7,6 +7,7 @@ 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 @@ -79,6 +80,7 @@ public static enum Status {ACTIVATED, INVALID, DE_ACTIVATED} private String stateProvince; private String postalCode; private String country; + private List links; public String getToken() { return token; @@ -1234,4 +1236,25 @@ public HyperwalletBankAccount clearCountry() { country = null; return this; } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + addField("links", links); + this.links = links; + } + + public HyperwalletBankAccount links(List links) { + addField("links", links); + this.links = links; + return this; + } + + public HyperwalletBankAccount clearLinks() { + clearField("links"); + this.links = null; + return this; + } } diff --git a/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletStatusTransition.java b/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletStatusTransition.java index 064bd3783..6ac0769a2 100644 --- a/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletStatusTransition.java +++ b/src/main/java/com/hyperwallet/clientsdk/model/HyperwalletStatusTransition.java @@ -33,7 +33,6 @@ public enum Status { private String notes; private List links; - public String getToken() { return token; } diff --git a/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java b/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java index 765bf0697..18daf8a6b 100644 --- a/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java +++ b/src/test/java/com/hyperwallet/clientsdk/HyperwalletIT.java @@ -1,6 +1,9 @@ package com.hyperwallet.clientsdk; import com.hyperwallet.clientsdk.model.*; +import com.hyperwallet.clientsdk.model.HyperwalletBankAccount.Type; +import com.hyperwallet.clientsdk.model.HyperwalletUser.Gender; +import com.hyperwallet.clientsdk.model.HyperwalletUser.ProfileType; import org.mockserver.integration.ClientAndServer; import org.mockserver.model.HttpRequest; import org.mockserver.model.HttpResponse; @@ -1628,6 +1631,330 @@ public void testCreateBankCardWithErrorResponse() throws Exception { } } + // + // Bank Accounts + // + + @Test + public void testCreateBankAccount() throws Exception { + String functionality = "createBankAccount"; + initMockServer(functionality); + + HyperwalletBankAccount bankAccount = new HyperwalletBankAccount() + .userToken("usr-c4292f1a-866f-4310-a289-b916853939de") + .transferMethodCountry("US") + .transferMethodCurrency("USD") + .type(Type.BANK_ACCOUNT) + .branchId("021000021") + .bankAccountId("1234") + .bankAccountPurpose("SAVINGS"); + HyperwalletBankAccount returnValue; + try { + returnValue = client.createBankAccount(bankAccount); + } 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-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12" + + "-bd24-d77fc02b9f4f"); + Map mapParams = new HashMap<>(); + mapParams.put("rel", "self"); + hyperwalletLink.setParams(mapParams); + hyperwalletLinks.add(hyperwalletLink); + + assertThat(returnValue.getToken(), is(equalTo("trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f"))); + assertThat(returnValue.getType(), is(equalTo(HyperwalletBankAccount.Type.BANK_ACCOUNT))); + assertThat(returnValue.getStatus(), is(equalTo(HyperwalletBankAccount.Status.ACTIVATED))); + assertThat(returnValue.getCreatedOn(), is(equalTo(dateFormat.parse("2020-09-08T15:01:07 UTC")))); + assertThat(returnValue.getTransferMethodCountry(), is(equalTo("US"))); + assertThat(returnValue.getTransferMethodCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getBankName(), is(equalTo("JPMORGAN CHASE BANK"))); + assertThat(returnValue.getBranchId(), is(equalTo("021000021"))); + assertThat(returnValue.getBankAccountId(), is(equalTo("1599557466"))); + assertThat(returnValue.getBankAccountPurpose(), is(equalTo("SAVINGS"))); + assertThat(returnValue.getUserToken(), is(equalTo("usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad"))); + assertThat(returnValue.getProfileType(), is(equalTo(ProfileType.INDIVIDUAL))); + assertThat(returnValue.getFirstName(), is(equalTo("firstName"))); + assertThat(returnValue.getLastName(), is(equalTo("lastName"))); + assertThat(returnValue.getDateOfBirth(), is(equalTo(dateFormat.parse("2000-09-08T15:01:07 UTC")))); + assertThat(returnValue.getGender(), is(equalTo(Gender.MALE))); + assertThat(returnValue.getPhoneNumber(), is(equalTo("605-555-1323"))); + assertThat(returnValue.getMobileNumber(), is(equalTo("605-555-1323"))); + assertThat(returnValue.getGovernmentId(), is(equalTo("444444444"))); + assertThat(returnValue.getAddressLine1(), is(equalTo("1234 IndividualAddress St"))); + assertThat(returnValue.getAddressLine2(), is(equalTo("1234 AddressLineTwo St"))); + assertThat(returnValue.getCity(), is(equalTo("Test1111"))); + assertThat(returnValue.getStateProvince(), is(equalTo("CA"))); + assertThat(returnValue.getCountry(), is(equalTo("US"))); + assertThat(returnValue.getPostalCode(), is(equalTo("12345"))); + + 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 testGetBankAccount() throws Exception { + String functionality = "getBankAccount"; + initMockServer(functionality); + + HyperwalletBankAccount returnValue; + + try { + String userToken = "usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad"; + String transferMethodToken = "trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f"; + returnValue = client.getBankAccount(userToken, transferMethodToken); + } 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-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12" + + "-bd24-d77fc02b9f4f"); + Map mapParams = new HashMap<>(); + mapParams.put("rel", "self"); + hyperwalletLink.setParams(mapParams); + hyperwalletLinks.add(hyperwalletLink); + + assertThat(returnValue.getToken(), is(equalTo("trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f"))); + assertThat(returnValue.getType(), is(equalTo(HyperwalletBankAccount.Type.BANK_ACCOUNT))); + assertThat(returnValue.getStatus(), is(equalTo(HyperwalletBankAccount.Status.DE_ACTIVATED))); + assertThat(returnValue.getCreatedOn(), is(equalTo(dateFormat.parse("2020-09-08T15:01:07 UTC")))); + assertThat(returnValue.getTransferMethodCountry(), is(equalTo("US"))); + assertThat(returnValue.getTransferMethodCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getBankName(), is(equalTo("JPMORGAN CHASE BANK"))); + assertThat(returnValue.getBranchId(), is(equalTo("021000021"))); + assertThat(returnValue.getBankAccountId(), is(equalTo("1599557466"))); + assertThat(returnValue.getBankAccountPurpose(), is(equalTo("SAVINGS"))); + assertThat(returnValue.getUserToken(), is(equalTo("usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad"))); + assertThat(returnValue.getProfileType(), is(equalTo(ProfileType.INDIVIDUAL))); + assertThat(returnValue.getFirstName(), is(equalTo("firstName"))); + assertThat(returnValue.getLastName(), is(equalTo("lastName"))); + assertThat(returnValue.getDateOfBirth(), is(equalTo(dateFormat.parse("2000-09-08T15:01:07 UTC")))); + assertThat(returnValue.getGender(), is(equalTo(Gender.MALE))); + assertThat(returnValue.getPhoneNumber(), is(equalTo("605-555-1323"))); + assertThat(returnValue.getMobileNumber(), is(equalTo("605-555-1323"))); + assertThat(returnValue.getGovernmentId(), is(equalTo("444444444"))); + assertThat(returnValue.getAddressLine1(), is(equalTo("1234 IndividualAddress St"))); + assertThat(returnValue.getAddressLine2(), is(equalTo("1234 AddressLineTwo St"))); + assertThat(returnValue.getCity(), is(equalTo("Test1111"))); + assertThat(returnValue.getStateProvince(), is(equalTo("CA"))); + assertThat(returnValue.getCountry(), is(equalTo("US"))); + assertThat(returnValue.getPostalCode(), is(equalTo("12345"))); + + 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 testGetBankAccountLists() throws Exception { + String functionality = "listBankAccounts"; + initMockServer(functionality); + + HyperwalletList bankAccountHyperwalletList; + + try { + String userToken = "usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad"; + bankAccountHyperwalletList = client.listBankAccounts(userToken); + } 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-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12" + + "-bd24-d77fc02b9f4f"); + Map mapParams = new HashMap<>(); + mapParams.put("rel", "self"); + hyperwalletLink.setParams(mapParams); + hyperwalletLinks.add(hyperwalletLink); + + HyperwalletBankAccount returnValue = bankAccountHyperwalletList.getData().get(0); + assertThat(returnValue.getToken(), is(equalTo("trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f"))); + assertThat(returnValue.getType(), is(equalTo(HyperwalletBankAccount.Type.BANK_ACCOUNT))); + assertThat(returnValue.getStatus(), is(equalTo(HyperwalletBankAccount.Status.DE_ACTIVATED))); + assertThat(returnValue.getCreatedOn(), is(equalTo(dateFormat.parse("2020-09-08T15:01:07 UTC")))); + assertThat(returnValue.getTransferMethodCountry(), is(equalTo("US"))); + assertThat(returnValue.getTransferMethodCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getBankName(), is(equalTo("JPMORGAN CHASE BANK"))); + assertThat(returnValue.getBranchId(), is(equalTo("021000021"))); + assertThat(returnValue.getBankAccountId(), is(equalTo("1599557466"))); + assertThat(returnValue.getBankAccountPurpose(), is(equalTo("SAVINGS"))); + assertThat(returnValue.getUserToken(), is(equalTo("usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad"))); + assertThat(returnValue.getProfileType(), is(equalTo(ProfileType.INDIVIDUAL))); + assertThat(returnValue.getFirstName(), is(equalTo("firstName"))); + assertThat(returnValue.getLastName(), is(equalTo("lastName"))); + assertThat(returnValue.getDateOfBirth(), is(equalTo(dateFormat.parse("2000-09-08T15:01:07 UTC")))); + assertThat(returnValue.getGender(), is(equalTo(Gender.MALE))); + assertThat(returnValue.getPhoneNumber(), is(equalTo("605-555-1323"))); + assertThat(returnValue.getMobileNumber(), is(equalTo("605-555-1323"))); + assertThat(returnValue.getGovernmentId(), is(equalTo("444444444"))); + assertThat(returnValue.getAddressLine1(), is(equalTo("1234 IndividualAddress St"))); + assertThat(returnValue.getAddressLine2(), is(equalTo("1234 AddressLineTwo St"))); + assertThat(returnValue.getCity(), is(equalTo("Test1111"))); + assertThat(returnValue.getStateProvince(), is(equalTo("CA"))); + assertThat(returnValue.getCountry(), is(equalTo("US"))); + assertThat(returnValue.getPostalCode(), is(equalTo("12345"))); + + HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); + HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); + assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); + assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); + + HyperwalletLink hyperwalletLink1 = bankAccountHyperwalletList.getLinks().get(0); + assertThat(hyperwalletLink1.getHref(), + is(equalTo("https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts?limit=100"))); + assertEquals(hyperwalletLink1.getParams(), hyperwalletLinks.get(0).getParams()); + } + + @Test + public void testDeactivateBankAccount() throws Exception { + String functionality = "deactivateBankAccount"; + initMockServer(functionality); + + HyperwalletStatusTransition returnValue; + try { + String userToken = "usr-c4292f1a-866f-4310-a289-b916853939de"; + String bankAccountToken = "trm-d69300ef-5011-486b-bd2e-bfd8b20fef26"; + returnValue = client.deactivateBankAccount(userToken, bankAccountToken); + } 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-f695ef43-9614-4e17-9269-902c234616c3/bank-accounts/trm-d69300ef-5011-486b" + + "-bd2e-bfd8b20fef26/status-transitions/sts-1825afa2-61f1-4860-aa69-a65b9d14f556"); + Map mapParams = new HashMap<>(); + mapParams.put("rel", "self"); + hyperwalletLink.setParams(mapParams); + hyperwalletLinks.add(hyperwalletLink); + + 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 testListBankAccountStatusTransitions() throws Exception { + String functionality = "listBankAccountStatusTransitions"; + initMockServer(functionality); + + HyperwalletList hyperwalletStatusTransitionHyperwalletList; + try { + String userToken = "usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad"; + String bankAccountToken = "trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f"; + hyperwalletStatusTransitionHyperwalletList = client.listBankAccountStatusTransitions(userToken, bankAccountToken); + } 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-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12" + + "-bd24-d77fc02b9f4f/status-transitions/sts-1834b075-ee3c-4c00-b1dc-a517fe8a87ab"); + Map mapParams = new HashMap<>(); + mapParams.put("rel", "self"); + hyperwalletLink.setParams(mapParams); + hyperwalletLinks.add(hyperwalletLink); + + HyperwalletStatusTransition returnValue = hyperwalletStatusTransitionHyperwalletList.getData().get(0); + assertThat(returnValue.getToken(), is(equalTo("sts-1834b075-ee3c-4c00-b1dc-a517fe8a87ab"))); + assertThat(returnValue.getCreatedOn(), is(equalTo(dateFormat.parse("2020-09-08T15:01:58 UTC")))); + assertThat(returnValue.getTransition(), is(equalTo(DE_ACTIVATED))); + assertThat(returnValue.getFromStatus(), is(equalTo(ACTIVATED))); + assertThat(returnValue.getToStatus(), is(equalTo(DE_ACTIVATED))); + assertThat(returnValue.getNotes(), is(equalTo("Deactivating card"))); + + HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); + HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); + assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); + assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); + + HyperwalletLink hyperwalletLink1 = hyperwalletStatusTransitionHyperwalletList.getLinks().get(0); + assertThat(hyperwalletLink1.getHref(), is(equalTo( + "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12" + + "-bd24-d77fc02b9f4f/status-transitions?limit=100"))); + assertEquals(hyperwalletLink1.getParams(), hyperwalletLinks.get(0).getParams()); + } + + @Test + public void updateBankAccount() throws Exception { + String functionality = "updateBankAccount"; + initMockServer(functionality); + + HyperwalletBankAccount bankAccount = new HyperwalletBankAccount() + .userToken("usr-c4292f1a-866f-4310-a289-b916853939de") + .token("trm-950a3055-e54c-456f-beb2-c6f6d42eddce") + .firstName("FirstNameChanged"); + + HyperwalletBankAccount returnValue; + try { + returnValue = client.updateBankAccount(bankAccount); + } 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-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12" + + "-bd24-d77fc02b9f4f"); + Map mapParams = new HashMap<>(); + mapParams.put("rel", "self"); + hyperwalletLink.setParams(mapParams); + hyperwalletLinks.add(hyperwalletLink); + + assertThat(returnValue.getToken(), is(equalTo("trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f"))); + assertThat(returnValue.getType(), is(equalTo(HyperwalletBankAccount.Type.BANK_ACCOUNT))); + assertThat(returnValue.getStatus(), is(equalTo(HyperwalletBankAccount.Status.ACTIVATED))); + assertThat(returnValue.getCreatedOn(), is(equalTo(dateFormat.parse("2020-09-08T15:01:07 UTC")))); + assertThat(returnValue.getTransferMethodCountry(), is(equalTo("US"))); + assertThat(returnValue.getTransferMethodCurrency(), is(equalTo("USD"))); + assertThat(returnValue.getBankName(), is(equalTo("JPMORGAN CHASE BANK"))); + assertThat(returnValue.getBranchId(), is(equalTo("021000021"))); + assertThat(returnValue.getBankAccountId(), is(equalTo("1599557466"))); + assertThat(returnValue.getBankAccountPurpose(), is(equalTo("SAVINGS"))); + assertThat(returnValue.getUserToken(), is(equalTo("usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad"))); + assertThat(returnValue.getProfileType(), is(equalTo(ProfileType.INDIVIDUAL))); + assertThat(returnValue.getFirstName(), is(equalTo("FirstNameChanged"))); + assertThat(returnValue.getLastName(), is(equalTo("lastName"))); + assertThat(returnValue.getDateOfBirth(), is(equalTo(dateFormat.parse("2000-09-08T15:01:07 UTC")))); + assertThat(returnValue.getGender(), is(equalTo(Gender.MALE))); + assertThat(returnValue.getPhoneNumber(), is(equalTo("605-555-1323"))); + assertThat(returnValue.getMobileNumber(), is(equalTo("605-555-1323"))); + assertThat(returnValue.getGovernmentId(), is(equalTo("444444444"))); + assertThat(returnValue.getAddressLine1(), is(equalTo("1234 IndividualAddress St"))); + assertThat(returnValue.getAddressLine2(), is(equalTo("1234 AddressLineTwo St"))); + assertThat(returnValue.getCity(), is(equalTo("Test1111"))); + assertThat(returnValue.getStateProvince(), is(equalTo("CA"))); + assertThat(returnValue.getCountry(), is(equalTo("US"))); + assertThat(returnValue.getPostalCode(), is(equalTo("12345"))); + + HyperwalletLink actualHyperwalletLink = returnValue.getLinks().get(0); + HyperwalletLink expectedHyperwalletLink = hyperwalletLinks.get(0); + assertThat(actualHyperwalletLink.getHref(), is(equalTo(expectedHyperwalletLink.getHref()))); + assertEquals(actualHyperwalletLink.getParams(), expectedHyperwalletLink.getParams()); + } + // // Programs // diff --git a/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletBankAccountTest.java b/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletBankAccountTest.java index 6a38b75a2..eefd2adf0 100644 --- a/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletBankAccountTest.java +++ b/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletBankAccountTest.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 HyperwalletBankAccountTest extends BaseModelTest { protected HyperwalletBankAccount createBaseModel() { HyperwalletBankAccount bankAccount = new HyperwalletBankAccount(); + List hyperwalletLinkList = new ArrayList<>(); + HyperwalletLink hyperwalletLink = new HyperwalletLink(); + hyperwalletLinkList.add(hyperwalletLink); bankAccount .token("test-token") @@ -74,7 +79,8 @@ protected HyperwalletBankAccount createBaseModel() { .city("test-city") .stateProvince("test-state-province") .postalCode("test-postal-code") - .country("test-country"); + .country("test-country") + .links(hyperwalletLinkList); return bankAccount; } diff --git a/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletStatusTransitionTest.java b/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletStatusTransitionTest.java index cfbfaa104..55ad1d115 100644 --- a/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletStatusTransitionTest.java +++ b/src/test/java/com/hyperwallet/clientsdk/model/HyperwalletStatusTransitionTest.java @@ -24,8 +24,8 @@ protected HyperwalletStatusTransition createBaseModel() { .fromStatus(HyperwalletStatusTransition.Status.LOCKED) .toStatus(HyperwalletStatusTransition.Status.ACTIVATED) .createdOn(new Date()) - .links(hyperwalletLinkList) - .notes("test-notes"); + .notes("test-notes") + .links(hyperwalletLinkList); return transition; } diff --git a/src/test/resources/integration/createBankAccount-request.txt b/src/test/resources/integration/createBankAccount-request.txt new file mode 100644 index 000000000..34a988651 --- /dev/null +++ b/src/test/resources/integration/createBankAccount-request.txt @@ -0,0 +1,12 @@ +curl -X "POST" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/bank-accounts" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-d "{ + "transferMethodCountry": "US", + "transferMethodCurrency": "USD", + "type": "BANK_ACCOUNT", + "branchId": "021000021", + "bankAccountId": "1234", + "bankAccountPurpose": "SAVINGS" +}" \ No newline at end of file diff --git a/src/test/resources/integration/createBankAccount-response.json b/src/test/resources/integration/createBankAccount-response.json new file mode 100644 index 000000000..85cabce63 --- /dev/null +++ b/src/test/resources/integration/createBankAccount-response.json @@ -0,0 +1,35 @@ +{ + "token": "trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f", + "type": "BANK_ACCOUNT", + "status": "ACTIVATED", + "createdOn": "2020-09-08T15:01:07", + "transferMethodCountry": "US", + "transferMethodCurrency": "USD", + "bankName": "JPMORGAN CHASE BANK", + "branchId": "021000021", + "bankAccountId": "1599557466", + "bankAccountPurpose": "SAVINGS", + "userToken": "usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad", + "profileType": "INDIVIDUAL", + "firstName": "firstName", + "lastName": "lastName", + "dateOfBirth": "2000-09-08T15:01:07", + "gender": "MALE", + "phoneNumber": "605-555-1323", + "mobileNumber": "605-555-1323", + "governmentId": "444444444", + "addressLine1": "1234 IndividualAddress St", + "addressLine2": "1234 AddressLineTwo St", + "city": "Test1111", + "stateProvince": "CA", + "country": "US", + "postalCode": "12345", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/deactivateBankAccount-request.txt b/src/test/resources/integration/deactivateBankAccount-request.txt new file mode 100644 index 000000000..bd733bd23 --- /dev/null +++ b/src/test/resources/integration/deactivateBankAccount-request.txt @@ -0,0 +1,7 @@ +curl -X "POST" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/bank-accounts/trm-d69300ef-5011-486b-bd2e-bfd8b20fef26/status-transitions" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-d "{ + "transition": "DE_ACTIVATED" +}" diff --git a/src/test/resources/integration/deactivateBankAccount-response.json b/src/test/resources/integration/deactivateBankAccount-response.json new file mode 100644 index 000000000..fd646f651 --- /dev/null +++ b/src/test/resources/integration/deactivateBankAccount-response.json @@ -0,0 +1,16 @@ +{ + "token": "sts-1825afa2-61f1-4860-aa69-a65b9d14f556", + "createdOn": "2017-11-16T00:55:57", + "transition": "DE_ACTIVATED", + "fromStatus": "ACTIVATED", + "toStatus": "DE_ACTIVATED", + "notes": "Closing this account.", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-f695ef43-9614-4e17-9269-902c234616c3/bank-accounts/trm-d69300ef-5011-486b-bd2e-bfd8b20fef26/status-transitions/sts-1825afa2-61f1-4860-aa69-a65b9d14f556" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/getBankAccount-request.txt b/src/test/resources/integration/getBankAccount-request.txt new file mode 100644 index 000000000..23be3ff55 --- /dev/null +++ b/src/test/resources/integration/getBankAccount-request.txt @@ -0,0 +1,3 @@ +curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Accept: application/json" \ No newline at end of file diff --git a/src/test/resources/integration/getBankAccount-response.json b/src/test/resources/integration/getBankAccount-response.json new file mode 100644 index 000000000..7a7f13d92 --- /dev/null +++ b/src/test/resources/integration/getBankAccount-response.json @@ -0,0 +1,35 @@ +{ + "token": "trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f", + "type": "BANK_ACCOUNT", + "status": "DE_ACTIVATED", + "createdOn": "2020-09-08T15:01:07", + "transferMethodCountry": "US", + "transferMethodCurrency": "USD", + "bankName": "JPMORGAN CHASE BANK", + "branchId": "021000021", + "bankAccountId": "1599557466", + "bankAccountPurpose": "SAVINGS", + "userToken": "usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad", + "profileType": "INDIVIDUAL", + "firstName": "firstName", + "lastName": "lastName", + "dateOfBirth": "2000-09-08T15:01:07", + "gender": "MALE", + "phoneNumber": "605-555-1323", + "mobileNumber": "605-555-1323", + "governmentId": "444444444", + "addressLine1": "1234 IndividualAddress St", + "addressLine2": "1234 AddressLineTwo St", + "city": "Test1111", + "stateProvince": "CA", + "country": "US", + "postalCode": "12345", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/listBankAccountStatusTransitions-request.txt b/src/test/resources/integration/listBankAccountStatusTransitions-request.txt new file mode 100644 index 000000000..6d4d1bd08 --- /dev/null +++ b/src/test/resources/integration/listBankAccountStatusTransitions-request.txt @@ -0,0 +1,3 @@ +curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f/status-transitions" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Accept: application/json" \ No newline at end of file diff --git a/src/test/resources/integration/listBankAccountStatusTransitions-response.json b/src/test/resources/integration/listBankAccountStatusTransitions-response.json new file mode 100644 index 000000000..a7bb8087d --- /dev/null +++ b/src/test/resources/integration/listBankAccountStatusTransitions-response.json @@ -0,0 +1,31 @@ +{ + "hasNextPage": false, + "hasPreviousPage": false, + "limit": 100, + "data": [ + { + "token": "sts-1834b075-ee3c-4c00-b1dc-a517fe8a87ab", + "createdOn": "2020-09-08T15:01:58", + "transition": "DE_ACTIVATED", + "fromStatus": "ACTIVATED", + "toStatus": "DE_ACTIVATED", + "notes": "Deactivating card", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f/status-transitions/sts-1834b075-ee3c-4c00-b1dc-a517fe8a87ab" + } + ] + } + ], + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f/status-transitions?limit=100" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/listBankAccounts-request.txt b/src/test/resources/integration/listBankAccounts-request.txt new file mode 100644 index 000000000..f7f439368 --- /dev/null +++ b/src/test/resources/integration/listBankAccounts-request.txt @@ -0,0 +1,3 @@ +curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Accept: application/json" diff --git a/src/test/resources/integration/listBankAccounts-response.json b/src/test/resources/integration/listBankAccounts-response.json new file mode 100644 index 000000000..6b11b7516 --- /dev/null +++ b/src/test/resources/integration/listBankAccounts-response.json @@ -0,0 +1,51 @@ +{ + "hasNextPage": false, + "hasPreviousPage": false, + "limit": 100, + "data": [ + { + "token": "trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f", + "type": "BANK_ACCOUNT", + "status": "DE_ACTIVATED", + "verificationStatus": "NOT_REQUIRED", + "createdOn": "2020-09-08T15:01:07", + "transferMethodCountry": "US", + "transferMethodCurrency": "USD", + "bankName": "JPMORGAN CHASE BANK", + "branchId": "021000021", + "bankAccountId": "1599557466", + "bankAccountPurpose": "SAVINGS", + "userToken": "usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad", + "profileType": "INDIVIDUAL", + "firstName": "firstName", + "lastName": "lastName", + "dateOfBirth": "2000-09-08T15:01:07", + "gender": "MALE", + "phoneNumber": "605-555-1323", + "mobileNumber": "605-555-1323", + "governmentId": "444444444", + "addressLine1": "1234 IndividualAddress St", + "addressLine2": "1234 AddressLineTwo St", + "city": "Test1111", + "stateProvince": "CA", + "country": "US", + "postalCode": "12345", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f" + } + ] + } + ], + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts?limit=100" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/integration/updateBankAccount-request.txt b/src/test/resources/integration/updateBankAccount-request.txt new file mode 100644 index 000000000..b4e7d4e3f --- /dev/null +++ b/src/test/resources/integration/updateBankAccount-request.txt @@ -0,0 +1,7 @@ +curl -X "PUT" "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-c4292f1a-866f-4310-a289-b916853939de/bank-accounts/trm-950a3055-e54c-456f-beb2-c6f6d42eddce" \ +-u testuser@12345678:myAccPassw0rd \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-d "{ + "firstName": "FirstNameChanged" +}" \ No newline at end of file diff --git a/src/test/resources/integration/updateBankAccount-response.json b/src/test/resources/integration/updateBankAccount-response.json new file mode 100644 index 000000000..4add26b04 --- /dev/null +++ b/src/test/resources/integration/updateBankAccount-response.json @@ -0,0 +1,35 @@ +{ + "token": "trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f", + "type": "BANK_ACCOUNT", + "status": "ACTIVATED", + "createdOn": "2020-09-08T15:01:07", + "transferMethodCountry": "US", + "transferMethodCurrency": "USD", + "bankName": "JPMORGAN CHASE BANK", + "branchId": "021000021", + "bankAccountId": "1599557466", + "bankAccountPurpose": "SAVINGS", + "userToken": "usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad", + "profileType": "INDIVIDUAL", + "firstName": "FirstNameChanged", + "lastName": "lastName", + "dateOfBirth": "2000-09-08T15:01:07", + "gender": "MALE", + "phoneNumber": "605-555-1323", + "mobileNumber": "605-555-1323", + "governmentId": "444444444", + "addressLine1": "1234 IndividualAddress St", + "addressLine2": "1234 AddressLineTwo St", + "city": "Test1111", + "stateProvince": "CA", + "country": "US", + "postalCode": "12345", + "links": [ + { + "params": { + "rel": "self" + }, + "href": "https://api.sandbox.hyperwallet.com/rest/v4/users/usr-321ad2c1-df3f-4a7a-bce4-3e88416b54ad/bank-accounts/trm-2bd0b56d-e111-4d12-bd24-d77fc02b9f4f" + } + ] +} \ No newline at end of file