Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0856dce
DTSERWFOUR -210 - Update transfer method information
shanavas123 Dec 11, 2020
7164398
Merge branches 'development' and 'task/DTSERWFOUR-210-Update-transfer…
shanavas123 Dec 11, 2020
747f462
DTSERWFOUR-210- added Unit test
shanavas123 Dec 14, 2020
a2f888c
DTSERWFOUR-210- update widget
shanavas123 Dec 14, 2020
2a4ff31
DTSERWFOUR-210- update UI-SDK-Repo
shanavas123 Dec 15, 2020
0c2e207
DTSERWFOUR-211 - Fetch transfer method information and display for ed…
rajkumar-balakrishnasamy Dec 15, 2020
26b4d97
update unit Test causes
shanavas123 Dec 15, 2020
dc97fae
DTSERWFOUR-211 - Updated the code.
rajkumar-balakrishnasamy Dec 15, 2020
902131d
update unit Test causes
shanavas123 Dec 15, 2020
e4fac80
update failed unit Test causes
shanavas123 Dec 15, 2020
67ff592
update api call for Update
shanavas123 Dec 16, 2020
2beb5ab
DTSERWFOUR-211 - Handled the update code for edit.
rajkumar-balakrishnasamy Dec 16, 2020
a1d3ce2
Merge branches 'task/DTSERWFOUR-210-Update-transfer-method-informatio…
rajkumar-balakrishnasamy Dec 16, 2020
11b7cc4
DTSERWFOUR-211 - Fixed minor Bugs.
rajkumar-balakrishnasamy Dec 16, 2020
c7be689
fixed failed test causes
shanavas123 Dec 16, 2020
496bc45
Update widget
shanavas123 Dec 16, 2020
8a21a16
Merge branches 'task/DTSERWFOUR-210-Update-transfer-method-informatio…
rajkumar-balakrishnasamy Dec 16, 2020
e915669
DTSERWFOUR-211 - Resolved the merge conflicts
rajkumar-balakrishnasamy Dec 16, 2020
2cdd65d
Update widget for masked field
shanavas123 Dec 16, 2020
39df7ff
DTSERWFOUR-211 - Fixed the Debit card number display issue.
rajkumar-balakrishnasamy Dec 16, 2020
ae36f5a
DTSERWFOUR-211 - Fixed the Expiry Date display issue.
rajkumar-balakrishnasamy Dec 16, 2020
289413a
DTSERWFOUR-212 - Add edit button in the transfer methods list.
rajkumar-balakrishnasamy Dec 16, 2020
6bd0304
Address review comments.
shanavas123 Dec 17, 2020
caff0b6
Address review comments.
shanavas123 Dec 17, 2020
a960416
Merge branches 'task/DTSERWFOUR-210-Update-transfer-method-informatio…
rajkumar-balakrishnasamy Dec 17, 2020
af997fc
DTSERWFOUR-212 - Fixed the observations.
rajkumar-balakrishnasamy Dec 17, 2020
c0c7efc
Merge branches 'task/DTSERWFOUR-211-Fetch-transfer-method-information…
rajkumar-balakrishnasamy Dec 17, 2020
6ea82b2
DTSERWFOUR-212 - Fixed the observations.
rajkumar-balakrishnasamy Dec 18, 2020
c6fc668
Fixed blocking API call if no changes in edit.
shanavas123 Dec 18, 2020
a97267d
Implemented new class file to update transfer methods(Update Bank Acc…
ShravanKumarSidigum Dec 18, 2020
292f4c1
DTSERWFOUR-212 - Fixed the key listener observation.
rajkumar-balakrishnasamy Dec 18, 2020
eaf8154
Updated widget
shanavas123 Dec 18, 2020
dffda54
Merge branch 'development' into task/DTSERWFOUR-210-Update-transfer-m…
shanavas123 Dec 18, 2020
7d08f10
DTSERWFOUR-212 - Add edit button in the transfer methods list. (#227)
rajkumar-balakrishnasamy Dec 18, 2020
21a5ea7
DTSERWFOUR-211 - Fetch transfer method information and display for ed…
rajkumar-balakrishnasamy Dec 18, 2020
b261e28
Addressed review comments.
shanavas123 Dec 21, 2020
f63285a
Addressed review comments.
shanavas123 Dec 21, 2020
7eb078b
DTSERWFOUR-212 - Fixed test cases.
rajkumar-balakrishnasamy Dec 21, 2020
3ab0ebe
Merge branches 'task/DTSERWFOUR-210-Update-transfer-method-informatio…
rajkumar-balakrishnasamy Dec 21, 2020
303443a
Merge branch 'task/DTSERWFOUR-212-Update-listTransferMethod-edit-func…
rajkumar-balakrishnasamy Dec 21, 2020
f67df34
DTSERWFOUR-212 - Updated test cases.
rajkumar-balakrishnasamy Dec 21, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ private HyperwalletIntent() {
*/
public static final short SELECT_TRANSFER_SOURCE_REQUEST_CODE = 104;

/**
* Update Transfer method request code
*/
public static final short UPDATE_TRANSFER_METHOD_REQUEST_CODE = 105;

/**
* SDK Broadcast payload error
*/
Expand All @@ -81,5 +86,10 @@ private HyperwalletIntent() {
*/
public static final String EXTRA_TRANSFER_METHOD_ADDED = "EXTRA_TRANSFER_METHOD_ADDED";

/**
* Transfer method updated, extra activity parcelable transfer method payload
*/
public static final String EXTRA_TRANSFER_METHOD_UPDATED = "EXTRA_TRANSFER_METHOD_UPDATED";


}
12 changes: 12 additions & 0 deletions commonui/src/main/res/drawable/ic_edit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M16.8989,6.774L17.3578,6.1161C17.3741,6.0928 17.3919,6.0713 17.4111,6.0517C17.791,5.4347 17.628,4.6199 17.0264,4.198C16.5253,3.8469 15.8569,3.8701 15.3822,4.2424C15.1649,4.4128 14.8506,4.3748 14.6802,4.1575C14.5098,3.9402 14.5478,3.6259 14.7651,3.4555C15.5839,2.8134 16.7358,2.7733 17.6005,3.3792C18.6768,4.1341 18.9386,5.6184 18.1847,6.6947C18.166,6.7213 18.1453,6.7455 18.1229,6.7673L15.8996,9.9546C15.7415,10.1814 15.4292,10.2368 15.2027,10.0782L12.5123,8.1943L6.8039,16.3267L6.2983,19.5628L9.0893,17.964L13.8453,11.3236C14.0061,11.0991 14.3184,11.0475 14.5429,11.2082C14.7674,11.369 14.819,11.6814 14.6583,11.9059L9.8388,18.6349L9.6809,18.7776L5.8922,20.948C5.5283,21.1564 5.0849,20.8513 5.1496,20.4369L5.8339,16.0575C5.8457,15.9819 5.8747,15.91 5.9186,15.8474L13.5194,5.0189C13.6778,4.7931 13.9892,4.7384 14.2152,4.8965L16.8989,6.774L16.8989,6.774ZM16.3268,7.5942L14.051,6.002L13.0868,7.3758L15.366,8.9717L16.3268,7.5942L16.3268,7.5942Z"
android:strokeWidth="1"
android:fillColor="#2C2E2F"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
</vector>
28 changes: 10 additions & 18 deletions commonui/src/main/res/drawable/ic_trash.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="19dp"
android:viewportWidth="17"
android:viewportHeight="19">
<path
android:pathData="M6.1332,3.6868L10.3684,3.6868L10.3684,2.6284L6.1332,2.6284L6.1332,3.6868ZM15.3208,3.6872L12.1408,3.6872C12.1416,3.6652 12.1444,3.6436 12.1444,3.6208L12.1444,2.9808C12.1444,1.8168 11.1908,0.8636 10.0268,0.8636L6.4972,0.8636C5.3324,0.8636 4.3796,1.8168 4.3796,2.9808L4.3796,3.6208C4.3796,3.6436 4.3824,3.6652 4.3832,3.6872L1.2032,3.6872C0.6208,3.6872 0.1448,4.1636 0.1448,4.7456L0.1448,5.804C0.1448,6.3868 0.6208,6.8632 1.2032,6.8632L1.5564,6.8632L1.5564,6.1568L14.968,6.1568L14.968,6.8632L15.3212,6.8632C15.9032,6.8632 16.3796,6.3868 16.3796,5.804L16.3796,4.7456C16.3792,4.1636 15.9028,3.6872 15.3208,3.6872L15.3208,3.6872Z"
android:strokeWidth="1"
android:fillAlpha="0.53999996"
android:fillColor="#000000"
android:fillType="evenOdd"
android:strokeColor="#00000000" />
<path
android:pathData="M12.1442,16.5692C12.1442,16.7636 11.985,16.9224 11.7906,16.9224L11.085,16.9224C10.8906,16.9224 10.7322,16.764 10.7322,16.5692L10.7322,9.5108C10.7322,9.3172 10.8902,9.1576 11.085,9.1576L11.7906,9.1576C11.9846,9.1576 12.1442,9.3168 12.1442,9.5108L12.1442,16.5692ZM8.9678,16.5692C8.9678,16.7636 8.8086,16.9224 8.615,16.9224L7.9086,16.9224C7.7146,16.9224 7.5558,16.764 7.5558,16.5692L7.5558,9.5108C7.5558,9.3172 7.7142,9.1576 7.9086,9.1576L8.615,9.1576C8.8078,9.1576 8.9678,9.3168 8.9678,9.5108L8.9678,16.5692ZM5.7914,16.5692C5.7914,16.7636 5.6326,16.9224 5.4386,16.9224L4.7326,16.9224C4.5382,16.9224 4.3794,16.764 4.3794,16.5692L4.3794,9.5108C4.3794,9.3172 4.5374,9.1576 4.7326,9.1576L5.4386,9.1576C5.6322,9.1576 5.7914,9.3168 5.7914,9.5108L5.7914,16.5692ZM2.2614,7.2168L2.2614,17.8044C2.2614,18.3872 2.7374,18.8636 3.3202,18.8636L13.2026,18.8636C13.785,18.8636 14.2614,18.3872 14.2614,17.8044L14.2614,7.2168L2.2614,7.2168Z"
android:strokeWidth="1"
android:fillAlpha="0.53999996"
android:fillColor="#000000"
android:fillType="evenOdd"
android:strokeColor="#00000000" />
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M14.8246,5L14.3912,3.1781C14.3756,3.0844 14.285,3 14.2544,3L10.2019,3C10.1591,3 10.0422,3.1006 10.0278,3.1827L10.0233,3.2048L9.6236,5L14.8246,5ZM14.2544,2C14.7951,2 15.285,2.4565 15.3708,2.9802L15.852,5L19.5,5C19.7761,5 20,5.2239 20,5.5C20,5.7761 19.7761,6 19.5,6L18.386,6L17.5517,19.7573C17.5065,20.5549 16.752,21 15.8789,21L11.958,20.972L8.0378,21C7.1647,21 6.4102,20.5549 6.365,19.7573L5.529,6L4.5,6C4.2239,6 4,5.7761 4,5.5C4,5.2239 4.2239,5 4.5,5L8.599,5L9.0452,2.9968C9.1486,2.4473 9.6726,2 10.2019,2L14.2544,2ZM17.385,6L6.531,6L7.3632,19.6987C7.3717,19.8484 7.6288,20 8.0343,20L11.4155,19.9765C11.4441,19.9716 11.4735,19.9692 11.5035,19.9694L11.951,19.972L12.4132,19.9694L12.5031,19.9768L12.5031,19.9768L15.8824,20C16.2879,20 16.5449,19.8484 16.5534,19.6987L17.385,6ZM12.5,8.5L12.5,18.25C12.5,18.9167 11.5,18.9167 11.5,18.25L11.5,8.5C11.5,7.8333 12.5,7.8333 12.5,8.5ZM8.9707,8.0015C9.2461,7.9804 9.4864,8.1865 9.5074,8.4618L10.2522,18.186C10.2733,18.4613 10.0672,18.7016 9.7919,18.7227C9.5165,18.7438 9.2762,18.5377 9.2551,18.2624L8.5104,8.5382C8.4893,8.2628 8.6954,8.0225 8.9707,8.0015ZM15.0379,8.0014C15.3133,8.0224 15.5195,8.2626 15.4986,8.5379L14.7586,18.2621C14.7376,18.5375 14.4974,18.7437 14.2221,18.7227C13.9467,18.7018 13.7405,18.4616 13.7614,18.1862L14.5014,8.4621C14.5224,8.1867 14.7626,7.9805 15.0379,8.0014Z"
android:strokeWidth="1"
android:fillColor="#2C2E2F"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
</vector>
1 change: 1 addition & 0 deletions commonui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

<string name="authentication_error_header">Authentication Error</string>
<string name="cancelButtonLabel">Cancel</string>
<string name="edit" translatable="false">Edit</string>
<string name="remove">Remove</string>
<string name="mobileAreYouSure">Are you sure?</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ class FieldMapKey {
this.mTransferMethodType = mTransferMethodType;
}

FieldMapKey() {
this.mCountry = null;
this.mCurrency = null;
this.mTransferMethodType = null;
}
private String getCountry() {
return mCountry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ void createTransferMethod(@NonNull TransferMethod transferMethod,
*/
void loadTransferMethods(@NonNull LoadTransferMethodListCallback callback);


/**
* Update transfer method specified.
*
* @param transferMethod transfer method to deactivate @see {@link TransferMethod}
* @param callback @see {@link DeactivateTransferMethodCallback}
*/
void updateTransferMethod(@NonNull final TransferMethod transferMethod,
@NonNull LoadTransferMethodCallback callback);


/**
* Load latest transfer methods available, associated with current context
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ public class TransferMethodRepositoryFactory {
private static TransferMethodRepositoryFactory sInstance;
private TransferMethodRepository mTransferMethodRepository;
private TransferMethodConfigurationRepository mTransferMethodConfigurationRepository;
private TransferMethodUpdateConfigurationRepository mTransferMethodUpdateConfigurationRepository;

private TransferMethodRepositoryFactory() {
mTransferMethodRepository = new TransferMethodRepositoryImpl();
mTransferMethodConfigurationRepository = new TransferMethodConfigurationRepositoryImpl();
mTransferMethodUpdateConfigurationRepository = new TransferMethodUpdateConfigurationRepositoryImpl();
}

public static synchronized TransferMethodRepositoryFactory getInstance() {
Expand All @@ -44,4 +46,9 @@ public TransferMethodRepository getTransferMethodRepository() {
public TransferMethodConfigurationRepository getTransferMethodConfigurationRepository() {
return mTransferMethodConfigurationRepository;
}

public TransferMethodUpdateConfigurationRepository getTransferMethodUpdateConfigurationRepository() {
return mTransferMethodUpdateConfigurationRepository;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,31 @@ public Handler getHandler() {
});
}

@Override
public void updateTransferMethod(@NonNull TransferMethod transferMethod,
@NonNull LoadTransferMethodCallback callback) {
switch (transferMethod.getField(TYPE)) {
case BANK_ACCOUNT:
case WIRE_ACCOUNT:
updateBankAccount(transferMethod, callback);
break;
case BANK_CARD:
updateBankCard(transferMethod, callback);
break;
case PAYPAL_ACCOUNT:
updatePayPalAccount(transferMethod, callback);
break;
case VENMO_ACCOUNT:
updateVenmoAccount(transferMethod, callback);
break;
case PAPER_CHECK:
updatePaperCheck(transferMethod, callback);
break;
default: // error on unknown transfer type
callback.onError(getErrorsOnUnsupportedTransferType());
}
}

/**
* @see TransferMethodRepository#loadLatestTransferMethod(LoadTransferMethodCallback)
*/
Expand Down Expand Up @@ -247,7 +272,7 @@ public Handler getHandler() {
}

private void deactivateVenmoAccount(@NonNull final TransferMethod transferMethod,
@NonNull final DeactivateTransferMethodCallback callback) {
@NonNull final DeactivateTransferMethodCallback callback) {
getHyperwallet().deactivateVenmoAccount(transferMethod.getField(TOKEN), null,
new HyperwalletListener<StatusTransition>() {
@Override
Expand Down Expand Up @@ -289,7 +314,7 @@ public Handler getHandler() {
}

private void createBankAccount(final TransferMethod transferMethod,
final LoadTransferMethodCallback callback) {
final LoadTransferMethodCallback callback) {
BankAccount bankAccount = (BankAccount) transferMethod;

getHyperwallet().createBankAccount(bankAccount, new HyperwalletListener<BankAccount>() {
Expand Down Expand Up @@ -333,7 +358,7 @@ public Handler getHandler() {
}

private void createPayPalAccount(@NonNull final TransferMethod transferMethod,
@NonNull final LoadTransferMethodCallback callback) {
@NonNull final LoadTransferMethodCallback callback) {
PayPalAccount payPalAccount = (PayPalAccount) transferMethod;

getHyperwallet().createPayPalAccount(payPalAccount, new HyperwalletListener<PayPalAccount>() {
Expand All @@ -355,7 +380,7 @@ public Handler getHandler() {
}

private void createVenmoAccount(@NonNull final TransferMethod transferMethod,
@NonNull final LoadTransferMethodCallback callback) {
@NonNull final LoadTransferMethodCallback callback) {
VenmoAccount venmoAccount = (VenmoAccount) transferMethod;

getHyperwallet().createVenmoAccount(venmoAccount, new HyperwalletListener<VenmoAccount>() {
Expand Down Expand Up @@ -405,4 +430,115 @@ private Errors getErrorsOnUnsupportedTransferType() {
EC_UNEXPECTED_EXCEPTION);
return new Errors(Collections.singletonList(error));
}

private void updateBankAccount(final TransferMethod transferMethod,
final LoadTransferMethodCallback callback) {
BankAccount bankAccount = (BankAccount) transferMethod;

getHyperwallet().updateBankAccount(bankAccount, new HyperwalletListener<BankAccount>() {
@Override
public void onSuccess(@Nullable BankAccount result) {
callback.onTransferMethodLoaded(result);
}

@Override
public void onFailure(HyperwalletException exception) {
callback.onError(exception.getErrors());
}

@Override
public Handler getHandler() {
return mHandler;
}
});
}

private void updateBankCard(@NonNull final TransferMethod transferMethod,
@NonNull final LoadTransferMethodCallback callback) {
BankCard bankCard = (BankCard) transferMethod;

getHyperwallet().updateBankCard(bankCard, new HyperwalletListener<BankCard>() {
@Override
public void onSuccess(@Nullable BankCard result) {
callback.onTransferMethodLoaded(result);
}

@Override
public void onFailure(HyperwalletException exception) {
callback.onError(exception.getErrors());
}

@Override
public Handler getHandler() {
return mHandler;
}
});
}

private void updatePayPalAccount(@NonNull final TransferMethod transferMethod,
@NonNull final LoadTransferMethodCallback callback) {
PayPalAccount payPalAccount = (PayPalAccount) transferMethod;

getHyperwallet().updatePayPalAccount(payPalAccount, new HyperwalletListener<PayPalAccount>() {
@Override
public void onSuccess(@Nullable PayPalAccount result) {
callback.onTransferMethodLoaded(result);
}

@Override
public void onFailure(HyperwalletException exception) {
callback.onError(exception.getErrors());
}

@Override
public Handler getHandler() {
return mHandler;
}
});
}

private void updateVenmoAccount(@NonNull final TransferMethod transferMethod,
@NonNull final LoadTransferMethodCallback callback) {
VenmoAccount venmoAccount = (VenmoAccount) transferMethod;

getHyperwallet().updateVenmoAccount(venmoAccount, new HyperwalletListener<VenmoAccount>() {
@Override
public void onSuccess(@Nullable VenmoAccount result) {
callback.onTransferMethodLoaded(result);
}

@Override
public void onFailure(HyperwalletException exception) {
callback.onError(exception.getErrors());
}

@Override
public Handler getHandler() {
return mHandler;
}
});
}

private void updatePaperCheck(@NonNull final TransferMethod transferMethod,
@NonNull final LoadTransferMethodCallback callback) {
PaperCheck paperCheck = (PaperCheck) transferMethod;

getHyperwallet().updatePaperCheck(paperCheck, new HyperwalletListener<PaperCheck>() {
@Override
public void onSuccess(@Nullable PaperCheck result) {
callback.onTransferMethodLoaded(result);
}

@Override
public void onFailure(HyperwalletException exception) {
callback.onError(exception.getErrors());
}

@Override
public Handler getHandler() {
return mHandler;
}
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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.ui.transfermethod.repository;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.hyperwallet.android.model.Errors;
import com.hyperwallet.android.model.graphql.HyperwalletTransferMethodConfigurationField;

public interface TransferMethodUpdateConfigurationRepository {

void getFields(@NonNull final String transferMethodToken,
@NonNull final LoadFieldsCallback loadFieldsCallback);


void refreshFields();

interface LoadFieldsCallback {

void onFieldsLoaded(@Nullable final HyperwalletTransferMethodConfigurationField field);

void onError(@NonNull final Errors errors);
}
}
Loading