Skip to content

Commit 19ab0dd

Browse files
authored
Commit for release 1.0.0-beta02 (#23)
This commit contains the following functionality: - Added PayPal as a Transfer method - Added support to get User object
1 parent 803870f commit 19ab0dd

32 files changed

+2870
-34
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@ Changelog
77
* Create Bank Account and Bank Card for United States (USD)
88
* Retrieve field requirements for bank Accounts and Bank Cards
99
* List Accounts
10-
* Deactivate (Remove) Accounts
10+
* Deactivate (Remove) Accounts
11+
12+
1.0.0-beta02
13+
-------------------
14+
* Added PayPal as a Transfer method
15+
* Added support to get User object

README.md

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

1919
```bash
20-
api 'com.hyperwallet.android:core-sdk:1.0.0-beta01'
20+
api 'com.hyperwallet.android:core-sdk:1.0.0-beta02'
2121
```
2222

2323
## Initialization

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-beta01";
24+
project.version = "1.0.0-beta02-SNAPSHOT";
2525
}
2626

2727
task clean(type: Delete) {

core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ publishing {
151151

152152
tasks.withType(Sign) {
153153
onlyIf {
154-
isReleaseVersion
154+
isReleaseVersion && !gradle.taskGraph.hasTask("publishToMavenLocal")
155155
}
156156
}
157157

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

Lines changed: 188 additions & 17 deletions
Large diffs are not rendered by default.

core/src/main/java/com/hyperwallet/android/model/HyperwalletBankCardPagination.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,22 @@
1919

2020
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.BANK_CARD;
2121

22+
import androidx.annotation.NonNull;
23+
24+
import com.hyperwallet.android.util.DateUtil;
25+
26+
import java.util.Date;
2227
import java.util.Map;
2328

2429
/**
2530
* Represents the bank card pagination fields
2631
*/
2732
public class HyperwalletBankCardPagination extends HyperwalletTransferMethodPagination {
2833

34+
protected static final String TRANSFER_METHOD_CREATE_ON = "createdOn";
35+
36+
private Date mCreatedOn;
37+
2938
/**
3039
* Constructors the bank card pagination
3140
*/
@@ -41,6 +50,21 @@ public HyperwalletBankCardPagination() {
4150
*/
4251
public HyperwalletBankCardPagination(Map<String, String> urlQueryMap) {
4352
super(urlQueryMap);
53+
mCreatedOn = getDateValueBy(urlQueryMap, TRANSFER_METHOD_CREATE_ON);
4454
setType(BANK_CARD);
4555
}
56+
57+
public Date getCreatedOn() {
58+
return mCreatedOn;
59+
}
60+
61+
@NonNull
62+
@Override
63+
public Map<String, String> buildQuery() {
64+
Map<String, String> query = super.buildQuery();
65+
if (mCreatedOn != null) {
66+
query.put(TRANSFER_METHOD_CREATE_ON, DateUtil.toDateTimeFormat(mCreatedOn));
67+
}
68+
return query;
69+
}
4670
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright 2018 Hyperwallet
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
6+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
7+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8+
*
9+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
10+
* the Software.
11+
*
12+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
13+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
15+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16+
* THE SOFTWARE.
17+
*/
18+
package com.hyperwallet.android.model;
19+
20+
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.PAYPAL_ACCOUNT;
21+
22+
import androidx.annotation.NonNull;
23+
24+
import com.hyperwallet.android.util.DateUtil;
25+
26+
import java.util.Date;
27+
import java.util.Map;
28+
29+
/**
30+
* Represents the PayPal Account pagination fields
31+
*/
32+
public class HyperwalletPayPalAccountPagination extends HyperwalletTransferMethodPagination {
33+
34+
protected static final String TRANSFER_METHOD_CREATE_ON = "createdOn";
35+
36+
private Date mCreatedOn;
37+
38+
/**
39+
* Constructs the default implementation of the PayPal Account pagination.
40+
*/
41+
public HyperwalletPayPalAccountPagination() {
42+
super();
43+
setType(PAYPAL_ACCOUNT);
44+
}
45+
46+
/**
47+
* Constructs the PayPal Account pagination based in the preview request with extra parameters.
48+
*
49+
* @param urlQueryMap the map with properties to build the pagination
50+
*/
51+
public HyperwalletPayPalAccountPagination(Map<String, String> urlQueryMap) {
52+
super(urlQueryMap);
53+
mCreatedOn = getDateValueBy(urlQueryMap, TRANSFER_METHOD_CREATE_ON);
54+
setType(PAYPAL_ACCOUNT);
55+
}
56+
57+
public Date getCreatedOn() {
58+
return mCreatedOn;
59+
}
60+
61+
@NonNull
62+
@Override
63+
public Map<String, String> buildQuery() {
64+
Map<String, String> query = super.buildQuery();
65+
if (mCreatedOn != null) {
66+
query.put(TRANSFER_METHOD_CREATE_ON, DateUtil.toDateTimeFormat(mCreatedOn));
67+
}
68+
return query;
69+
}
70+
}

core/src/main/java/com/hyperwallet/android/model/HyperwalletTransferMethod.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public final class TransferMethodTypes {
5858
public static final String PAPER_CHECK = "PAPER_CHECK";
5959
public static final String PREPAID_CARD = "PREPAID_CARD";
6060
public static final String WIRE_ACCOUNT = "WIRE_ACCOUNT";
61+
public static final String PAYPAL_ACCOUNT = "PAYPAL_ACCOUNT";
6162
}
6263

6364
@Retention(RetentionPolicy.SOURCE)
@@ -106,7 +107,8 @@ public final class TransferMethodTypes {
106107
TransferMethodFields.CARD_NUMBER,
107108
TransferMethodFields.CARD_TYPE,
108109
TransferMethodFields.DATE_OF_EXPIRY,
109-
TransferMethodFields.CVV
110+
TransferMethodFields.CVV,
111+
TransferMethodFields.EMAIL
110112
})
111113
public @interface TransferMethodFieldKey {
112114
}
@@ -140,6 +142,7 @@ public final class TransferMethodFields {
140142
public static final String PHONE_NUMBER = "phoneNumber";
141143
public static final String POSTAL_CODE = "postalCode";
142144
public static final String STATE_PROVINCE = "stateProvince";
145+
public static final String EMAIL = "email";
143146

144147
// bank account field keys
145148
public static final String BANK_ACCOUNT_ID = "bankAccountId";

core/src/main/java/com/hyperwallet/android/model/HyperwalletTransferMethodPagination.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static com.hyperwallet.android.model.HyperwalletStatusTransition.StatusDefinition.VERIFIED;
2424
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.BANK_ACCOUNT;
2525
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.BANK_CARD;
26+
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.PAYPAL_ACCOUNT;
2627
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.WIRE_ACCOUNT;
2728
import static com.hyperwallet.android.util.DateUtil.fromDateTimeString;
2829

@@ -58,7 +59,8 @@ public class HyperwalletTransferMethodPagination extends HyperwalletPagination {
5859
@StringDef({
5960
BANK_ACCOUNT,
6061
WIRE_ACCOUNT,
61-
BANK_CARD
62+
BANK_CARD,
63+
PAYPAL_ACCOUNT
6264
})
6365
public @interface TransferMethodTypeQuery {
6466
}
@@ -128,7 +130,7 @@ public HyperwalletTransferMethodPagination(@NonNull Map<String, String> urlQuery
128130
* @return the valid Date value or null
129131
*/
130132
@Nullable
131-
private Date getDateValueBy(@NonNull Map<String, String> urlQueryMap, @NonNull String queryKey) {
133+
Date getDateValueBy(@NonNull Map<String, String> urlQueryMap, @NonNull String queryKey) {
132134
if (containsKeyAndHasValue(urlQueryMap, queryKey)) {
133135
return fromDateTimeString(urlQueryMap.get(queryKey));
134136
}

0 commit comments

Comments
 (0)