Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -37,6 +37,9 @@ public interface TransferMethodConfigurationRepository {

void getKeys(@NonNull final LoadKeysCallback loadKeysCallback);

void getTransferMethodTypesFeeAndProcessingTime(@NonNull final String country, @NonNull final String currency,
@NonNull final LoadKeysCallback loadKeysCallback);

void getFields(@NonNull final String country, @NonNull final String currency,
@NonNull final String transferMethodType, @NonNull final String transferMethodProfileType,
@NonNull final LoadFieldsCallback loadFieldsCallback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.hyperwallet.android.model.graphql.HyperwalletTransferMethodConfigurationKey;
import com.hyperwallet.android.model.graphql.query.TransferMethodConfigurationFieldQuery;
import com.hyperwallet.android.model.graphql.query.TransferMethodConfigurationKeysQuery;
import com.hyperwallet.android.model.graphql.query.TransferMethodTypesFeeAndProcessingTimesQuery;
import com.hyperwallet.android.ui.common.repository.EspressoIdlingResource;

import java.util.HashMap;
Expand Down Expand Up @@ -97,6 +98,31 @@ public Handler getHandler() {
});
}

@VisibleForTesting
void getTransferMethodTypesFeeAndProcessingTimeKeyResult(final String country, final String currency, final LoadKeysCallback loadKeysCallback){
TransferMethodTypesFeeAndProcessingTimesQuery query = new TransferMethodTypesFeeAndProcessingTimesQuery(country, currency);
EspressoIdlingResource.increment();
getHyperwallet().retrieveTransferMethodTypesFeesAndProcessingTimes(query,
new HyperwalletListener<HyperwalletTransferMethodConfigurationKey>() {
@Override
public void onSuccess(@Nullable HyperwalletTransferMethodConfigurationKey result) {
loadKeysCallback.onKeysLoaded(result);
EspressoIdlingResource.decrement();
}

@Override
public void onFailure(HyperwalletException exception) {
loadKeysCallback.onError(exception.getErrors());
EspressoIdlingResource.decrement();
}

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


@VisibleForTesting
void getTransferMethodConfigurationFieldResult(@NonNull final String country,
Expand Down Expand Up @@ -143,6 +169,12 @@ public synchronized void getKeys(@NonNull final LoadKeysCallback loadKeysCallbac
}
}

@Override
public synchronized void getTransferMethodTypesFeeAndProcessingTime(@NonNull String country, @NonNull String currency,
@NonNull LoadKeysCallback loadKeysCallback) {
getTransferMethodTypesFeeAndProcessingTimeKeyResult(country, currency, loadKeysCallback);
}

@Override
public synchronized void getFields(@NonNull final String country, @NonNull final String currency,
@NonNull final String transferMethodType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public void testSelectTransferMethod_verifyCorrectLabelsDisplayed() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_CA_response.json")).mock();

mActivityTestRule.launchActivity(null);

onView(withId(R.id.toolbar)).check(matches(isDisplayed()));
Expand All @@ -119,6 +122,12 @@ public void testSelectTransferMethod_verifyCountrySelectionList() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_CA_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_CA_response.json")).mock();

mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).perform(click());
Expand Down Expand Up @@ -147,6 +156,12 @@ public void testSelectTransferMethod_verifyCountrySelectionSearch() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_large_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_CA_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_CA_response.json")).mock();

mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).perform(click());
Expand All @@ -169,6 +184,16 @@ public void testSelectTransferMethod_verifyCurrencySelectionList() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();


mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).perform(click());
Expand All @@ -195,6 +220,10 @@ public void testSelectTransferMethod_verifyTransferMethodsList() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();


mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
Expand Down Expand Up @@ -266,6 +295,10 @@ public void testSelectTransferMethod_verifyTransferMethodsListEmptyFee() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_empty_fee_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_empty_fee_US_response.json")).mock();


mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
Expand All @@ -287,6 +320,10 @@ public void testSelectTransferMethod_verifyTransferMethodsListEmptyProcessing()
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_empty_processing_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_empty_processing_US_response.json")).mock();


mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
Expand All @@ -311,6 +348,14 @@ public void testSelectTransferMethod_verifyTransferMethodsListUpdatedOnSelection
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_CA_response.json")).mock();



mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
Expand Down Expand Up @@ -354,6 +399,10 @@ public void testSelectTransferMethod_verifyIntentIndividualUser() {
.getResourceContent("user_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();

Expand All @@ -373,6 +422,10 @@ public void testSelectTransferMethod_verifyIntentBusinessUser() {
.getResourceContent("user_business_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();

Expand All @@ -392,6 +445,10 @@ public void testSelectTransferMethod_clickBankAccountOpensAddTransferMethodUi()
.getResourceContent("user_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();

Expand All @@ -409,6 +466,10 @@ public void testSelectTransferMethod_clickBankCardOpensAddTransferMethodUi() {
.getResourceContent("user_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_bank_card_response.json")).mock();

Expand All @@ -427,6 +488,9 @@ public void testSelectTransferMethod_verifyThatCountryIsFromUserProfile() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_CA_response.json")).mock();

mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("Canada")));
Expand All @@ -440,6 +504,10 @@ public void testSelectTransferMethod_verifyDefaultsToUSWhenUserProfileCountryIsN
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();


mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
Expand All @@ -453,6 +521,10 @@ public void testSelectTransferMethod_verifyDefaultsToUSWhenUserProfileDoesNotHav
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();


mActivityTestRule.launchActivity(null);

onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
Expand All @@ -466,6 +538,12 @@ public void testSelectTransferMethod_verifyNoFeeLabelsDisplayed() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_no_fee_response.json")).mock();

mActivityTestRule.launchActivity(null);

onView(withId(R.id.toolbar)).check(matches(isDisplayed()));
Expand Down Expand Up @@ -523,6 +601,12 @@ public void testSelectTransferMethod_verifyMixedFeeIsDisplayed() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_mixedfee_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_fee_processing_time_US_response.json")).mock();

mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_mixed_fee_CN_response.json")).mock();

mActivityTestRule.launchActivity(null);

onView(withId(R.id.toolbar)).check(matches(isDisplayed()));
Expand Down
Loading