Skip to content

Commit 9805012

Browse files
authored
Tag/1.0.0 beta07 (#110)
* Added Venmo as a Transfer method * Added support for List Prepaid Card Balances * Enhancements
1 parent dbb3bd9 commit 9805012

File tree

71 files changed

+2654
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2654
-67
lines changed

CHANGELOG.md

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

4+
[1.0.0-beta07](https://github.com/hyperwallet/hyperwallet-android-sdk/releases/tag/1.0.0-beta07)
5+
-------------------
6+
* Added Venmo as a Transfer method
7+
* Added support for List Prepaid Card Balances
8+
* Enhancements
9+
410
[1.0.0-beta06](https://github.com/hyperwallet/hyperwallet-android-sdk/releases/tag/1.0.0-beta06)
511
-------------------
612
* Security updates

README.md

Lines changed: 61 additions & 1 deletion
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-beta06'
24+
api 'com.hyperwallet.android:core-sdk:1.0.0-beta07'
2525
```
2626

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

157+
### Create Venmo Account
158+
```java
159+
final VenmoAccount venmoAccount = new VenmoAccount.Builder()
160+
.transferMethodCountry("US")
161+
.transferMethodCurrency("USD")
162+
.accountId("9876543210")
163+
.build();
164+
165+
Hyperwallet.getDefault().createVenmoAccount(venmoAccount, listener);
166+
// onSuccess: response (VenmoAccount in this case) will contain information about the user’s Venmo account
167+
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
168+
```
169+
170+
### Get Venmo Account
171+
```java
172+
Hyperwallet.getDefault().getVenmoAccount("trm-fake-token", listener);
173+
// onSuccess: response (VenmoAccount in this case) will contain information about the user’s Venmo account or null if not exist.
174+
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
175+
```
176+
177+
### Update Venmo Account
178+
```java
179+
final VenmoAccount venmoAccount = new VenmoAccount
180+
.Builder()
181+
.accountId("9876543211")
182+
.token("trm-fake-token")
183+
.build();
184+
185+
Hyperwallet.getDefault().updateVenmoAccount(venmoAccount, mListener);
186+
// Code to handle successful response or error
187+
// onSuccess: response (VenmoAccount in this case) will contain information about the user’s Venmo account
188+
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure of Venmo account updating
189+
```
190+
191+
### Deactivate Venmo Account
192+
```java
193+
Hyperwallet.getDefault().deactivateVenmoAccount("trm-fake-token", "deactivate Venmo account", mListener);
194+
// Code to handle successful response or error
195+
// onSuccess: response (StatusTransition in this case) will contain information about the status transition
196+
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure of Venmo account deactivation
197+
```
198+
199+
### List Venmo Account
200+
```java
201+
VenmoAccountQueryParam queryParam = new VenmoAccountQueryParam.Builder().status(ACTIVATED).build();
202+
Hyperwallet.getDefault().listVenmoAccounts(queryParam, mListener);
203+
// onSuccess: response (PageList<VenmoAccount>) will contain a PageList of VenmoAccount or null if not exists
204+
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
205+
```
206+
157207
### Create Bank Account
158208
```java
159209
final BankAccount bankAccount = new BankAccount.Builder()
@@ -324,6 +374,16 @@ Hyperwallet.getDefault().listUserBalances(balanceQueryParam, listener);
324374
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
325375
```
326376

377+
### List Prepaid Card Balances
378+
```java
379+
PrepaidCardBalanceQueryParam prepaidCardBalanceQueryParam = new PrepaidCardBalanceQueryParam.Builder()
380+
.sortByCurrencyAsc()
381+
.build();
382+
Hyperwallet.getDefault().listPrepaidCardBalances("trm-12345", prepaidCardBalanceQueryParam, listener);
383+
// onSuccess: response (PageList<Balance>) will contain a PageList of Balance or null if not exists
384+
// onFailure: error (ErrorType) will contain Errors containing information about what caused the failure
385+
```
386+
327387
### Create Transfer
328388
```java
329389
final Transfer transfer = new Transfer.Builder()

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-beta06"
24+
project.version = "1.0.0-beta07"
2525
}
2626

2727
task clean(type: Delete) {

core/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ apply plugin: 'org.sonarqube'
55
apply from: "$projectDir/config/jacoco-settings.gradle"
66

77
android {
8-
compileSdkVersion 28
8+
compileSdkVersion 29
99
testOptions.unitTests.includeAndroidResources = true
1010
defaultConfig {
1111
minSdkVersion 21
12-
targetSdkVersion 28
12+
targetSdkVersion 29
1313
versionCode 3
1414
versionName version
1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -35,10 +35,10 @@ android {
3535

3636
dependencies {
3737

38-
implementation "androidx.appcompat:appcompat:1.0.2"
38+
implementation "androidx.appcompat:appcompat:1.2.0"
3939

40-
testImplementation "junit:junit:4.12"
41-
testImplementation "org.mockito:mockito-core:2.27.0"
40+
testImplementation "junit:junit:4.13"
41+
testImplementation "org.mockito:mockito-core:3.2.0"
4242
testImplementation "org.robolectric:robolectric:4.2"
4343
testImplementation "com.squareup.okhttp3:mockwebserver:3.11.0"
4444
testImplementation group: 'pl.pragmatists', name: 'JUnitParams', version: "1.1.1"

core/src/main/java/com/hyperwallet/android/Configuration.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public class Configuration {
5353
private static final String JWT_SEPARATOR = "\\.";
5454
private static final String JWT_SUB = "sub";
5555
private static final Long STALE_PERIOD = 30000L;
56+
private static final String PROGRAM_MODEL = "program-model";
5657

5758
private final String mAuthenticationToken;
5859
private long mCreatedOn;
@@ -64,6 +65,7 @@ public class Configuration {
6465
private long mExpireOnBootTime;
6566
private String mInsightApiUri;
6667
private String mEnvironment;
68+
private String mProgramModel;
6769

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

153+
/**
154+
* @return program model
155+
*/
156+
public String getProgramModel() {
157+
return mProgramModel;
158+
}
159+
151160
private void parseAuthenticationToken() throws JSONException {
152161
String[] authenticationTokenParts = mAuthenticationToken.split(JWT_SEPARATOR);
153162
if (authenticationTokenParts.length != 3) {
@@ -181,5 +190,6 @@ private void parsePayload(String payload) throws JSONException {
181190
mExpireOnBootTime = SystemClock.elapsedRealtime() + tokenLifespan;
182191
mEnvironment = jsonObject.optString(ENVIRONMENT);
183192
mInsightApiUri = jsonObject.optString(INSIGHT_API_URI);
193+
mProgramModel = jsonObject.optString(PROGRAM_MODEL);
184194
}
185195
}

core/src/main/java/com/hyperwallet/android/HttpTransaction.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.io.IOException;
3434
import java.lang.reflect.InvocationTargetException;
3535
import java.util.HashMap;
36+
import java.util.Locale;
3637
import java.util.Map;
3738

3839
/**
@@ -48,6 +49,12 @@ public abstract class HttpTransaction implements Runnable {
4849
private static final String HTTP_HEADER_CONTENT_TYPE_KEY = "Content-Type";
4950
private static final String HTTP_HEADER_USER_AGENT_KEY = "User-Agent";
5051
private static final String HTTP_HEADER_USER_AGENT = "HyperwalletSDK/Android/%s; App: HyperwalletSDK; Android: %s";
52+
private static final String HTTP_HEADER_ACCEPT_LANGUAGE_KEY = "Accept-Language";
53+
private static final String HTTP_HEADER_X_SDK_VERSION_KEY = "X-Sdk-Version";
54+
private static final String HTTP_HEADER_X_SDK_TYPE_KEY = "X-Sdk-Type";
55+
protected static final String HTTP_HEADER_X_SDK_CONTEXTID_KEY = "X-Sdk-ContextId";
56+
private static final String HTTP_HEADER_X_SDK_TYPE = "android";
57+
5158
private Map<String, String> mHeaderMap;
5259
private HyperwalletListener mListener;
5360
private HttpMethod mMethod;
@@ -78,6 +85,9 @@ public HttpTransaction(@NonNull final HttpMethod httpMethod, @NonNull final Stri
7885
addHeader(HTTP_HEADER_ACCEPT_KEY, APPLICATION_JSON);
7986
addHeader(HTTP_HEADER_CONTENT_TYPE_KEY, APPLICATION_JSON);
8087
addHeader(HTTP_HEADER_USER_AGENT_KEY, getUserAgent());
88+
addHeader(HTTP_HEADER_ACCEPT_LANGUAGE_KEY, Locale.getDefault().toLanguageTag());
89+
addHeader(HTTP_HEADER_X_SDK_VERSION_KEY, BuildConfig.VERSION_NAME);
90+
addHeader(HTTP_HEADER_X_SDK_TYPE_KEY, HTTP_HEADER_X_SDK_TYPE);
8191
}
8292

8393
/**

0 commit comments

Comments
 (0)