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 @@ -165,7 +165,7 @@ public void testSelectDestination_verifyActiveExternalAccountsDisplayed() {
matches(atPosition(4, hasDescendant(withText(R.string.prepaid_card_font_icon)))));
onView(withId(R.id.transfer_destination_list)).check(
matches(atPosition(4, hasDescendant(withText(R.string.prepaid_card)))));
onView(withId(R.id.transfer_destination_list)).check(matches(atPosition(4, hasDescendant(withText("Canada")))));
onView(withId(R.id.transfer_destination_list)).check(matches(atPosition(4, hasDescendant(withText("USD")))));
String ppcInfo = getCardBrandWithFourDigits("Visa", "3187");
onView(withId(R.id.transfer_destination_list)).check(
matches(atPosition(4, hasDescendant(withText(ppcInfo)))));
Expand Down Expand Up @@ -458,7 +458,7 @@ public void testSelectDestination_listTransferMethodsConnectionError() {
matches(atPosition(4, hasDescendant(withText(R.string.prepaid_card_font_icon)))));
onView(withId(R.id.transfer_destination_list)).check(
matches(atPosition(4, hasDescendant(withText(R.string.prepaid_card)))));
onView(withId(R.id.transfer_destination_list)).check(matches(atPosition(4, hasDescendant(withText("Canada")))));
onView(withId(R.id.transfer_destination_list)).check(matches(atPosition(4, hasDescendant(withText("USD")))));
String ppcInfo = getCardBrandWithFourDigits("Visa", "3187");
onView(withId(R.id.transfer_destination_list)).check(
matches(atPosition(4, hasDescendant(withText(ppcInfo)))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1338,8 +1338,10 @@ public void testTransferFragment_verifyTransferFromPrepaidCard() {

// Verify Transfer From is Prepaid Card
verifyTransferFromPPC();
String ppcInfo = VISA + MASK + "9285";
Espresso.onView(ViewMatchers.withId(R.id.transfer_source_description_1))
.check(ViewAssertions.matches(ViewMatchers.withText(containsString("USD"))));
String ppcInfo = VISA + MASK + "9285";
Espresso.onView(ViewMatchers.withId(R.id.transfer_source_description_2))
.check(ViewAssertions.matches(ViewMatchers.withText(containsString(ppcInfo))));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,11 @@ private void showTransferDestination(@NonNull final TransferMethod transferMetho
transferIdentifier.setText(transferMethodIdentification);
transferTitle.setText(getStringResourceByName(transferTitle.getContext(), type));
transferIcon.setText(getStringFontIcon(transferIcon.getContext(), type));
transferCountry.setText(locale.getDisplayName());
if (type.equals(PREPAID_CARD)) {
transferCountry.setText(transferMethod.getField(TRANSFER_METHOD_CURRENCY));
} else {
transferCountry.setText(locale.getDisplayName());
}

mTransferCurrency.setText(transferMethod.getField(TRANSFER_METHOD_CURRENCY));
mTransferDestination.setVisibility(View.VISIBLE);
Expand All @@ -739,18 +743,22 @@ private void showTransferDestination(@NonNull final TransferMethod transferMetho
private void showTransferSource(@NonNull final TransferSource transferSource) {
TextView transferSourceIcon = getView().findViewById(R.id.transfer_source_icon);
TextView transferSourceTitle = getView().findViewById(R.id.transfer_source_title);
TextView transferSourceIdentifier = getView().findViewById(R.id.transfer_source_description_1);
TextView transferSourceCurrency = getView().findViewById(R.id.transfer_source_description_1);
TextView transferSourceIdentifier = getView().findViewById(R.id.transfer_source_description_2);
if (transferSource.getType().equals(PREPAID_CARD)) {
transferSourceIdentifier.setVisibility(View.VISIBLE);
transferSourceTitle.setText(
getTransferMethodName(transferSourceIdentifier.getContext(), transferSource.getType()));
transferSourceIcon.setText(getStringFontIcon(transferSourceIcon.getContext(), transferSource.getType()));
transferSourceCurrency.setText(transferSource.getCurrencyCodes());
transferSourceIdentifier.setText(getTransferMethodDetail(transferSourceIdentifier.getContext(),
transferSource.getIdentification(), transferSource.getType()));
} else {
transferSourceIdentifier.setVisibility(View.GONE);
transferSourceTitle.setText(transferSourceIdentifier.getContext().getString(R.string.availableFunds));
transferSourceIcon.setText(transferSourceIcon.getContext().getString(R.string.available_funds_font_icon));
transferSourceCurrency.setText(transferSource.getCurrencyCodes());
}
transferSourceIdentifier.setText(transferSource.getIdentification() == null ? transferSource.getCurrencyCodes()
: getTransferMethodDetail(transferSourceIdentifier.getContext(),
transferSource.getIdentification(), transferSource.getType()));
}

private String formattedAmount(final double amount, final String currencyCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TOKEN;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TRANSFER_METHOD_COUNTRY;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TRANSFER_METHOD_CURRENCY;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TYPE;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodTypes.PREPAID_CARD;
import static com.hyperwallet.android.ui.common.view.TransferMethodUtils.getStringFontIcon;
import static com.hyperwallet.android.ui.common.view.TransferMethodUtils.getStringResourceByName;
import static com.hyperwallet.android.ui.common.view.TransferMethodUtils.getTransferMethodDetail;
Expand Down Expand Up @@ -266,7 +268,11 @@ void bind(@NonNull final TransferMethod destination, final boolean selected) {

mTitle.setText(getStringResourceByName(mTitle.getContext(), type));
mIcon.setText(getStringFontIcon(mIcon.getContext(), type));
mTransferDestinationCountry.setText(locale.getDisplayName());
if (type.equals(PREPAID_CARD)) {
mTransferDestinationCountry.setText(destination.getField(TRANSFER_METHOD_CURRENCY));
} else {
mTransferDestinationCountry.setText(locale.getDisplayName());
}
mTransferDestinationIdentification.setText(transferId);

if (selected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ private static class TransferSourceViewHolder extends RecyclerView.ViewHolder im
private final TextView mTitle;
private final TextView mIcon;
private final TextView mTransferSourceIdentification;
private final TextView mTransferSourceCurrency;
private final ImageView mSelectedIcon;
private final ListTransferSourceViewModel mViewModel;
private TransferSource mSource;
Expand All @@ -209,8 +210,8 @@ private static class TransferSourceViewHolder extends RecyclerView.ViewHolder im

mIcon = itemView.findViewById(R.id.icon);
mTitle = itemView.findViewById(R.id.title);
mTransferSourceIdentification = itemView.findViewById(R.id.description_1);
itemView.findViewById(R.id.description_2).setVisibility(View.GONE);
mTransferSourceIdentification = itemView.findViewById(R.id.description_2);
mTransferSourceCurrency = itemView.findViewById(R.id.description_1);
mSelectedIcon = itemView.findViewById(R.id.item_selected_image);
mViewModel = viewModel;
}
Expand All @@ -225,14 +226,17 @@ void bind(@NonNull final TransferSource source, final boolean selected) {
if (source.getType().equals(PREPAID_CARD)) {
mTitle.setText(getTransferMethodName(mTitle.getContext(), source.getType()));
mIcon.setText(getStringFontIcon(mIcon.getContext(), source.getType()));
mTransferSourceIdentification.setText(
getTransferMethodDetail(mTransferSourceIdentification.getContext(),
source.getIdentification(), source.getType()));
mTransferSourceCurrency.setText(source.getCurrencyCodes());
mTransferSourceIdentification.setVisibility(View.VISIBLE);
} else {
mTitle.setText(mTitle.getContext().getString(R.string.availableFunds));
mIcon.setText(mIcon.getContext().getString(R.string.available_funds_font_icon));
mTransferSourceCurrency.setText(source.getCurrencyCodes());
mTransferSourceIdentification.setVisibility(View.GONE);
}
mTransferSourceIdentification.setText(source.getIdentification() == null ? source.getCurrencyCodes()
: getTransferMethodDetail(mTransferSourceIdentification.getContext(),
source.getIdentification(), source.getType()));

if (selected) {
mSelectedIcon.setVisibility(View.VISIBLE);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.hyperwallet.android.model.transfer.Transfer.EMPTY_STRING;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TRANSFER_METHOD_COUNTRY;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TRANSFER_METHOD_CURRENCY;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodFields.TYPE;
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodTypes.PREPAID_CARD;
import static com.hyperwallet.android.ui.common.util.CurrencyParser.getValueWithTruncateDecimals;
Expand Down Expand Up @@ -140,25 +141,32 @@ private void showTransferDestination() {
transferIdentifier.setText(transferMethodIdentification);
transferTitle.setText(getStringResourceByName(transferTitle.getContext(), type));
transferIcon.setText(getStringFontIcon(transferIcon.getContext(), type));
transferCountry.setText(locale.getDisplayName());
if (type.equals(PREPAID_CARD)) {
transferCountry.setText(
mScheduleTransferViewModel.getTransferDestination().getField(TRANSFER_METHOD_CURRENCY));
} else {
transferCountry.setText(locale.getDisplayName());
}
}

private void showTransferSource() {
TransferSource transferSource = mScheduleTransferViewModel.getTransferSource();
TextView transferSourceIcon = getView().findViewById(R.id.transfer_source_icon);
TextView transferSourceTitle = getView().findViewById(R.id.transfer_source_title);
TextView transferSourceIdentifier = getView().findViewById(R.id.transfer_source_description_1);
TextView transferSourceCurrency = getView().findViewById(R.id.transfer_source_description_1);
TextView transferSourceIdentifier = getView().findViewById(R.id.transfer_source_description_2);
if (transferSource.getType().equals(PREPAID_CARD)) {
transferSourceTitle.setText(
getTransferMethodName(transferSourceIdentifier.getContext(), transferSource.getType()));
transferSourceIcon.setText(getStringFontIcon(transferSourceIcon.getContext(), transferSource.getType()));
transferSourceCurrency.setText(transferSource.getCurrencyCodes());
transferSourceIdentifier.setText(getTransferMethodDetail(transferSourceIdentifier.getContext(),
transferSource.getIdentification(), transferSource.getType()));
} else {
transferSourceTitle.setText(transferSourceIdentifier.getContext().getString(R.string.availableFunds));
transferSourceIcon.setText(transferSourceIcon.getContext().getString(R.string.available_funds_font_icon));
transferSourceCurrency.setText(transferSource.getCurrencyCodes());
}
transferSourceIdentifier.setText(transferSource.getIdentification() == null ? transferSource.getCurrencyCodes()
: getTransferMethodDetail(transferSourceIdentifier.getContext(),
transferSource.getIdentification(), transferSource.getType()));
}

private void showForeignExchange() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ public void onPrepaidCardLoaded(@Nullable PrepaidCard prepaidCard) {
TransferSource sourceWrapper = new TransferSource();
sourceWrapper.setToken(prepaidCard.getField(TOKEN));
sourceWrapper.setType(PREPAID_CARD);
sourceWrapper.setCurrencyCodes(prepaidCard.getField(TRANSFER_METHOD_CURRENCY));
sourceWrapper.setIdentification(prepaidCard);
sources.add(sourceWrapper);
mSelectedTransferSource.postValue(sourceWrapper);
Expand Down Expand Up @@ -555,6 +556,7 @@ public void onPrepaidCardListLoaded(@NonNull List<PrepaidCard> prepaidCardList)
TransferSource sourceWrapper = new TransferSource();
sourceWrapper.setToken(prepaidCard.getField(TOKEN));
sourceWrapper.setType(PREPAID_CARD);
sourceWrapper.setCurrencyCodes(prepaidCard.getField(TRANSFER_METHOD_CURRENCY));
sourceWrapper.setIdentification(prepaidCard);
sources.add(sourceWrapper);
}
Expand Down
12 changes: 10 additions & 2 deletions transferui/src/main/res/layout/widget_transfer_source.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,19 @@
android:layout_width="@dimen/description_max_layout_width"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Hyperwallet.Body2"
app:layout_constraintBottom_toTopOf="@+id/divider"
app:layout_constraintLeft_toLeftOf="@+id/transfer_source_title"
app:layout_constraintTop_toBottomOf="@+id/transfer_source_title"
tools:text="@string/not_available" />

<TextView
android:id="@+id/transfer_source_description_2"
android:layout_width="@dimen/description_max_layout_width"
android:layout_height="wrap_content"
tools:text="@string/not_available"
android:textAppearance="@style/TextAppearance.Hyperwallet.Body2"
app:layout_constraintLeft_toLeftOf="@+id/transfer_source_title"
app:layout_constraintTop_toBottomOf="@+id/transfer_source_description_1"/>


<View
android:id="@+id/divider"
Expand All @@ -51,6 +59,6 @@
android:layout_marginTop="@dimen/divider_padding_top"
android:visibility="invisible"
app:layout_constraintStart_toStartOf="@+id/transfer_source_title"
app:layout_constraintTop_toBottomOf="@+id/transfer_source_description_1"/>
app:layout_constraintTop_toBottomOf="@+id/transfer_source_description_2"/>

</androidx.constraintlayout.widget.ConstraintLayout>