Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f102ef4
HW-51710: Get user details in the core sdk
vshcherbyna-epam May 2, 2019
318f038
add tests
vshcherbyna-epam May 3, 2019
b729f16
add tests for Hyperwallet
vshcherbyna-epam May 3, 2019
a0e0bd5
fix code coverage test
vshcherbyna-epam May 3, 2019
de34a81
remove toke parameter from the Hyperwallet.getUser(...)
vshcherbyna-epam May 3, 2019
2199e6d
HW-51227: Core Paypal Account (#10)
May 6, 2019
3710069
HW-51227: Core Paypal Account (#10)
May 6, 2019
be609bd
HW-51710: Get user details in the core sdk
vshcherbyna-epam May 2, 2019
95faa32
fix getUser
vshcherbyna-epam May 7, 2019
01dbb07
address callouts
vshcherbyna-epam May 7, 2019
960665b
fix code coverage test
vshcherbyna-epam May 7, 2019
9c2ea3b
HW-51227: Core Paypal Account (#10)
May 6, 2019
9d6fd6e
add tests for Hyperwallet
vshcherbyna-epam May 3, 2019
09afecc
HW-51227: Core Paypal Account (#10)
May 6, 2019
b5e28f2
HW-51710 remove duplicate imports and tests
fmattos-hw May 8, 2019
dc5214f
HW-51710 fix imports
fmattos-hw May 8, 2019
8375ad9
HW-51710: Get user details in the core sdk
vshcherbyna-epam May 2, 2019
8b708b8
add tests
vshcherbyna-epam May 3, 2019
e252a0a
add tests for Hyperwallet
vshcherbyna-epam May 3, 2019
f4543f7
fix code coverage test
vshcherbyna-epam May 3, 2019
0849e29
remove toke parameter from the Hyperwallet.getUser(...)
vshcherbyna-epam May 3, 2019
400f5e0
HW-51227: Core Paypal Account (#10)
May 6, 2019
ed58dc8
HW-51710: Get user details in the core sdk
vshcherbyna-epam May 2, 2019
e22c21f
fix getUser
vshcherbyna-epam May 7, 2019
f896c6b
address callouts
vshcherbyna-epam May 7, 2019
202cf18
fix code coverage test
vshcherbyna-epam May 7, 2019
d26fe31
HW-51227: Core Paypal Account (#10)
May 6, 2019
c4fd3da
add tests for Hyperwallet
vshcherbyna-epam May 3, 2019
a9ce857
HW-51227: Core Paypal Account (#10)
May 6, 2019
985bcd6
HW-51710 remove duplicate imports and tests
fmattos-hw May 8, 2019
696b82c
HW-51710 fix imports
fmattos-hw May 8, 2019
fa7a71d
Merge branch 'feature/HW-51710_Get_user_details_in_the_core_sdk' of h…
fmattos-hw May 8, 2019
5add744
HW-51710 optmizing imports
fmattos-hw May 8, 2019
253b3b9
HW-51710 increasing test coverage
fmattos-hw May 8, 2019
1ec9ef1
HW-51710 increase test coverage
fmattos-hw May 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 188 additions & 17 deletions core/src/main/java/com/hyperwallet/android/Hyperwallet.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@

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

import androidx.annotation.NonNull;

import com.hyperwallet.android.util.DateUtil;

import java.util.Date;
import java.util.Map;

/**
* Represents the bank card pagination fields
*/
public class HyperwalletBankCardPagination extends HyperwalletTransferMethodPagination {

protected static final String TRANSFER_METHOD_CREATE_ON = "createdOn";

private Date mCreatedOn;

/**
* Constructors the bank card pagination
*/
Expand All @@ -41,6 +50,21 @@ public HyperwalletBankCardPagination() {
*/
public HyperwalletBankCardPagination(Map<String, String> urlQueryMap) {
super(urlQueryMap);
mCreatedOn = getDateValueBy(urlQueryMap, TRANSFER_METHOD_CREATE_ON);
setType(BANK_CARD);
}

public Date getCreatedOn() {
return mCreatedOn;
}

@NonNull
@Override
public Map<String, String> buildQuery() {
Map<String, String> query = super.buildQuery();
if (mCreatedOn != null) {
query.put(TRANSFER_METHOD_CREATE_ON, DateUtil.toDateTimeFormat(mCreatedOn));
}
return query;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright 2018 Hyperwallet
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.hyperwallet.android.model;

import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.PAYPAL_ACCOUNT;

import androidx.annotation.NonNull;

import com.hyperwallet.android.util.DateUtil;

import java.util.Date;
import java.util.Map;

/**
* Represents the PayPal Account pagination fields
*/
public class HyperwalletPayPalAccountPagination extends HyperwalletTransferMethodPagination {

protected static final String TRANSFER_METHOD_CREATE_ON = "createdOn";

private Date mCreatedOn;

/**
* Constructs the default implementation of the PayPal Account pagination.
*/
public HyperwalletPayPalAccountPagination() {
super();
setType(PAYPAL_ACCOUNT);
}

/**
* Constructs the PayPal Account pagination based in the preview request with extra parameters.
*
* @param urlQueryMap the map with properties to build the pagination
*/
public HyperwalletPayPalAccountPagination(Map<String, String> urlQueryMap) {
super(urlQueryMap);
mCreatedOn = getDateValueBy(urlQueryMap, TRANSFER_METHOD_CREATE_ON);
setType(PAYPAL_ACCOUNT);
}

public Date getCreatedOn() {
return mCreatedOn;
}

@NonNull
@Override
public Map<String, String> buildQuery() {
Map<String, String> query = super.buildQuery();
if (mCreatedOn != null) {
query.put(TRANSFER_METHOD_CREATE_ON, DateUtil.toDateTimeFormat(mCreatedOn));
}
return query;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public final class TransferMethodTypes {
public static final String PAPER_CHECK = "PAPER_CHECK";
public static final String PREPAID_CARD = "PREPAID_CARD";
public static final String WIRE_ACCOUNT = "WIRE_ACCOUNT";
public static final String PAYPAL_ACCOUNT = "PAYPAL_ACCOUNT";
}

@Retention(RetentionPolicy.SOURCE)
Expand Down Expand Up @@ -106,7 +107,8 @@ public final class TransferMethodTypes {
TransferMethodFields.CARD_NUMBER,
TransferMethodFields.CARD_TYPE,
TransferMethodFields.DATE_OF_EXPIRY,
TransferMethodFields.CVV
TransferMethodFields.CVV,
TransferMethodFields.EMAIL
})
public @interface TransferMethodFieldKey {
}
Expand Down Expand Up @@ -140,6 +142,7 @@ public final class TransferMethodFields {
public static final String PHONE_NUMBER = "phoneNumber";
public static final String POSTAL_CODE = "postalCode";
public static final String STATE_PROVINCE = "stateProvince";
public static final String EMAIL = "email";

// bank account field keys
public static final String BANK_ACCOUNT_ID = "bankAccountId";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static com.hyperwallet.android.model.HyperwalletStatusTransition.StatusDefinition.VERIFIED;
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.BANK_ACCOUNT;
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.BANK_CARD;
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.PAYPAL_ACCOUNT;
import static com.hyperwallet.android.model.HyperwalletTransferMethod.TransferMethodTypes.WIRE_ACCOUNT;
import static com.hyperwallet.android.util.DateUtil.fromDateTimeString;

Expand Down Expand Up @@ -58,7 +59,8 @@ public class HyperwalletTransferMethodPagination extends HyperwalletPagination {
@StringDef({
BANK_ACCOUNT,
WIRE_ACCOUNT,
BANK_CARD
BANK_CARD,
PAYPAL_ACCOUNT
})
public @interface TransferMethodTypeQuery {
}
Expand Down Expand Up @@ -128,7 +130,7 @@ public HyperwalletTransferMethodPagination(@NonNull Map<String, String> urlQuery
* @return the valid Date value or null
*/
@Nullable
private Date getDateValueBy(@NonNull Map<String, String> urlQueryMap, @NonNull String queryKey) {
Date getDateValueBy(@NonNull Map<String, String> urlQueryMap, @NonNull String queryKey) {
if (containsKeyAndHasValue(urlQueryMap, queryKey)) {
return fromDateTimeString(urlQueryMap.get(queryKey));
}
Expand Down
Loading