Skip to content

Commit

Permalink
Tag/1.0.0 beta07 (#110)
Browse files Browse the repository at this point in the history
* Added Venmo as a Transfer method
* Added support for List Prepaid Card Balances
* Enhancements
  • Loading branch information
vwagh-hw authored Nov 24, 2020
1 parent dbb3bd9 commit 9805012
Show file tree
Hide file tree
Showing 71 changed files with 2,654 additions and 67 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

[1.0.0-beta07](https://github.com/hyperwallet/hyperwallet-android-sdk/releases/tag/1.0.0-beta07)
-------------------
* Added Venmo as a Transfer method
* Added support for List Prepaid Card Balances
* Enhancements

[1.0.0-beta06](https://github.com/hyperwallet/hyperwallet-android-sdk/releases/tag/1.0.0-beta06)
-------------------
* Security updates
Expand Down
62 changes: 61 additions & 1 deletion 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-beta06'
api 'com.hyperwallet.android:core-sdk:1.0.0-beta07'
```

### Proguard
Expand Down Expand Up @@ -154,6 +154,56 @@ Hyperwallet.getDefault().listPayPalAccounts(payPalAccountQueryParam, listener);
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
```

### Create Venmo Account
```java
final VenmoAccount venmoAccount = new VenmoAccount.Builder()
.transferMethodCountry("US")
.transferMethodCurrency("USD")
.accountId("9876543210")
.build();

Hyperwallet.getDefault().createVenmoAccount(venmoAccount, listener);
// 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
```

### Get Venmo Account
```java
Hyperwallet.getDefault().getVenmoAccount("trm-fake-token", listener);
// onSuccess: response (VenmoAccount in this case) will contain information about the user’s Venmo account or null if not exist.
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
```

### Update Venmo Account
```java
final VenmoAccount venmoAccount = new VenmoAccount
.Builder()
.accountId("9876543211")
.token("trm-fake-token")
.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
```

### List Venmo Account
```java
VenmoAccountQueryParam queryParam = new VenmoAccountQueryParam.Builder().status(ACTIVATED).build();
Hyperwallet.getDefault().listVenmoAccounts(queryParam, mListener);
// onSuccess: response (PageList<VenmoAccount>) will contain a PageList of VenmoAccount or null if not exists
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
```

### Create Bank Account
```java
final BankAccount bankAccount = new BankAccount.Builder()
Expand Down Expand Up @@ -324,6 +374,16 @@ Hyperwallet.getDefault().listUserBalances(balanceQueryParam, listener);
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
```

### List Prepaid Card Balances
```java
PrepaidCardBalanceQueryParam prepaidCardBalanceQueryParam = new PrepaidCardBalanceQueryParam.Builder()
.sortByCurrencyAsc()
.build();
Hyperwallet.getDefault().listPrepaidCardBalances("trm-12345", prepaidCardBalanceQueryParam, listener);
// onSuccess: response (PageList<Balance>) will contain a PageList of Balance or null if not exists
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
```

### Create Transfer
```java
final Transfer transfer = new Transfer.Builder()
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-beta06"
project.version = "1.0.0-beta07"
}

task clean(type: Delete) {
Expand Down
10 changes: 5 additions & 5 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ apply plugin: 'org.sonarqube'
apply from: "$projectDir/config/jacoco-settings.gradle"

android {
compileSdkVersion 28
compileSdkVersion 29
testOptions.unitTests.includeAndroidResources = true
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
versionCode 3
versionName version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -35,10 +35,10 @@ android {

dependencies {

implementation "androidx.appcompat:appcompat:1.0.2"
implementation "androidx.appcompat:appcompat:1.2.0"

testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-core:2.27.0"
testImplementation "junit:junit:4.13"
testImplementation "org.mockito:mockito-core:3.2.0"
testImplementation "org.robolectric:robolectric:4.2"
testImplementation "com.squareup.okhttp3:mockwebserver:3.11.0"
testImplementation group: 'pl.pragmatists', name: 'JUnitParams', version: "1.1.1"
Expand Down
10 changes: 10 additions & 0 deletions core/src/main/java/com/hyperwallet/android/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class Configuration {
private static final String JWT_SEPARATOR = "\\.";
private static final String JWT_SUB = "sub";
private static final Long STALE_PERIOD = 30000L;
private static final String PROGRAM_MODEL = "program-model";

private final String mAuthenticationToken;
private long mCreatedOn;
Expand All @@ -64,6 +65,7 @@ public class Configuration {
private long mExpireOnBootTime;
private String mInsightApiUri;
private String mEnvironment;
private String mProgramModel;

/**
* Construct {@Configuration} with Authentication token specified
Expand Down Expand Up @@ -148,6 +150,13 @@ public boolean isStale() {
return SystemClock.elapsedRealtime() >= mExpireOnBootTime - STALE_PERIOD;
}

/**
* @return program model
*/
public String getProgramModel() {
return mProgramModel;
}

private void parseAuthenticationToken() throws JSONException {
String[] authenticationTokenParts = mAuthenticationToken.split(JWT_SEPARATOR);
if (authenticationTokenParts.length != 3) {
Expand Down Expand Up @@ -181,5 +190,6 @@ private void parsePayload(String payload) throws JSONException {
mExpireOnBootTime = SystemClock.elapsedRealtime() + tokenLifespan;
mEnvironment = jsonObject.optString(ENVIRONMENT);
mInsightApiUri = jsonObject.optString(INSIGHT_API_URI);
mProgramModel = jsonObject.optString(PROGRAM_MODEL);
}
}
10 changes: 10 additions & 0 deletions core/src/main/java/com/hyperwallet/android/HttpTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

/**
Expand All @@ -48,6 +49,12 @@ public abstract class HttpTransaction implements Runnable {
private static final String HTTP_HEADER_CONTENT_TYPE_KEY = "Content-Type";
private static final String HTTP_HEADER_USER_AGENT_KEY = "User-Agent";
private static final String HTTP_HEADER_USER_AGENT = "HyperwalletSDK/Android/%s; App: HyperwalletSDK; Android: %s";
private static final String HTTP_HEADER_ACCEPT_LANGUAGE_KEY = "Accept-Language";
private static final String HTTP_HEADER_X_SDK_VERSION_KEY = "X-Sdk-Version";
private static final String HTTP_HEADER_X_SDK_TYPE_KEY = "X-Sdk-Type";
protected static final String HTTP_HEADER_X_SDK_CONTEXTID_KEY = "X-Sdk-ContextId";
private static final String HTTP_HEADER_X_SDK_TYPE = "android";

private Map<String, String> mHeaderMap;
private HyperwalletListener mListener;
private HttpMethod mMethod;
Expand Down Expand Up @@ -78,6 +85,9 @@ public HttpTransaction(@NonNull final HttpMethod httpMethod, @NonNull final Stri
addHeader(HTTP_HEADER_ACCEPT_KEY, APPLICATION_JSON);
addHeader(HTTP_HEADER_CONTENT_TYPE_KEY, APPLICATION_JSON);
addHeader(HTTP_HEADER_USER_AGENT_KEY, getUserAgent());
addHeader(HTTP_HEADER_ACCEPT_LANGUAGE_KEY, Locale.getDefault().toLanguageTag());
addHeader(HTTP_HEADER_X_SDK_VERSION_KEY, BuildConfig.VERSION_NAME);
addHeader(HTTP_HEADER_X_SDK_TYPE_KEY, HTTP_HEADER_X_SDK_TYPE);
}

/**
Expand Down
Loading

0 comments on commit 9805012

Please sign in to comment.