From 289413a5a12d9259b1141c5095ab12a8ded07067 Mon Sep 17 00:00:00 2001 From: Rajkumar Date: Thu, 17 Dec 2020 02:55:10 +0530 Subject: [PATCH 1/5] DTSERWFOUR-212 - Add edit button in the transfer methods list. --- commonui/src/main/res/values/strings.xml | 1 + .../view/ListTransferMethodActivity.java | 13 ++++++- .../view/ListTransferMethodFragment.java | 37 +++++++------------ .../res/menu/transfer_method_context_menu.xml | 4 ++ 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/commonui/src/main/res/values/strings.xml b/commonui/src/main/res/values/strings.xml index d1ece3372..c350f1971 100644 --- a/commonui/src/main/res/values/strings.xml +++ b/commonui/src/main/res/values/strings.xml @@ -33,6 +33,7 @@ Authentication Error Cancel + Edit Remove Are you sure? diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodActivity.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodActivity.java index f81e7a84b..08cc89d91 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodActivity.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodActivity.java @@ -49,7 +49,7 @@ public class ListTransferMethodActivity extends AppCompatActivity implements ListTransferMethodFragment.OnAddNewTransferMethodSelected, ListTransferMethodFragment.OnDeactivateTransferMethodNetworkErrorCallback, ListTransferMethodFragment.OnLoadTransferMethodNetworkErrorCallback, - ListTransferMethodFragment.OnTransferMethodContextMenuDeletionSelected, + ListTransferMethodFragment.OnTransferMethodContextMenuItemSelected, OnTransferMethodDeactivateCallback, OnNetworkErrorCallback { public static final String TAG = "transfer-method:list:list-transfer-methods"; @@ -177,6 +177,17 @@ public void showConfirmationDialog(@NonNull TransferMethod transferMethod) { } } + @Override + public void invokeTransferMethodEdit(@NonNull TransferMethod transferMethod) { + String type = transferMethod.getField(TransferMethod.TransferMethodFields.TYPE); + String token = transferMethod.getField(TransferMethod.TransferMethodFields.TOKEN); + Intent intent = new Intent(this, UpdateTransferMethodActivity.class); + intent.putExtra(UpdateTransferMethodActivity.EXTRA_TRANSFER_METHOD_TYPE, type); + intent.putExtra(UpdateTransferMethodActivity.EXTRA_TRANSFER_METHOD_TOKEN, token); + intent.putExtra(UpdateTransferMethodActivity.EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, true); + startActivity(intent); + } + @Override public void confirm() { mRetryCode = RETRY_CONFIRM_DEACTIVATE_TRANSFER_METHOD; diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodFragment.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodFragment.java index 118fc9eab..27d1195f4 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodFragment.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodFragment.java @@ -69,7 +69,7 @@ public class ListTransferMethodFragment extends Fragment implements ListTransfer private View mProgressBar; private ArrayList mTransferMethodList; private OnAddNewTransferMethodSelected mOnAddNewTransferMethodSelected; - private OnTransferMethodContextMenuDeletionSelected mOnTransferMethodContextMenuDeletionSelected; + private OnTransferMethodContextMenuItemSelected mOnTransferMethodContextMenuItemSelected; private OnDeactivateTransferMethodNetworkErrorCallback mOnDeactivateTransferMethodNetworkErrorCallback; private OnLoadTransferMethodNetworkErrorCallback mOnLoadTransferMethodNetworkErrorCallback; private boolean mIsTransferMethodsReloadNeeded; @@ -105,10 +105,10 @@ public void onAttach(Context context) { } try { - mOnTransferMethodContextMenuDeletionSelected = (OnTransferMethodContextMenuDeletionSelected) context; + mOnTransferMethodContextMenuItemSelected = (OnTransferMethodContextMenuItemSelected) context; } catch (ClassCastException e) { throw new ClassCastException(getActivity().toString() + " must implement " - + OnTransferMethodContextMenuDeletionSelected.class.getCanonicalName()); + + OnTransferMethodContextMenuItemSelected.class.getCanonicalName()); } try { @@ -144,7 +144,7 @@ public void onViewStateRestored(@Nullable Bundle savedInstanceState) { mIsTransferMethodsReloadNeeded = true; } mListTransferMethodAdapter = new ListTransferMethodAdapter(mTransferMethodList, - mOnTransferMethodContextMenuDeletionSelected); + mOnTransferMethodContextMenuItemSelected); recyclerView.setAdapter(mListTransferMethodAdapter); } @@ -272,9 +272,11 @@ public void loadTransferMethods() { mPresenter.loadTransferMethods(); } - interface OnTransferMethodContextMenuDeletionSelected { + interface OnTransferMethodContextMenuItemSelected { void showConfirmationDialog(@NonNull final TransferMethod transferMethod); + + void invokeTransferMethodEdit(@NonNull final TransferMethod transferMethod); } interface OnAddNewTransferMethodSelected { @@ -294,12 +296,12 @@ interface OnLoadTransferMethodNetworkErrorCallback { private static class ListTransferMethodAdapter extends RecyclerView.Adapter { private List mTransferMethodList; - private OnTransferMethodContextMenuDeletionSelected mOnTransferMethodContextMenuDeletionSelected; + private OnTransferMethodContextMenuItemSelected mOnTransferMethodContextMenuItemSelected; ListTransferMethodAdapter(final List transferMethodList, - final OnTransferMethodContextMenuDeletionSelected onTransferMethodContextMenuSelection) { + final OnTransferMethodContextMenuItemSelected onTransferMethodContextMenuSelection) { mTransferMethodList = transferMethodList; - mOnTransferMethodContextMenuDeletionSelected = onTransferMethodContextMenuSelection; + mOnTransferMethodContextMenuItemSelected = onTransferMethodContextMenuSelection; } @NonNull @@ -373,20 +375,6 @@ void bind(@NonNull final TransferMethod transferMethod) { mTransferMethodIdentification.setText(transferMethodIdentification); } - // Todo: Remove before code merge. Used for Debugging purpose. - itemView.setOnClickListener(new OneClickListener() { - @Override - public void onOneClick(View v) { - String type = transferMethod.getField(TransferMethod.TransferMethodFields.TYPE); - String token = transferMethod.getField(TransferMethod.TransferMethodFields.TOKEN); - Intent intent = new Intent(itemView.getContext(), UpdateTransferMethodActivity.class); - intent.putExtra(UpdateTransferMethodActivity.EXTRA_TRANSFER_METHOD_TYPE, type); - intent.putExtra(UpdateTransferMethodActivity.EXTRA_TRANSFER_METHOD_TOKEN, token); - intent.putExtra(UpdateTransferMethodActivity.EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, true); - itemView.getContext().startActivity(intent); - } - }); - mImageButton.setOnClickListener(new View.OnClickListener() { @Override @SuppressWarnings("RestrictedApi") @@ -402,7 +390,10 @@ public void onClick(View v) { @Override public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.remove_account_context_option) { - mOnTransferMethodContextMenuDeletionSelected.showConfirmationDialog(transferMethod); + mOnTransferMethodContextMenuItemSelected.showConfirmationDialog(transferMethod); + return true; + } if (item.getItemId() == R.id.edit_account_context_option) { + mOnTransferMethodContextMenuItemSelected.invokeTransferMethodEdit(transferMethod); return true; } return false; diff --git a/transfermethodui/src/main/res/menu/transfer_method_context_menu.xml b/transfermethodui/src/main/res/menu/transfer_method_context_menu.xml index 93fd95f14..aa7954f40 100644 --- a/transfermethodui/src/main/res/menu/transfer_method_context_menu.xml +++ b/transfermethodui/src/main/res/menu/transfer_method_context_menu.xml @@ -1,5 +1,9 @@ + Date: Fri, 18 Dec 2020 15:00:58 +0530 Subject: [PATCH 2/5] DTSERWFOUR-212 - Fixed the observations. --- commonui/src/main/res/drawable/ic_edit.xml | 12 ++++++++ commonui/src/main/res/drawable/ic_trash.xml | 28 +++++++------------ .../view/ListTransferMethodActivity.java | 8 ++++-- .../view/ListTransferMethodFragment.java | 6 +++- .../view/UpdateTransferMethodActivity.java | 1 + .../view/UpdateTransferMethodFragment.java | 7 +++-- .../fragment_update_transfer_method.xml | 6 ++-- .../res/menu/transfer_method_context_menu.xml | 2 +- 8 files changed, 41 insertions(+), 29 deletions(-) create mode 100644 commonui/src/main/res/drawable/ic_edit.xml diff --git a/commonui/src/main/res/drawable/ic_edit.xml b/commonui/src/main/res/drawable/ic_edit.xml new file mode 100644 index 000000000..bf16bd5cc --- /dev/null +++ b/commonui/src/main/res/drawable/ic_edit.xml @@ -0,0 +1,12 @@ + + + diff --git a/commonui/src/main/res/drawable/ic_trash.xml b/commonui/src/main/res/drawable/ic_trash.xml index 5fdcd6dfe..caa047ad8 100644 --- a/commonui/src/main/res/drawable/ic_trash.xml +++ b/commonui/src/main/res/drawable/ic_trash.xml @@ -1,20 +1,12 @@ - - + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodActivity.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodActivity.java index 08cc89d91..ab11d8e15 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodActivity.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodActivity.java @@ -17,6 +17,7 @@ package com.hyperwallet.android.ui.transfermethod.view; import static com.hyperwallet.android.ui.common.intent.HyperwalletIntent.SELECT_TRANSFER_METHOD_REQUEST_CODE; +import static com.hyperwallet.android.ui.common.intent.HyperwalletIntent.UPDATE_TRANSFER_METHOD_REQUEST_CODE; import static com.hyperwallet.android.ui.transfermethod.view.ListTransferMethodFragment.ARGUMENT_IS_TRANSFER_METHODS_RELOAD_NEEDED; import android.content.Intent; @@ -134,6 +135,9 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { if (fragment != null && fragment.getArguments() != null) { fragment.getArguments().putBoolean(ARGUMENT_IS_TRANSFER_METHODS_RELOAD_NEEDED, true); } + } else if (requestCode == UPDATE_TRANSFER_METHOD_REQUEST_CODE && resultCode == RESULT_OK) { + ActivityUtils.initFragment(this, ListTransferMethodFragment.newInstance(), + R.id.list_transfer_method_fragment); } } @@ -179,13 +183,11 @@ public void showConfirmationDialog(@NonNull TransferMethod transferMethod) { @Override public void invokeTransferMethodEdit(@NonNull TransferMethod transferMethod) { - String type = transferMethod.getField(TransferMethod.TransferMethodFields.TYPE); String token = transferMethod.getField(TransferMethod.TransferMethodFields.TOKEN); Intent intent = new Intent(this, UpdateTransferMethodActivity.class); - intent.putExtra(UpdateTransferMethodActivity.EXTRA_TRANSFER_METHOD_TYPE, type); intent.putExtra(UpdateTransferMethodActivity.EXTRA_TRANSFER_METHOD_TOKEN, token); intent.putExtra(UpdateTransferMethodActivity.EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, true); - startActivity(intent); + startActivityForResult(intent, UPDATE_TRANSFER_METHOD_REQUEST_CODE); } @Override diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodFragment.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodFragment.java index 27d1195f4..f5c185311 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodFragment.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/ListTransferMethodFragment.java @@ -187,7 +187,11 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) { public void onResume() { super.onResume(); mIsTransferMethodsReloadNeeded = getArguments().getBoolean(ARGUMENT_IS_TRANSFER_METHODS_RELOAD_NEEDED, true); - if (mIsTransferMethodsReloadNeeded) { + loadTransferMethodsList(mIsTransferMethodsReloadNeeded); + } + + private void loadTransferMethodsList(boolean shouldReload) { + if (shouldReload) { getArguments().putBoolean(ARGUMENT_IS_TRANSFER_METHODS_RELOAD_NEEDED, false); mPresenter.loadTransferMethods(); } else { diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodActivity.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodActivity.java index 6b223c445..7bb47db9c 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodActivity.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodActivity.java @@ -54,6 +54,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { collapsingToolbar.setCollapsedTitleTextAppearance(titleStyleCollapse); int titleStyleExpanded = TransferMethodUtils.getAdjustExpandTitleStyle(getTitle().toString()); collapsingToolbar.setExpandedTitleTextAppearance(titleStyleExpanded); + getSupportActionBar().setTitle(""); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodFragment.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodFragment.java index 171a74bda..b43e552da 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodFragment.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodFragment.java @@ -51,6 +51,7 @@ import com.hyperwallet.android.ui.common.insight.HyperwalletInsight; import com.hyperwallet.android.ui.common.util.ErrorTypes; import com.hyperwallet.android.ui.common.util.PageGroups; +import com.hyperwallet.android.ui.common.view.TransferMethodUtils; import com.hyperwallet.android.ui.transfermethod.TransferMethodLocalBroadcast; import com.hyperwallet.android.ui.transfermethod.repository.TransferMethodRepositoryFactory; import com.hyperwallet.android.ui.transfermethod.view.widget.AbstractWidget; @@ -158,7 +159,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat mDynamicContainer = view.findViewById(R.id.update_transfer_method_dynamic_container); mNestedScrollView = view.findViewById(R.id.update_transfer_method_scroll_view); - mUpdateButtonProgressBar = view.findViewById(R.id.update_transfer_method_progress_bar); + mUpdateButtonProgressBar = view.findViewById(R.id.update_transfer_method_button_progress_bar); mProgressBar = view.findViewById(R.id.update_transfer_method_progress_bar_layout); mUpdateTransferMethodButton = view.findViewById(R.id.update_transfer_method_button); @@ -440,8 +441,8 @@ public void showTransferMethodFields( TransferMethodConfiguration fields = hyperwalletTransferMethodConfigurationField.getFields(); Locale locale = new Locale.Builder().setRegion(fields.getCountry()).build(); mTransferMethodType = fields.getTransferMethodType(); -// getActivity().getActionBar().setTitle( -// TransferMethodUtils.getTransferMethodName(getContext(), mTransferMethodType)); + String transferMethod = TransferMethodUtils.getTransferMethodName(getContext(), mTransferMethodType); + ((UpdateTransferMethodActivity) getActivity()).getSupportActionBar().setTitle(transferMethod); // group for (FieldGroup group : fields.getFieldGroups()) { View sectionHeader = LayoutInflater.from(mDynamicContainer.getContext()) diff --git a/transfermethodui/src/main/res/layout/fragment_update_transfer_method.xml b/transfermethodui/src/main/res/layout/fragment_update_transfer_method.xml index 568353712..47ee191f6 100644 --- a/transfermethodui/src/main/res/layout/fragment_update_transfer_method.xml +++ b/transfermethodui/src/main/res/layout/fragment_update_transfer_method.xml @@ -106,12 +106,12 @@ app:layout_constraintTop_toTopOf="parent" /> + android:icon="@drawable/ic_edit" /> Date: Fri, 18 Dec 2020 16:08:35 +0530 Subject: [PATCH 3/5] Fixed blocking API call if no changes in edit. --- .../transfermethod/view/UpdateTransferMethodFragment.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodFragment.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodFragment.java index b43e552da..49ad03ac6 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodFragment.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/UpdateTransferMethodFragment.java @@ -89,6 +89,7 @@ public class UpdateTransferMethodFragment extends Fragment implements WidgetEven private TransferMethod mTransferMethod; private String mTransferMethodToken; private HashMap mWidgetInputStateHashMap; + private boolean isEdited; /** * Please do not use this to have instance of UpdateTransferMethodFragment this is reserved for android framework @@ -269,12 +270,17 @@ private void triggerUpdate() { if (view.getTag() instanceof AbstractWidget) { AbstractWidget widget = (AbstractWidget) view.getTag(); if (widget.isEdited) { + isEdited = true; mTransferMethod.setField(widget.getName(), widget.getValue()); } } } - mPresenter.updateTransferMethod(mTransferMethod); + if (isEdited) { + mPresenter.updateTransferMethod(mTransferMethod); + } else { + getActivity().finish(); + } } } From a97267dc19db5f373194a560cfcae828cec12b60 Mon Sep 17 00:00:00 2001 From: ssidigum Date: Fri, 18 Dec 2020 21:50:36 +0530 Subject: [PATCH 4/5] Implemented new class file to update transfer methods(Update Bank Account) and added new respective JSON mock response files. --- .../EditTransferMethodTest.java | 257 ++++ ...fer_method_update_bankacount_response.json | 1192 ++++++++++++++++ ...nsfer_method_update_bankcard_response.json | 90 ++ ...fer_method_update_papercheck_response.json | 167 +++ ...ransfer_method_update_paypal_response.json | 46 + ...transfer_method_update_venmo_response.json | 45 + ...er_method_update_wireaccount_response.json | 1234 +++++++++++++++++ 7 files changed, 3031 insertions(+) create mode 100644 transfermethodui/src/androidTest/java/com/hyperwallet/android/ui/transfermethod/EditTransferMethodTest.java create mode 100644 transfermethodui/src/test/resources/transfer_method_update_bankacount_response.json create mode 100644 transfermethodui/src/test/resources/transfer_method_update_bankcard_response.json create mode 100644 transfermethodui/src/test/resources/transfer_method_update_papercheck_response.json create mode 100644 transfermethodui/src/test/resources/transfer_method_update_paypal_response.json create mode 100644 transfermethodui/src/test/resources/transfer_method_update_venmo_response.json create mode 100644 transfermethodui/src/test/resources/transfer_method_update_wireaccount_response.json diff --git a/transfermethodui/src/androidTest/java/com/hyperwallet/android/ui/transfermethod/EditTransferMethodTest.java b/transfermethodui/src/androidTest/java/com/hyperwallet/android/ui/transfermethod/EditTransferMethodTest.java new file mode 100644 index 000000000..e1144cdbf --- /dev/null +++ b/transfermethodui/src/androidTest/java/com/hyperwallet/android/ui/transfermethod/EditTransferMethodTest.java @@ -0,0 +1,257 @@ +package com.hyperwallet.android.ui.transfermethod; + +import android.app.Instrumentation; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.view.MenuItem; +import android.widget.ImageButton; +import android.widget.TextView; + +import androidx.localbroadcastmanager.content.LocalBroadcastManager; +import androidx.test.core.app.ApplicationProvider; +import androidx.test.espresso.IdlingRegistry; +import androidx.test.espresso.Root; +import androidx.test.espresso.assertion.ViewAssertions; +import androidx.test.espresso.matcher.ViewMatchers; +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.rule.ActivityTestRule; + +import com.hyperwallet.android.model.StatusTransition; +import com.hyperwallet.android.ui.R; +import com.hyperwallet.android.ui.common.repository.EspressoIdlingResource; +import com.hyperwallet.android.ui.common.view.error.DefaultErrorDialogFragment; +import com.hyperwallet.android.ui.testutils.rule.HyperwalletExternalResourceManager; +import com.hyperwallet.android.ui.testutils.rule.HyperwalletMockWebServer; +import com.hyperwallet.android.ui.testutils.util.RecyclerViewCountAssertion; +import com.hyperwallet.android.ui.transfermethod.repository.TransferMethodRepositoryFactory; +import com.hyperwallet.android.ui.transfermethod.rule.HyperwalletInsightMockRule; +import com.hyperwallet.android.ui.transfermethod.view.AddTransferMethodActivity; +import com.hyperwallet.android.ui.transfermethod.view.ListTransferMethodActivity; + +import org.hamcrest.Matchers; +import org.junit.After; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.IOException; +import java.util.concurrent.CountDownLatch; + +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.action.ViewActions.replaceText; +import static androidx.test.espresso.action.ViewActions.typeText; +import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.RootMatchers.isDialog; +import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant; +import static androidx.test.espresso.matcher.ViewMatchers.hasSibling; +import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; +import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility; +import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withParent; +import static androidx.test.espresso.matcher.ViewMatchers.withText; +import static com.hyperwallet.android.model.StatusTransition.StatusDefinition.DE_ACTIVATED; +import static com.hyperwallet.android.ui.common.view.error.DefaultErrorDialogFragment.RESULT_ERROR; +import static com.hyperwallet.android.ui.testutils.util.EspressoUtils.atPosition; +import static com.hyperwallet.android.ui.testutils.util.EspressoUtils.nestedScrollTo; +import static com.hyperwallet.android.ui.testutils.util.EspressoUtils.withDrawable; +import static java.net.HttpURLConnection.HTTP_BAD_REQUEST; +import static java.net.HttpURLConnection.HTTP_OK; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.is; + +@RunWith(AndroidJUnit4.class) +public class EditTransferMethodTest { + + private static final String ACCOUNT_NUMBER = "8017110254"; + private static final String ROUTING_NUMBER = "211179539"; + + @ClassRule + public static HyperwalletExternalResourceManager sResourceManager = new HyperwalletExternalResourceManager(); + @Rule + public HyperwalletInsightMockRule mHyperwalletInsightMockRule = new HyperwalletInsightMockRule(); + @Rule + public HyperwalletMockWebServer mMockWebServer = new HyperwalletMockWebServer(8080); + @Rule + public ActivityTestRule mActivityTestRule = + new ActivityTestRule<>(ListTransferMethodActivity.class, true, false); + + @Before + public void setup() { + mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager + .getResourceContent("authentication_token_response.json")).mock(); + IdlingRegistry.getInstance().register(EspressoIdlingResource.getIdlingResource()); + } + + @After + public void cleanup() { + TransferMethodRepositoryFactory.clearInstance(); + IdlingRegistry.getInstance().unregister(EspressoIdlingResource.getIdlingResource()); + } + + + @Test + public void testUpdateTransferMethodFragment_verifyUpdateBankAccountTransferMethod() throws InterruptedException { + mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager + .getResourceContent("transfer_method_list_single_bank_account_response.json")).mock(); + mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager + .getResourceContent("transfer_method_update_bankacount_response.json")).mock(); + + + final CountDownLatch gate = new CountDownLatch(1); + final BroadcastReceiver br = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + gate.countDown(); + + StatusTransition statusTransition = intent.getParcelableExtra( + "hyperwallet-local-broadcast-payload"); + assertThat("Transition is not valid", statusTransition.getTransition(), is(DE_ACTIVATED)); + } + }; + + // run test + mActivityTestRule.launchActivity(null); + LocalBroadcastManager.getInstance(mActivityTestRule.getActivity().getApplicationContext()) + .registerReceiver(br, new IntentFilter("ACTION_HYPERWALLET_TRANSFER_METHOD_DEACTIVATED")); + + // assert + onView(withId(R.id.toolbar)).check(matches(isDisplayed())); + onView(withId(R.id.toolbar)) + .check(matches( + hasDescendant(withText(R.string.mobileTransferMethodsHeader)))); + onView(withId(R.id.fab)).check(matches(isDisplayed())); + + onView(withId(R.id.list_transfer_method_item)).check( + matches(atPosition(0, hasDescendant(withText(R.string.bank_account_font_icon))))); + onView(withId(R.id.list_transfer_method_item)).check( + matches(atPosition(0, hasDescendant(withText(R.string.bank_account))))); + onView(withId(R.id.list_transfer_method_item)).check( + matches(atPosition(0, hasDescendant(withText("United States"))))); + onView(withId(R.id.list_transfer_method_item)).check( + matches(atPosition(0, hasDescendant(withText(getEndingIn("1332")))))); + onView(withId(R.id.list_transfer_method_item)).check( + matches(atPosition(0, hasDescendant(withDrawable(R.drawable.ic_three_dots_16dp))))); + + onView(allOf(instanceOf(ImageButton.class), hasSibling(withText(R.string.bank_account)))).perform(click()) + .inRoot(Matchers.instanceOf(MenuItem.class)); + onView(withDrawable(R.drawable.ic_trash)).check(matches(isDisplayed())); + onView(withText(R.string.edit)).check(matches(isDisplayed())).perform(click()); + + onView(withId(R.id.branchIdLabel)).check(matches(isDisplayed())); + + onView(withId(R.id.branchId)).perform(nestedScrollTo()).check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + .check(matches(withText("021000021"))); + + onView(ViewMatchers.withId(R.id.branchIdLabel)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.bankAccountId)) + .perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + .check(matches(withText("****"))); + + onView(ViewMatchers.withId(R.id.bankAccountIdLabel)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + // ACCOUNT HOLDER INFO + onView( + Matchers.allOf( + ViewMatchers.withId(R.id.section_header_title), + ViewMatchers.withText(R.string.account_holder) + ) + ) + .perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.firstName)) + .perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + .check(matches(withText("Android Mobile"))); + + onView(ViewMatchers.withId(R.id.firstNameLabel)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.middleName)) + .perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + .check(matches(withText("mobile-qa"))); + + onView(ViewMatchers.withId(R.id.middleNameLabel)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.lastName)) + .perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + .check(matches(withText("UITest"))); + + onView(ViewMatchers.withId(R.id.lastNameLabel)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + // ADDRESS + onView( + Matchers.allOf( + ViewMatchers.withId(R.id.section_header_title), + ViewMatchers.withText(R.string.address) + ) + ).perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.country)) + .perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + .check(matches(withText("Canada"))); + + onView(ViewMatchers.withId(R.id.countryLabel)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.stateProvince)) + .perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + .check(matches(withText("BC"))); + + onView(ViewMatchers.withId(R.id.stateProvinceLabel)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.addressLine1)) + .perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + .check(matches(withText("475 howe st"))); + + onView(ViewMatchers.withId(R.id.addressLine1Label)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.city)) + .perform(nestedScrollTo()) + .check(matches(withText("vancouver"))) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.cityLabel)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + onView(ViewMatchers.withId(R.id.postalCode)) + .perform(nestedScrollTo()) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + .check(matches(withText("V6Z1L2"))); + + onView(ViewMatchers.withId(R.id.postalCodeLabel)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())); + + } + + private String getEndingIn(String ending) { + return String.format(InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.endingIn), ending); + } + +} diff --git a/transfermethodui/src/test/resources/transfer_method_update_bankacount_response.json b/transfermethodui/src/test/resources/transfer_method_update_bankacount_response.json new file mode 100644 index 000000000..6d4445dee --- /dev/null +++ b/transfermethodui/src/test/resources/transfer_method_update_bankacount_response.json @@ -0,0 +1,1192 @@ +{ + "data": { + "transferMethodUpdateUIConfigurations": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "profile": "INDIVIDUAL", + "fieldGroups": { + "nodes": [ + { + "group": "ACCOUNT_INFORMATION", + "isEditable": true, + "instruction": { + "textBottom": "On a paper check, the routing number is printed as the first 9 digits on the bottom of the check, followed by 4-17 digits for the account number." + }, + "fields": [ + { + "category": "ACCOUNT", + "value": "021000021", + "dataType": "NUMBER", + "isRequired": true, + "isEditable": true, + "label": "Routing Number", + "maxLength": 9, + "minLength": 9, + "name": "branchId", + "placeholder": "", + "regularExpression": "^[0-9]{9}$", + "validationMessage": { + "length": "The exact length of this field is 9.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ACCOUNT", + "value": "****", + "dataType": "NUMBER", + "isRequired": true, + "isEditable": true, + "label": "Account Number", + "maxLength": 17, + "minLength": 3, + "name": "bankAccountId", + "placeholder": "", + "regularExpression": "^(?![0-]+$)[0-9-]{3,17}$", + "validationMessage": { + "length": "The minimum length of this field is 3 and maximum length is 17.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": true + }, + { + "category": "ACCOUNT", + "value": "SAVINGS", + "dataType": "SELECTION", + "isRequired": true, + "isEditable": true, + "label": "Account Type", + "name": "bankAccountPurpose", + "placeholder": "", + "fieldSelectionOptions": [ + { + "label": "Checking", + "value": "CHECKING" + }, + { + "label": "Savings", + "value": "SAVINGS" + } + ], + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + }, + { + "group": "ACCOUNT_HOLDER", + "isEditable": true, + "instruction": { + }, + "fields": [ + { + "category": "PROFILE", + "value": "Android Mobile", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "First Name", + "name": "firstName", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-.,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{1,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "PROFILE", + "value": "mobile-qa", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "Middle Name", + "name": "middleName", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-.,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{1,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "PROFILE", + "value": "UITest", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Last Name", + "name": "lastName", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-.,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{1,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + }, + { + "group": "ADDRESS", + "isEditable": true, + "instruction": { + }, + "fields": [ + { + "category": "ADDRESS", + "value": "CA", + "dataType": "SELECTION", + "isRequired": true, + "isEditable": true, + "label": "Country", + "name": "country", + "placeholder": "", + "fieldSelectionOptions": [ + { + "label": "Afghanistan", + "value": "AF" + }, + { + "label": "Åland Islands", + "value": "AX" + }, + { + "label": "Albania", + "value": "AL" + }, + { + "label": "Algeria", + "value": "DZ" + }, + { + "label": "American Samoa", + "value": "AS" + }, + { + "label": "Andorra", + "value": "AD" + }, + { + "label": "Angola", + "value": "AO" + }, + { + "label": "Anguilla", + "value": "AI" + }, + { + "label": "Antarctica", + "value": "AQ" + }, + { + "label": "Antigua & Barbuda", + "value": "AG" + }, + { + "label": "Argentina", + "value": "AR" + }, + { + "label": "Armenia", + "value": "AM" + }, + { + "label": "Aruba", + "value": "AW" + }, + { + "label": "Australia", + "value": "AU" + }, + { + "label": "Austria", + "value": "AT" + }, + { + "label": "Azerbaijan", + "value": "AZ" + }, + { + "label": "Bahamas", + "value": "BS" + }, + { + "label": "Bahrain", + "value": "BH" + }, + { + "label": "Bangladesh", + "value": "BD" + }, + { + "label": "Barbados", + "value": "BB" + }, + { + "label": "Belgium", + "value": "BE" + }, + { + "label": "Belize", + "value": "BZ" + }, + { + "label": "Benin", + "value": "BJ" + }, + { + "label": "Bermuda", + "value": "BM" + }, + { + "label": "Bhutan", + "value": "BT" + }, + { + "label": "Bolivia", + "value": "BO" + }, + { + "label": "Caribbean Netherlands", + "value": "BQ" + }, + { + "label": "Bosnia & Herzegovina", + "value": "BA" + }, + { + "label": "Botswana", + "value": "BW" + }, + { + "label": "Bouvet Island", + "value": "BV" + }, + { + "label": "Brazil", + "value": "BR" + }, + { + "label": "British Indian Ocean Territory", + "value": "IO" + }, + { + "label": "Brunei", + "value": "BN" + }, + { + "label": "Bulgaria", + "value": "BG" + }, + { + "label": "Burkina Faso", + "value": "BF" + }, + { + "label": "Burundi", + "value": "BI" + }, + { + "label": "Cambodia", + "value": "KH" + }, + { + "label": "Cameroon", + "value": "CM" + }, + { + "label": "Canada", + "value": "CA" + }, + { + "label": "Cape Verde", + "value": "CV" + }, + { + "label": "Cayman Islands", + "value": "KY" + }, + { + "label": "Chad", + "value": "TD" + }, + { + "label": "Chile", + "value": "CL" + }, + { + "label": "China", + "value": "CN" + }, + { + "label": "Christmas Island", + "value": "CX" + }, + { + "label": "Cocos (Keeling) Islands", + "value": "CC" + }, + { + "label": "Colombia", + "value": "CO" + }, + { + "label": "Comoros", + "value": "KM" + }, + { + "label": "Congo - Brazzaville", + "value": "CG" + }, + { + "label": "Cook Islands", + "value": "CK" + }, + { + "label": "Costa Rica", + "value": "CR" + }, + { + "label": "Côte d’Ivoire", + "value": "CI" + }, + { + "label": "Croatia", + "value": "HR" + }, + { + "label": "Curaçao", + "value": "CW" + }, + { + "label": "Cyprus", + "value": "CY" + }, + { + "label": "Czechia", + "value": "CZ" + }, + { + "label": "Denmark", + "value": "DK" + }, + { + "label": "Djibouti", + "value": "DJ" + }, + { + "label": "Dominica", + "value": "DM" + }, + { + "label": "Dominican Republic", + "value": "DO" + }, + { + "label": "Timor-Leste", + "value": "TL" + }, + { + "label": "Ecuador", + "value": "EC" + }, + { + "label": "Egypt", + "value": "EG" + }, + { + "label": "El Salvador", + "value": "SV" + }, + { + "label": "Equatorial Guinea", + "value": "GQ" + }, + { + "label": "Estonia", + "value": "EE" + }, + { + "label": "Ethiopia", + "value": "ET" + }, + { + "label": "Falkland Islands", + "value": "FK" + }, + { + "label": "Faroe Islands", + "value": "FO" + }, + { + "label": "Fiji", + "value": "FJ" + }, + { + "label": "Finland", + "value": "FI" + }, + { + "label": "France", + "value": "FR" + }, + { + "label": "French Guiana", + "value": "GF" + }, + { + "label": "French Polynesia", + "value": "PF" + }, + { + "label": "French Southern Territories", + "value": "TF" + }, + { + "label": "Gabon", + "value": "GA" + }, + { + "label": "Gambia", + "value": "GM" + }, + { + "label": "Georgia", + "value": "GE" + }, + { + "label": "Germany", + "value": "DE" + }, + { + "label": "Ghana", + "value": "GH" + }, + { + "label": "Gibraltar", + "value": "GI" + }, + { + "label": "Greece", + "value": "GR" + }, + { + "label": "Greenland", + "value": "GL" + }, + { + "label": "Grenada", + "value": "GD" + }, + { + "label": "Guadeloupe", + "value": "GP" + }, + { + "label": "Guam", + "value": "GU" + }, + { + "label": "Guatemala", + "value": "GT" + }, + { + "label": "Guernsey", + "value": "GG" + }, + { + "label": "Guinea", + "value": "GN" + }, + { + "label": "Guyana", + "value": "GY" + }, + { + "label": "Haiti", + "value": "HT" + }, + { + "label": "Heard & McDonald Islands", + "value": "HM" + }, + { + "label": "Honduras", + "value": "HN" + }, + { + "label": "Hong Kong SAR China", + "value": "HK" + }, + { + "label": "Hungary", + "value": "HU" + }, + { + "label": "Iceland", + "value": "IS" + }, + { + "label": "India", + "value": "IN" + }, + { + "label": "Indonesia", + "value": "ID" + }, + { + "label": "Ireland", + "value": "IE" + }, + { + "label": "Isle of Man", + "value": "IM" + }, + { + "label": "Israel", + "value": "IL" + }, + { + "label": "Italy", + "value": "IT" + }, + { + "label": "Jamaica", + "value": "JM" + }, + { + "label": "Japan", + "value": "JP" + }, + { + "label": "Jersey", + "value": "JE" + }, + { + "label": "Jordan", + "value": "JO" + }, + { + "label": "Kazakhstan", + "value": "KZ" + }, + { + "label": "Kenya", + "value": "KE" + }, + { + "label": "Kiribati", + "value": "KI" + }, + { + "label": "South Korea", + "value": "KR" + }, + { + "label": "Kosovo", + "value": "XK" + }, + { + "label": "Kuwait", + "value": "KW" + }, + { + "label": "Kyrgyzstan", + "value": "KG" + }, + { + "label": "Laos", + "value": "LA" + }, + { + "label": "Latvia", + "value": "LV" + }, + { + "label": "Lesotho", + "value": "LS" + }, + { + "label": "Liechtenstein", + "value": "LI" + }, + { + "label": "Lithuania", + "value": "LT" + }, + { + "label": "Luxembourg", + "value": "LU" + }, + { + "label": "Macao SAR China", + "value": "MO" + }, + { + "label": "North Macedonia", + "value": "MK" + }, + { + "label": "Madagascar", + "value": "MG" + }, + { + "label": "Malawi", + "value": "MW" + }, + { + "label": "Malaysia", + "value": "MY" + }, + { + "label": "Maldives", + "value": "MV" + }, + { + "label": "Mali", + "value": "ML" + }, + { + "label": "Malta", + "value": "MT" + }, + { + "label": "Marshall Islands", + "value": "MH" + }, + { + "label": "Martinique", + "value": "MQ" + }, + { + "label": "Mauritania", + "value": "MR" + }, + { + "label": "Mauritius", + "value": "MU" + }, + { + "label": "Mayotte", + "value": "YT" + }, + { + "label": "Mexico", + "value": "MX" + }, + { + "label": "Micronesia", + "value": "FM" + }, + { + "label": "Moldova", + "value": "MD" + }, + { + "label": "Monaco", + "value": "MC" + }, + { + "label": "Mongolia", + "value": "MN" + }, + { + "label": "Montenegro", + "value": "ME" + }, + { + "label": "Montserrat", + "value": "MS" + }, + { + "label": "Morocco", + "value": "MA" + }, + { + "label": "Mozambique", + "value": "MZ" + }, + { + "label": "Namibia", + "value": "NA" + }, + { + "label": "Nauru", + "value": "NR" + }, + { + "label": "Nepal", + "value": "NP" + }, + { + "label": "Netherlands", + "value": "NL" + }, + { + "label": "Curaçao", + "value": "AN" + }, + { + "label": "New Caledonia", + "value": "NC" + }, + { + "label": "New Zealand", + "value": "NZ" + }, + { + "label": "Nicaragua", + "value": "NI" + }, + { + "label": "Niger", + "value": "NE" + }, + { + "label": "Nigeria", + "value": "NG" + }, + { + "label": "Niue", + "value": "NU" + }, + { + "label": "Norfolk Island", + "value": "NF" + }, + { + "label": "Northern Mariana Islands", + "value": "MP" + }, + { + "label": "Norway", + "value": "NO" + }, + { + "label": "Oman", + "value": "OM" + }, + { + "label": "Pakistan", + "value": "PK" + }, + { + "label": "Palau", + "value": "PW" + }, + { + "label": "Palestinian Territories", + "value": "PS" + }, + { + "label": "Panama", + "value": "PA" + }, + { + "label": "Papua New Guinea", + "value": "PG" + }, + { + "label": "Paraguay", + "value": "PY" + }, + { + "label": "Peru", + "value": "PE" + }, + { + "label": "Philippines", + "value": "PH" + }, + { + "label": "Pitcairn Islands", + "value": "PN" + }, + { + "label": "Poland", + "value": "PL" + }, + { + "label": "Portugal", + "value": "PT" + }, + { + "label": "Puerto Rico", + "value": "PR" + }, + { + "label": "Qatar", + "value": "QA" + }, + { + "label": "Réunion", + "value": "RE" + }, + { + "label": "Romania", + "value": "RO" + }, + { + "label": "Russia", + "value": "RU" + }, + { + "label": "Rwanda", + "value": "RW" + }, + { + "label": "St. Kitts & Nevis", + "value": "KN" + }, + { + "label": "St. Lucia", + "value": "LC" + }, + { + "label": "St. Martin", + "value": "MF" + }, + { + "label": "St. Vincent & Grenadines", + "value": "VC" + }, + { + "label": "Samoa", + "value": "WS" + }, + { + "label": "San Marino", + "value": "SM" + }, + { + "label": "São Tomé & Príncipe", + "value": "ST" + }, + { + "label": "Saudi Arabia", + "value": "SA" + }, + { + "label": "Senegal", + "value": "SN" + }, + { + "label": "Serbia", + "value": "RS" + }, + { + "label": "Seychelles", + "value": "SC" + }, + { + "label": "Sierra Leone", + "value": "SL" + }, + { + "label": "Singapore", + "value": "SG" + }, + { + "label": "Sint Maarten", + "value": "SX" + }, + { + "label": "Slovakia", + "value": "SK" + }, + { + "label": "Slovenia", + "value": "SI" + }, + { + "label": "Solomon Islands", + "value": "SB" + }, + { + "label": "South Africa", + "value": "ZA" + }, + { + "label": "South Georgia & South Sandwich Islands", + "value": "GS" + }, + { + "label": "South Sudan", + "value": "SS" + }, + { + "label": "Spain", + "value": "ES" + }, + { + "label": "Sri Lanka", + "value": "LK" + }, + { + "label": "St. Barthélemy", + "value": "BL" + }, + { + "label": "St. Helena", + "value": "SH" + }, + { + "label": "St. Pierre & Miquelon", + "value": "PM" + }, + { + "label": "Suriname", + "value": "SR" + }, + { + "label": "Svalbard & Jan Mayen", + "value": "SJ" + }, + { + "label": "Eswatini", + "value": "SZ" + }, + { + "label": "Sweden", + "value": "SE" + }, + { + "label": "Switzerland", + "value": "CH" + }, + { + "label": "Taiwan", + "value": "TW" + }, + { + "label": "Tajikistan", + "value": "TJ" + }, + { + "label": "Tanzania", + "value": "TZ" + }, + { + "label": "Thailand", + "value": "TH" + }, + { + "label": "Togo", + "value": "TG" + }, + { + "label": "Tokelau", + "value": "TK" + }, + { + "label": "Tonga", + "value": "TO" + }, + { + "label": "Trinidad & Tobago", + "value": "TT" + }, + { + "label": "Tunisia", + "value": "TN" + }, + { + "label": "Turkey", + "value": "TR" + }, + { + "label": "Turkmenistan", + "value": "TM" + }, + { + "label": "Turks & Caicos Islands", + "value": "TC" + }, + { + "label": "Tuvalu", + "value": "TV" + }, + { + "label": "Uganda", + "value": "UG" + }, + { + "label": "Ukraine", + "value": "UA" + }, + { + "label": "United Arab Emirates", + "value": "AE" + }, + { + "label": "United Kingdom", + "value": "GB" + }, + { + "label": "United States", + "value": "US" + }, + { + "label": "U.S. Outlying Islands", + "value": "UM" + }, + { + "label": "Uruguay", + "value": "UY" + }, + { + "label": "Uzbekistan", + "value": "UZ" + }, + { + "label": "Vanuatu", + "value": "VU" + }, + { + "label": "Vatican City", + "value": "VA" + }, + { + "label": "Venezuela", + "value": "VE" + }, + { + "label": "Vietnam", + "value": "VN" + }, + { + "label": "British Virgin Islands", + "value": "VG" + }, + { + "label": "U.S. Virgin Islands", + "value": "VI" + }, + { + "label": "Wallis & Futuna", + "value": "WF" + }, + { + "label": "Western Sahara", + "value": "EH" + }, + { + "label": "Zambia", + "value": "ZM" + } + ], + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "BC", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "State/Province", + "name": "stateProvince", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-().,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{2,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "475 howe st", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Address Line 1", + "name": "addressLine1", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\/\\-:().,#;'°&\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{2,100}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "Address Line 2", + "name": "addressLine2", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\/\\-:().,#;'°&\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{2,100}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "vancouver", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "City", + "name": "city", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-().,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{2,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "V6Z1L2", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Zip/Postal Code", + "name": "postalCode", + "placeholder": "", + "regularExpression": "^(?![\\-]+$)[\\sa-zA-Z0-9\\-]{2,16}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/transfer_method_update_bankcard_response.json b/transfermethodui/src/test/resources/transfer_method_update_bankcard_response.json new file mode 100644 index 000000000..41b7eebc1 --- /dev/null +++ b/transfermethodui/src/test/resources/transfer_method_update_bankcard_response.json @@ -0,0 +1,90 @@ +{ + "data": { + "transferMethodUpdateUIConfigurations": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_CARD", + "profile": "INDIVIDUAL", + "fieldGroups": { + "nodes": [ + { + "group": "ACCOUNT_INFORMATION", + "isEditable": true, + "instruction": { + "textBottom": "CVV is a 3 digit number, typically found on the back of a debit card." + }, + "fields": [ + { + "category": "ACCOUNT", + "value": "****0006", + "dataType": "NUMBER", + "isRequired": true, + "isEditable": true, + "label": "Card Number", + "maxLength": 19, + "minLength": 13, + "name": "cardNumber", + "placeholder": "", + "regularExpression": "^[0-9]{13,19}$", + "validationMessage": { + "length": "The minimum length of this field is 13 and maximum length is 19.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": true, + "mask": { + "defaultPattern": "#### #### #### ####", + "scrubRegex": " " + } + }, + { + "category": "ACCOUNT", + "value": "2024-10-01", + "dataType": "EXPIRY_DATE", + "isRequired": true, + "isEditable": true, + "label": "Expiration Date", + "maxLength": 7, + "minLength": 7, + "name": "dateOfExpiry", + "placeholder": "", + "regularExpression": "^[0-9]{4}-(1[0-2]|0[1-9])$", + "validationMessage": { + "length": "The exact length of this field is 7.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ACCOUNT", + "dataType": "NUMBER", + "isRequired": true, + "isEditable": true, + "label": "CVV (Card Security Code)", + "maxLength": 4, + "minLength": 3, + "name": "cvv", + "placeholder": "", + "regularExpression": "^[0-9]{3,4}$", + "validationMessage": { + "length": "The minimum length of this field is 3 and maximum length is 4.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false, + "mask": { + "defaultPattern": "###" + } + } + ] + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/transfer_method_update_papercheck_response.json b/transfermethodui/src/test/resources/transfer_method_update_papercheck_response.json new file mode 100644 index 000000000..ceb45badd --- /dev/null +++ b/transfermethodui/src/test/resources/transfer_method_update_papercheck_response.json @@ -0,0 +1,167 @@ +{ + "data": { + "transferMethodUpdateUIConfigurations": { + "nodes": [ + { + "country": "CA", + "currency": "CAD", + "transferMethodType": "PAPER_CHECK", + "profile": "INDIVIDUAL", + "fieldGroups": { + "nodes": [ + { + "group": "ACCOUNT_INFORMATION", + "isEditable": true, + "instruction": { + }, + "fields": [ + { + "category": "ACCOUNT", + "value": "STANDARD", + "dataType": "SELECTION", + "isRequired": false, + "isEditable": true, + "label": "Shipping Method", + "name": "shippingMethod", + "placeholder": "", + "fieldSelectionOptions": [ + { + "label": "Expedited Delivery", + "value": "EXPEDITED" + }, + { + "label": "Standard Mail", + "value": "STANDARD" + } + ], + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + }, + { + "group": "ADDRESS", + "isEditable": true, + "instruction": { + }, + "fields": [ + { + "category": "ADDRESS", + "value": "CA", + "dataType": "SELECTION", + "isRequired": true, + "isEditable": false, + "label": "Country", + "name": "country", + "placeholder": "", + "fieldSelectionOptions": [ + { + "label": "Canada", + "value": "CA" + } + ], + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "BC", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "State/Province", + "name": "stateProvince", + "placeholder": "", + "regularExpression": "[A-Z]{2}", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "475 howe st", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Address Line 1", + "name": "addressLine1", + "placeholder": "", + "regularExpression": "^$||[\\sa-zA-Z0-9/\\-?:().,+]{1,50}", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "Address Line 2", + "name": "addressLine2", + "placeholder": "", + "regularExpression": "^$||[\\sa-zA-Z0-9/\\-?:().,+]{1,50}", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "vancouver", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "City", + "name": "city", + "placeholder": "", + "regularExpression": "^$||[\\sa-zA-Z0-9/\\-?:().,+]+", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "V6Z1L2", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Zip/Postal Code", + "name": "postalCode", + "placeholder": "", + "regularExpression": "^$||[\\p{Nd}\\p{L}\\p{Z}-]+", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/transfer_method_update_paypal_response.json b/transfermethodui/src/test/resources/transfer_method_update_paypal_response.json new file mode 100644 index 000000000..aca67a871 --- /dev/null +++ b/transfermethodui/src/test/resources/transfer_method_update_paypal_response.json @@ -0,0 +1,46 @@ +{ + "data": { + "transferMethodUpdateUIConfigurations": { + "nodes": [ + { + "country": "CA", + "currency": "CAD", + "transferMethodType": "PAYPAL_ACCOUNT", + "profile": "INDIVIDUAL", + "fieldGroups": { + "nodes": [ + { + "group": "CONTACT_INFORMATION", + "isEditable": true, + "instruction": { + "textBottom": "Email address associated with your PayPal account." + }, + "fields": [ + { + "category": "ACCOUNT", + "value": "hello@hw.com", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Email", + "maxLength": 200, + "minLength": 3, + "name": "email", + "placeholder": "", + "regularExpression": "^(?:[a-zA-Z0-9]{1}|[a-zA-Z0-9\\_]{1}[a-zA-Z0-9\\_\\!#$%&\\'*\\/=?^{|}~`\\-\\.+]{0,64}[a-zA-Z0-9\\_\\-+]{1})[@]{1}(?:[a-zA-Z0-9]{1}(?=.*?[\\.])([a-zA-Z0-9-\\.](?!\\.\\.)){0,133})([a-zA-Z0-9]){2}$", + "validationMessage": { + "length": "The minimum length of this field is 3 and maximum length is 200.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/transfer_method_update_venmo_response.json b/transfermethodui/src/test/resources/transfer_method_update_venmo_response.json new file mode 100644 index 000000000..8ff3968bf --- /dev/null +++ b/transfermethodui/src/test/resources/transfer_method_update_venmo_response.json @@ -0,0 +1,45 @@ +{ + "data": { + "transferMethodUpdateUIConfigurations": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "VENMO_ACCOUNT", + "profile": "INDIVIDUAL", + "fieldGroups": { + "nodes": [ + { + "group": "ACCOUNT_INFORMATION", + "isEditable": true, + "instruction": { + }, + "fields": [ + { + "category": "ACCOUNT", + "value": "5555555555", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Mobile Number", + "maxLength": 10, + "minLength": 10, + "name": "accountId", + "placeholder": "", + "regularExpression": "^([0-9]{10})$", + "validationMessage": { + "length": "The exact length of this field is 10.", + "pattern": "is invalid. The number you provided is not a valid US mobile number. Please use this format: 5555555555", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/transfer_method_update_wireaccount_response.json b/transfermethodui/src/test/resources/transfer_method_update_wireaccount_response.json new file mode 100644 index 000000000..f7338b3bb --- /dev/null +++ b/transfermethodui/src/test/resources/transfer_method_update_wireaccount_response.json @@ -0,0 +1,1234 @@ +{ + "data": { + "transferMethodUpdateUIConfigurations": { + "nodes": [ + { + "country": "CA", + "currency": "AUD", + "transferMethodType": "WIRE_ACCOUNT", + "profile": "INDIVIDUAL", + "fieldGroups": { + "nodes": [ + { + "group": "ACCOUNT_INFORMATION", + "isEditable": true, + "instruction": { + }, + "fields": [ + { + "category": "ACCOUNT", + "value": "ACMTCAMM", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "BIC/SWIFT", + "maxLength": 11, + "minLength": 8, + "name": "bankId", + "placeholder": "", + "regularExpression": "^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", + "validationMessage": { + "length": "The minimum length of this field is 8 and maximum length is 11.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false, + "mask": { + "defaultPattern": "@@@@@@*****" + } + }, + { + "category": "ACCOUNT", + "value": "****4569", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Account Number OR IBAN", + "maxLength": 34, + "minLength": 1, + "name": "bankAccountId", + "placeholder": "", + "regularExpression": "^[a-zA-Z0-9-]{1,34}$", + "validationMessage": { + "length": "The minimum length of this field is 1 and maximum length is 34.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": true + }, + { + "category": "ACCOUNT", + "value": "", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "Additional Wire Instructions", + "maxLength": 50, + "minLength": 1, + "name": "wireInstructions", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\/\\-?:().,+]{1,50}$", + "validationMessage": { + "length": "The minimum length of this field is 1 and maximum length is 50.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + }, + { + "group": "INTERMEDIARY_ACCOUNT", + "isEditable": true, + "instruction": { + }, + "fields": [ + { + "category": "INTERMEDIARY_ACCOUNT", + "value": "", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "Intermediary BIC / SWIFT Code", + "maxLength": 11, + "minLength": 8, + "name": "intermediaryBankId", + "placeholder": "", + "regularExpression": "^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", + "validationMessage": { + "length": "The minimum length of this field is 8 and maximum length is 11.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "INTERMEDIARY_ACCOUNT", + "value": "", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "Intermediary Account Number", + "maxLength": 34, + "minLength": 1, + "name": "intermediaryBankAccountId", + "placeholder": "", + "regularExpression": "^[a-zA-Z0-9-]{1,34}$", + "validationMessage": { + "length": "The minimum length of this field is 1 and maximum length is 34.", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + }, + { + "group": "ACCOUNT_HOLDER", + "isEditable": true, + "instruction": { + }, + "fields": [ + { + "category": "PROFILE", + "value": "Android Mobile", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "First Name", + "name": "firstName", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-.,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{1,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "PROFILE", + "value": "mobile-qa", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "Middle Name", + "name": "middleName", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-.,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{1,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "PROFILE", + "value": "UITest", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Last Name", + "name": "lastName", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-.,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{1,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + }, + { + "group": "ADDRESS", + "isEditable": true, + "instruction": { + }, + "fields": [ + { + "category": "ADDRESS", + "value": "CA", + "dataType": "SELECTION", + "isRequired": true, + "isEditable": true, + "label": "Country", + "name": "country", + "placeholder": "", + "fieldSelectionOptions": [ + { + "label": "Afghanistan", + "value": "AF" + }, + { + "label": "Åland Islands", + "value": "AX" + }, + { + "label": "Albania", + "value": "AL" + }, + { + "label": "Algeria", + "value": "DZ" + }, + { + "label": "American Samoa", + "value": "AS" + }, + { + "label": "Andorra", + "value": "AD" + }, + { + "label": "Angola", + "value": "AO" + }, + { + "label": "Anguilla", + "value": "AI" + }, + { + "label": "Antarctica", + "value": "AQ" + }, + { + "label": "Antigua & Barbuda", + "value": "AG" + }, + { + "label": "Argentina", + "value": "AR" + }, + { + "label": "Armenia", + "value": "AM" + }, + { + "label": "Aruba", + "value": "AW" + }, + { + "label": "Australia", + "value": "AU" + }, + { + "label": "Austria", + "value": "AT" + }, + { + "label": "Azerbaijan", + "value": "AZ" + }, + { + "label": "Bahamas", + "value": "BS" + }, + { + "label": "Bahrain", + "value": "BH" + }, + { + "label": "Bangladesh", + "value": "BD" + }, + { + "label": "Barbados", + "value": "BB" + }, + { + "label": "Belgium", + "value": "BE" + }, + { + "label": "Belize", + "value": "BZ" + }, + { + "label": "Benin", + "value": "BJ" + }, + { + "label": "Bermuda", + "value": "BM" + }, + { + "label": "Bhutan", + "value": "BT" + }, + { + "label": "Bolivia", + "value": "BO" + }, + { + "label": "Caribbean Netherlands", + "value": "BQ" + }, + { + "label": "Bosnia & Herzegovina", + "value": "BA" + }, + { + "label": "Botswana", + "value": "BW" + }, + { + "label": "Bouvet Island", + "value": "BV" + }, + { + "label": "Brazil", + "value": "BR" + }, + { + "label": "British Indian Ocean Territory", + "value": "IO" + }, + { + "label": "Brunei", + "value": "BN" + }, + { + "label": "Bulgaria", + "value": "BG" + }, + { + "label": "Burkina Faso", + "value": "BF" + }, + { + "label": "Burundi", + "value": "BI" + }, + { + "label": "Cambodia", + "value": "KH" + }, + { + "label": "Cameroon", + "value": "CM" + }, + { + "label": "Canada", + "value": "CA" + }, + { + "label": "Cape Verde", + "value": "CV" + }, + { + "label": "Cayman Islands", + "value": "KY" + }, + { + "label": "Chad", + "value": "TD" + }, + { + "label": "Chile", + "value": "CL" + }, + { + "label": "China", + "value": "CN" + }, + { + "label": "Christmas Island", + "value": "CX" + }, + { + "label": "Cocos (Keeling) Islands", + "value": "CC" + }, + { + "label": "Colombia", + "value": "CO" + }, + { + "label": "Comoros", + "value": "KM" + }, + { + "label": "Congo - Brazzaville", + "value": "CG" + }, + { + "label": "Cook Islands", + "value": "CK" + }, + { + "label": "Costa Rica", + "value": "CR" + }, + { + "label": "Côte d’Ivoire", + "value": "CI" + }, + { + "label": "Croatia", + "value": "HR" + }, + { + "label": "Curaçao", + "value": "CW" + }, + { + "label": "Cyprus", + "value": "CY" + }, + { + "label": "Czechia", + "value": "CZ" + }, + { + "label": "Denmark", + "value": "DK" + }, + { + "label": "Djibouti", + "value": "DJ" + }, + { + "label": "Dominica", + "value": "DM" + }, + { + "label": "Dominican Republic", + "value": "DO" + }, + { + "label": "Timor-Leste", + "value": "TL" + }, + { + "label": "Ecuador", + "value": "EC" + }, + { + "label": "Egypt", + "value": "EG" + }, + { + "label": "El Salvador", + "value": "SV" + }, + { + "label": "Equatorial Guinea", + "value": "GQ" + }, + { + "label": "Estonia", + "value": "EE" + }, + { + "label": "Ethiopia", + "value": "ET" + }, + { + "label": "Falkland Islands", + "value": "FK" + }, + { + "label": "Faroe Islands", + "value": "FO" + }, + { + "label": "Fiji", + "value": "FJ" + }, + { + "label": "Finland", + "value": "FI" + }, + { + "label": "France", + "value": "FR" + }, + { + "label": "French Guiana", + "value": "GF" + }, + { + "label": "French Polynesia", + "value": "PF" + }, + { + "label": "French Southern Territories", + "value": "TF" + }, + { + "label": "Gabon", + "value": "GA" + }, + { + "label": "Gambia", + "value": "GM" + }, + { + "label": "Georgia", + "value": "GE" + }, + { + "label": "Germany", + "value": "DE" + }, + { + "label": "Ghana", + "value": "GH" + }, + { + "label": "Gibraltar", + "value": "GI" + }, + { + "label": "Greece", + "value": "GR" + }, + { + "label": "Greenland", + "value": "GL" + }, + { + "label": "Grenada", + "value": "GD" + }, + { + "label": "Guadeloupe", + "value": "GP" + }, + { + "label": "Guam", + "value": "GU" + }, + { + "label": "Guatemala", + "value": "GT" + }, + { + "label": "Guernsey", + "value": "GG" + }, + { + "label": "Guinea", + "value": "GN" + }, + { + "label": "Guyana", + "value": "GY" + }, + { + "label": "Haiti", + "value": "HT" + }, + { + "label": "Heard & McDonald Islands", + "value": "HM" + }, + { + "label": "Honduras", + "value": "HN" + }, + { + "label": "Hong Kong SAR China", + "value": "HK" + }, + { + "label": "Hungary", + "value": "HU" + }, + { + "label": "Iceland", + "value": "IS" + }, + { + "label": "India", + "value": "IN" + }, + { + "label": "Indonesia", + "value": "ID" + }, + { + "label": "Ireland", + "value": "IE" + }, + { + "label": "Isle of Man", + "value": "IM" + }, + { + "label": "Israel", + "value": "IL" + }, + { + "label": "Italy", + "value": "IT" + }, + { + "label": "Jamaica", + "value": "JM" + }, + { + "label": "Japan", + "value": "JP" + }, + { + "label": "Jersey", + "value": "JE" + }, + { + "label": "Jordan", + "value": "JO" + }, + { + "label": "Kazakhstan", + "value": "KZ" + }, + { + "label": "Kenya", + "value": "KE" + }, + { + "label": "Kiribati", + "value": "KI" + }, + { + "label": "South Korea", + "value": "KR" + }, + { + "label": "Kosovo", + "value": "XK" + }, + { + "label": "Kuwait", + "value": "KW" + }, + { + "label": "Kyrgyzstan", + "value": "KG" + }, + { + "label": "Laos", + "value": "LA" + }, + { + "label": "Latvia", + "value": "LV" + }, + { + "label": "Lesotho", + "value": "LS" + }, + { + "label": "Liechtenstein", + "value": "LI" + }, + { + "label": "Lithuania", + "value": "LT" + }, + { + "label": "Luxembourg", + "value": "LU" + }, + { + "label": "Macao SAR China", + "value": "MO" + }, + { + "label": "North Macedonia", + "value": "MK" + }, + { + "label": "Madagascar", + "value": "MG" + }, + { + "label": "Malawi", + "value": "MW" + }, + { + "label": "Malaysia", + "value": "MY" + }, + { + "label": "Maldives", + "value": "MV" + }, + { + "label": "Mali", + "value": "ML" + }, + { + "label": "Malta", + "value": "MT" + }, + { + "label": "Marshall Islands", + "value": "MH" + }, + { + "label": "Martinique", + "value": "MQ" + }, + { + "label": "Mauritania", + "value": "MR" + }, + { + "label": "Mauritius", + "value": "MU" + }, + { + "label": "Mayotte", + "value": "YT" + }, + { + "label": "Mexico", + "value": "MX" + }, + { + "label": "Micronesia", + "value": "FM" + }, + { + "label": "Moldova", + "value": "MD" + }, + { + "label": "Monaco", + "value": "MC" + }, + { + "label": "Mongolia", + "value": "MN" + }, + { + "label": "Montenegro", + "value": "ME" + }, + { + "label": "Montserrat", + "value": "MS" + }, + { + "label": "Morocco", + "value": "MA" + }, + { + "label": "Mozambique", + "value": "MZ" + }, + { + "label": "Namibia", + "value": "NA" + }, + { + "label": "Nauru", + "value": "NR" + }, + { + "label": "Nepal", + "value": "NP" + }, + { + "label": "Netherlands", + "value": "NL" + }, + { + "label": "Curaçao", + "value": "AN" + }, + { + "label": "New Caledonia", + "value": "NC" + }, + { + "label": "New Zealand", + "value": "NZ" + }, + { + "label": "Nicaragua", + "value": "NI" + }, + { + "label": "Niger", + "value": "NE" + }, + { + "label": "Nigeria", + "value": "NG" + }, + { + "label": "Niue", + "value": "NU" + }, + { + "label": "Norfolk Island", + "value": "NF" + }, + { + "label": "Northern Mariana Islands", + "value": "MP" + }, + { + "label": "Norway", + "value": "NO" + }, + { + "label": "Oman", + "value": "OM" + }, + { + "label": "Pakistan", + "value": "PK" + }, + { + "label": "Palau", + "value": "PW" + }, + { + "label": "Palestinian Territories", + "value": "PS" + }, + { + "label": "Panama", + "value": "PA" + }, + { + "label": "Papua New Guinea", + "value": "PG" + }, + { + "label": "Paraguay", + "value": "PY" + }, + { + "label": "Peru", + "value": "PE" + }, + { + "label": "Philippines", + "value": "PH" + }, + { + "label": "Pitcairn Islands", + "value": "PN" + }, + { + "label": "Poland", + "value": "PL" + }, + { + "label": "Portugal", + "value": "PT" + }, + { + "label": "Puerto Rico", + "value": "PR" + }, + { + "label": "Qatar", + "value": "QA" + }, + { + "label": "Réunion", + "value": "RE" + }, + { + "label": "Romania", + "value": "RO" + }, + { + "label": "Russia", + "value": "RU" + }, + { + "label": "Rwanda", + "value": "RW" + }, + { + "label": "St. Kitts & Nevis", + "value": "KN" + }, + { + "label": "St. Lucia", + "value": "LC" + }, + { + "label": "St. Martin", + "value": "MF" + }, + { + "label": "St. Vincent & Grenadines", + "value": "VC" + }, + { + "label": "Samoa", + "value": "WS" + }, + { + "label": "San Marino", + "value": "SM" + }, + { + "label": "São Tomé & Príncipe", + "value": "ST" + }, + { + "label": "Saudi Arabia", + "value": "SA" + }, + { + "label": "Senegal", + "value": "SN" + }, + { + "label": "Serbia", + "value": "RS" + }, + { + "label": "Seychelles", + "value": "SC" + }, + { + "label": "Sierra Leone", + "value": "SL" + }, + { + "label": "Singapore", + "value": "SG" + }, + { + "label": "Sint Maarten", + "value": "SX" + }, + { + "label": "Slovakia", + "value": "SK" + }, + { + "label": "Slovenia", + "value": "SI" + }, + { + "label": "Solomon Islands", + "value": "SB" + }, + { + "label": "South Africa", + "value": "ZA" + }, + { + "label": "South Georgia & South Sandwich Islands", + "value": "GS" + }, + { + "label": "South Sudan", + "value": "SS" + }, + { + "label": "Spain", + "value": "ES" + }, + { + "label": "Sri Lanka", + "value": "LK" + }, + { + "label": "St. Barthélemy", + "value": "BL" + }, + { + "label": "St. Helena", + "value": "SH" + }, + { + "label": "St. Pierre & Miquelon", + "value": "PM" + }, + { + "label": "Suriname", + "value": "SR" + }, + { + "label": "Svalbard & Jan Mayen", + "value": "SJ" + }, + { + "label": "Eswatini", + "value": "SZ" + }, + { + "label": "Sweden", + "value": "SE" + }, + { + "label": "Switzerland", + "value": "CH" + }, + { + "label": "Taiwan", + "value": "TW" + }, + { + "label": "Tajikistan", + "value": "TJ" + }, + { + "label": "Tanzania", + "value": "TZ" + }, + { + "label": "Thailand", + "value": "TH" + }, + { + "label": "Togo", + "value": "TG" + }, + { + "label": "Tokelau", + "value": "TK" + }, + { + "label": "Tonga", + "value": "TO" + }, + { + "label": "Trinidad & Tobago", + "value": "TT" + }, + { + "label": "Tunisia", + "value": "TN" + }, + { + "label": "Turkey", + "value": "TR" + }, + { + "label": "Turkmenistan", + "value": "TM" + }, + { + "label": "Turks & Caicos Islands", + "value": "TC" + }, + { + "label": "Tuvalu", + "value": "TV" + }, + { + "label": "Uganda", + "value": "UG" + }, + { + "label": "Ukraine", + "value": "UA" + }, + { + "label": "United Arab Emirates", + "value": "AE" + }, + { + "label": "United Kingdom", + "value": "GB" + }, + { + "label": "United States", + "value": "US" + }, + { + "label": "U.S. Outlying Islands", + "value": "UM" + }, + { + "label": "Uruguay", + "value": "UY" + }, + { + "label": "Uzbekistan", + "value": "UZ" + }, + { + "label": "Vanuatu", + "value": "VU" + }, + { + "label": "Vatican City", + "value": "VA" + }, + { + "label": "Venezuela", + "value": "VE" + }, + { + "label": "Vietnam", + "value": "VN" + }, + { + "label": "British Virgin Islands", + "value": "VG" + }, + { + "label": "U.S. Virgin Islands", + "value": "VI" + }, + { + "label": "Wallis & Futuna", + "value": "WF" + }, + { + "label": "Western Sahara", + "value": "EH" + }, + { + "label": "Zambia", + "value": "ZM" + } + ], + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "BC", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "State/Province", + "name": "stateProvince", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-().,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{2,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "475 howe st", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "Address Line 1", + "name": "addressLine1", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\/\\-:().,#;'&°\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{2,100}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "Address Line 2", + "name": "addressLine2", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\/\\-:().,#;'&°\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{2,100}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "vancouver", + "dataType": "TEXT", + "isRequired": true, + "isEditable": true, + "label": "City", + "name": "city", + "placeholder": "", + "regularExpression": "^[\\sa-zA-Z0-9\\-().,'\\u00C0-\\u00FF\\u0100-\\u017F\\u0180-\\u024F]{2,50}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + }, + { + "category": "ADDRESS", + "value": "V6Z1L2", + "dataType": "TEXT", + "isRequired": false, + "isEditable": true, + "label": "Zip/Postal Code", + "name": "postalCode", + "placeholder": "", + "regularExpression": "^(?![\\-]+$)[\\sa-zA-Z0-9\\-]{2,16}$", + "validationMessage": { + "length": "", + "pattern": "is invalid length or format.", + "empty": "You must provide a value for this field" + }, + "fieldValueMasked": false + } + ] + } + ] + } + } + ] + } + } +} \ No newline at end of file From 292f4c10a2b27ced4eb989bd9e6e3f3b45544392 Mon Sep 17 00:00:00 2001 From: Rajkumar Date: Sat, 19 Dec 2020 00:03:52 +0530 Subject: [PATCH 5/5] DTSERWFOUR-212 - Fixed the key listener observation. --- .../android/ui/transfermethod/view/widget/AbstractWidget.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/widget/AbstractWidget.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/widget/AbstractWidget.java index 5d6076f48..0e9cb8311 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/widget/AbstractWidget.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/widget/AbstractWidget.java @@ -167,8 +167,8 @@ public DefaultKeyListener(View focusView, View clearFocusView) { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { + isEdited = true; if (event.getAction() == KeyEvent.ACTION_DOWN) { - isEdited = true; switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: