Skip to content

Commit

Permalink
DTSERWFOUR-467 Tag/1.0.0 beta09 Release (#121)
Browse files Browse the repository at this point in the history
- Enhancement for Paper Check Transfer method
  • Loading branch information
vwagh-hw authored Mar 29, 2021
1 parent 7a40261 commit 881a9a9
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

[1.0.0-beta09](https://github.com/hyperwallet/hyperwallet-android-sdk/releases/tag/1.0.0-beta09)
-------------------
* Enhancement for Paper Check Transfer method

[1.0.0-beta08](https://github.com/hyperwallet/hyperwallet-android-sdk/releases/tag/1.0.0-beta08)
-------------------
* Added Paper Check as a Transfer method
Expand Down
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ We also provide an out-of-the-box [Hyperwallet Android UI SDK](https://github.c
To install Hyperwallet Core SDK, you just need to add the dependency into your build.gradle file in Android Studio (or Gradle). For example:

```bash
api 'com.hyperwallet.android:core-sdk:1.0.0-beta08'
api 'com.hyperwallet.android:core-sdk:1.0.0-beta09'
```

### Proguard
Expand Down Expand Up @@ -183,15 +183,13 @@ final VenmoAccount venmoAccount = new VenmoAccount
.build();

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

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

### Update Paper Check
```java
final PaperCheck paperCheck = new PaperCheck
.Builder()
.token("trm-fake-token")
.build();
final PaperCheck paperCheck = new PaperCheck
.Builder()
.token("trm-fake-token")
.shippingMethod("EXPEDITED")
.build();

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

### Deactivate Paper Check
```java
Hyperwallet.getDefault().deactivatePaperCheck("trm-fake-token", "deactivate Paper Check", listener);
// Code to handle successful response or error
// onSuccess: response (StatusTransition in this case) will contain information about the status transition
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure of Paper Check deactivation
```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ allprojects {
mavenLocal()
}

project.version = "1.0.0-beta08"
project.version = "1.0.0-beta09"
}

task clean(type: Delete) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,39 @@ public PaperCheck.Builder transferMethodCurrency(@NonNull String transferMethodC
return this;
}

public PaperCheck.Builder shippingMethod(@NonNull final String shippingMethod) {
mFields.put(TransferMethodFields.SHIPPING_METHOD, shippingMethod);
return this;
}

public PaperCheck.Builder addressLine1(@NonNull final String addressLine1) {
mFields.put(TransferMethodFields.ADDRESS_LINE_1, addressLine1);
return this;
}

public PaperCheck.Builder addressLine2(@NonNull final String addressLine2) {
mFields.put(TransferMethodFields.ADDRESS_LINE_2, addressLine2);
return this;
}

public PaperCheck.Builder city(@NonNull final String city) {
mFields.put(TransferMethodFields.CITY, city);
return this;
}
public PaperCheck.Builder postalCode(@NonNull final String postalCode) {
mFields.put(TransferMethodFields.POSTAL_CODE, postalCode);
return this;
}

public PaperCheck.Builder stateProvince(@NonNull final String stateProvince) {
mFields.put(TransferMethodFields.STATE_PROVINCE, stateProvince);
return this;
}
public PaperCheck.Builder country(@NonNull final String country) {
mFields.put(TransferMethodFields.COUNTRY, country);
return this;
}

public PaperCheck build() {
return new PaperCheck(mFields);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void testBuild_withRequiredParametersOnly() throws JSONException {
assertThat(headers.get("Content-Type"), is("application/json"));
assertThat(headers.get("User-Agent"), is("HyperwalletSDK/Android/" + BuildConfig.VERSION_NAME +
"; App: HyperwalletSDK; Android: " + Build.VERSION.RELEASE));
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta08"));
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta09"));
assertThat(headers.get("X-Sdk-Type"), is("android"));
assertThat(headers.get("X-Sdk-ContextId"), is(notNullValue()));
assertThat(headers.get("X-Sdk-ContextId"), is(contextId));
Expand Down Expand Up @@ -104,7 +104,7 @@ public void testBuild_withJsonModelOptionalParameter() throws JSONException {
assertThat(headers.get("Content-Type"), is("application/json"));
assertThat(headers.get("User-Agent"), is("HyperwalletSDK/Android/" + BuildConfig.VERSION_NAME +
"; App: HyperwalletSDK; Android: " + Build.VERSION.RELEASE));
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta08"));
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta09"));
assertThat(headers.get("X-Sdk-Type"), is("android"));
assertThat(headers.get("X-Sdk-ContextId"), is(notNullValue()));
assertThat(headers.get("X-Sdk-ContextId"), is(contextId));
Expand Down Expand Up @@ -140,7 +140,7 @@ public void testBuild_withQueryModelOptionalParameter() throws JSONException {
assertThat(headers.get("Content-Type"), is("application/json"));
assertThat(headers.get("User-Agent"), is("HyperwalletSDK/Android/" + BuildConfig.VERSION_NAME +
"; App: HyperwalletSDK; Android: " + Build.VERSION.RELEASE));
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta08"));
assertThat(headers.get("X-Sdk-Version"), is("1.0.0-beta09"));
assertThat(headers.get("X-Sdk-Type"), is("android"));
assertThat(headers.get("X-Sdk-ContextId"), is(notNullValue()));
assertThat(headers.get("X-Sdk-ContextId"), is(contextId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@

import okhttp3.mockwebserver.RecordedRequest;

import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.ADDRESS_LINE_1;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.ADDRESS_LINE_2;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.CITY;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.COUNTRY;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.CREATED_ON;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.POSTAL_CODE;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.SHIPPING_METHOD;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.STATE_PROVINCE;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.STATUS;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TOKEN;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TRANSFER_METHOD_COUNTRY;
Expand Down Expand Up @@ -70,9 +76,23 @@ public void testUpdatePaperCheck_withSuccess() throws InterruptedException {
final PaperCheck paperCheck = new PaperCheck
.Builder()
.token("trm-fake-token")
.shippingMethod("EXPEDITED")
.city("Victoria")
.postalCode("12345")
.addressLine1("123 Other Street")
.addressLine2("1234 AddressLineTwo St")
.stateProvince("CA")
.country("US")
.build();

assertThat(paperCheck.getField(TOKEN), is("trm-fake-token"));
assertThat(paperCheck.getField(SHIPPING_METHOD), is("EXPEDITED"));
assertThat(paperCheck.getField(CITY), is("Victoria"));
assertThat(paperCheck.getField(POSTAL_CODE), is("12345"));
assertThat(paperCheck.getField(ADDRESS_LINE_1),is("123 Other Street"));
assertThat(paperCheck.getField(ADDRESS_LINE_2),is("1234 AddressLineTwo St"));
assertThat(paperCheck.getField(STATE_PROVINCE),is("CA"));
assertThat(paperCheck.getField(COUNTRY),is("US"));

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

@Test
Expand All @@ -107,6 +133,7 @@ public void testUpdatePaperCheck_withValidationError() throws InterruptedExcepti
final PaperCheck paperCheck = new PaperCheck
.Builder()
.token("trm-fake-token")
.postalCode("1234")
.build();

assertThat(paperCheck.getField(TOKEN),
Expand Down Expand Up @@ -134,7 +161,7 @@ public void testUpdatePaperCheck_withValidationError() throws InterruptedExcepti

Error error1 = errors.getErrors().get(0);
assertThat(error1.getCode(), is("CONSTRAINT_VIOLATIONS"));
assertThat(error1.getFieldName(), is("phoneNumber"));
assertThat(error1.getMessage(), is("The number you provided is not valid!"));
assertThat(error1.getFieldName(), is("postalCode"));
assertThat(error1.getMessage(), is("Invalid Postal Code"));
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"errors": [
{
"message": "The number you provided is not valid!",
"fieldName": "phoneNumber",
"message": "Invalid Postal Code",
"fieldName": "postalCode",
"code": "CONSTRAINT_VIOLATIONS"
}

]
}

0 comments on commit 881a9a9

Please sign in to comment.