Skip to content

Commit 881a9a9

Browse files
authored
DTSERWFOUR-467 Tag/1.0.0 beta09 Release (#121)
- Enhancement for Paper Check Transfer method
1 parent 7a40261 commit 881a9a9

File tree

7 files changed

+79
-17
lines changed

7 files changed

+79
-17
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
[1.0.0-beta09](https://github.com/hyperwallet/hyperwallet-android-sdk/releases/tag/1.0.0-beta09)
5+
-------------------
6+
* Enhancement for Paper Check Transfer method
7+
48
[1.0.0-beta08](https://github.com/hyperwallet/hyperwallet-android-sdk/releases/tag/1.0.0-beta08)
59
-------------------
610
* Added Paper Check as a Transfer method

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ We also provide an out-of-the-box [Hyperwallet Android UI SDK](https://github.c
2121
To install Hyperwallet Core SDK, you just need to add the dependency into your build.gradle file in Android Studio (or Gradle). For example:
2222

2323
```bash
24-
api 'com.hyperwallet.android:core-sdk:1.0.0-beta08'
24+
api 'com.hyperwallet.android:core-sdk:1.0.0-beta09'
2525
```
2626

2727
### Proguard
@@ -183,15 +183,13 @@ final VenmoAccount venmoAccount = new VenmoAccount
183183
.build();
184184

185185
Hyperwallet.getDefault().updateVenmoAccount(venmoAccount, mListener);
186-
// Code to handle successful response or error
187186
// onSuccess: response (VenmoAccount in this case) will contain information about the user’s Venmo account
188187
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure of Venmo account updating
189188
```
190189

191190
### Deactivate Venmo Account
192191
```java
193192
Hyperwallet.getDefault().deactivateVenmoAccount("trm-fake-token", "deactivate Venmo account", mListener);
194-
// Code to handle successful response or error
195193
// onSuccess: response (StatusTransition in this case) will contain information about the status transition
196194
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure of Venmo account deactivation
197195
```
@@ -225,21 +223,20 @@ Hyperwallet.getDefault().getPaperCheck("trm-fake-token", listener);
225223

226224
### Update Paper Check
227225
```java
228-
final PaperCheck paperCheck = new PaperCheck
229-
.Builder()
230-
.token("trm-fake-token")
231-
.build();
226+
final PaperCheck paperCheck = new PaperCheck
227+
.Builder()
228+
.token("trm-fake-token")
229+
.shippingMethod("EXPEDITED")
230+
.build();
232231

233232
Hyperwallet.getDefault().updatePaperCheck(paperCheck, listener);
234-
// Code to handle successful response or error
235233
// onSuccess: response (PaperCheck in this case) will contain information about the user’s PaperCheck
236234
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure of PaperCheck updating
237235
```
238236

239237
### Deactivate Paper Check
240238
```java
241239
Hyperwallet.getDefault().deactivatePaperCheck("trm-fake-token", "deactivate Paper Check", listener);
242-
// Code to handle successful response or error
243240
// onSuccess: response (StatusTransition in this case) will contain information about the status transition
244241
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure of Paper Check deactivation
245242
```

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ allprojects {
2121
mavenLocal()
2222
}
2323

24-
project.version = "1.0.0-beta08"
24+
project.version = "1.0.0-beta09"
2525
}
2626

2727
task clean(type: Delete) {

core/src/main/java/com/hyperwallet/android/model/transfermethod/PaperCheck.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,39 @@ public PaperCheck.Builder transferMethodCurrency(@NonNull String transferMethodC
8989
return this;
9090
}
9191

92+
public PaperCheck.Builder shippingMethod(@NonNull final String shippingMethod) {
93+
mFields.put(TransferMethodFields.SHIPPING_METHOD, shippingMethod);
94+
return this;
95+
}
96+
97+
public PaperCheck.Builder addressLine1(@NonNull final String addressLine1) {
98+
mFields.put(TransferMethodFields.ADDRESS_LINE_1, addressLine1);
99+
return this;
100+
}
101+
102+
public PaperCheck.Builder addressLine2(@NonNull final String addressLine2) {
103+
mFields.put(TransferMethodFields.ADDRESS_LINE_2, addressLine2);
104+
return this;
105+
}
106+
107+
public PaperCheck.Builder city(@NonNull final String city) {
108+
mFields.put(TransferMethodFields.CITY, city);
109+
return this;
110+
}
111+
public PaperCheck.Builder postalCode(@NonNull final String postalCode) {
112+
mFields.put(TransferMethodFields.POSTAL_CODE, postalCode);
113+
return this;
114+
}
115+
116+
public PaperCheck.Builder stateProvince(@NonNull final String stateProvince) {
117+
mFields.put(TransferMethodFields.STATE_PROVINCE, stateProvince);
118+
return this;
119+
}
120+
public PaperCheck.Builder country(@NonNull final String country) {
121+
mFields.put(TransferMethodFields.COUNTRY, country);
122+
return this;
123+
}
124+
92125
public PaperCheck build() {
93126
return new PaperCheck(mFields);
94127
}

core/src/test/java/com/hyperwallet/android/RestTransactionBuilderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void testBuild_withRequiredParametersOnly() throws JSONException {
6767
assertThat(headers.get("Content-Type"), is("application/json"));
6868
assertThat(headers.get("User-Agent"), is("HyperwalletSDK/Android/" + BuildConfig.VERSION_NAME +
6969
"; App: HyperwalletSDK; Android: " + Build.VERSION.RELEASE));
70-
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta08"));
70+
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta09"));
7171
assertThat(headers.get("X-Sdk-Type"), is("android"));
7272
assertThat(headers.get("X-Sdk-ContextId"), is(notNullValue()));
7373
assertThat(headers.get("X-Sdk-ContextId"), is(contextId));
@@ -104,7 +104,7 @@ public void testBuild_withJsonModelOptionalParameter() throws JSONException {
104104
assertThat(headers.get("Content-Type"), is("application/json"));
105105
assertThat(headers.get("User-Agent"), is("HyperwalletSDK/Android/" + BuildConfig.VERSION_NAME +
106106
"; App: HyperwalletSDK; Android: " + Build.VERSION.RELEASE));
107-
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta08"));
107+
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta09"));
108108
assertThat(headers.get("X-Sdk-Type"), is("android"));
109109
assertThat(headers.get("X-Sdk-ContextId"), is(notNullValue()));
110110
assertThat(headers.get("X-Sdk-ContextId"), is(contextId));
@@ -140,7 +140,7 @@ public void testBuild_withQueryModelOptionalParameter() throws JSONException {
140140
assertThat(headers.get("Content-Type"), is("application/json"));
141141
assertThat(headers.get("User-Agent"), is("HyperwalletSDK/Android/" + BuildConfig.VERSION_NAME +
142142
"; App: HyperwalletSDK; Android: " + Build.VERSION.RELEASE));
143-
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta08"));
143+
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta09"));
144144
assertThat(headers.get("X-Sdk-Type"), is("android"));
145145
assertThat(headers.get("X-Sdk-ContextId"), is(notNullValue()));
146146
assertThat(headers.get("X-Sdk-ContextId"), is(contextId));

core/src/test/java/com/hyperwallet/android/transfermethod/UpdatePaperCheckTest.java

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@
2727

2828
import okhttp3.mockwebserver.RecordedRequest;
2929

30+
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.ADDRESS_LINE_1;
31+
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.ADDRESS_LINE_2;
32+
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.CITY;
33+
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.COUNTRY;
3034
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.CREATED_ON;
35+
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.POSTAL_CODE;
3136
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.SHIPPING_METHOD;
37+
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.STATE_PROVINCE;
3238
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.STATUS;
3339
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TOKEN;
3440
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TRANSFER_METHOD_COUNTRY;
@@ -70,9 +76,23 @@ public void testUpdatePaperCheck_withSuccess() throws InterruptedException {
7076
final PaperCheck paperCheck = new PaperCheck
7177
.Builder()
7278
.token("trm-fake-token")
79+
.shippingMethod("EXPEDITED")
80+
.city("Victoria")
81+
.postalCode("12345")
82+
.addressLine1("123 Other Street")
83+
.addressLine2("1234 AddressLineTwo St")
84+
.stateProvince("CA")
85+
.country("US")
7386
.build();
7487

7588
assertThat(paperCheck.getField(TOKEN), is("trm-fake-token"));
89+
assertThat(paperCheck.getField(SHIPPING_METHOD), is("EXPEDITED"));
90+
assertThat(paperCheck.getField(CITY), is("Victoria"));
91+
assertThat(paperCheck.getField(POSTAL_CODE), is("12345"));
92+
assertThat(paperCheck.getField(ADDRESS_LINE_1),is("123 Other Street"));
93+
assertThat(paperCheck.getField(ADDRESS_LINE_2),is("1234 AddressLineTwo St"));
94+
assertThat(paperCheck.getField(STATE_PROVINCE),is("CA"));
95+
assertThat(paperCheck.getField(COUNTRY),is("US"));
7696

7797
Hyperwallet.getDefault().updatePaperCheck(paperCheck, mListener);
7898
mAwait.await(50, TimeUnit.MILLISECONDS);
@@ -95,6 +115,12 @@ public void testUpdatePaperCheck_withSuccess() throws InterruptedException {
95115
assertThat(paperCheckResponse.getField(TRANSFER_METHOD_COUNTRY), is("US"));
96116
assertThat(paperCheckResponse.getField(CREATED_ON), is("2020-11-29T15:13:55"));
97117
assertThat(paperCheckResponse.getField(SHIPPING_METHOD), is("EXPEDITED"));
118+
assertThat(paperCheckResponse.getField(CITY), is("Victoria"));
119+
assertThat(paperCheckResponse.getField(POSTAL_CODE), is("12345"));
120+
assertThat(paperCheckResponse.getField(ADDRESS_LINE_1),is("123 Other Street"));
121+
assertThat(paperCheckResponse.getField(ADDRESS_LINE_2),is("1234 AddressLineTwo St"));
122+
assertThat(paperCheckResponse.getField(STATE_PROVINCE),is("CA"));
123+
assertThat(paperCheckResponse.getField(COUNTRY),is("US"));
98124
}
99125

100126
@Test
@@ -107,6 +133,7 @@ public void testUpdatePaperCheck_withValidationError() throws InterruptedExcepti
107133
final PaperCheck paperCheck = new PaperCheck
108134
.Builder()
109135
.token("trm-fake-token")
136+
.postalCode("1234")
110137
.build();
111138

112139
assertThat(paperCheck.getField(TOKEN),
@@ -134,7 +161,7 @@ public void testUpdatePaperCheck_withValidationError() throws InterruptedExcepti
134161

135162
Error error1 = errors.getErrors().get(0);
136163
assertThat(error1.getCode(), is("CONSTRAINT_VIOLATIONS"));
137-
assertThat(error1.getFieldName(), is("phoneNumber"));
138-
assertThat(error1.getMessage(), is("The number you provided is not valid!"));
164+
assertThat(error1.getFieldName(), is("postalCode"));
165+
assertThat(error1.getMessage(), is("Invalid Postal Code"));
139166
}
140167
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"errors": [
33
{
4-
"message": "The number you provided is not valid!",
5-
"fieldName": "phoneNumber",
4+
"message": "Invalid Postal Code",
5+
"fieldName": "postalCode",
66
"code": "CONSTRAINT_VIOLATIONS"
77
}
8+
89
]
910
}

0 commit comments

Comments
 (0)