diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fbd60224..0940888bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +[1.0.0-beta11](https://github.com/hyperwallet/hyperwallet-android-ui-sdk/releases/tag/1.0.0-beta11) +------------------- +* Fixed currency formatting issues +* Enhanced add Transfer Method graphQL calls +* Bug fixes + [1.0.0-beta10](https://github.com/hyperwallet/hyperwallet-android-ui-sdk/releases/tag/1.0.0-beta10) ------------------- * UI Enhancements diff --git a/README.md b/README.md index 4fd6ba6ce..7bfc7b356 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ Note that this SDK is geared towards those who need both backend data and UI fea To install Hyperwallet UI SDK, you just need to add the dependencies into your build.gradle file in Android Studio (or Gradle). For example: ```bash -api 'com.hyperwallet.android.ui:transfermethodui:1.0.0-beta10' -api 'com.hyperwallet.android.ui:receiptui:1.0.0-beta10' -api 'com.hyperwallet.android.ui:transferui:1.0.0-beta10' +api 'com.hyperwallet.android.ui:transfermethodui:1.0.0-beta11' +api 'com.hyperwallet.android.ui:receiptui:1.0.0-beta11' +api 'com.hyperwallet.android.ui:transferui:1.0.0-beta11' ``` ### Proguard diff --git a/build.gradle b/build.gradle index bfe368adc..713fb33db 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ allprojects { } - project.version = "1.0.0-beta10" + project.version = "1.0.0-beta11" } @@ -33,12 +33,12 @@ subprojects { ext { hyperwalletGroupId = 'com.hyperwallet.android.ui' - compileVersion = 29 + compileVersion = 30 minVersion = 21 - targetVersion = 29 + targetVersion = 30 codeVersion = 1 - hyperwalletCoreVersion = '1.0.0-beta09' + hyperwalletCoreVersion = '1.0.0-beta10' hyperwalletInsightVersion = '1.0.0-beta02' // androidMaterialVersion = '1.0.0' diff --git a/commonui/src/main/java/com/hyperwallet/android/ui/common/util/CurrencyParser.java b/commonui/src/main/java/com/hyperwallet/android/ui/common/util/CurrencyParser.java index 6f11835e7..fb8a4a625 100644 --- a/commonui/src/main/java/com/hyperwallet/android/ui/common/util/CurrencyParser.java +++ b/commonui/src/main/java/com/hyperwallet/android/ui/common/util/CurrencyParser.java @@ -1,7 +1,5 @@ package com.hyperwallet.android.ui.common.util; -import static com.hyperwallet.android.model.transfer.Transfer.EMPTY_STRING; - import android.content.Context; import androidx.annotation.VisibleForTesting; @@ -12,22 +10,27 @@ import java.io.IOException; import java.io.InputStream; +import java.math.RoundingMode; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Currency; +import java.util.HashMap; import java.util.List; +import java.util.Locale; public class CurrencyParser { private static CurrencyParser instance; private static final String CURRENCY_LIST = "currency.json"; - private List currencyList; + private final List currencyList; + private final HashMap localeList = new HashMap<>(); private static final String REGEX_REMOVE_EMPTY_SPACE = "^\\s+|\\s+$"; private CurrencyParser(Context context) { currencyList = populateCurrencyList(readJSONFromAsset(context)); + setLocaleList(); } public static CurrencyParser getInstance(Context context) { @@ -73,21 +76,6 @@ private List populateCurrencyList(String currencyList) { return mCurrencyDetailsList; } - /** - * Formats the currency as per currency code. - * - * @param currency Any currency symbol. - * @param amount Any valid number in decimal. - * @return Returns the formatted number as per currency. - */ - public String formatCurrency(String currency, String amount) { - int numberOfFractions = getNumberOfFractionDigits(currency); - NumberFormat format = NumberFormat.getCurrencyInstance(); - format.setMinimumFractionDigits(numberOfFractions); - format.setCurrency(Currency.getInstance(currency)); - return format.format(Double.parseDouble(amount)); - } - @VisibleForTesting int getNumberOfFractionDigits(String currencyCode) { for (CurrencyDetails list : currencyList) { @@ -108,15 +96,21 @@ int getNumberOfFractionDigits(String currencyCode) { */ public String formatCurrencyWithSymbol(String currency, String amount) { - DecimalFormat currencyFormatter = (DecimalFormat) DecimalFormat.getCurrencyInstance(); + DecimalFormat currencyFormatter; + if(localeList.containsKey(currency)) { + LocaleDetails locale = localeList.get(currency); + currencyFormatter = (DecimalFormat) DecimalFormat.getCurrencyInstance((new Locale(locale.getLanguage(),locale.getCountryCode()))); + }else { + currencyFormatter = (DecimalFormat) DecimalFormat.getCurrencyInstance(); + } CurrencyDetails currencyDetails = getCurrency(currency); currencyFormatter.setMinimumFractionDigits(currencyDetails == null ? 0 : currencyDetails.getDecimals()); currencyFormatter.setCurrency(Currency.getInstance(currency)); DecimalFormatSymbols decimalFormatSymbols = currencyFormatter.getDecimalFormatSymbols(); decimalFormatSymbols.setCurrencySymbol(""); currencyFormatter.setDecimalFormatSymbols(decimalFormatSymbols); - String formattedAmount = currencyFormatter.format(Double.parseDouble(amount)).replaceAll(REGEX_REMOVE_EMPTY_SPACE, EMPTY_STRING); - return currencyDetails == null ? "" : currencyDetails.getSymbol() + formattedAmount; + String formattedAmount = currencyFormatter.format(Double.parseDouble(amount)); + return currencyDetails == null ? "" : currencyDetails.getSymbol() + formattedAmount.trim(); } public CurrencyDetails getCurrency(String currencyCode) { @@ -127,4 +121,122 @@ public CurrencyDetails getCurrency(String currencyCode) { } return null; } + + /** + * + */ + public void setLocaleList() { + localeList.clear(); + localeList.put("AED",new LocaleDetails("en","AE")); + localeList.put("ALL",new LocaleDetails("en","US")); + localeList.put("AMD",new LocaleDetails("hy","AM")); + localeList.put("ARS",new LocaleDetails("es","AR")); + localeList.put("AUD",new LocaleDetails("en","AU")); + localeList.put("BAM",new LocaleDetails("hr","BA")); + localeList.put("BDT",new LocaleDetails("en","BD")); + localeList.put("BGN",new LocaleDetails("bg","BG")); + localeList.put("BHD",new LocaleDetails("en","US")); + localeList.put("BOB",new LocaleDetails("qu","BO")); + localeList.put("BRL",new LocaleDetails("en","BR")); + localeList.put("BWP",new LocaleDetails("en","BW")); + localeList.put("CAD",new LocaleDetails("en","CA")); + localeList.put("CHF",new LocaleDetails("en","CH")); + localeList.put("CLP",new LocaleDetails("es","CL")); + localeList.put("CNH",new LocaleDetails("en","CN")); + localeList.put("CNY",new LocaleDetails("en","CN")); + localeList.put("COP",new LocaleDetails("es","CO")); + localeList.put("CZK",new LocaleDetails("cs","CZ")); + localeList.put("DKK",new LocaleDetails("en","DK")); + localeList.put("EEK",new LocaleDetails("en","US")); + localeList.put("EGP",new LocaleDetails("en","US")); + localeList.put("ETB",new LocaleDetails("so","ET")); + localeList.put("EUR",new LocaleDetails("es","EA")); + localeList.put("FJD",new LocaleDetails("en","FJ")); + localeList.put("GBP",new LocaleDetails("kw","GB")); + localeList.put("GHS",new LocaleDetails("ee","GH")); + localeList.put("GMD",new LocaleDetails("en","GM")); + localeList.put("HKD",new LocaleDetails("en","HK")); + localeList.put("HRK",new LocaleDetails("es","HR")); + localeList.put("HUF",new LocaleDetails("hu","HU")); + localeList.put("IDR",new LocaleDetails("jv","ID")); + localeList.put("ILS",new LocaleDetails("he","IL")); + localeList.put("INR",new LocaleDetails("en","IN")); + localeList.put("ISK",new LocaleDetails("en","US")); + localeList.put("JMD",new LocaleDetails("en","JM")); + localeList.put("JOD",new LocaleDetails("en","us")); + localeList.put("JPY",new LocaleDetails("en","JP")); + localeList.put("KES",new LocaleDetails("guz","KE")); + localeList.put("KHR",new LocaleDetails("km","KH")); + localeList.put("KRW",new LocaleDetails("en","KR")); + localeList.put("KWD",new LocaleDetails("en","US")); + localeList.put("KZT",new LocaleDetails("ru","KZ")); + localeList.put("LAK",new LocaleDetails("lo","LA")); + localeList.put("LKR",new LocaleDetails("ta","LK")); + localeList.put("LSL",new LocaleDetails("en","US")); + localeList.put("MAD",new LocaleDetails("zgh","MA")); + localeList.put("MGA",new LocaleDetails("en","MG")); + localeList.put("MRU",new LocaleDetails("ff","MR")); + localeList.put("MUR",new LocaleDetails("en","MU")); + localeList.put("MWK",new LocaleDetails("en","MW")); + localeList.put("MXN",new LocaleDetails("en","MX")); + localeList.put("MYR",new LocaleDetails("en","MY")); + localeList.put("MZN",new LocaleDetails("mgh","MZ")); + localeList.put("NAD",new LocaleDetails("af","NA")); + localeList.put("NGN",new LocaleDetails("en","NG")); + localeList.put("NOK",new LocaleDetails("nn","NO")); + localeList.put("NPR",new LocaleDetails("en","US")); + localeList.put("NZD",new LocaleDetails("en","PN")); + localeList.put("OMR",new LocaleDetails("ae","OM")); + localeList.put("PEN",new LocaleDetails("en","PE")); + localeList.put("PGK",new LocaleDetails("en","PG")); + localeList.put("PHP",new LocaleDetails("ceb","PH")); + localeList.put("PKR",new LocaleDetails("en","PK")); + localeList.put("PLN",new LocaleDetails("pl","PL")); + localeList.put("QAR",new LocaleDetails("en","US")); + localeList.put("RON",new LocaleDetails("ro","RO")); + localeList.put("RSD",new LocaleDetails("sr","Latn_RS")); + localeList.put("RUB",new LocaleDetails("ru","RU")); + localeList.put("SBD",new LocaleDetails("en","SB")); + localeList.put("SEK",new LocaleDetails("en","SE")); + localeList.put("SGD",new LocaleDetails("ta","SG")); + localeList.put("SVG",new LocaleDetails("en","US")); + localeList.put("SZL",new LocaleDetails("en","SZ")); + localeList.put("THB",new LocaleDetails("th","TH")); + localeList.put("TND",new LocaleDetails("en","TN")); + localeList.put("TOP",new LocaleDetails("to","TO")); + localeList.put("TRY",new LocaleDetails("tr","TR")); + localeList.put("TWD",new LocaleDetails("zh","TW")); + localeList.put("UGX",new LocaleDetails("cgg","UG")); + localeList.put("USD",new LocaleDetails("es","US")); + localeList.put("UYU",new LocaleDetails("es","UY")); + localeList.put("VND",new LocaleDetails("vi","VN")); + localeList.put("VUV",new LocaleDetails("en","VU")); + localeList.put("WST",new LocaleDetails("en","WS")); + localeList.put("XPF",new LocaleDetails("fr","PF")); + localeList.put("ZAR",new LocaleDetails("en","ZA")); + localeList.put("ZMW",new LocaleDetails("en","ZM")); + } + + public HashMap getLocaleList() + { + return localeList; + } + /** + * truncate decimals for given value + * + * @param value Any value in string. + * @param noOfDecimals number of decimal to be truncate. + * @return Returns truncated decimal value. + */ + public static String getValueWithTruncateDecimals(String value, int noOfDecimals) { + if (value != null) { + NumberFormat nf = NumberFormat.getNumberInstance(); + nf.setMaximumFractionDigits(noOfDecimals); + nf.setRoundingMode(RoundingMode.HALF_UP); + double amount = Double.parseDouble(value); + return nf.format(amount); + } else { + return ""; + } + } } diff --git a/commonui/src/main/java/com/hyperwallet/android/ui/common/util/LocaleDetails.java b/commonui/src/main/java/com/hyperwallet/android/ui/common/util/LocaleDetails.java new file mode 100644 index 000000000..ec99a3f65 --- /dev/null +++ b/commonui/src/main/java/com/hyperwallet/android/ui/common/util/LocaleDetails.java @@ -0,0 +1,19 @@ +package com.hyperwallet.android.ui.common.util; + +public class LocaleDetails { + private String language; + private String countryCode; + + public LocaleDetails(String language, String countryCode) { + this.language = language; + this.countryCode = countryCode; + } + + public String getLanguage() { + return language; + } + + public String getCountryCode() { + return countryCode; + } +} diff --git a/commonui/src/test/java/com/hyperwallet/android/ui/common/util/CurrencyParserTest.java b/commonui/src/test/java/com/hyperwallet/android/ui/common/util/CurrencyParserTest.java index 9637542e8..0c100c89d 100644 --- a/commonui/src/test/java/com/hyperwallet/android/ui/common/util/CurrencyParserTest.java +++ b/commonui/src/test/java/com/hyperwallet/android/ui/common/util/CurrencyParserTest.java @@ -20,62 +20,62 @@ public class CurrencyParserTest { private Map currenciesMap = new HashMap() { { - put("ALL", "ALL1,000,000.00"); // Albania Currency - put("ARS", "ARS1,000,000.00"); // Argentina Currency - put("AMD", "AMD1,000,000.00"); // Armenia Currency - put("AUD", "AUD1,000,000.00"); // Australia Currency - put("BDT", "BDT1,000,000.00"); // Bangladesh Currency - put("BRL", "BRL1,000,000.00"); // Brazil Currency - put("BGN", "BGN1,000,000.00"); // Bulgaria Currency - put("KHR", "KHR1,000,000.00"); // Cambodia Currency - put("CAD", "CAD1,000,000.00"); // Canada Currency - put("CLP", "CLP1,000,000"); // Chile Currency - put("CNY", "CNY1,000,000.00"); // China Currency - put("COP", "COP1,000,000.00"); // Colombia Currency - put("HRK", "HRK1,000,000.00"); // Croatia Currency - put("CZK", "CZK1,000,000.00"); // Czech Republic Currency - put("DKK", "DKK1,000,000.00"); // Denmark Currency - put("EGP", "EGP1,000,000.00"); // Egypt Currency - put("EUR", "EUR1,000,000.00"); // Austria Currency - put("HKD", "HKD1,000,000.00"); // Hong Kong Currency - put("HUF", "HUF1,000,000.00"); // Hungary Currency - put("INR", "INR1,000,000.00"); // India Currency - put("IDR", "IDR1,000,000"); // Indonesia Currency - put("JMD", "JMD1,000,000.00"); // Jamaica Currency - put("JPY", "JPY1,000,000"); // Japan Currency - put("JOD", "JOD1,000,000.00"); // Jordan Currency - put("KZT", "KZT1,000,000.00"); // Kazakhstan Currency - put("KES", "KES1,000,000.00"); // Kenya Currency - put("LAK", "LAK1,000,000.00"); // Laos Currency - put("MYR", "MYR1,000,000.00"); // Malaysia Currency - put("MXN", "MXN1,000,000.00"); // Mexico Currency - put("MAD", "MAD1,000,000.00"); // Morocco Currency - put("ILS", "ILS1,000,000.00"); // Israel Currency - put("TWD", "TWD1,000,000"); // Taiwan Currency - put("TRY", "TRY1,000,000.00"); // Turkey Currency - put("NZD", "NZD1,000,000.00"); // New Zealand Currency - put("NGN", "NGN1,000,000.00"); // Nigeria Currency - put("NOK", "NOK1,000,000.00"); // Norway Currency - put("PKR", "PKR1,000,000.00"); // Pakistan Currency - put("PEN", "PEN1,000,000.00"); // Peru Currency - put("PHP", "PHP1,000,000.00"); // Philippines Currency - put("PLN", "PLN1,000,000.00"); // Poland Currency - put("GBP", "GBP1,000,000.00"); // Isle of Man - put("RON", "RON1,000,000.00"); // Romania Currency - put("RUB", "RUB1,000,000.00"); // Russia Currency - put("RSD", "RSD1,000,000.00"); // Serbia Currency - put("SGD", "SGD1,000,000.00"); // Singapore Currency - put("ZAR", "ZAR1,000,000.00"); // South Africa Currency - put("KRW", "KRW1,000,000"); // South Korea Currency - put("LKR", "LKR1,000,000.00"); // Sri Lanka Currency - put("SEK", "SEK1,000,000.00"); // Sweden Currency - put("CHF", "CHF1,000,000.00"); // Switzerland Currency - put("THB", "THB1,000,000.00"); // Thailand Currency - put("TND", "TND1,000,000.000"); // Tunisia Currency - put("AED", "AED1,000,000.00"); // United Arab Emirates Currency - put("UGX", "UGX1,000,000"); // Uganda Currency + put("ALL", "L1,000,000.00"); // Albania Currency + put("ARS", "$1.000.000,00"); // Argentina Currency + put("AMD", "֏1,000,000.00"); // Armenia Currency + put("AUD", "A$1,000,000.00"); // Australia Currency + put("BDT", "Tk1,000,000.00"); // Bangladesh Currency + put("BRL", "R$1,000,000.00"); // Brazil Currency + put("BGN", "лв.1 000 000,00"); // Bulgaria Currency + put("KHR", "៛1,000,000.00"); // Cambodia Currency + put("CAD", "$1,000,000.00"); // Canada Currency + put("CLP", "$1.000.000"); // Chile Currency + put("CNY", "¥1,000,000.00"); // China Currency + put("COP", "$1.000.000,00"); // Colombia Currency + put("HRK", "kn1.000.000,00"); // Croatia Currency + put("CZK", "Kč1 000 000,00"); // Czech Republic Currency + put("DKK", "kr1,000,000.00"); // Denmark Currency + put("EGP", "E£1,000,000.00"); // Egypt Currency + put("EUR", "€1.000.000,00"); // Austria Currency + put("HKD", "HK$1,000,000.00"); // Hong Kong Currency + put("HUF", "Ft1 000 000,00"); // Hungary Currency + put("INR", "₹1,000,000.00"); // India Currency + put("IDR", "rp1,000,000"); // Indonesia Currency + put("JMD", "$1,000,000.00"); // Jamaica Currency + put("JPY", "¥1,000,000"); // Japan Currency + put("JOD", "د.ا1,000,000.00"); // Jordan Currency + put("KZT", "₸1 000 000,00"); // Kazakhstan Currency + put("KES", "KSh1,000,000.00"); // Kenya Currency + put("LAK", "₭1,000,000.00"); // Laos Currency + put("MYR", "RM1,000,000.00"); // Malaysia Currency + put("MXN", "$1,000,000.00"); // Mexico Currency + put("MAD", "د.م.1,000,000.00"); // Morocco Currency + put("ILS", "₪1,000,000.00"); // Israel Currency + put("TWD", "NT$1,000,000"); // Taiwan Currency + put("TRY", "TL1.000.000,00"); // Turkey Currency + put("NZD", "NZ$1,000,000.00"); // New Zealand Currency + put("NGN", "₦1,000,000.00"); // Nigeria Currency + put("NOK", "kr1 000 000,00"); // Norway Currency + put("PKR", "Rs1,000,000.00"); // Pakistan Currency + put("PEN", "S/.1,000,000.00"); // Peru Currency + put("PHP", "₱1,000,000.00"); // Philippines Currency + put("PLN", "zł1 000 000,00"); // Poland Currency + put("GBP", "£1,000,000.00"); // Isle of Man + put("RON", "lei1.000.000,00"); // Romania Currency + put("RUB", "руб1 000 000,00"); // Russia Currency + put("RSD", "Дин.1.000.000,00"); // Serbia Currency + put("SGD", "S$1,000,000.00"); // Singapore Currency + put("ZAR", "R1,000,000.00"); // South Africa Currency + put("KRW", "₩1,000,000"); // South Korea Currency + put("LKR", "රු1,000,000.00"); // Sri Lanka Currency + put("SEK", "kr1,000,000.00"); // Sweden Currency + put("CHF", "1,000,000.00"); // Switzerland Currency + put("THB", "฿1,000,000.00"); // Thailand Currency + put("TND", "د.ت1,000,000.000"); // Tunisia Currency + put("AED", "د.إ1,000,000.00"); // United Arab Emirates Currency + put("UGX", "USh1,000,000"); // Uganda Currency put("USD", "$1,000,000.00"); // United States Currency - put("VND", "VND1,000,000.00"); // Vietnam Currency + put("VND", "₫1.000.000,00"); // Vietnam Currency } }; @@ -85,7 +85,7 @@ public void testAllCurrencyFormats() { for (Map.Entry currencyMap : currenciesMap.entrySet()) { Context context = ApplicationProvider.getApplicationContext(); - String currency = CurrencyParser.getInstance(context).formatCurrency(currencyMap.getKey(), amount); + String currency = CurrencyParser.getInstance(context).formatCurrencyWithSymbol(currencyMap.getKey(), amount); assertThat(currency, is(currencyMap.getValue())); } } @@ -118,4 +118,17 @@ public void testGetNumberOfFractionDigits_NoDigitDecimal(){ int noOfDigits = CurrencyParser.getInstance(context).getNumberOfFractionDigits("JPY"); assertThat(noOfDigits, is(0)); } + + @Test + public void testFXRateWithFourDecimal() + { + assertThat("1.2346",is(CurrencyParser.getValueWithTruncateDecimals("1.234567",4))); + assertThat("1.234",is(CurrencyParser.getValueWithTruncateDecimals("1.234",4))); + assertThat("1.0001",is(CurrencyParser.getValueWithTruncateDecimals("1.000056",4))); + assertThat("1",is(CurrencyParser.getValueWithTruncateDecimals("1",4))); + assertThat("",is(CurrencyParser.getValueWithTruncateDecimals(null,4))); + assertThat("1.235",is(CurrencyParser.getValueWithTruncateDecimals("1.234567",3))); + assertThat("1.23",is(CurrencyParser.getValueWithTruncateDecimals("1.234567",2))); + assertThat("1.2",is(CurrencyParser.getValueWithTruncateDecimals("1.234567",1))); + } } diff --git a/commonui/src/test/java/com/hyperwallet/android/ui/common/util/UtilsTest.java b/commonui/src/test/java/com/hyperwallet/android/ui/common/util/UtilsTest.java index a49604df7..62ff094e0 100644 --- a/commonui/src/test/java/com/hyperwallet/android/ui/common/util/UtilsTest.java +++ b/commonui/src/test/java/com/hyperwallet/android/ui/common/util/UtilsTest.java @@ -20,62 +20,62 @@ public class UtilsTest { private Map currenciesMap = new HashMap() { { - put("ALL", "ALL1,000,000.00"); // Albania Currency - put("ARS", "ARS1,000,000.00"); // Argentina Currency - put("AMD", "AMD1,000,000.00"); // Armenia Currency - put("AUD", "AUD1,000,000.00"); // Australia Currency - put("BDT", "BDT1,000,000.00"); // Bangladesh Currency - put("BRL", "BRL1,000,000.00"); // Brazil Currency - put("BGN", "BGN1,000,000.00"); // Bulgaria Currency - put("KHR", "KHR1,000,000.00"); // Cambodia Currency - put("CAD", "CAD1,000,000.00"); // Canada Currency - put("CLP", "CLP1,000,000"); // Chile Currency - put("CNY", "CNY1,000,000.00"); // China Currency - put("COP", "COP1,000,000.00"); // Colombia Currency - put("HRK", "HRK1,000,000.00"); // Croatia Currency - put("CZK", "CZK1,000,000.00"); // Czech Republic Currency - put("DKK", "DKK1,000,000.00"); // Denmark Currency - put("EGP", "EGP1,000,000.00"); // Egypt Currency - put("EUR", "EUR1,000,000.00"); // Austria Currency - put("HKD", "HKD1,000,000.00"); // Hong Kong Currency - put("HUF", "HUF1,000,000.00"); // Hungary Currency - put("INR", "INR1,000,000.00"); // India Currency - put("IDR", "IDR1,000,000"); // Indonesia Currency - put("JMD", "JMD1,000,000.00"); // Jamaica Currency - put("JPY", "JPY1,000,000"); // Japan Currency - put("JOD", "JOD1,000,000.00"); // Jordan Currency - put("KZT", "KZT1,000,000.00"); // Kazakhstan Currency - put("KES", "KES1,000,000.00"); // Kenya Currency - put("LAK", "LAK1,000,000.00"); // Laos Currency - put("MYR", "MYR1,000,000.00"); // Malaysia Currency - put("MXN", "MXN1,000,000.00"); // Mexico Currency - put("MAD", "MAD1,000,000.00"); // Morocco Currency - put("ILS", "ILS1,000,000.00"); // Israel Currency - put("TWD", "TWD1,000,000"); // Taiwan Currency - put("TRY", "TRY1,000,000.00"); // Turkey Currency - put("NZD", "NZD1,000,000.00"); // New Zealand Currency - put("NGN", "NGN1,000,000.00"); // Nigeria Currency - put("NOK", "NOK1,000,000.00"); // Norway Currency - put("PKR", "PKR1,000,000.00"); // Pakistan Currency - put("PEN", "PEN1,000,000.00"); // Peru Currency - put("PHP", "PHP1,000,000.00"); // Philippines Currency - put("PLN", "PLN1,000,000.00"); // Poland Currency - put("GBP", "GBP1,000,000.00"); // Isle of Man - put("RON", "RON1,000,000.00"); // Romania Currency - put("RUB", "RUB1,000,000.00"); // Russia Currency - put("RSD", "RSD1,000,000.00"); // Serbia Currency - put("SGD", "SGD1,000,000.00"); // Singapore Currency - put("ZAR", "ZAR1,000,000.00"); // South Africa Currency - put("KRW", "KRW1,000,000"); // South Korea Currency - put("LKR", "LKR1,000,000.00"); // Sri Lanka Currency - put("SEK", "SEK1,000,000.00"); // Sweden Currency - put("CHF", "CHF1,000,000.00"); // Switzerland Currency - put("THB", "THB1,000,000.00"); // Thailand Currency - put("TND", "TND1,000,000.000"); // Tunisia Currency - put("AED", "AED1,000,000.00"); // United Arab Emirates Currency - put("UGX", "UGX1,000,000"); // Uganda Currency + put("ALL", "L1,000,000.00"); // Albania Currency + put("ARS", "$1.000.000,00"); // Argentina Currency + put("AMD", "֏1,000,000.00"); // Armenia Currency + put("AUD", "A$1,000,000.00"); // Australia Currency + put("BDT", "Tk1,000,000.00"); // Bangladesh Currency + put("BRL", "R$1,000,000.00"); // Brazil Currency + put("BGN", "лв.1 000 000,00"); // Bulgaria Currency + put("KHR", "៛1,000,000.00"); // Cambodia Currency + put("CAD", "$1,000,000.00"); // Canada Currency + put("CLP", "$1.000.000"); // Chile Currency + put("CNY", "¥1,000,000.00"); // China Currency + put("COP", "$1.000.000,00"); // Colombia Currency + put("HRK", "kn1.000.000,00"); // Croatia Currency + put("CZK", "Kč1 000 000,00"); // Czech Republic Currency + put("DKK", "kr1,000,000.00"); // Denmark Currency + put("EGP", "E£1,000,000.00"); // Egypt Currency + put("EUR", "€1.000.000,00"); // Austria Currency + put("HKD", "HK$1,000,000.00"); // Hong Kong Currency + put("HUF", "Ft1 000 000,00"); // Hungary Currency + put("INR", "₹1,000,000.00"); // India Currency + put("IDR", "rp1,000,000"); // Indonesia Currency + put("JMD", "$1,000,000.00"); // Jamaica Currency + put("JPY", "¥1,000,000"); // Japan Currency + put("JOD", "د.ا1,000,000.00"); // Jordan Currency + put("KZT", "₸1 000 000,00"); // Kazakhstan Currency + put("KES", "KSh1,000,000.00"); // Kenya Currency + put("LAK", "₭1,000,000.00"); // Laos Currency + put("MYR", "RM1,000,000.00"); // Malaysia Currency + put("MXN", "$1,000,000.00"); // Mexico Currency + put("MAD", "د.م.1,000,000.00"); // Morocco Currency + put("ILS", "₪1,000,000.00"); // Israel Currency + put("TWD", "NT$1,000,000"); // Taiwan Currency + put("TRY", "TL1.000.000,00"); // Turkey Currency + put("NZD", "NZ$1,000,000.00"); // New Zealand Currency + put("NGN", "₦1,000,000.00"); // Nigeria Currency + put("NOK", "kr1 000 000,00"); // Norway Currency + put("PKR", "Rs1,000,000.00"); // Pakistan Currency + put("PEN", "S/.1,000,000.00"); // Peru Currency + put("PHP", "₱1,000,000.00"); // Philippines Currency + put("PLN", "zł1 000 000,00"); // Poland Currency + put("GBP", "£1,000,000.00"); // Isle of Man + put("RON", "lei1.000.000,00"); // Romania Currency + put("RUB", "руб1 000 000,00"); // Russia Currency + put("RSD", "Дин.1.000.000,00"); // Serbia Currency + put("SGD", "S$1,000,000.00"); // Singapore Currency + put("ZAR", "R1,000,000.00"); // South Africa Currency + put("KRW", "₩1,000,000"); // South Korea Currency + put("LKR", "රු1,000,000.00"); // Sri Lanka Currency + put("SEK", "kr1,000,000.00"); // Sweden Currency + put("CHF", "1,000,000.00"); // Switzerland Currency + put("THB", "฿1,000,000.00"); // Thailand Currency + put("TND", "د.ت1,000,000.000"); // Tunisia Currency + put("AED", "د.إ1,000,000.00"); // United Arab Emirates Currency + put("UGX", "USh1,000,000"); // Uganda Currency put("USD", "$1,000,000.00"); // United States Currency - put("VND", "VND1,000,000.00"); // Vietnam Currency + put("VND", "₫1.000.000,00"); // Vietnam Currency } }; @@ -85,7 +85,7 @@ public void testAllCurrencyFormats() { for (Map.Entry currencyMap : currenciesMap.entrySet()) { Context context = ApplicationProvider.getApplicationContext(); - String currency = CurrencyParser.getInstance(context).formatCurrency(currencyMap.getKey(), amount); + String currency = CurrencyParser.getInstance(context).formatCurrencyWithSymbol(currencyMap.getKey(), amount); assertThat(currency, is(currencyMap.getValue())); } } diff --git a/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/ListPrepaidCardReceiptsTest.java b/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/ListPrepaidCardReceiptsTest.java index 821ce0a7d..b983784ff 100644 --- a/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/ListPrepaidCardReceiptsTest.java +++ b/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/ListPrepaidCardReceiptsTest.java @@ -77,7 +77,7 @@ protected Intent getActivityIntent() { private TimeZone mDefaultTimeZone; private String usdCurrencySymbol = "$"; - private String cadCurrencySymbol = "CA$"; + private String cadCurrencySymbol = "$"; private String wonCurrencySymbol = "₩"; private String debitSymbol = "-"; private String monthLabel1 = "June 2019"; @@ -317,7 +317,7 @@ public void testListPrepaidCardReceipt_checkDateTextOnLocaleChange() { matches(atPosition(0, hasDescendant(withText(R.string.adjustment))))); onView(withId(R.id.list_receipts)).check( - matches(atPosition(0, hasDescendant(withText(containsString(debitSymbol + "8,90")))))); + matches(atPosition(0, hasDescendant(withText(containsString(debitSymbol + usdCurrencySymbol +"8.90")))))); onView(withId(R.id.list_receipts)).check( matches(atPosition(0, hasDescendant(withText("1. Juni 2019"))))); onView(withId(R.id.list_receipts)).check( diff --git a/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/ListUserReceiptsTest.java b/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/ListUserReceiptsTest.java index ac990fc48..3717d2e69 100644 --- a/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/ListUserReceiptsTest.java +++ b/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/ListUserReceiptsTest.java @@ -2,6 +2,7 @@ import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.action.ViewActions.longClick; import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist; import static androidx.test.espresso.assertion.ViewAssertions.matches; import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant; @@ -28,6 +29,7 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.espresso.IdlingRegistry; import androidx.test.espresso.contrib.RecyclerViewActions; +import androidx.test.espresso.matcher.RootMatchers; import androidx.test.espresso.matcher.ViewMatchers; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.rule.ActivityTestRule; @@ -67,17 +69,17 @@ public class ListUserReceiptsTest { private TimeZone mDefaultTimeZone; private String usdCurrencySymbol = "$"; - private String cadCurrencySymbol = "CA$"; + private String cadCurrencySymbol = "$"; private String krwCurrencySymbol = "₩"; private String debitSymbol = "-"; private String monthLabel1 = "June 2019"; private String monthLabel2 = "December 2018"; - Pair CAD = new Pair("CAD","CA$"); + Pair CAD = new Pair("CAD","$"); Pair USD = new Pair("USD","$"); - Pair EURO = new Pair("EUR", "€"); - Pair KRW = new Pair("KRW", "₩"); - Pair JOD = new Pair("JOD", "JOD"); + Pair EURO = new Pair("EUR","€"); + Pair KRW = new Pair("KRW","₩"); + Pair JOD = new Pair("JOD","د.ا"); @Before public void setup() { @@ -212,7 +214,7 @@ public void testListReceipt_userHasMultipleTransactionCurrencyFormat() { onView(withId(R.id.list_receipts)).check( matches(atPosition(3, hasDescendant(withText(R.string.transfer_to_prepaid_card))))); onView(withId(R.id.list_receipts)).check( - matches(atPosition(3, hasDescendant(withText(debitSymbol + EURO.second.toString() + "10,000,000.00"))))); + matches(atPosition(3, hasDescendant(withText(debitSymbol + EURO.second.toString() + "10.000.000,00 "))))); onView(withId(R.id.list_receipts)).check( matches(atPosition(3, hasDescendant(withText("December 1, 2018"))))); onView(withId(R.id.list_receipts)).check(matches(atPosition(3, hasDescendant(withText(EURO.first.toString()))))); @@ -565,6 +567,39 @@ public void testListReceipt_checkDateTextOnLocaleChange() { onView(withId(R.id.list_receipts)).check(matches(atPosition(0, hasDescendant(withText("2 maggio 2019"))))); } + @Test + public void testListReceipt_selectTransactionDetails() { + mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager + .getResourceContent("receipt_list_response.json")).mock(); + mMockWebServer.mockResponse().withHttpResponseCode(HTTP_NO_CONTENT).withBody("").mock(); + // run test + mActivityTestRule.launchActivity(null); + // assert + onView(allOf(instanceOf(TextView.class), withParent(withId(R.id.toolbar)))) + .check(matches(withText(R.string.title_activity_receipt_list))); + onView(withId(R.id.list_receipts)).check(matches(isDisplayed())); + onView(withId(R.id.list_receipts)).perform(RecyclerViewActions.actionOnItemAtPosition(3, click())); + onView(withId(R.id.transaction_header_text)).check(matches(withText(R.string.mobileTransactionTypeLabel))); + onView(withId(R.id.transaction_type_icon)).check(matches(withText(R.string.debit))); + onView(withId(R.id.transaction_title)).check(matches(withText(R.string.transfer_to_prepaid_card))); + onView(withId(R.id.transaction_title)).perform(longClick()); + onView(withText("Copy")).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed())); + onView(withId(R.id.transaction_amount)).perform(longClick()); + onView(withText("Copy")).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed())); + onView(withId(R.id.transaction_currency)).perform(longClick()); + onView(withText("Copy")).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed())); + onView(withId(R.id.transaction_date)).perform(longClick()); + onView(withText("Copy")).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed())); + onView(withId(R.id.receipt_id_label)).perform(longClick()); + onView(withText("Copy")).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed())); + onView(withId(R.id.receipt_id_value)).perform(longClick()); + onView(withText("Copy")).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed())); + onView(withId(R.id.date_label)).perform(longClick()); + onView(withText("Copy")).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed())); + onView(withId(R.id.date_value)).perform(longClick()); + onView(withText("Copy")).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed())); + } + @Test public void testListReceipt_displaysNetworkErrorDialogOnConnectionTimeout() { mMockWebServer.getServer().enqueue(new MockResponse().setResponseCode(HTTP_OK).setBody(sResourceManager diff --git a/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/TabbedListReceiptsTest.java b/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/TabbedListReceiptsTest.java index 6f29e55b5..80765d3fe 100644 --- a/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/TabbedListReceiptsTest.java +++ b/receiptui/src/androidTest/java/com/hyperwallet/android/ui/receipt/TabbedListReceiptsTest.java @@ -89,7 +89,7 @@ protected Intent getActivityIntent() { private TimeZone mDefaultTimeZone; private String monthLabel1 = "June 2019"; - private String cadCurrencySymbol = "CA$"; + private String cadCurrencySymbol = "$"; private String usdCurrencySymbol = "$"; private String debitSymbol = "-"; Pair KRW = new Pair("KRW", "₩"); diff --git a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListPrepaidCardReceiptActivity.java b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListPrepaidCardReceiptActivity.java index 3f126a101..786cefaf5 100644 --- a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListPrepaidCardReceiptActivity.java +++ b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListPrepaidCardReceiptActivity.java @@ -52,7 +52,6 @@ public class ListPrepaidCardReceiptActivity extends AppCompatActivity implements @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_list_prepaid_card_receipt); diff --git a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListReceiptFragment.java b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListReceiptFragment.java index 237640deb..385150ebc 100644 --- a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListReceiptFragment.java +++ b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListReceiptFragment.java @@ -287,7 +287,7 @@ public void onOneClick(View v) { transactionAmount.setTextColor(transactionAmount.getContext() .getResources().getColor(R.color.positiveColor)); transactionAmount.setText( - CurrencyParser.getInstance(itemView.getContext()).formatCurrency(receipt.getCurrency(), + CurrencyParser.getInstance(itemView.getContext()).formatCurrencyWithSymbol(receipt.getCurrency(), receipt.getAmount())); transactionTypeIcon.setTextColor(transactionTypeIcon.getContext() .getResources().getColor(R.color.positiveColor)); @@ -298,7 +298,7 @@ public void onOneClick(View v) { transactionTypeIcon.setTextColor(transactionTypeIcon.getContext() .getResources().getColor(R.color.negativeColor)); transactionAmount.setText(transactionAmount.getContext().getString(R.string.debit_sign, - CurrencyParser.getInstance(itemView.getContext()).formatCurrency(receipt.getCurrency(), + CurrencyParser.getInstance(itemView.getContext()).formatCurrencyWithSymbol(receipt.getCurrency(), receipt.getAmount()))); transactionTypeIcon.setText(transactionTypeIcon.getContext().getText(R.string.debit)); } diff --git a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListReceiptsFragment.java b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListReceiptsFragment.java index e8e6e3272..f66ee74b2 100644 --- a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListReceiptsFragment.java +++ b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListReceiptsFragment.java @@ -76,19 +76,22 @@ public class ListReceiptsFragment extends Fragment { private View mEmptyTransactionPlaceholder; private TextView mEmptyTransactionTextView; private Boolean mShouldShowNoTransactionPlaceholder = Boolean.FALSE; + private Boolean mLockScreenToPortrait = false; private ListReceiptsFragmentCallback callback; - static ListReceiptsFragment newInstance() { + static ListReceiptsFragment newInstance(boolean lockScreenToPortrait) { ListReceiptsFragment listReceiptsFragment = new ListReceiptsFragment(); + listReceiptsFragment.mLockScreenToPortrait = lockScreenToPortrait; return listReceiptsFragment; } - static ListReceiptsFragment newInstance(String prepaidCardToken) { + static ListReceiptsFragment newInstance(String prepaidCardToken, boolean lockScreenToPortrait) { ListReceiptsFragment fragment = new ListReceiptsFragment(); Bundle internalState = new Bundle(); internalState.putString(ARGUMENT_PREPAID_CARD_TOKEN, prepaidCardToken); fragment.setArguments(internalState); fragment.mPrepaidCardToken = prepaidCardToken; + fragment.mLockScreenToPortrait = lockScreenToPortrait; return fragment; } @@ -214,9 +217,7 @@ private void navigate(@NonNull final Event event) { Intent intent = new Intent(getActivity(), ReceiptDetailActivity.class); intent.putExtra(ReceiptDetailActivity.EXTRA_RECEIPT, event.getContent()); - intent.putExtra(ReceiptDetailActivity.EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, - getActivity().getIntent().getBooleanExtra( - TabbedListReceiptsActivity.EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, false)); + intent.putExtra(ReceiptDetailActivity.EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, mLockScreenToPortrait); startActivity(intent); } } @@ -322,7 +323,7 @@ public void onOneClick(View v) { transactionAmount.setTextColor(transactionAmount.getContext() .getResources().getColor(R.color.positiveColor)); transactionAmount.setText( - CurrencyParser.getInstance(itemView.getContext()).formatCurrency(receipt.getCurrency(), + CurrencyParser.getInstance(itemView.getContext()).formatCurrencyWithSymbol(receipt.getCurrency(), receipt.getAmount())); transactionTypeIcon.setTextColor(transactionTypeIcon.getContext() .getResources().getColor(R.color.positiveColor)); @@ -333,7 +334,7 @@ public void onOneClick(View v) { transactionTypeIcon.setTextColor(transactionTypeIcon.getContext() .getResources().getColor(R.color.negativeColor)); transactionAmount.setText(transactionAmount.getContext().getString(R.string.debit_sign, - CurrencyParser.getInstance(itemView.getContext()).formatCurrency(receipt.getCurrency(), + CurrencyParser.getInstance(itemView.getContext()).formatCurrencyWithSymbol(receipt.getCurrency(), receipt.getAmount()))); transactionTypeIcon.setText(transactionTypeIcon.getContext().getText(R.string.debit)); } diff --git a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListUserReceiptActivity.java b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListUserReceiptActivity.java index 08f2e1142..7b6221b1e 100644 --- a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListUserReceiptActivity.java +++ b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ListUserReceiptActivity.java @@ -51,7 +51,6 @@ public class ListUserReceiptActivity extends AppCompatActivity implements OnNetw @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_list_user_receipt); diff --git a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ReceiptDetailActivity.java b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ReceiptDetailActivity.java index f8966609a..070766b53 100644 --- a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ReceiptDetailActivity.java +++ b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ReceiptDetailActivity.java @@ -41,7 +41,6 @@ public class ReceiptDetailActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_receipt_detail); diff --git a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ReceiptDetailFragment.java b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ReceiptDetailFragment.java index 71c4753a8..16c0163a1 100644 --- a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ReceiptDetailFragment.java +++ b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/ReceiptDetailFragment.java @@ -17,15 +17,14 @@ package com.hyperwallet.android.ui.receipt.view; import static android.text.format.DateUtils.FORMAT_ABBREV_MONTH; -import static android.text.format.DateUtils.FORMAT_ABBREV_WEEKDAY; import static android.text.format.DateUtils.FORMAT_SHOW_DATE; import static android.text.format.DateUtils.FORMAT_SHOW_TIME; -import static android.text.format.DateUtils.FORMAT_SHOW_WEEKDAY; import static android.text.format.DateUtils.FORMAT_SHOW_YEAR; import static android.text.format.DateUtils.formatDateTime; import static com.hyperwallet.android.model.receipt.Receipt.Entries.CREDIT; import static com.hyperwallet.android.model.receipt.Receipt.Entries.DEBIT; +import static com.hyperwallet.android.ui.common.util.CurrencyParser.getValueWithTruncateDecimals; import android.content.Context; import android.os.Build; @@ -117,11 +116,27 @@ private void setTransactionView(@NonNull final Receipt receipt, @NonNull final V TextView transactionCurrency = view.findViewById(R.id.transaction_currency); String currencyString = Currency.getInstance(receipt.getCurrency()).getSymbol(Locale.getDefault()); + transactionTitle.setTextIsSelectable(true); + transactionTitle.setLongClickable(true); + transactionTitle.setFocusable(true); + + transactionDate.setTextIsSelectable(true); + transactionDate.setLongClickable(true); + transactionDate.setFocusable(true); + + transactionAmount.setTextIsSelectable(true); + transactionAmount.setLongClickable(true); + transactionAmount.setFocusable(true); + + transactionCurrency.setTextIsSelectable(true); + transactionCurrency.setLongClickable(true); + transactionCurrency.setFocusable(true); + if (CREDIT.equals(receipt.getEntry())) { transactionAmount.setTextColor(transactionAmount.getContext() .getResources().getColor(R.color.positiveColor)); transactionAmount.setText( - CurrencyParser.getInstance(view.getContext()).formatCurrency(receipt.getCurrency(), + CurrencyParser.getInstance(view.getContext()).formatCurrencyWithSymbol(receipt.getCurrency(), receipt.getAmount())); transactionTypeIcon.setTextColor(transactionTypeIcon.getContext() .getResources().getColor(R.color.positiveColor)); @@ -130,7 +145,7 @@ private void setTransactionView(@NonNull final Receipt receipt, @NonNull final V transactionAmount.setTextColor(transactionAmount.getContext() .getResources().getColor(R.color.negativeColor)); transactionAmount.setText(transactionAmount.getContext().getString(R.string.debit_sign, - CurrencyParser.getInstance(view.getContext()).formatCurrency(receipt.getCurrency(), + CurrencyParser.getInstance(view.getContext()).formatCurrencyWithSymbol(receipt.getCurrency(), receipt.getAmount()))); transactionTypeIcon.setTextColor(transactionTypeIcon.getContext() .getResources().getColor(R.color.negativeColor)); @@ -165,15 +180,15 @@ private void setFeeDetailsView(@NonNull final Receipt receipt, @NonNull final Vi String currencySymbol = Currency.getInstance(receipt.getCurrency()).getSymbol(Locale.getDefault()); TextView amountView = view.findViewById(R.id.details_amount_value); - amountView.setText(CurrencyParser.getInstance(view.getContext()).formatCurrency(receipt.getCurrency(), + amountView.setText(CurrencyParser.getInstance(view.getContext()).formatCurrencyWithSymbol(receipt.getCurrency(), receipt.getAmount()) + " " + receipt.getCurrency()); TextView fee = view.findViewById(R.id.details_fee_value); - fee.setText(CurrencyParser.getInstance(view.getContext()).formatCurrency(receipt.getCurrency(), + fee.setText(CurrencyParser.getInstance(view.getContext()).formatCurrencyWithSymbol(receipt.getCurrency(), receipt.getFee()) + " " + receipt.getCurrency()); TextView transfer = view.findViewById(R.id.details_transfer_amount_value); - transfer.setText(CurrencyParser.getInstance(view.getContext()).formatCurrency(receipt.getCurrency(), + transfer.setText(CurrencyParser.getInstance(view.getContext()).formatCurrencyWithSymbol(receipt.getCurrency(), transferAmountTotal) + " " + receipt.getCurrency()); } } @@ -213,8 +228,14 @@ private void setDetailsView(@NonNull final Receipt receipt, @NonNull final View } if (!TextUtils.isEmpty(receiptDetails.getNotes())) { - setViewInformation(R.id.receipt_notes_information, R.id.notes_value, - view, receiptDetails.getNotes()); + if (receipt.getForeignExchangeRate() != null) { + String fxRate = getValueWithTruncateDecimals(receipt.getForeignExchangeRate(),4); + setViewInformation(R.id.receipt_notes_information, R.id.notes_value, + view, receiptDetails.getNotes().replace(receipt.getForeignExchangeRate(), fxRate)); + } else { + setViewInformation(R.id.receipt_notes_information, R.id.notes_value, + view, receiptDetails.getNotes()); + } } } } diff --git a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/TabbedListReceiptsActivity.java b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/TabbedListReceiptsActivity.java index c5cc2bd69..e011576a7 100644 --- a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/TabbedListReceiptsActivity.java +++ b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/TabbedListReceiptsActivity.java @@ -51,7 +51,6 @@ public class TabbedListReceiptsActivity extends AppCompatActivity implements OnN @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_tabbed_list_receipt); @@ -67,15 +66,16 @@ public void onClick(View v) { } }); - if (getIntent().getBooleanExtra(EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, false)) { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - } - mTabbedListReceiptsViewModel = ViewModelProviders.of(this, new TabbedListReceiptsViewModel.TabbedListReceiptsViewModelFactory(new UserRepositoryImpl(), new PrepaidCardRepositoryImpl())) .get(TabbedListReceiptsViewModel.class); + if (getIntent().getBooleanExtra(EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, false)) { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + mTabbedListReceiptsViewModel.setPortraitMode(true); + } + registerObservers(); if (savedInstanceState == null) { diff --git a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/TabbedListReceiptsFragment.java b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/TabbedListReceiptsFragment.java index ed0805574..0b053769b 100644 --- a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/TabbedListReceiptsFragment.java +++ b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/view/TabbedListReceiptsFragment.java @@ -197,9 +197,9 @@ public Fragment getItem(int position) { if (prepaidCard != null && prepaidCard.getField(TOKEN) != null) { token = prepaidCard.getField(TOKEN); } - return ListReceiptsFragment.newInstance(token); + return ListReceiptsFragment.newInstance(token, mTabbedListReceiptsViewModel.isPortraitMode()); } - return ListReceiptsFragment.newInstance(); + return ListReceiptsFragment.newInstance(mTabbedListReceiptsViewModel.isPortraitMode()); } @Nullable diff --git a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/viewmodel/TabbedListReceiptsViewModel.java b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/viewmodel/TabbedListReceiptsViewModel.java index dcf2d6190..3c4440eda 100644 --- a/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/viewmodel/TabbedListReceiptsViewModel.java +++ b/receiptui/src/main/java/com/hyperwallet/android/ui/receipt/viewmodel/TabbedListReceiptsViewModel.java @@ -48,6 +48,7 @@ public class TabbedListReceiptsViewModel extends ViewModel { private MutableLiveData retryListReceipts = new MutableLiveData(); public ProgramModel mProgramModel; private boolean mIsInitialized; + private boolean mIsPortraitMode; public MutableLiveData getUser() { return mUser; @@ -70,6 +71,14 @@ public MutableLiveData getRetryListReceipts() { return retryListReceipts; } + public boolean isPortraitMode() { + return mIsPortraitMode; + } + + public void setPortraitMode(final boolean portraitMode) { + mIsPortraitMode = portraitMode; + } + public TabbedListReceiptsViewModel( UserRepository mUserRepository, PrepaidCardRepository prepaidCardRepository) { diff --git a/receiptui/src/main/res/layout/fragment_receipt_detail.xml b/receiptui/src/main/res/layout/fragment_receipt_detail.xml index 53689e370..3c4471751 100644 --- a/receiptui/src/main/res/layout/fragment_receipt_detail.xml +++ b/receiptui/src/main/res/layout/fragment_receipt_detail.xml @@ -92,6 +92,9 @@ android:layout_alignParentTop="true" android:layout_marginTop="@dimen/grid_margin_top" android:text="@string/mobileJournalNumberLabel" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Body1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -108,6 +111,9 @@ android:layout_toEndOf="@+id/receipt_id_label" android:layout_marginTop="@dimen/grid_margin_top" android:layout_marginBottom="0dp" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" tools:text="@string/text_placeholder" android:textAppearance="@style/TextAppearance.Hyperwallet.Caption" app:layout_constraintEnd_toEndOf="parent" @@ -127,6 +133,9 @@ android:layout_height="wrap_content" android:paddingTop="@dimen/item_text_top_bottom_margin" android:text="@string/date" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Body1" /> @@ -158,6 +170,9 @@ android:layout_alignParentTop="true" android:layout_marginTop="@dimen/item_text_top_bottom_margin" android:text="@string/mobileMerchantTxnLabel" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Body1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintStart_toStartOf="parent" /> @@ -175,6 +190,9 @@ android:layout_toEndOf="@+id/client_id_label" android:gravity="end" tools:text="@string/text_placeholder" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Caption" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> @@ -196,6 +214,9 @@ android:layout_alignParentTop="true" android:layout_marginTop="@dimen/item_text_top_bottom_margin" android:text="@string/mobileCharityName" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Body1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintStart_toStartOf="parent"/> @@ -210,6 +231,9 @@ android:layout_toEndOf="@+id/charity_label" android:gravity="end" tools:text="@string/text_placeholder" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Caption" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent"/> @@ -231,6 +255,9 @@ android:layout_alignParentTop="true" android:layout_marginTop="@dimen/item_text_top_bottom_margin" android:text="@string/mobileCheckNumber" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Body1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintStart_toStartOf="parent" /> @@ -246,6 +273,9 @@ android:layout_toEndOf="@+id/check_number_label" android:gravity="end" tools:text="@string/text_placeholder" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Caption" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> @@ -267,6 +297,9 @@ android:layout_alignParentTop="true" android:layout_marginTop="@dimen/item_text_top_bottom_margin" android:text="@string/mobilePromoWebsite" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Body1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintStart_toStartOf="parent" /> @@ -282,6 +315,9 @@ android:layout_toEndOf="@+id/website_label" android:gravity="end" tools:text="@string/text_placeholder" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Caption" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> @@ -326,6 +362,9 @@ android:layout_marginTop="@dimen/grid_margin_top" android:layout_marginBottom="@dimen/grid_margin_bottom" tools:text="@string/text_placeholder" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Caption" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> @@ -374,6 +413,9 @@ android:layout_alignParentTop="true" android:layout_marginTop="@dimen/grid_margin_top" android:text="@string/amount" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Body1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -391,6 +433,9 @@ android:layout_marginTop="@dimen/grid_margin_top" android:layout_marginBottom="0dp" tools:text="@string/text_placeholder" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Caption" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -412,6 +457,9 @@ android:layout_alignParentTop="true" android:layout_marginTop="@dimen/grid_margin_top" android:text="@string/mobileFeeLabel" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Body1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -429,6 +477,9 @@ android:layout_marginTop="@dimen/grid_margin_top" android:layout_marginBottom="0dp" tools:text="@string/text_placeholder" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Caption" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -450,6 +501,9 @@ android:layout_alignParentTop="true" android:layout_marginTop="@dimen/grid_margin_top" android:text="@string/mobileTransactionDetailsTotal" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Body1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -467,6 +521,9 @@ android:layout_marginTop="@dimen/grid_margin_top" android:layout_marginBottom="0dp" tools:text="@string/text_placeholder" + android:textIsSelectable="true" + android:focusable="true" + android:longClickable="true" android:textAppearance="@style/TextAppearance.Hyperwallet.Caption" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/transfermethodrepository/src/main/java/com/hyperwallet/android/ui/transfermethod/repository/TransferMethodConfigurationRepository.java b/transfermethodrepository/src/main/java/com/hyperwallet/android/ui/transfermethod/repository/TransferMethodConfigurationRepository.java index 69ee0ab90..153d3c87e 100644 --- a/transfermethodrepository/src/main/java/com/hyperwallet/android/ui/transfermethod/repository/TransferMethodConfigurationRepository.java +++ b/transfermethodrepository/src/main/java/com/hyperwallet/android/ui/transfermethod/repository/TransferMethodConfigurationRepository.java @@ -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); diff --git a/transfermethodrepository/src/main/java/com/hyperwallet/android/ui/transfermethod/repository/TransferMethodConfigurationRepositoryImpl.java b/transfermethodrepository/src/main/java/com/hyperwallet/android/ui/transfermethod/repository/TransferMethodConfigurationRepositoryImpl.java index a6a2793a9..da6153fe9 100644 --- a/transfermethodrepository/src/main/java/com/hyperwallet/android/ui/transfermethod/repository/TransferMethodConfigurationRepositoryImpl.java +++ b/transfermethodrepository/src/main/java/com/hyperwallet/android/ui/transfermethod/repository/TransferMethodConfigurationRepositoryImpl.java @@ -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; @@ -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() { + @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, @@ -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, diff --git a/transfermethodrepository/src/test/resources/successful_tmc_fields_bank_account_response.json b/transfermethodrepository/src/test/resources/successful_tmc_fields_bank_account_response.json index 238492d0b..f3265003c 100644 --- a/transfermethodrepository/src/test/resources/successful_tmc_fields_bank_account_response.json +++ b/transfermethodrepository/src/test/resources/successful_tmc_fields_bank_account_response.json @@ -1,6 +1,6 @@ { "data": { - "transferMethodUIConfigurations": { + "transferMethodCreateUIConfigurations": { "nodes": [ { "country": "US", diff --git a/transfermethodui/src/androidTest/java/com/hyperwallet/android/ui/transfermethod/SelectTransferMethodTest.java b/transfermethodui/src/androidTest/java/com/hyperwallet/android/ui/transfermethod/SelectTransferMethodTest.java index 29106e351..ee3f23761 100644 --- a/transfermethodui/src/androidTest/java/com/hyperwallet/android/ui/transfermethod/SelectTransferMethodTest.java +++ b/transfermethodui/src/androidTest/java/com/hyperwallet/android/ui/transfermethod/SelectTransferMethodTest.java @@ -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())); @@ -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()); @@ -126,7 +135,7 @@ public void testSelectTransferMethod_verifyCountrySelectionList() { onView(allOf(instanceOf(TextView.class), withParent(withId(R.id.country_selection_toolbar)))).check( matches(withText(R.string.mobileCountryRegion))); onView(withId(R.id.search_button)).check(doesNotExist()); - onView(withId(R.id.country_selection_list)).check(new RecyclerViewCountAssertion(5)); + onView(withId(R.id.country_selection_list)).check(new RecyclerViewCountAssertion(6)); onView(allOf(withId(R.id.country_name), withText("Canada"))).check(matches(isDisplayed())); onView(allOf(withId(R.id.country_name), withText("Croatia"))).check(matches(isDisplayed())); onView(allOf(withId(R.id.country_name), withText("Mexico"))).check(matches(isDisplayed())); @@ -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()); @@ -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()); @@ -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"))); @@ -207,10 +236,12 @@ public void testSelectTransferMethod_verifyTransferMethodsList() { matches(atPosition(0, hasDescendant(withText(R.string.bank_account))))); String bankCardFee = InstrumentationRegistry.getInstrumentation().getTargetContext() - .getString(R.string.feeAndProcessingTimeInformation, usdDollarSymbol + "2.00", "1-2 Business days"); + .getString(R.string.feeInformation, usdDollarSymbol + "2.00"); + String bankCardProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "1-2 Business days"); onView(withId(R.id.select_transfer_method_types_list)).check( - matches(atPosition(0, hasDescendant(withText(bankCardFee))))); + matches(atPosition(0, hasDescendant(withText(bankCardFee+bankCardProcessingTime))))); onView(withId(R.id.select_transfer_method_types_list)).check( matches(atPosition(1, hasDescendant(withText(R.string.bank_card_font_icon))))); @@ -218,10 +249,13 @@ public void testSelectTransferMethod_verifyTransferMethodsList() { matches(atPosition(1, hasDescendant(withText(R.string.bank_card))))); String debitCardFee = InstrumentationRegistry.getInstrumentation().getTargetContext() - .getString(R.string.feeAndProcessingTimeInformation, usdDollarSymbol + "1.75", "IMMEDIATE"); + .getString(R.string.feeInformation, usdDollarSymbol + "1.75"); + + String debitCardProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "IMMEDIATE"); onView(withId(R.id.select_transfer_method_types_list)).check( - matches(atPosition(1, hasDescendant(withText(debitCardFee))))); + matches(atPosition(1, hasDescendant(withText(debitCardFee+debitCardProcessingTime))))); onView(withId(R.id.select_transfer_method_types_list)).check( @@ -233,10 +267,12 @@ public void testSelectTransferMethod_verifyTransferMethodsList() { matches(atPosition(2, hasDescendant(wireAccountViewMatchers)))); String wireTransferFee = InstrumentationRegistry.getInstrumentation().getTargetContext() - .getString(R.string.feeAndProcessingTimeInformation, usdDollarSymbol + "20.00", "1-3 Business days"); + .getString(R.string.feeInformation, usdDollarSymbol + "20.00"); + String wireTransferProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "1-3 Business days"); onView(withId(R.id.select_transfer_method_types_list)).check( - matches(atPosition(2, hasDescendant(withText(wireTransferFee))))); + matches(atPosition(2, hasDescendant(withText(wireTransferFee+wireTransferProcessingTime))))); onView(withId(R.id.select_transfer_method_types_list)).check( matches(atPosition(3, hasDescendant(withText(R.string.paypal_account_font_icon))))); @@ -244,10 +280,12 @@ public void testSelectTransferMethod_verifyTransferMethodsList() { matches(atPosition(3, hasDescendant(withText("PayPal"))))); String paypalFee = InstrumentationRegistry.getInstrumentation().getTargetContext() - .getString(R.string.feeAndProcessingTimeInformation, usdDollarSymbol + "0.25", "IMMEDIATE"); + .getString(R.string.feeInformation, usdDollarSymbol + "0.25"); + String paypalProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "IMMEDIATE"); onView(withId(R.id.select_transfer_method_types_list)).check( - matches(atPosition(3, hasDescendant(withText(paypalFee))))); + matches(atPosition(3, hasDescendant(withText(paypalFee+paypalProcessingTime))))); } @Test @@ -257,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"))); @@ -268,7 +310,7 @@ public void testSelectTransferMethod_verifyTransferMethodsListEmptyFee() { onView(withId(R.id.select_transfer_method_types_list)).check( matches(atPosition(0, hasDescendant(withText(R.string.bank_account))))); onView(withId(R.id.select_transfer_method_types_list)).check( - matches(atPosition(0, hasDescendant(withText("1-2 Business days"))))); + matches(atPosition(0, hasDescendant(withText("No fee \u2022 1-2 Business days"))))); } @Test @@ -278,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"))); @@ -302,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"))); @@ -318,10 +372,12 @@ public void testSelectTransferMethod_verifyTransferMethodsListUpdatedOnSelection matches(atPosition(0, hasDescendant(withText(R.string.bank_account))))); String bankAccountFee = InstrumentationRegistry.getInstrumentation().getTargetContext() - .getString(R.string.feeAndProcessingTimeInformation, cdnDollarSymbol + "2.20", "1-2 Business days"); + .getString(R.string.feeInformation, cdnDollarSymbol + "2.20"); + String bankCardProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "1-2 Business days"); onView(withId(R.id.select_transfer_method_types_list)).check( - matches(atPosition(0, hasDescendant(withText(bankAccountFee))))); + matches(atPosition(0, hasDescendant(withText(bankAccountFee+bankCardProcessingTime))))); onView(withId(R.id.select_transfer_method_types_list)).check( matches(atPosition(1, hasDescendant(withText(R.string.paypal_account_font_icon))))); @@ -329,10 +385,12 @@ public void testSelectTransferMethod_verifyTransferMethodsListUpdatedOnSelection matches(atPosition(1, hasDescendant(withText("PayPal"))))); String paypalFee = InstrumentationRegistry.getInstrumentation().getTargetContext() - .getString(R.string.feeAndProcessingTimeInformation, cdnDollarSymbol + "0.25", "IMMEDIATE"); + .getString(R.string.feeInformation, cdnDollarSymbol + "0.25"); + String paypalProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "IMMEDIATE"); onView(withId(R.id.select_transfer_method_types_list)).check( - matches(atPosition(1, hasDescendant(withText(paypalFee))))); + matches(atPosition(1, hasDescendant(withText(paypalFee+paypalProcessingTime))))); } @Test @@ -341,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(); @@ -360,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(); @@ -379,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(); @@ -396,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(); @@ -414,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"))); @@ -427,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"))); @@ -440,9 +521,116 @@ 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"))); onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD"))); } + + @Test + public void testSelectTransferMethod_verifyNoFeeLabelsDisplayed() { + mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager + .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_keys_no_fee_response.json")).mock(); + + mActivityTestRule.launchActivity(null); + + onView(withId(R.id.toolbar)).check(matches(isDisplayed())); + onView(withText(R.string.mobileAddTransferMethodHeader)).check(matches(withParent(withId(R.id.toolbar)))); + + onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States"))); + onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD"))); + onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(4)); + + onView(withId(R.id.select_transfer_method_country_value)).perform(click()); + onView(allOf(withId(R.id.country_name), withText("CHINA"))).perform(click()); + + String bankAccountFee = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.noFee); + String bankAccountProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "1-2 Business days"); + + onView(withId(R.id.select_transfer_method_types_list)).check( + matches(atPosition(0, hasDescendant(withText(bankAccountFee+bankAccountProcessingTime))))); + + + String bankCardFee = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.noFee); + String bankCardProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "IMMEDIATE"); + + onView(withId(R.id.select_transfer_method_types_list)).check( + matches(atPosition(1, hasDescendant(withText(bankCardFee+bankCardProcessingTime))))); + + + + String wireTransferFee = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.noFee); + String wireTransferProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "1-3 Business days"); + + onView(withId(R.id.select_transfer_method_types_list)).check( + matches(atPosition(2, hasDescendant(withText(wireTransferFee+wireTransferProcessingTime))))); + + String paypalTransferFee = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.noFee); + String paypalTransferProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "IMMEDIATE"); + + onView(withId(R.id.select_transfer_method_types_list)).check( + matches(atPosition(3, hasDescendant(withText(paypalTransferFee+paypalTransferProcessingTime))))); + + + } + + @Test + public void testSelectTransferMethod_verifyMixedFeeIsDisplayed() { + mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager + .getResourceContent("user_response.json")).mock(); + 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())); + onView(withText(R.string.mobileAddTransferMethodHeader)).check(matches(withParent(withId(R.id.toolbar)))); + + onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States"))); + onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD"))); + onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(4)); + + onView(withId(R.id.select_transfer_method_country_value)).perform(click()); + onView(allOf(withId(R.id.country_name), withText("CHINA"))).perform(click()); + + String mixedFee = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.fee_mix_formatter,usdDollarSymbol,"5.00","4.50","4.00","10.00"); + + String venmoTransferFee = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.feeInformation,mixedFee); + + String venmoTransferProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext() + .getString(R.string.processingTimeInformation, "1-2 Business days"); + + onView(withId(R.id.select_transfer_method_types_list)).check( + matches(atPosition(4, hasDescendant(withText(venmoTransferFee+venmoTransferProcessingTime))))); + + + } } diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/AddTransferMethodFragment.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/AddTransferMethodFragment.java index dde95a619..e52d53610 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/AddTransferMethodFragment.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/AddTransferMethodFragment.java @@ -28,6 +28,7 @@ import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodTypes.WIRE_ACCOUNT; import static com.hyperwallet.android.ui.common.intent.HyperwalletIntent.EXTRA_TRANSFER_METHOD_ADDED; import static com.hyperwallet.android.ui.transfermethod.TransferMethodLocalBroadcast.TransferMethodLocalBroadcastAction.ACTION_HYPERWALLET_TRANSFER_METHOD_ADDED; +import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.getFormattedFeeAndProcessingTime; import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.isFeeAvailable; import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.isProcessingTimeAvailable; @@ -408,22 +409,12 @@ public void showTransactionInformation(@NonNull final List fees, View container = getView().findViewById(R.id.add_transfer_method_static_container); TextView feeAndProcessingTime = getView().findViewById(R.id.add_transfer_method_information); - if (isFeeAvailable(fees) && isProcessingTimeAvailable(processingTime)) { - String formattedFee = FeeFormatter.getFormattedFee(header.getContext(), fees); - feeAndProcessingTime.setVisibility(View.VISIBLE); - feeAndProcessingTime.setText( - feeAndProcessingTime.getContext().getString(R.string.feeAndProcessingTimeInformation, formattedFee, - processingTime.getValue())); - } else if (isFeeAvailable(fees) && !isProcessingTimeAvailable(processingTime)) { - String formattedFee = FeeFormatter.getFormattedFee(header.getContext(), fees); + if (!isFeeAvailable(fees) && !isProcessingTimeAvailable(processingTime)) { + feeAndProcessingTime.setVisibility(View.GONE); + } else { feeAndProcessingTime.setVisibility(View.VISIBLE); feeAndProcessingTime.setText( - feeAndProcessingTime.getContext().getString(R.string.feeInformation, formattedFee)); - } else if (isProcessingTimeAvailable(processingTime) && !isFeeAvailable(fees)) { - feeAndProcessingTime.setVisibility(View.VISIBLE); - feeAndProcessingTime.setText(processingTime.getValue()); - } else { - feeAndProcessingTime.setVisibility(View.GONE); + getFormattedFeeAndProcessingTime(feeAndProcessingTime.getContext(), fees, processingTime)); } if (feeAndProcessingTime.getVisibility() == View.VISIBLE) { diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/FeeFormatter.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/FeeFormatter.java index ad092748d..b97c4ef5d 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/FeeFormatter.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/FeeFormatter.java @@ -35,7 +35,7 @@ public class FeeFormatter { public static String getFormattedFee(@NonNull final Context context, @NonNull final List fees) { - String formattedString = context.getResources().getString(R.string.unknown); + String formattedString = context.getResources().getString(R.string.noFee); if (fees.size() == 1) { formattedString = getSingleFormattedFee(context, fees, formattedString); } else { @@ -48,10 +48,13 @@ private static String getSingleFormattedFee(@NonNull Context context, @NonNull L String formattedString) { Fee fee = fees.get(0); if (Fee.FeeRate.FLAT.equals(fee.getFeeRateType())) { + if (!isValidFee(fee.getValue())) { + return formattedString; + } formattedString = context.getResources().getString(R.string.fee_flat_formatter, Currency.getInstance(fee.getCurrency()).getSymbol(Locale.getDefault()), fee.getValue()); } else if (Fee.FeeRate.PERCENT.equals(fee.getFeeRateType())) { - formattedString = getPercentFormattedFee(context, fee); + formattedString = getPercentFormattedFee(context, fee, formattedString); } return formattedString; } @@ -72,18 +75,48 @@ private static String getMixFormattedFee(@NonNull Context context, @NonNull List if (flatFee != null && percentFee != null) { String minimumAmount = percentFee.getMin(); String maximumAmount = percentFee.getMax(); - if (maximumAmount.isEmpty() && minimumAmount.isEmpty()) { + + if (!isValidFee(flatFee.getValue()) && !isValidFee(percentFee.getValue())) { + return formattedString; + } else if (maximumAmount.isEmpty() && minimumAmount.isEmpty() && !isValidFee(percentFee.getValue())) { + formattedString = context.getResources().getString(R.string.fee_flat_formatter, + Currency.getInstance(flatFee.getCurrency()).getSymbol(Locale.getDefault()), flatFee.getValue()); + } else if (maximumAmount.isEmpty() && minimumAmount.isEmpty() && !isValidFee(flatFee.getValue())) { + formattedString = context.getResources().getString(R.string.fee_percent_no_min_and_max_formatter, + percentFee.getValue()); + } else if (maximumAmount.isEmpty() && minimumAmount.isEmpty()) { formattedString = context.getResources().getString(R.string.fee_mix_no_min_and_max_formatter, Currency.getInstance(flatFee.getCurrency()).getSymbol(Locale.getDefault()), flatFee.getValue(), percentFee.getValue()); + } else if (maximumAmount.isEmpty() && !isValidFee(percentFee.getValue())) { + formattedString = context.getResources().getString(R.string.fee_flat_formatter, + Currency.getInstance(flatFee.getCurrency()).getSymbol(Locale.getDefault()), flatFee.getValue()); + } else if (maximumAmount.isEmpty() && !isValidFee(flatFee.getValue())) { + formattedString = context.getResources().getString(R.string.fee_percent_only_min_formatter, + percentFee.getValue(), + percentFee.getCurrency(), minimumAmount); } else if (maximumAmount.isEmpty()) { formattedString = context.getResources().getString(R.string.fee_mix_only_min_formatter, Currency.getInstance(flatFee.getCurrency()).getSymbol(Locale.getDefault()), flatFee.getValue(), percentFee.getValue(), minimumAmount); + } else if (minimumAmount.isEmpty() && !isValidFee(percentFee.getValue())) { + formattedString = context.getResources().getString(R.string.fee_flat_formatter, + Currency.getInstance(flatFee.getCurrency()).getSymbol(Locale.getDefault()), flatFee.getValue()); + } else if (minimumAmount.isEmpty() && !isValidFee(flatFee.getValue())) { + formattedString = context.getResources().getString(R.string.fee_percent_only_max_formatter, + percentFee.getValue(), + percentFee.getCurrency(), maximumAmount); } else if (minimumAmount.isEmpty()) { formattedString = context.getResources().getString(R.string.fee_mix_only_max_formatter, Currency.getInstance(flatFee.getCurrency()).getSymbol(Locale.getDefault()), flatFee.getValue(), percentFee.getValue(), maximumAmount); + } else if (isValidFee(percentFee.getValue()) && !isValidFee(flatFee.getValue())) { + formattedString = context.getResources().getString(R.string.fee_percent_formatter, + percentFee.getValue(), + percentFee.getCurrency(), minimumAmount, maximumAmount); + } else if (isValidFee(flatFee.getValue()) && !isValidFee(percentFee.getValue())) { + formattedString = context.getResources().getString(R.string.fee_flat_formatter, + Currency.getInstance(flatFee.getCurrency()).getSymbol(Locale.getDefault()), flatFee.getValue()); } else { formattedString = context.getResources().getString(R.string.fee_mix_formatter, Currency.getInstance(flatFee.getCurrency()).getSymbol(Locale.getDefault()), @@ -94,10 +127,15 @@ private static String getMixFormattedFee(@NonNull Context context, @NonNull List } - private static String getPercentFormattedFee(@NonNull final Context context, @NonNull final Fee fee) { + private static String getPercentFormattedFee(@NonNull final Context context, @NonNull final Fee fee, + String formattedString) { String formattedFee; String minimumAmount = fee.getMin(); String maximumAmount = fee.getMax(); + + if (!isValidFee(fee.getValue())) { + return formattedString; + } if (maximumAmount.isEmpty() && minimumAmount.isEmpty()) { formattedFee = context.getResources().getString(R.string.fee_percent_no_min_and_max_formatter, fee.getValue()); @@ -122,4 +160,41 @@ protected static boolean isFeeAvailable(@Nullable final List fees) { protected static boolean isProcessingTimeAvailable(@Nullable final ProcessingTime processingTime) { return processingTime != null && !TextUtils.isEmpty(processingTime.getValue()); } + + protected static boolean isNoFeeStringAvailable(@NonNull final Context context, String fee) { + return fee.contains(context.getResources().getString(R.string.noFee)); + } + + protected static boolean isValidFee(String fee) { + if (TextUtils.isEmpty(fee)) { + return false; + } else { + return Double.parseDouble(fee) != 0.0; + } + } + + public static String getFormattedFeeAndProcessingTime(@NonNull Context context, @NonNull final List fees, + @Nullable final ProcessingTime processingTime) { + if (isFeeAvailable(fees)) { + String formattedFee = getFormattedFee(context, fees); + if (isNoFeeStringAvailable(context, formattedFee) && isProcessingTimeAvailable(processingTime)) { + return String.format("%s%s", context.getResources().getString(R.string.noFee), + context.getResources().getString(R.string.processingTimeInformation, + processingTime.getValue())); + } else if (!isNoFeeStringAvailable(context, formattedFee) && !isProcessingTimeAvailable(processingTime)) { + return context.getResources().getString(R.string.feeInformation, formattedFee); + } else if (!isNoFeeStringAvailable(context, formattedFee) && isProcessingTimeAvailable(processingTime)) { + return String.format("%s%s", context.getResources().getString(R.string.feeInformation, formattedFee), + context.getResources().getString(R.string.processingTimeInformation, + processingTime.getValue())); + } else { + return context.getResources().getString(R.string.noFee); + } + } else if (isProcessingTimeAvailable(processingTime) && !isFeeAvailable(fees)) { + return String.format("%s%s", context.getResources().getString(R.string.noFee), + context.getResources().getString(R.string.processingTimeInformation, processingTime.getValue())); + } else { + return context.getResources().getString(R.string.noFee); + } + } } 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 332ad93b7..a7ff6603a 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 @@ -70,7 +70,6 @@ public class ListTransferMethodActivity extends AppCompatActivity implements @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_list_transfer_method); diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodActivity.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodActivity.java index 851c6c14d..9397167a4 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodActivity.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodActivity.java @@ -68,7 +68,6 @@ public class SelectTransferMethodActivity extends AppCompatActivity implements @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_select_transfer_method); diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodFragment.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodFragment.java index 51b7fed6a..268daffd6 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodFragment.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodFragment.java @@ -20,6 +20,7 @@ import static com.hyperwallet.android.ui.common.intent.HyperwalletIntent.ADD_TRANSFER_METHOD_REQUEST_CODE; import static com.hyperwallet.android.ui.common.view.TransferMethodUtils.getStringFontIcon; +import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.getFormattedFeeAndProcessingTime; import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.isFeeAvailable; import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.isProcessingTimeAvailable; @@ -496,25 +497,14 @@ class ViewHolder extends RecyclerView.ViewHolder { void bind(TransferMethodSelectionItem selectionItem) { mTitle.setText(selectionItem.getTransferMethodName()); mIcon.setText(getStringFontIcon(mIcon.getContext(), selectionItem.getTransferMethodType())); - String formattedFee = FeeFormatter.getFormattedFee(mTitle.getContext(), selectionItem.getFees()); - - if (isFeeAvailable(selectionItem.getFees()) - && isProcessingTimeAvailable(selectionItem.getProcessingTime())) { - mDescriptionFeesAndProcessingTime.setVisibility(View.VISIBLE); - mDescriptionFeesAndProcessingTime.setText(mDescriptionFeesAndProcessingTime.getContext() - .getString(R.string.feeAndProcessingTimeInformation, formattedFee, - selectionItem.getProcessingTime().getValue())); - } else if (isFeeAvailable(selectionItem.getFees()) + if (!isFeeAvailable(selectionItem.getFees()) && !isProcessingTimeAvailable(selectionItem.getProcessingTime())) { - mDescriptionFeesAndProcessingTime.setVisibility(View.VISIBLE); - mDescriptionFeesAndProcessingTime.setText(mDescriptionFeesAndProcessingTime.getContext() - .getString(R.string.feeInformation, formattedFee)); - } else if (isProcessingTimeAvailable(selectionItem.getProcessingTime()) - && !isFeeAvailable(selectionItem.getFees())) { - mDescriptionFeesAndProcessingTime.setVisibility(View.VISIBLE); - mDescriptionFeesAndProcessingTime.setText(selectionItem.getProcessingTime().getValue()); - } else { mDescriptionFeesAndProcessingTime.setVisibility(View.INVISIBLE); + } else { + mDescriptionFeesAndProcessingTime.setVisibility(View.VISIBLE); + mDescriptionFeesAndProcessingTime.setText( + getFormattedFeeAndProcessingTime(mDescriptionFeesAndProcessingTime.getContext(), + selectionItem.getFees(), selectionItem.getProcessingTime())); } itemView.setOnClickListener(new OneClickListener() { diff --git a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodPresenter.java b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodPresenter.java index 17105aa23..7e529c0c6 100644 --- a/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodPresenter.java +++ b/transfermethodui/src/main/java/com/hyperwallet/android/ui/transfermethod/view/SelectTransferMethodPresenter.java @@ -102,17 +102,11 @@ public void onKeysLoaded(@Nullable final HyperwalletTransferMethodConfigurationK return; } - mView.hideProgressBar(); - Set transferMethodTypes = - key.getTransferMethodType(country.getCode(), currencyCodeString) != null - ? key.getTransferMethodType(country.getCode(), currencyCodeString) : - new HashSet(); - mView.showTransferMethodCountry(country.getCode()); mView.showTransferMethodCurrency(currencyCodeString); - mView.showTransferMethodTypes( - getTransferMethodSelectionItems(country.getCode(), currencyCodeString, - user.getProfileType(), transferMethodTypes)); + + loadFeeAndProcessingTimeAndShowTransferMethods(country.getCode(), currencyCodeString, + user); } @Override @@ -139,6 +133,7 @@ private void showErrorLoadTransferMethods(@NonNull Errors errors) { @Override public void loadCurrency(final boolean forceUpdate, @NonNull final String countryCode) { + mView.showProgressBar(); if (forceUpdate) { mTransferMethodConfigurationRepository.refreshKeys(); @@ -156,17 +151,12 @@ public void onKeysLoaded(@Nullable final HyperwalletTransferMethodConfigurationK List currencies = key.getCurrencies(countryCode) != null ? new ArrayList<>(key.getCurrencies(countryCode)) : new ArrayList(); - String currencyCode = currencies.get(0).getCode(); - Set transferMethodTypes = - key.getTransferMethodType(countryCode, currencyCode) != null ? - key.getTransferMethodType(countryCode, currencyCode) : - new HashSet(); mView.showTransferMethodCountry(countryCode); mView.showTransferMethodCurrency(currencies.get(0).getCode()); - mView.showTransferMethodTypes(getTransferMethodSelectionItems(countryCode, - currencies.get(0).getCode(), - user.getProfileType(), transferMethodTypes)); + + loadFeeAndProcessingTimeAndShowTransferMethods(countryCode, currencies.get(0).getCode(), + user); } @Override @@ -193,6 +183,8 @@ private void showErrorLoadCurrency(@NonNull Errors errors) { @Override public void loadTransferMethodTypes(final boolean forceUpdate, @NonNull final String countryCode, @NonNull final String currencyCode) { + mView.showProgressBar(); + if (forceUpdate) { mTransferMethodConfigurationRepository.refreshKeys(); } @@ -200,6 +192,7 @@ public void loadTransferMethodTypes(final boolean forceUpdate, mUserRepository.loadUser(new UserRepository.LoadUserCallback() { @Override public void onUserLoaded(@NonNull final User user) { + mView.showProgressBar(); mTransferMethodConfigurationRepository.getKeys( new TransferMethodConfigurationRepository.LoadKeysCallback() { @Override @@ -207,16 +200,10 @@ public void onKeysLoaded(@Nullable final HyperwalletTransferMethodConfigurationK if (!mView.isActive()) { return; } - - Set transferMethodTypes = - key.getTransferMethodType(countryCode, currencyCode) != null ? - key.getTransferMethodType(countryCode, currencyCode) : - new HashSet(); mView.showTransferMethodCountry(countryCode); mView.showTransferMethodCurrency(currencyCode); - mView.showTransferMethodTypes( - getTransferMethodSelectionItems(countryCode, currencyCode, - user.getProfileType(), transferMethodTypes)); + + loadFeeAndProcessingTimeAndShowTransferMethods(countryCode, currencyCode, user); } @Override @@ -322,4 +309,28 @@ private List getTransferMethodSelectionItems( } return selectionItems; } + + private void loadFeeAndProcessingTimeAndShowTransferMethods(final String countryCode, final String currencyCode, + final User user) { + mTransferMethodConfigurationRepository.getTransferMethodTypesFeeAndProcessingTime(countryCode, currencyCode, + new TransferMethodConfigurationRepository.LoadKeysCallback() { + @Override + public void onKeysLoaded( + @Nullable final HyperwalletTransferMethodConfigurationKey transferMethodConfigurationKey) { + mView.hideProgressBar(); + Set transferMethodTypes = + transferMethodConfigurationKey.getTransferMethodType( + countryCode, currencyCode) != null + ? transferMethodConfigurationKey.getTransferMethodType( + countryCode, currencyCode) : new HashSet(); + mView.showTransferMethodTypes(getTransferMethodSelectionItems( + countryCode, currencyCode, user.getProfileType(), transferMethodTypes)); + } + + @Override + public void onError(@NonNull Errors errors) { + showErrorLoadTransferMethods(errors); + } + }); + } } 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 49ad03ac6..bba83ac33 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 @@ -9,6 +9,7 @@ import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodTypes.WIRE_ACCOUNT; import static com.hyperwallet.android.ui.common.intent.HyperwalletIntent.EXTRA_TRANSFER_METHOD_UPDATED; import static com.hyperwallet.android.ui.transfermethod.TransferMethodLocalBroadcast.TransferMethodLocalBroadcastAction.ACTION_HYPERWALLET_TRANSFER_METHOD_UPDATED; +import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.getFormattedFeeAndProcessingTime; import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.isFeeAvailable; import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.isProcessingTimeAvailable; @@ -409,23 +410,12 @@ public void showTransactionInformation(@NonNull List fees, View header = getView().findViewById(R.id.update_transfer_method_static_container_header); View container = getView().findViewById(R.id.update_transfer_method_static_container); TextView feeAndProcessingTime = getView().findViewById(R.id.update_transfer_method_information); - - if (isFeeAvailable(fees) && isProcessingTimeAvailable(processingTime)) { - String formattedFee = FeeFormatter.getFormattedFee(header.getContext(), fees); - feeAndProcessingTime.setVisibility(View.VISIBLE); - feeAndProcessingTime.setText( - feeAndProcessingTime.getContext().getString(R.string.feeAndProcessingTimeInformation, formattedFee, - processingTime.getValue())); - } else if (isFeeAvailable(fees) && !isProcessingTimeAvailable(processingTime)) { - String formattedFee = FeeFormatter.getFormattedFee(header.getContext(), fees); + if (!isFeeAvailable(fees) && !isProcessingTimeAvailable(processingTime)) { + feeAndProcessingTime.setVisibility(View.GONE); + } else { feeAndProcessingTime.setVisibility(View.VISIBLE); feeAndProcessingTime.setText( - feeAndProcessingTime.getContext().getString(R.string.feeInformation, formattedFee)); - } else if (isProcessingTimeAvailable(processingTime) && !isFeeAvailable(fees)) { - feeAndProcessingTime.setVisibility(View.VISIBLE); - feeAndProcessingTime.setText(processingTime.getValue()); - } else { - feeAndProcessingTime.setVisibility(View.GONE); + getFormattedFeeAndProcessingTime(feeAndProcessingTime.getContext(), fees, processingTime)); } if (feeAndProcessingTime.getVisibility() == View.VISIBLE) { diff --git a/transfermethodui/src/main/res/layout/fragment_list_transfer_method.xml b/transfermethodui/src/main/res/layout/fragment_list_transfer_method.xml index f080ca316..41ee4deb4 100644 --- a/transfermethodui/src/main/res/layout/fragment_list_transfer_method.xml +++ b/transfermethodui/src/main/res/layout/fragment_list_transfer_method.xml @@ -45,5 +45,7 @@ + android:layout_height="match_parent" + android:paddingBottom="@dimen/row_height_double_entry" + android:clipToPadding="false"/> diff --git a/transfermethodui/src/main/res/values-bg/strings.xml b/transfermethodui/src/main/res/values-bg/strings.xml index f5a46d28c..128f2332f 100644 --- a/transfermethodui/src/main/res/values-bg/strings.xml +++ b/transfermethodui/src/main/res/values-bg/strings.xml @@ -25,8 +25,8 @@ Изберете метод за трансфер по подразбиране ММ/ГГ - %s такса \u2022 %s %s такса + Без такса Добавете метод за трансфер, за да започнете. diff --git a/transfermethodui/src/main/res/values-cs/strings.xml b/transfermethodui/src/main/res/values-cs/strings.xml index 243356557..0b4d243de 100644 --- a/transfermethodui/src/main/res/values-cs/strings.xml +++ b/transfermethodui/src/main/res/values-cs/strings.xml @@ -25,8 +25,8 @@ Vyberte výchozí způsob převodu MM/RR - %s poplatek \u2022 %s %s poplatek + Bez poplatku Chcete-li začít, přidejte způsob převodu. diff --git a/transfermethodui/src/main/res/values-de/strings.xml b/transfermethodui/src/main/res/values-de/strings.xml index e550f1cf1..56c3e5710 100644 --- a/transfermethodui/src/main/res/values-de/strings.xml +++ b/transfermethodui/src/main/res/values-de/strings.xml @@ -25,8 +25,8 @@ Wählen Sie eine Standard-Überweisungsmethode MM/JJ - %s Gebühr \u2022 %s %s Gebühr + Keine Gebühr Fügen Sie eine Überweisungsmethode hinzu, um zu beginnen. diff --git a/transfermethodui/src/main/res/values-el/strings.xml b/transfermethodui/src/main/res/values-el/strings.xml index 5ff2937d1..2066bb7e6 100644 --- a/transfermethodui/src/main/res/values-el/strings.xml +++ b/transfermethodui/src/main/res/values-el/strings.xml @@ -25,8 +25,8 @@ Επιλέξτε έναν προεπιλεγμένο τρόπο μεταφοράς ΜΜ/ΈΈ - %sΤέλος \u2022 %s %sΤέλος + Δωρεάν Ξεκινήστε προσθέτοντας έναν τρόπο μεταφοράς. diff --git a/transfermethodui/src/main/res/values-es/strings.xml b/transfermethodui/src/main/res/values-es/strings.xml index ba89b105d..90f1c403c 100644 --- a/transfermethodui/src/main/res/values-es/strings.xml +++ b/transfermethodui/src/main/res/values-es/strings.xml @@ -25,8 +25,8 @@ Seleccione un método de transferencia predeterminado MM/AA - %s tarifa \u2022 %s %s tarifa + Sin comisiones Añada un método de transferencia para empezar. diff --git a/transfermethodui/src/main/res/values-fi/strings.xml b/transfermethodui/src/main/res/values-fi/strings.xml index 25fc6c328..29763cd89 100644 --- a/transfermethodui/src/main/res/values-fi/strings.xml +++ b/transfermethodui/src/main/res/values-fi/strings.xml @@ -25,8 +25,8 @@ Valitse oletusarvoinen siirtomenetelmä KK/VV - %s maksu \u2022 %s %s maksu + Ei maksu Aloita lisäämällä siirtomenetelmä. diff --git a/transfermethodui/src/main/res/values-fr/strings.xml b/transfermethodui/src/main/res/values-fr/strings.xml index 7c6f3fc0d..3e8823cca 100644 --- a/transfermethodui/src/main/res/values-fr/strings.xml +++ b/transfermethodui/src/main/res/values-fr/strings.xml @@ -25,8 +25,8 @@ Sélectionnez une méthode de transfert par défaut MM/AA - %s frais \u2022 %s %s frais + Pas de frais Ajouter une méthode de transfert pour commencer. diff --git a/transfermethodui/src/main/res/values-hr/strings.xml b/transfermethodui/src/main/res/values-hr/strings.xml index 810c2233f..c72ec615f 100644 --- a/transfermethodui/src/main/res/values-hr/strings.xml +++ b/transfermethodui/src/main/res/values-hr/strings.xml @@ -25,8 +25,8 @@ Izaberite zadani način prijenosa MM/GG - %s naknada \u2022 %s %s naknada + Bez naknade Dodajte način prijenosa da biste započeli. diff --git a/transfermethodui/src/main/res/values-hu/strings.xml b/transfermethodui/src/main/res/values-hu/strings.xml index c8f72a443..7b089f8fb 100644 --- a/transfermethodui/src/main/res/values-hu/strings.xml +++ b/transfermethodui/src/main/res/values-hu/strings.xml @@ -25,8 +25,8 @@ Alapértelmezett átutalási mód kiválasztása HH/ÉÉ - %s díj \u2022 %s %s díj + Nincs díj A kezdéshez adjon hozzá egy átutalási módot. diff --git a/transfermethodui/src/main/res/values-in/strings.xml b/transfermethodui/src/main/res/values-in/strings.xml index 279ee62e2..95a137547 100644 --- a/transfermethodui/src/main/res/values-in/strings.xml +++ b/transfermethodui/src/main/res/values-in/strings.xml @@ -25,8 +25,8 @@ Pilih metode transfer standar BB/TT - Biaya %s \u2022 %s Biaya %s + Tidak Ada Biaya Tambahkan metode transfer untuk memulai. diff --git a/transfermethodui/src/main/res/values-is/strings.xml b/transfermethodui/src/main/res/values-is/strings.xml index 5fb234698..4834449fc 100644 --- a/transfermethodui/src/main/res/values-is/strings.xml +++ b/transfermethodui/src/main/res/values-is/strings.xml @@ -25,8 +25,8 @@ Veldu sjálfvalda millifærsluaðferð MM/ÁÁ - %s gjald \u2022 %s %s gjald + Ekkert gjald Bæta við millifærsluaðferð til að byrja. diff --git a/transfermethodui/src/main/res/values-it/strings.xml b/transfermethodui/src/main/res/values-it/strings.xml index 0525a14fb..e17ef501a 100644 --- a/transfermethodui/src/main/res/values-it/strings.xml +++ b/transfermethodui/src/main/res/values-it/strings.xml @@ -25,8 +25,8 @@ Seleziona un metodo di trasferimento predefinito MM/AA - %sCommissione \u2022 %s %sCommissione + Nessuna commissione Aggiungi un metodo di trasferimento per iniziare. diff --git a/transfermethodui/src/main/res/values-ja/strings.xml b/transfermethodui/src/main/res/values-ja/strings.xml index 79fd90a36..a17a7d601 100644 --- a/transfermethodui/src/main/res/values-ja/strings.xml +++ b/transfermethodui/src/main/res/values-ja/strings.xml @@ -25,8 +25,8 @@ デフォルトの送金方法を選択 MM/YY - %s手数料 \u2022 %s %s手数料 + 手数料なし 始めるには、送金方法を追加します。 diff --git a/transfermethodui/src/main/res/values-ko/strings.xml b/transfermethodui/src/main/res/values-ko/strings.xml index be3cafb31..6576b5056 100644 --- a/transfermethodui/src/main/res/values-ko/strings.xml +++ b/transfermethodui/src/main/res/values-ko/strings.xml @@ -25,8 +25,8 @@ 기본 이체 방법 선택 월월/년년 - %s 수수료 \u2022 %s %s 수수료 + 수수료 없음 시작하려면 이체 방법을 추가하십시오. diff --git a/transfermethodui/src/main/res/values-lv/strings.xml b/transfermethodui/src/main/res/values-lv/strings.xml index 5452fdb04..b508abe5f 100644 --- a/transfermethodui/src/main/res/values-lv/strings.xml +++ b/transfermethodui/src/main/res/values-lv/strings.xml @@ -25,8 +25,8 @@ Atlasiet noklusēto pārskaitījuma veidu MM/GG - %s komisijas maksa \u2022 %s %s komisijas maksa + Bez maksa Pievienojiet pārskaitījuma veidu, lai uzsāktu darījumu. diff --git a/transfermethodui/src/main/res/values-mk/strings.xml b/transfermethodui/src/main/res/values-mk/strings.xml index 03c6262c4..06e05988a 100644 --- a/transfermethodui/src/main/res/values-mk/strings.xml +++ b/transfermethodui/src/main/res/values-mk/strings.xml @@ -25,8 +25,8 @@ Избери стандарден метод на трансфер ММ/ГГ - %s цена \u2022 %s %s цена + Без провизија Додади метод на трансфер за да почнеш. diff --git a/transfermethodui/src/main/res/values-mn/strings.xml b/transfermethodui/src/main/res/values-mn/strings.xml index 6585a2e0a..826c892c0 100644 --- a/transfermethodui/src/main/res/values-mn/strings.xml +++ b/transfermethodui/src/main/res/values-mn/strings.xml @@ -25,8 +25,8 @@ Анхдагч шилжүүлгийн аргыг сонгоно уу СС/ОО - %s хураамж \u2022 %s %s хураамж + Хураамжгүй Эхлэхийн тулд шилжүүлгийн аргыг нэмнэ үү. diff --git a/transfermethodui/src/main/res/values-ms/strings.xml b/transfermethodui/src/main/res/values-ms/strings.xml index 034b9a8aa..e89526e5a 100644 --- a/transfermethodui/src/main/res/values-ms/strings.xml +++ b/transfermethodui/src/main/res/values-ms/strings.xml @@ -25,8 +25,8 @@ Pilih kaedah pemindahan lalai BB/TT - %s yuran \u2022 %s %s yuran + Tiada Yuran Tambah kaedah pemindahan untuk memulakan. diff --git a/transfermethodui/src/main/res/values-nl/strings.xml b/transfermethodui/src/main/res/values-nl/strings.xml index b2e5814f0..ba1dc6bba 100644 --- a/transfermethodui/src/main/res/values-nl/strings.xml +++ b/transfermethodui/src/main/res/values-nl/strings.xml @@ -24,8 +24,8 @@ Selecteer een standaard overboekingsmethode MM/JJ - %s kosten \u2022 %s %s kosten + Geen kosten Voeg een overboekingsmethode toe om te beginnen. diff --git a/transfermethodui/src/main/res/values-pl/strings.xml b/transfermethodui/src/main/res/values-pl/strings.xml index 06ea64c9d..dba3bc1d2 100644 --- a/transfermethodui/src/main/res/values-pl/strings.xml +++ b/transfermethodui/src/main/res/values-pl/strings.xml @@ -25,8 +25,8 @@ Wybierz domyślną metodę przelewu MM/RR - %s opłata \u2022 %s %s opłata + Brak opłat Dodaj metodę przelewu, aby zacząć. diff --git a/transfermethodui/src/main/res/values-pt-rPT/strings.xml b/transfermethodui/src/main/res/values-pt-rPT/strings.xml index ce0e6219c..83df9e3f5 100644 --- a/transfermethodui/src/main/res/values-pt-rPT/strings.xml +++ b/transfermethodui/src/main/res/values-pt-rPT/strings.xml @@ -25,8 +25,8 @@ Selecione um método de transferência padrão MM/AA - %s taxa \u2022 %s %s taxa + Sem taxa Adicione um método de transferência para começar. diff --git a/transfermethodui/src/main/res/values-pt/strings.xml b/transfermethodui/src/main/res/values-pt/strings.xml index aced1c1fd..cab92b951 100644 --- a/transfermethodui/src/main/res/values-pt/strings.xml +++ b/transfermethodui/src/main/res/values-pt/strings.xml @@ -25,8 +25,8 @@ Selecione um método de transferência padrão MM/AA - %staxa \u2022 %s %s taxa + Sem taxa Adicione um método de transferência para começar. diff --git a/transfermethodui/src/main/res/values-ro/strings.xml b/transfermethodui/src/main/res/values-ro/strings.xml index 7160f117b..342c20d4a 100644 --- a/transfermethodui/src/main/res/values-ro/strings.xml +++ b/transfermethodui/src/main/res/values-ro/strings.xml @@ -25,8 +25,8 @@ Selectați o metodă implicită de transfer LL/AA - %s comision \u2022 %s %s comision + Nicio taxă Adăugați o metodă de transfer pentru a începe. diff --git a/transfermethodui/src/main/res/values-ru/strings.xml b/transfermethodui/src/main/res/values-ru/strings.xml index 787a1ad28..4afdaa6af 100644 --- a/transfermethodui/src/main/res/values-ru/strings.xml +++ b/transfermethodui/src/main/res/values-ru/strings.xml @@ -24,8 +24,8 @@ Выбрать способ перевода по умолчанию ММ/ГГ - %s сбор \u2022 %s %s сбор + Комиссия отсутствует Чтобы начать, добавьте способ перевода. diff --git a/transfermethodui/src/main/res/values-sk/strings.xml b/transfermethodui/src/main/res/values-sk/strings.xml index 0a1282c9c..f9850fdb1 100644 --- a/transfermethodui/src/main/res/values-sk/strings.xml +++ b/transfermethodui/src/main/res/values-sk/strings.xml @@ -25,8 +25,8 @@ Vybrať predvolený spôsob prevodu MM/RR - %s poplatok \u2022 %s Poplatok %s + Bez poplatku Pridajte spôsob prevodu, aby ste mohli začať. diff --git a/transfermethodui/src/main/res/values-sl/strings.xml b/transfermethodui/src/main/res/values-sl/strings.xml index 3372831b4..cda0c54b5 100644 --- a/transfermethodui/src/main/res/values-sl/strings.xml +++ b/transfermethodui/src/main/res/values-sl/strings.xml @@ -25,8 +25,8 @@ Izberi privzeti način prenosa MM/LL - %sPristojbina \u2022 %s %s pristojbina + Brez pristojbine Za začetek dodajte način prenosa. diff --git a/transfermethodui/src/main/res/values-sv/strings.xml b/transfermethodui/src/main/res/values-sv/strings.xml index 632205707..7814da3ab 100644 --- a/transfermethodui/src/main/res/values-sv/strings.xml +++ b/transfermethodui/src/main/res/values-sv/strings.xml @@ -25,8 +25,8 @@ Välj en standardöverföringsmetod MM/ÅÅ - %s avgift \u2022 %s %s avgift + Ingen avgift Lägg till en överföringsmetod för att komma igång. diff --git a/transfermethodui/src/main/res/values-th/strings.xml b/transfermethodui/src/main/res/values-th/strings.xml index 7ebb3c941..6011271d7 100644 --- a/transfermethodui/src/main/res/values-th/strings.xml +++ b/transfermethodui/src/main/res/values-th/strings.xml @@ -25,8 +25,8 @@ เลือกวิธีการโอนเงินเริ่มต้น ดด/ปป - ค่าธรรมเนียม %s \u2022 %s ค่าธรรมเนียม %s + ไม่มีค่าธรรมเนียม เพิ่มวิธีการโอนเงินเพื่อเริ่มต้นใช้งาน diff --git a/transfermethodui/src/main/res/values-tr/strings.xml b/transfermethodui/src/main/res/values-tr/strings.xml index 295c3fdae..ba164b4a5 100644 --- a/transfermethodui/src/main/res/values-tr/strings.xml +++ b/transfermethodui/src/main/res/values-tr/strings.xml @@ -25,8 +25,8 @@ Varsayılan bir aktarım yöntemi seç AA/YY - %s ücret \u2022 %s %s ücret + Ücret Yok Başlamak için bir aktarım yöntemi ekle. diff --git a/transfermethodui/src/main/res/values-uk/strings.xml b/transfermethodui/src/main/res/values-uk/strings.xml index 0cd8df2ad..11697c689 100644 --- a/transfermethodui/src/main/res/values-uk/strings.xml +++ b/transfermethodui/src/main/res/values-uk/strings.xml @@ -25,8 +25,8 @@ Вибрати типовий спосіб переказу ММ/РР - %s комісія \u2022 %s %s комісія + Комісія не стягується Щоб розпочати, додайте спосіб переказу. diff --git a/transfermethodui/src/main/res/values-vi/strings.xml b/transfermethodui/src/main/res/values-vi/strings.xml index 38d219cbd..b578d3082 100644 --- a/transfermethodui/src/main/res/values-vi/strings.xml +++ b/transfermethodui/src/main/res/values-vi/strings.xml @@ -24,8 +24,8 @@ Chọn phương thức chuyển mặc định MM/YY - %s phí \u2022 %s %s phí + Miễn phí Thêm phương thức chuyển tiền để bắt đầu. diff --git a/transfermethodui/src/main/res/values-zh-rCN/strings.xml b/transfermethodui/src/main/res/values-zh-rCN/strings.xml index 4471d6385..4687f00cc 100644 --- a/transfermethodui/src/main/res/values-zh-rCN/strings.xml +++ b/transfermethodui/src/main/res/values-zh-rCN/strings.xml @@ -25,8 +25,8 @@ 选择默认转账方式 MM/YY - %s 费用 \u2022 %s %s 费用 + 不收费 添加转账方式以开始。 diff --git a/transfermethodui/src/main/res/values-zh-rTW/strings.xml b/transfermethodui/src/main/res/values-zh-rTW/strings.xml index d265f84c6..4b447addf 100644 --- a/transfermethodui/src/main/res/values-zh-rTW/strings.xml +++ b/transfermethodui/src/main/res/values-zh-rTW/strings.xml @@ -25,8 +25,8 @@ 選擇預設轉帳方式 月/年 - %s手續費\u2022%s %s手續費 + 免手續費 新增轉帳方式以開始使用。 diff --git a/transfermethodui/src/main/res/values-zh/strings.xml b/transfermethodui/src/main/res/values-zh/strings.xml index e8f7aed09..4b447addf 100644 --- a/transfermethodui/src/main/res/values-zh/strings.xml +++ b/transfermethodui/src/main/res/values-zh/strings.xml @@ -25,8 +25,8 @@ 選擇預設轉帳方式 月/年 - %s手續費\u2022 %s %s手續費 + 免手續費 新增轉帳方式以開始使用。 diff --git a/transfermethodui/src/main/res/values/strings.xml b/transfermethodui/src/main/res/values/strings.xml index 406ef6ee6..de9d2b6c5 100644 --- a/transfermethodui/src/main/res/values/strings.xml +++ b/transfermethodui/src/main/res/values/strings.xml @@ -26,8 +26,9 @@ Select a default transfer method MM/YY - %s fee \u2022 %s %s fee + \u0020\u2022 %s + No fee Add a transfer method to get started. diff --git a/transfermethodui/src/test/java/com/hyperwallet/android/ui/transfermethod/FeeFormatterTest.java b/transfermethodui/src/test/java/com/hyperwallet/android/ui/transfermethod/FeeFormatterTest.java index 7166174e6..27554c383 100644 --- a/transfermethodui/src/test/java/com/hyperwallet/android/ui/transfermethod/FeeFormatterTest.java +++ b/transfermethodui/src/test/java/com/hyperwallet/android/ui/transfermethod/FeeFormatterTest.java @@ -1,7 +1,9 @@ package com.hyperwallet.android.ui.transfermethod; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.any; import static org.hamcrest.Matchers.is; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -9,6 +11,7 @@ import android.content.res.Resources; import com.hyperwallet.android.model.graphql.Fee; +import com.hyperwallet.android.model.graphql.ProcessingTime; import com.hyperwallet.android.ui.R; import com.hyperwallet.android.ui.testutils.rule.HyperwalletExternalResourceManager; import com.hyperwallet.android.ui.transfermethod.view.FeeFormatter; @@ -27,6 +30,7 @@ import org.robolectric.RobolectricTestRunner; import java.util.Arrays; +import java.util.Collections; import java.util.List; @RunWith(RobolectricTestRunner.class) @@ -46,6 +50,8 @@ public class FeeFormatterTest { private Resources resources; private Fee mFlatFee; private JSONObject mJSONObject; + @Mock + private FeeFormatter mFeeFormatter; @Before public void setUp() throws JSONException { @@ -148,4 +154,150 @@ public void testGetFormattedFee_returnsPercentAndFlatFormattedFeeWithMinOnly() { assertThat(resourceIdCaptorValue, is(R.string.fee_mix_only_min_formatter)); assertThat(argumentList.size(), is(4)); } + + @Test + public void testGetFormattedFee_returnsFlatNoFee() { + Fee flatFee = new Fee(mJSONObject.optJSONObject("FEE_NINE").optJSONArray("nodes").optJSONObject(0)); + FeeFormatter.getFormattedFee(context, Arrays.asList(flatFee)); + verify(resources).getString(resourceIdCaptor.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + assertThat(resourceIdCaptorValue, is(R.string.noFee)); + } + + @Test + public void testGetFormattedFee_returnsPercentNoFee() { + Fee percentFee = new Fee(mJSONObject.optJSONObject("FEE_EIGHT").optJSONArray("nodes").optJSONObject(0)); + FeeFormatter.getFormattedFee(context, Arrays.asList(percentFee)); + verify(resources).getString(resourceIdCaptor.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + assertThat(resourceIdCaptorValue, is(R.string.noFee)); + } + + @Test + public void testGetFormattedFee_returnsMixedNoFee() { + Fee flatFee = new Fee(mJSONObject.optJSONObject("FEE_EIGHT").optJSONArray("nodes").optJSONObject(0)); + Fee percentFee = new Fee(mJSONObject.optJSONObject("FEE_NINE").optJSONArray("nodes").optJSONObject(0)); + + FeeFormatter.getFormattedFee(context, Arrays.asList(flatFee,percentFee)); + verify(resources).getString(resourceIdCaptor.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + assertThat(resourceIdCaptorValue, is(R.string.noFee)); + } + + @Test + public void testGetFormattedFee_returnsFlatFee() { + Fee percentFee = new Fee(mJSONObject.optJSONObject("FEE_EIGHT").optJSONArray("nodes").optJSONObject(0)); + FeeFormatter.getFormattedFee(context, Arrays.asList(mFlatFee,percentFee)); + + verify(resources).getString(resourceIdCaptor.capture(), formatterArgumentCapture.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + List argumentList = formatterArgumentCapture.getAllValues(); + assertThat(resourceIdCaptorValue, is(R.string.fee_flat_formatter)); + assertThat(argumentList.size(), is(2)); + } + + @Test + public void testGetFormattedFee_returnsFlatFeeWithMinAndMax() { + Fee percentFee = new Fee(mJSONObject.optJSONObject("FEE_TEN").optJSONArray("nodes").optJSONObject(0)); + FeeFormatter.getFormattedFee(context, Arrays.asList(mFlatFee,percentFee)); + + verify(resources).getString(resourceIdCaptor.capture(), formatterArgumentCapture.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + List argumentList = formatterArgumentCapture.getAllValues(); + assertThat(resourceIdCaptorValue, is(R.string.fee_flat_formatter)); + assertThat(argumentList.size(), is(2)); + } + + @Test + public void testGetFormattedFee_returnsFlatFeeWithMaxOnly() { + Fee percentFee = new Fee(mJSONObject.optJSONObject("FEE_TWELVE").optJSONArray("nodes").optJSONObject(0)); + FeeFormatter.getFormattedFee(context, Arrays.asList(mFlatFee,percentFee)); + + verify(resources).getString(resourceIdCaptor.capture(), formatterArgumentCapture.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + List argumentList = formatterArgumentCapture.getAllValues(); + assertThat(resourceIdCaptorValue, is(R.string.fee_flat_formatter)); + assertThat(argumentList.size(), is(2)); + } + + @Test + public void testGetFormattedFee_returnsFlatFeeWithMinOnly() { + Fee percentFee = new Fee(mJSONObject.optJSONObject("FEE_ELEVEN").optJSONArray("nodes").optJSONObject(0)); + FeeFormatter.getFormattedFee(context, Arrays.asList(mFlatFee,percentFee)); + + verify(resources).getString(resourceIdCaptor.capture(), formatterArgumentCapture.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + List argumentList = formatterArgumentCapture.getAllValues(); + assertThat(resourceIdCaptorValue, is(R.string.fee_flat_formatter)); + assertThat(argumentList.size(), is(2)); + } + + @Test + public void testGetFormattedFee_returnsPercentFeeWithMinAndMax() { + Fee flatFee = new Fee(mJSONObject.optJSONObject("FEE_NINE").optJSONArray("nodes").optJSONObject(0)); + Fee percentFee = new Fee(mJSONObject.optJSONObject("FEE_TWO").optJSONArray("nodes").optJSONObject(0)); + FeeFormatter.getFormattedFee(context, Arrays.asList(flatFee,percentFee)); + + verify(resources).getString(resourceIdCaptor.capture(), formatterArgumentCapture.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + List argumentList = formatterArgumentCapture.getAllValues(); + assertThat(resourceIdCaptorValue, is(R.string.fee_percent_formatter)); + assertThat(argumentList.size(), is(4)); + } + + @Test + public void testGetFormattedFee_returnsPercentFeeWithMinOnly() { + Fee flatFee = new Fee(mJSONObject.optJSONObject("FEE_NINE").optJSONArray("nodes").optJSONObject(0)); + Fee percentFee = new Fee(mJSONObject.optJSONObject("FEE_THREE").optJSONArray("nodes").optJSONObject(0)); + FeeFormatter.getFormattedFee(context, Arrays.asList(flatFee,percentFee)); + + verify(resources).getString(resourceIdCaptor.capture(), formatterArgumentCapture.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + List argumentList = formatterArgumentCapture.getAllValues(); + assertThat(resourceIdCaptorValue, is(R.string.fee_percent_only_min_formatter)); + assertThat(argumentList.size(), is(3)); + } + + @Test + public void testGetFormattedFee_returnsPercentFeeWithMaxOnly() { + Fee flatFee = new Fee(mJSONObject.optJSONObject("FEE_NINE").optJSONArray("nodes").optJSONObject(0)); + Fee percentFee = new Fee(mJSONObject.optJSONObject("FEE_FOUR").optJSONArray("nodes").optJSONObject(0)); + FeeFormatter.getFormattedFee(context, Arrays.asList(flatFee,percentFee)); + + verify(resources).getString(resourceIdCaptor.capture(), formatterArgumentCapture.capture()); + int resourceIdCaptorValue = resourceIdCaptor.getValue(); + List argumentList = formatterArgumentCapture.getAllValues(); + assertThat(resourceIdCaptorValue, is(R.string.fee_percent_only_max_formatter)); + assertThat(argumentList.size(), is(3)); + } + + @Test + public void testGetFormattedFeeAndProcessingTime_returnsFormattedFeeAndProcessingTimeWithNoFeeString() throws JSONException { + + JSONObject mJSONObject = new JSONObject(externalResourceManager.getResourceContent("processing_time_information.json")); + ProcessingTime mProcessingTime = new ProcessingTime(mJSONObject.getJSONObject("PROCESSING_TIME_ONE").getJSONArray("nodes").optJSONObject(0)); + + when(FeeFormatter.getFormattedFee(context,Arrays.asList(mFlatFee))).thenReturn("No fee"); + when(context.getResources().getString(R.string.noFee)).thenReturn("No fee"); + when(context.getResources().getString(R.string.fee_flat_formatter)).thenReturn("$2.00"); + when(context.getResources().getString(R.string.processingTimeInformation,"1-2 Business days")).thenReturn(" \u2022 1-2 Business days"); + + String formattedString = FeeFormatter.getFormattedFeeAndProcessingTime(context,Arrays.asList(mFlatFee),mProcessingTime); + assertThat(formattedString , is("No fee \u2022 1-2 Business days")); + } + + @Test + public void testGetFormattedFeeAndProcessingTime_returnsFormattedFeeAndProcessingTimeWithFlatFeeString() throws JSONException { + + JSONObject mJSONObject = new JSONObject(externalResourceManager.getResourceContent("processing_time_information.json")); + ProcessingTime mProcessingTime = new ProcessingTime(mJSONObject.getJSONObject("PROCESSING_TIME_ONE").getJSONArray("nodes").optJSONObject(0)); + + when(FeeFormatter.getFormattedFee(context,Arrays.asList(mFlatFee))).thenReturn("$3.00 fee"); + when(context.getResources().getString(R.string.noFee)).thenReturn("No fee"); + when(context.getResources().getString(R.string.feeInformation,"$3.00 fee")).thenReturn("$3.00 fee"); + when(context.getResources().getString(R.string.processingTimeInformation,"1-2 Business days")).thenReturn(" \u2022 1-2 Business days"); + + String formattedString = FeeFormatter.getFormattedFeeAndProcessingTime(context,Arrays.asList(mFlatFee),mProcessingTime); + assertThat(formattedString , is("$3.00 fee \u2022 1-2 Business days")); + } } \ No newline at end of file diff --git a/transfermethodui/src/test/java/com/hyperwallet/android/ui/transfermethod/SelectTransferMethodPresenterTest.java b/transfermethodui/src/test/java/com/hyperwallet/android/ui/transfermethod/SelectTransferMethodPresenterTest.java index ad4602bf6..c179c48f7 100644 --- a/transfermethodui/src/test/java/com/hyperwallet/android/ui/transfermethod/SelectTransferMethodPresenterTest.java +++ b/transfermethodui/src/test/java/com/hyperwallet/android/ui/transfermethod/SelectTransferMethodPresenterTest.java @@ -65,6 +65,7 @@ public class SelectTransferMethodPresenterTest { private HyperwalletTransferMethodConfigurationKey mResult; private HyperwalletTransferMethodConfigurationKey mPartialResult; + private HyperwalletTransferMethodConfigurationKey mFeeAndProcessingTimeResult; private User mUser; private SelectTransferMethodPresenter selectTransferMethodPresenter; @@ -83,6 +84,11 @@ public void initialize() throws Exception { final JSONObject userJsonObject = new JSONObject(userResponseBody); mUser = new User(userJsonObject); + String feeAndProcessingTimeResponseBody = externalResourceManager.getResourceContent( + "successful_tmc_keys_fee_processing_time_CA_response.json"); + final JSONObject feeAndProcessingTimeJsonObject = new JSONObject(feeAndProcessingTimeResponseBody); + mFeeAndProcessingTimeResult = new TransferMethodConfigurationKeyResult(feeAndProcessingTimeJsonObject); + selectTransferMethodPresenter = new SelectTransferMethodPresenter(view, mTransferMethodConfigurationRepository, mUserRepository); } @@ -103,6 +109,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -115,7 +132,7 @@ public Object answer(InvocationOnMock invocation) { UserRepository.LoadUserCallback.class)); // Then - selectTransferMethodPresenter.loadTransferMethodConfigurationKeys(false, "CA", "CAD"); + selectTransferMethodPresenter.loadTransferMethodConfigurationKeys(true, "CA", "CAD"); verify(view).showTransferMethodCountry("CA"); verify(view).showTransferMethodCurrency("CAD"); @@ -129,6 +146,58 @@ public Object answer(InvocationOnMock invocation) { verify(view, never()).showAddTransferMethod(anyString(), anyString(), anyString(), anyString()); } + @Test + public void testLoadTransferMethodConfigurationKeys_loadsFeeAndProcessingTimeKeysIntoViewOnError() { + // When + when(view.isActive()).thenReturn(true); + + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[0]; + callback.onKeysLoaded(mResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getKeys(any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onError(errors); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + UserRepository.LoadUserCallback userCallback = + (UserRepository.LoadUserCallback) invocation.getArguments()[0]; + userCallback.onUserLoaded(mUser); + return userCallback; + } + }).when(mUserRepository).loadUser(any( + UserRepository.LoadUserCallback.class)); + + // Then + selectTransferMethodPresenter.loadTransferMethodConfigurationKeys(false, "CA", "CAD"); + + verify(view).showTransferMethodCountry("CA"); + verify(view).showTransferMethodCurrency("CAD"); + verify(view, never()).showTransferMethodTypes(ArgumentMatchers.anyList()); + verify(view).showErrorLoadTransferMethodConfigurationKeys(ArgumentMatchers.anyList()); + verify(view, never()).showErrorLoadCurrency(ArgumentMatchers.anyList()); + verify(view, never()).showErrorLoadTransferMethodTypes(ArgumentMatchers.anyList()); + verify(view, never()).showErrorLoadCountrySelection(ArgumentMatchers.anyList()); + verify(view, never()).showErrorLoadCurrencySelection(ArgumentMatchers.anyList()); + verify(view, never()).showAddTransferMethod(anyString(), anyString(), anyString(), anyString()); + } + @Test public void testLoadTransferMethodConfigurationKeys_loadsKeysIntoViewOnSuccessInactive() { // When @@ -145,6 +214,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -186,6 +266,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -221,6 +312,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -263,6 +365,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -310,6 +423,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -325,7 +449,7 @@ public Object answer(InvocationOnMock invocation) { selectTransferMethodPresenter.loadCurrency(false, "CA"); verify(view).showTransferMethodCurrency("CAD"); - verify(view).showTransferMethodTypes(ArgumentMatchers.anyList()); + // verify(view).showTransferMethodTypes(ArgumentMatchers.anyList()); verify(view, never()).showErrorLoadTransferMethodConfigurationKeys( ArgumentMatchers.anyList()); verify(view, never()).showErrorLoadCurrency(ArgumentMatchers.anyList()); @@ -352,6 +476,19 @@ public Object answer(InvocationOnMock invocation) { } }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -400,6 +537,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -436,6 +584,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -449,7 +608,7 @@ public Object answer(InvocationOnMock invocation) { // Then - selectTransferMethodPresenter.loadTransferMethodTypes(false, "CA", "CAD"); + selectTransferMethodPresenter.loadTransferMethodTypes(true, "CA", "CAD"); verify(view).showTransferMethodTypes(ArgumentMatchers.anyList()); verify(view, never()).showErrorLoadTransferMethodConfigurationKeys( @@ -478,6 +637,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -520,6 +690,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -554,6 +735,17 @@ public Object answer(InvocationOnMock invocation) { }).when(mTransferMethodConfigurationRepository).getKeys(any( TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + TransferMethodConfigurationRepository.LoadKeysCallback callback = + (TransferMethodConfigurationRepository.LoadKeysCallback) invocation.getArguments()[2]; + callback.onKeysLoaded(mFeeAndProcessingTimeResult); + return callback; + } + }).when(mTransferMethodConfigurationRepository).getTransferMethodTypesFeeAndProcessingTime(anyString(), anyString(), any( + TransferMethodConfigurationRepository.LoadKeysCallback.class)); + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { diff --git a/transfermethodui/src/test/resources/fee_information.json b/transfermethodui/src/test/resources/fee_information.json index 01ceedeef..959fec6ca 100644 --- a/transfermethodui/src/test/resources/fee_information.json +++ b/transfermethodui/src/test/resources/fee_information.json @@ -73,5 +73,58 @@ "maximum": "" } ] + }, + "FEE_EIGHT": { + "nodes": [ + { + "currency": "USD", + "feeRateType": "PERCENT", + "value": "0.00", + "minimum": "10.00", + "maximum": "" + } + ] + }, + "FEE_NINE": { + "nodes": [ + { + "currency": "USD", + "value": "0.00", + "feeRateType": "FLAT" + } + ] + }, + "FEE_TEN": { + "nodes": [ + { + "currency": "USD", + "feeRateType": "PERCENT", + "value": "0.00", + "minimum": "10.00", + "maximum": "20.00" + } + ] + }, + "FEE_ELEVEN": { + "nodes": [ + { + "currency": "USD", + "feeRateType": "PERCENT", + "value": "0.00", + "minimum": "10.00", + "maximum": "" + } + ] + }, + "FEE_TWELVE": { + "nodes": [ + { + "currency": "USD", + "feeRateType": "PERCENT", + "value": "0.00", + "minimum": "", + "maximum": "20.00" + } + ] } } \ No newline at end of file diff --git a/transfermethodui/src/test/resources/processing_time_information.json b/transfermethodui/src/test/resources/processing_time_information.json new file mode 100644 index 000000000..49dd2ff54 --- /dev/null +++ b/transfermethodui/src/test/resources/processing_time_information.json @@ -0,0 +1,22 @@ +{ + "PROCESSING_TIME_ONE": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + }, + "PROCESSING_TIME_TWO": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CN", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT" + } + ] + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/successful_tmc_fields_bank_account_response.json b/transfermethodui/src/test/resources/successful_tmc_fields_bank_account_response.json index 356305f8b..0220ec531 100644 --- a/transfermethodui/src/test/resources/successful_tmc_fields_bank_account_response.json +++ b/transfermethodui/src/test/resources/successful_tmc_fields_bank_account_response.json @@ -1,6 +1,6 @@ { "data": { - "transferMethodUIConfigurations": { + "transferMethodCreateUIConfigurations": { "nodes": [ { "country": "US", @@ -1229,24 +1229,49 @@ } ] }, - "fees": { + "countries": { "nodes": [ { - "country": "US", - "currency": "USD", - "transferMethodType": "BANK_ACCOUNT", - "value": "2.00", - "feeRateType": "FLAT" - } - ] - }, - "processingTimes": { - "nodes": [ - { - "country": "US", - "currency": "USD", - "transferMethodType": "BANK_ACCOUNT", - "value": "1-2 Business days" + "code": "CA", + "name": "Canada", + "iso3": "CAN", + "currencies": { + "nodes": [ + { + "code": "CAD", + "name": "CAD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "processingTimes": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "1-2 Business days" + } + ] + }, + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "2.00", + "feeRateType": "FLAT" + } + ] + } + } + ] + } + } + ] + } } ] } diff --git a/transfermethodui/src/test/resources/successful_tmc_fields_bank_account_selection_response.json b/transfermethodui/src/test/resources/successful_tmc_fields_bank_account_selection_response.json index 8eba5a198..4508c66a0 100644 --- a/transfermethodui/src/test/resources/successful_tmc_fields_bank_account_selection_response.json +++ b/transfermethodui/src/test/resources/successful_tmc_fields_bank_account_selection_response.json @@ -1,6 +1,6 @@ { "data": { - "transferMethodUIConfigurations": { + "transferMethodCreateUIConfigurations": { "nodes": [ { "country": "AR", diff --git a/transfermethodui/src/test/resources/successful_tmc_fields_bank_card_response.json b/transfermethodui/src/test/resources/successful_tmc_fields_bank_card_response.json index 41a48de95..b2302a492 100644 --- a/transfermethodui/src/test/resources/successful_tmc_fields_bank_card_response.json +++ b/transfermethodui/src/test/resources/successful_tmc_fields_bank_card_response.json @@ -1,6 +1,6 @@ { "data": { - "transferMethodUIConfigurations": { + "transferMethodCreateUIConfigurations": { "nodes": [ { "country": "US", @@ -91,23 +91,48 @@ } ] }, - "fees": { + "countries": { "nodes": [ { - "value": "1.75", - "feeRateType": "FLAT", - "country": "US", - "currency": "USD" - } - ] - }, - "processingTimes": { - "nodes": [ - { - "country": "US", - "currency": "USD", - "transferMethodType": "BANK_CARD", - "value": "IMMEDIATE" + "code": "CA", + "name": "Canada", + "iso3": "CAN", + "currencies": { + "nodes": [ + { + "code": "CAD", + "name": "CAD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "processingTimes": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_CARD", + "value": "IMMEDIATE" + } + ] + }, + "fees": { + "nodes": [ + { + "value": "1.75", + "feeRateType": "FLAT", + "country": "US", + "currency": "USD" + } + ] + } + } + ] + } + } + ] + } } ] } diff --git a/transfermethodui/src/test/resources/successful_tmc_fields_empty_details_response.json b/transfermethodui/src/test/resources/successful_tmc_fields_empty_details_response.json index 6634f6f8b..23e41910b 100644 --- a/transfermethodui/src/test/resources/successful_tmc_fields_empty_details_response.json +++ b/transfermethodui/src/test/resources/successful_tmc_fields_empty_details_response.json @@ -1,6 +1,6 @@ { "data": { - "transferMethodUIConfigurations": { + "transferMethodCreateUIConfigurations": { "count": 1, "nodes": [ { diff --git a/transfermethodui/src/test/resources/successful_tmc_fields_paper_check_response.json b/transfermethodui/src/test/resources/successful_tmc_fields_paper_check_response.json index 23247b289..129441dda 100644 --- a/transfermethodui/src/test/resources/successful_tmc_fields_paper_check_response.json +++ b/transfermethodui/src/test/resources/successful_tmc_fields_paper_check_response.json @@ -1,6 +1,6 @@ { "data": { - "transferMethodUIConfigurations": { + "transferMethodCreateUIConfigurations": { "nodes": [ { "country": "US", @@ -134,23 +134,48 @@ } ] }, - "fees": { + "countries": { "nodes": [ { - "value": "0.25", - "feeRateType": "FLAT", - "country": "US", - "currency": "USD" - } - ] - }, - "processingTimes": { - "nodes": [ - { - "country": "US", - "currency": "USD", - "transferMethodType": "PAPER_CHECK", - "value": "5 - 7 Business days" + "code": "CA", + "name": "Canada", + "iso3": "CAN", + "currencies": { + "nodes": [ + { + "code": "CAD", + "name": "CAD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "processingTimes": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "PAPER_CHECK", + "value": "5 - 7 Business days" + } + ] + }, + "fees": { + "nodes": [ + { + "value": "0.25", + "feeRateType": "FLAT", + "country": "US", + "currency": "USD" + } + ] + } + } + ] + } + } + ] + } } ] } diff --git a/transfermethodui/src/test/resources/successful_tmc_fields_paypal_response.json b/transfermethodui/src/test/resources/successful_tmc_fields_paypal_response.json index adf27664c..1cbd8a1b8 100644 --- a/transfermethodui/src/test/resources/successful_tmc_fields_paypal_response.json +++ b/transfermethodui/src/test/resources/successful_tmc_fields_paypal_response.json @@ -1,6 +1,6 @@ { "data": { - "transferMethodUIConfigurations": { + "transferMethodCreateUIConfigurations": { "nodes": [ { "country": "US", @@ -1179,23 +1179,48 @@ } ] }, - "fees": { + "countries": { "nodes": [ { - "country": "US", - "currency": "USD", - "value": "0.25", - "feeRateType": "FLAT" - } - ] - }, - "processingTimes": { - "nodes": [ - { - "country": "US", - "currency": "USD", - "transferMethodType": "BANK_CARD", - "value": "IMMEDIATE" + "code": "CA", + "name": "Canada", + "iso3": "CAN", + "currencies": { + "nodes": [ + { + "code": "USD", + "name": "USD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "processingTimes": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "PAYPAL", + "value": "IMMEDIATE" + } + ] + }, + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "value": "0.25", + "feeRateType": "FLAT" + } + ] + } + } + ] + } + } + ] + } } ] } diff --git a/transfermethodui/src/test/resources/successful_tmc_fields_venmo_response.json b/transfermethodui/src/test/resources/successful_tmc_fields_venmo_response.json index c46abcaf7..6506daaa1 100644 --- a/transfermethodui/src/test/resources/successful_tmc_fields_venmo_response.json +++ b/transfermethodui/src/test/resources/successful_tmc_fields_venmo_response.json @@ -1,6 +1,6 @@ { "data": { - "transferMethodUIConfigurations": { + "transferMethodCreateUIConfigurations": { "nodes": [ { "country": "US", @@ -36,23 +36,48 @@ } ] }, - "fees": { + "countries": { "nodes": [ { - "country": "US", - "currency": "USD", - "value": "0.95", - "feeRateType": "FLAT" - } - ] - }, - "processingTimes": { - "nodes": [ - { - "country": "US", - "currency": "USD", - "transferMethodType": "VENMO", - "value": "IMMEDIATE" + "code": "CA", + "name": "Canada", + "iso3": "CAN", + "currencies": { + "nodes": [ + { + "code": "CAD", + "name": "CAD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "processingTimes": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "VENMO", + "value": "IMMEDIATE" + } + ] + }, + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "value": "0.95", + "feeRateType": "FLAT" + } + ] + } + } + ] + } + } + ] + } } ] } diff --git a/transfermethodui/src/test/resources/successful_tmc_keys_empty_fee_US_response.json b/transfermethodui/src/test/resources/successful_tmc_keys_empty_fee_US_response.json new file mode 100644 index 000000000..81cf43b6b --- /dev/null +++ b/transfermethodui/src/test/resources/successful_tmc_keys_empty_fee_US_response.json @@ -0,0 +1,38 @@ +{ + "data": { + "countries": { + "nodes": [ + { + "code": "US", + "name": "United States", + "currencies": { + "nodes": [ + { + "code": "USD", + "name": "USD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "processingTimes": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "1-2 Business days" + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/successful_tmc_keys_empty_processing_US_response.json b/transfermethodui/src/test/resources/successful_tmc_keys_empty_processing_US_response.json new file mode 100644 index 000000000..ccc9f5c72 --- /dev/null +++ b/transfermethodui/src/test/resources/successful_tmc_keys_empty_processing_US_response.json @@ -0,0 +1,39 @@ +{ + "data": { + "countries": { + "nodes": [ + { + "code": "US", + "name": "United States", + "currencies": { + "nodes": [ + { + "code": "USD", + "name": "USD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "2.00", + "feeRateType": "FLAT" + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/successful_tmc_keys_fee_processing_time_CA_response.json b/transfermethodui/src/test/resources/successful_tmc_keys_fee_processing_time_CA_response.json new file mode 100644 index 000000000..8adfc20d4 --- /dev/null +++ b/transfermethodui/src/test/resources/successful_tmc_keys_fee_processing_time_CA_response.json @@ -0,0 +1,74 @@ +{ + "data": { + "countries": { + "nodes": [ + { + "code": "CA", + "name": "Canada", + "currencies": { + "nodes": [ + { + "code": "CAD", + "name": "Canadian Dollar", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "CA", + "currency": "CAD", + "transferMethodType": "BANK_ACCOUNT", + "value": "2.20", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CA", + "currency": "CAD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + }, + { + "code": "PAYPAL_ACCOUNT", + "name": "PayPal", + "fees": { + "nodes": [ + { + "country": "CA", + "currency": "CAD", + "transferMethodType": "PAYPAL_ACCOUNT", + "value": "0.25", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CA", + "currency": "CAD", + "transferMethodType": "PAYPAL_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/successful_tmc_keys_fee_processing_time_US_response.json b/transfermethodui/src/test/resources/successful_tmc_keys_fee_processing_time_US_response.json new file mode 100644 index 000000000..e4b5371e3 --- /dev/null +++ b/transfermethodui/src/test/resources/successful_tmc_keys_fee_processing_time_US_response.json @@ -0,0 +1,124 @@ +{ + "data": { + "countries": { + "nodes": [ + { + "code": "US", + "name": "United States", + "currencies": { + "nodes": [ + { + "code": "USD", + "name": "United States Dollar", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "2.00", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + }, + { + "code": "BANK_CARD", + "name": "Debit Card", + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_CARD", + "value": "1.75", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_CARD" + } + ] + } + }, + { + "code": "WIRE_ACCOUNT", + "name": "Wire Transfer", + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT", + "value": "20.00", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-3 Business days", + "country": "US", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT" + } + ] + } + }, + { + "code": "PAYPAL_ACCOUNT", + "name": "PayPal", + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT", + "value": "0.25", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "US", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/successful_tmc_keys_mixed_fee_CN_response.json b/transfermethodui/src/test/resources/successful_tmc_keys_mixed_fee_CN_response.json new file mode 100644 index 000000000..26393fa23 --- /dev/null +++ b/transfermethodui/src/test/resources/successful_tmc_keys_mixed_fee_CN_response.json @@ -0,0 +1,161 @@ +{ + "data": { + "countries": { + "nodes": [ + { + "code": "CN", + "name": "CHINA", + "currencies": { + "nodes": [ + { + "code": "USD", + "name": "USD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "0.0", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + }, + { + "code": "BANK_CARD", + "name": "Debit Card", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_CARD", + "value": "0.00", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_CARD" + } + ] + } + }, + + { + "code": "WIRE_ACCOUNT", + "name": "Wire Transfer", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT", + "value": "0.000", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-3 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT" + } + ] + } + }, + { + "code": "PAYPAL_ACCOUNT", + "name": "PayPal", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT", + "value": "0.00", + "feeRateType": "PERCENT", + "minimum": "4.00", + "maximum": "10.00" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CN", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT" + } + ] + } + }, + { + "code": "VENMO_ACCOUNT", + "name": "VENMO", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "VENMO_ACCOUNT", + "value": "5.00", + "feeRateType": "FLAT" + }, + { + "country": "CN", + "currency": "USD", + "transferMethodType": "VENMO_ACCOUNT", + "value": "4.50", + "feeRateType": "PERCENT", + "minimum": "4.00", + "maximum": "10.00" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "VENMO_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/successful_tmc_keys_mixedfee_response.json b/transfermethodui/src/test/resources/successful_tmc_keys_mixedfee_response.json new file mode 100644 index 000000000..b3c8df6d9 --- /dev/null +++ b/transfermethodui/src/test/resources/successful_tmc_keys_mixedfee_response.json @@ -0,0 +1,565 @@ +{ + "data": { + "countries": { + "nodes": [ + { + "code": "CA", + "name": "Canada", + "currencies": { + "nodes": [ + { + "code": "CAD", + "name": "Canadian Dollar", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "CA", + "currency": "CAD", + "transferMethodType": "BANK_ACCOUNT", + "value": "2.20", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CA", + "currency": "CAD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + }, + { + "code": "PAYPAL_ACCOUNT", + "name": "PayPal", + "fees": { + "nodes": [ + { + "country": "CA", + "currency": "CAD", + "transferMethodType": "PAYPAL_ACCOUNT", + "value": "0.25", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CA", + "currency": "CAD", + "transferMethodType": "PAYPAL_ACCOUNT" + } + ] + } + } + ] + } + }, + { + "code": "USD", + "name": "United States Dollar", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "CA", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "2.00", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CA", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + }, + { + "code": "HR", + "name": "Croatia", + "currencies": { + "nodes": [ + { + "code": "EUR", + "name": "Euro", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "HR", + "currency": "EUR", + "transferMethodType": "BANK_ACCOUNT", + "value": "1.50", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "2-3 Business days", + "country": "HR", + "currency": "EUR", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + } + ] + } + }, + { + "code": "HRK", + "name": "Croatian Kuna", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "HR", + "currency": "HRK", + "transferMethodType": "BANK_ACCOUNT", + "value": "1.50", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "HR", + "currency": "HRK", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + }, + { + "code": "MX", + "name": "Mexico", + "currencies": { + "nodes": [ + { + "code": "MXN", + "name": "Mexican Peso", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "MX", + "currency": "MXN", + "transferMethodType": "BANK_ACCOUNT", + "value": "26.15", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "MX", + "currency": "MXN", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + }, + { + "code": "GB", + "name": "United Kingdom", + "currencies": { + "nodes": [ + { + "code": "EUR", + "name": "Euro", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "GB", + "currency": "EUR", + "transferMethodType": "BANK_ACCOUNT", + "value": "1.50", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "2-4 Business days", + "country": "GB", + "currency": "EUR", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + } + ] + } + }, + { + "code": "GBP", + "name": "British Pound", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "GB", + "currency": "GBP", + "transferMethodType": "BANK_ACCOUNT", + "value": "1.20", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "GB", + "currency": "GBP", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + }, + { + "code": "US", + "name": "United States", + "currencies": { + "nodes": [ + { + "code": "USD", + "name": "United States Dollar", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "2.00", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + }, + { + "code": "BANK_CARD", + "name": "Debit Card", + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_CARD", + "value": "1.75", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "US", + "currency": "USD", + "transferMethodType": "BANK_CARD" + } + ] + } + }, + { + "code": "WIRE_ACCOUNT", + "name": "Wire Transfer", + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT", + "value": "20.00", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-3 Business days", + "country": "US", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT" + } + ] + } + }, + { + "code": "PAYPAL_ACCOUNT", + "name": "PayPal", + "fees": { + "nodes": [ + { + "country": "US", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT", + "value": "0.25", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "US", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + }, + { + "code": "CN", + "name": "CHINA", + "currencies": { + "nodes": [ + { + "code": "USD", + "name": "USD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "0.0", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + }, + { + "code": "BANK_CARD", + "name": "Debit Card", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_CARD", + "value": "0.00", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_CARD" + } + ] + } + }, + + { + "code": "WIRE_ACCOUNT", + "name": "Wire Transfer", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT", + "value": "0.000", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-3 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT" + } + ] + } + }, + { + "code": "PAYPAL_ACCOUNT", + "name": "PayPal", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT", + "value": "0.00", + "feeRateType": "PERCENT", + "minimum": "4.00", + "maximum": "10.00" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CN", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT" + } + ] + } + }, + { + "code": "VENMO_ACCOUNT", + "name": "VENMO", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "VENMO_ACCOUNT", + "value": "5.00", + "feeRateType": "FLAT" + }, + { + "country": "CN", + "currency": "USD", + "transferMethodType": "VENMO_ACCOUNT", + "value": "4.50", + "feeRateType": "PERCENT", + "minimum": "4.00", + "maximum": "10.00" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "VENMO_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/successful_tmc_keys_no_fee_response.json b/transfermethodui/src/test/resources/successful_tmc_keys_no_fee_response.json new file mode 100644 index 000000000..c296ff51a --- /dev/null +++ b/transfermethodui/src/test/resources/successful_tmc_keys_no_fee_response.json @@ -0,0 +1,81 @@ +{ + "data": { + "countries": { + "nodes": [ + { + "code": "CN", + "name": "CHINA", + "currencies": { + "nodes": [ + { + "code": "USD", + "name": "USD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + }, + { + "code": "BANK_CARD", + "name": "Debit Card", + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_CARD" + } + ] + } + }, + + { + "code": "WIRE_ACCOUNT", + "name": "Wire Transfer", + "processingTimes": { + "nodes": [ + { + "value": "1-3 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT" + } + ] + } + }, + { + "code": "PAYPAL_ACCOUNT", + "name": "PayPal", + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CN", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/transfermethodui/src/test/resources/successful_tmc_keys_response.json b/transfermethodui/src/test/resources/successful_tmc_keys_response.json index dfe07fea4..f14704117 100644 --- a/transfermethodui/src/test/resources/successful_tmc_keys_response.json +++ b/transfermethodui/src/test/resources/successful_tmc_keys_response.json @@ -405,6 +405,125 @@ } ] } + }, + { + "code": "CN", + "name": "CHINA", + "currencies": { + "nodes": [ + { + "code": "USD", + "name": "USD", + "transferMethodTypes": { + "nodes": [ + { + "code": "BANK_ACCOUNT", + "name": "Bank Account", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT", + "value": "0.0", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-2 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_ACCOUNT" + } + ] + } + }, + { + "code": "BANK_CARD", + "name": "Debit Card", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_CARD", + "value": "0.00", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CN", + "currency": "USD", + "transferMethodType": "BANK_CARD" + } + ] + } + }, + + { + "code": "WIRE_ACCOUNT", + "name": "Wire Transfer", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT", + "value": "0.000", + "feeRateType": "FLAT" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "1-3 Business days", + "country": "CN", + "currency": "USD", + "transferMethodType": "WIRE_ACCOUNT" + } + ] + } + }, + { + "code": "PAYPAL_ACCOUNT", + "name": "PayPal", + "fees": { + "nodes": [ + { + "country": "CN", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT", + "value": "0.00", + "feeRateType": "PERCENT", + "minimum": "4.00", + "maximum": "10.00" + } + ] + }, + "processingTimes": { + "nodes": [ + { + "value": "IMMEDIATE", + "country": "CN", + "currency": "USD", + "transferMethodType": "PAYPAL_ACCOUNT" + } + ] + } + } + ] + } + } + ] + } } ] } diff --git a/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/SelectDestinationTest.java b/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/SelectDestinationTest.java index 5bc1db8a3..473872dbd 100644 --- a/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/SelectDestinationTest.java +++ b/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/SelectDestinationTest.java @@ -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))))); @@ -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))))); diff --git a/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/TransferPPCFundsTest.java b/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/TransferPPCFundsTest.java index b42be417b..068050206 100644 --- a/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/TransferPPCFundsTest.java +++ b/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/TransferPPCFundsTest.java @@ -293,7 +293,7 @@ public void onReceive(Context context, Intent intent) { allOf(withId(R.id.exchange_rate_label), withText(R.string.mobileFXRateLabel)))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(0, - hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("$1 USD = $1.291253 CAD")))))); + hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("$1 USD = $1.2913 CAD")))))); onView(withId(R.id.amount_label)).check(matches(withText(R.string.mobileConfirmDetailsAmount))); onView(withId(R.id.amount_value)).check(matches(withText("$152.20 CAD"))); onView(withId(R.id.fee_label)).check(matches(withText(R.string.mobileConfirmDetailsFee))); diff --git a/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/TransferUserFundsTest.java b/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/TransferUserFundsTest.java index 357ca78e2..3fc4dd985 100644 --- a/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/TransferUserFundsTest.java +++ b/transferui/src/androidTest/java/com/hyperwallet/android/ui/transfer/TransferUserFundsTest.java @@ -486,7 +486,7 @@ public void onReceive(Context context, Intent intent) { allOf(withId(R.id.exchange_rate_label), withText(R.string.mobileFXRateLabel)))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(0, - hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("$1 USD = $1.291253 CAD")))))); + hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("$1 USD = $1.2913 CAD")))))); onView(withId(R.id.amount_label)).check(matches(withText(R.string.mobileConfirmDetailsAmount))); onView(withId(R.id.amount_value)).check(matches(withText("$152.20 CAD"))); onView(withId(R.id.fee_label)).check(matches(withText(R.string.mobileConfirmDetailsFee))); @@ -806,13 +806,13 @@ public void onReceive(Context context, Intent intent) { allOf(withId(R.id.exchange_rate_label), withText(R.string.mobileFXRateLabel)))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(0, - hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("$1 CAD = $0.774400 USD")))))); + hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("$1 CAD = $0.7744 USD")))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(1, hasDescendant( allOf(withId(R.id.sell_label), withText(R.string.mobileFXsell)))))); onView(withId(R.id.list_foreign_exchange)).check( - matches(atPosition(1, hasDescendant(allOf(withId(R.id.sell_value), withText("€100.00 EUR")))))); + matches(atPosition(1, hasDescendant(allOf(withId(R.id.sell_value), withText("€100,00  EUR")))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(1, hasDescendant(allOf(withId(R.id.buy_label), withText(R.string.mobileFXbuy)))))); @@ -823,7 +823,7 @@ public void onReceive(Context context, Intent intent) { allOf(withId(R.id.exchange_rate_label), withText(R.string.mobileFXRateLabel)))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(1, - hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("€1 EUR = $1.126100 USD")))))); + hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("€1 EUR = $1.1261 USD")))))); onView(withId(R.id.amount_label)).check(matches(withText(R.string.mobileConfirmDetailsAmount))); onView(withId(R.id.amount_value)).check(matches(withText("$290.05 USD"))); @@ -919,13 +919,13 @@ public void onReceive(Context context, Intent intent) { allOf(withId(R.id.exchange_rate_label), withText(R.string.mobileFXRateLabel)))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(0, - hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("$1 CAD = $0.784400 USD")))))); + hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("$1 CAD = $0.7844 USD")))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(1, hasDescendant( allOf(withId(R.id.sell_label), withText(R.string.mobileFXsell)))))); onView(withId(R.id.list_foreign_exchange)).check( - matches(atPosition(1, hasDescendant(allOf(withId(R.id.sell_value), withText("€100.00 EUR")))))); + matches(atPosition(1, hasDescendant(allOf(withId(R.id.sell_value), withText("€100,00  EUR")))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(1, hasDescendant(allOf(withId(R.id.buy_label), withText(R.string.mobileFXbuy)))))); @@ -936,7 +936,7 @@ public void onReceive(Context context, Intent intent) { allOf(withId(R.id.exchange_rate_label), withText(R.string.mobileFXRateLabel)))))); onView(withId(R.id.list_foreign_exchange)).check( matches(atPosition(1, - hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("€1 EUR = $1.136100 USD")))))); + hasDescendant(allOf(withId(R.id.exchange_rate_value), withText("€1 EUR = $1.1361 USD")))))); onView(withId(R.id.amount_label)).check(matches(withText(R.string.mobileConfirmDetailsAmount))); onView(withId(R.id.amount_value)).check(matches(withText("$194.05 USD"))); @@ -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)))); } diff --git a/transferui/src/main/assets/currency.json b/transferui/src/main/assets/currency.json deleted file mode 100644 index bdb496f0a..000000000 --- a/transferui/src/main/assets/currency.json +++ /dev/null @@ -1,1474 +0,0 @@ -[ - { - "id" : 23, - "name" : "United Arab Emirates Dirham", - "currencycode" : "AED", - "isocurrencycode" : "784", - "baseunit" : "dirham", - "denominationamount" : 200, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "د.إ", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 85, - "name" : "Albanian LEK", - "currencycode" : "ALL", - "isocurrencycode" : "008", - "baseunit" : "qindarka", - "denominationamount" : 5550, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "L", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 93, - "name" : "Armenian Dram", - "currencycode" : "AMD", - "isocurrencycode" : "051", - "baseunit" : "luma", - "denominationamount" : 23000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "֏", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 86, - "name" : "Argentine Peso", - "currencycode" : "ARS", - "isocurrencycode" : "032", - "baseunit" : "centavo", - "denominationamount" : 3000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 1, - "name" : "Australian Dollar", - "currencycode" : "AUD", - "isocurrencycode" : "036", - "baseunit" : "cents", - "denominationamount" : 50, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "A$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 79, - "name" : "Australian Dollar", - "currencycode" : "BAM", - "isocurrencycode" : "036", - "baseunit" : "cents", - "denominationamount" : 50, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "A$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 39, - "name" : "Bangladeshi Taka", - "currencycode" : "BDT", - "isocurrencycode" : "050", - "baseunit" : "poisha", - "denominationamount" : 4000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "Tk", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 41, - "name" : "Bulgarian Lev", - "currencycode" : "BGN", - "isocurrencycode" : "975", - "baseunit" : "stotinka", - "denominationamount" : 90, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "лв.", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 42, - "name" : "Bahraini Dinar", - "currencycode" : "BHD", - "isocurrencycode" : "48", - "baseunit" : "fils", - "denominationamount" : 190, - "decimals" : 3, - "hiddenDecimals" : 0, - "symbol" : ".د.ب", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 87, - "name" : "Bolivian Boliviano", - "currencycode" : "BOB", - "isocurrencycode" : "068", - "baseunit" : "centavos", - "denominationamount" : 350, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "Bs", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 16, - "name" : "Real", - "currencycode" : "BRL", - "isocurrencycode" : "076", - "baseunit" : "real", - "denominationamount" : 200, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "R$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 43, - "name" : "Botswana Pula", - "currencycode" : "BWP", - "isocurrencycode" : "72", - "baseunit" : "thebe", - "denominationamount" : 550, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "P", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 26, - "name" : "Pay Points", - "currencycode" : "C01", - "isocurrencycode" : "C01", - "baseunit" : "point", - "denominationamount" : 1, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "PLP", - "exchangeable" : 1, - "governmentissued" : 0, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 28, - "name" : "MonaVie Credits", - "currencycode" : "C02", - "isocurrencycode" : "C02", - "baseunit" : "point", - "denominationamount" : 1, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "MVC", - "exchangeable" : 1, - "governmentissued" : 0, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 36, - "name" : "USD", - "currencycode" : "C03", - "isocurrencycode" : "C03", - "baseunit" : "cents", - "denominationamount" : 50, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "$", - "exchangeable" : 1, - "governmentissued" : 0, - "groupingUsed" : 1, - "fxTransactionVisible" : 0, - "displayedAs" : "USD" - }, - { - "id" : 2, - "name" : "Canadian Dollar", - "currencycode" : "CAD", - "isocurrencycode" : "124", - "baseunit" : "cents", - "denominationamount" : 50, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 45, - "name" : "Swiss Franc", - "currencycode" : "CHF", - "isocurrencycode" : "756", - "baseunit" : "centimes", - "denominationamount" : 50, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 33, - "name" : "Peso", - "currencycode" : "CLP", - "isocurrencycode" : "152", - "baseunit" : "centavos", - "denominationamount" : 365, - "decimals" : 0, - "hiddenDecimals" : 2, - "symbol" : "$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 75, - "name" : "Chinese Renminbi Offshore HK", - "currencycode" : "CNH", - "isocurrencycode" : "", - "baseunit" : "", - "denominationamount" : 352, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "¥", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 3, - "name" : "Yuan Renminbi", - "currencycode" : "CNY", - "isocurrencycode" : "156", - "baseunit" : "", - "denominationamount" : 351, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "¥", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 35, - "name" : "Colombian Peso", - "currencycode" : "COP", - "isocurrencycode" : "170", - "baseunit" : "centavo", - "denominationamount" : 170000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 46, - "name" : "Czech Koruna", - "currencycode" : "CZK", - "isocurrencycode" : "203", - "baseunit" : "haléřů", - "denominationamount" : 1000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "Kč", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 47, - "name" : "Danish Kroner", - "currencycode" : "DKK", - "isocurrencycode" : "208", - "baseunit" : "øre", - "denominationamount" : 335, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "kr", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 37, - "name" : "Estonian kroon", - "currencycode" : "EEK", - "isocurrencycode" : "233", - "baseunit" : "sent", - "denominationamount" : 700, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "KR", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 91, - "name" : "Egyptian pound", - "currencycode" : "EGP", - "isocurrencycode" : "818", - "baseunit" : "piastre", - "denominationamount" : 800, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "E£", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 40, - "name" : "Ethiopian Birr", - "currencycode" : "ETB", - "isocurrencycode" : "251", - "baseunit" : "santim", - "denominationamount" : 1500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "Br", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 4, - "name" : "Euro", - "currencycode" : "EUR", - "isocurrencycode" : "978", - "baseunit" : "cents", - "denominationamount" : 50, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "€", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 48, - "name" : "Fiji Dollar", - "currencycode" : "FJD", - "isocurrencycode" : "242", - "baseunit" : "cents", - "denominationamount" : 100, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "FJ$", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 5, - "name" : "Pound", - "currencycode" : "GBP", - "isocurrencycode" : "826", - "baseunit" : "pence", - "denominationamount" : 50, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "£", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 49, - "name" : "Ghanaian Cedi", - "currencycode" : "GHS", - "isocurrencycode" : "936", - "baseunit" : "pesewas ", - "denominationamount" : 275, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "GH₵", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 50, - "name" : "Gambian Dalasi", - "currencycode" : "GMD", - "isocurrencycode" : "270", - "baseunit" : "bututs", - "denominationamount" : 2500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "D", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 6, - "name" : "Hong Kong Dollar", - "currencycode" : "HKD", - "isocurrencycode" : "344", - "baseunit" : "cents", - "denominationamount" : 400, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "HK$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 78, - "name" : "Croatian Kuna", - "currencycode" : "HRK", - "isocurrencycode" : "191", - "baseunit" : "Lipa", - "denominationamount" : 335, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "kn", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 27, - "name" : "Hungary Forint", - "currencycode" : "HUF", - "isocurrencycode" : "348", - "baseunit" : "filler", - "denominationamount" : 15000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "Ft", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 29, - "name" : "Indonesian rupiah", - "currencycode" : "IDR", - "isocurrencycode" : "360", - "baseunit" : "rupiah", - "denominationamount" : 7044, - "decimals" : 0, - "hiddenDecimals" : 2, - "symbol" : "rp", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 18, - "name" : "New Israeli Shekel", - "currencycode" : "ILS", - "isocurrencycode" : "376", - "baseunit" : "agorot", - "denominationamount" : 175, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "₪", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 12, - "name" : "Indian Rupee", - "currencycode" : "INR", - "isocurrencycode" : "356", - "baseunit" : "paise", - "denominationamount" : 3550, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "₹", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 51, - "name" : "Icelandic Krona", - "currencycode" : "ISK", - "isocurrencycode" : "352", - "baseunit" : "", - "denominationamount" : 61, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "Íkr", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 90, - "name" : "Jamaican Dollar", - "currencycode" : "JMD", - "isocurrencycode" : "388", - "baseunit" : "cents", - "denominationamount" : 6500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 52, - "name" : "Jordanian Dinar", - "currencycode" : "JOD", - "isocurrencycode" : "400", - "baseunit" : "qirsh", - "denominationamount" : 35, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "د.ا", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 15, - "name" : "Japanese Yen", - "currencycode" : "JPY", - "isocurrencycode" : "392", - "baseunit" : "yen", - "denominationamount" : 54, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "¥", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 20, - "name" : "Kenyan Shilling", - "currencycode" : "KES", - "isocurrencycode" : "404", - "baseunit" : "cents", - "denominationamount" : 5000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "KSh", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 84, - "name" : "Cambodian Riel", - "currencycode" : "KHR", - "isocurrencycode" : "116", - "baseunit" : "sen", - "denominationamount" : 200000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "៛", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 21, - "name" : "South Korean Won", - "currencycode" : "KRW", - "isocurrencycode" : "410", - "baseunit" : "jeon", - "denominationamount" : 588, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "₩", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 53, - "name" : "Kuwaiti Dinar", - "currencycode" : "KWD", - "isocurrencycode" : "414", - "baseunit" : "fils", - "denominationamount" : 15, - "decimals" : 3, - "hiddenDecimals" : 0, - "symbol" : "د.ك", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 92, - "name" : "Kazakhstani tenge", - "currencycode" : "KZT", - "isocurrencycode" : "398", - "baseunit" : "Tiyn", - "denominationamount" : 19500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "₸", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 83, - "name" : "Laos KIP", - "currencycode" : "LAK", - "isocurrencycode" : "418", - "baseunit" : "att", - "denominationamount" : 440000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "₭", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 80, - "name" : "Sri Lankan Rupee", - "currencycode" : "LKR", - "isocurrencycode" : "144", - "baseunit" : "Cents", - "denominationamount" : 9000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "රු", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 54, - "name" : "Lesotho Maloti", - "currencycode" : "LSL", - "isocurrencycode" : "426", - "baseunit" : "lisente", - "denominationamount" : 700, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "M", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 55, - "name" : "Moroccan Dirham", - "currencycode" : "MAD", - "isocurrencycode" : "504", - "baseunit" : "Santim", - "denominationamount" : 475, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "د.م.", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 56, - "name" : "Malagasy Ariary", - "currencycode" : "MGA", - "isocurrencycode" : "969", - "baseunit" : "", - "denominationamount" : 1840, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "Ar", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 95, - "name" : "Mauritanian Ouguiya", - "currencycode" : "MRU", - "isocurrencycode" : "929", - "baseunit" : "khoums", - "denominationamount" : 1850, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "UM", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 57, - "name" : "Mauritian Rupee", - "currencycode" : "MUR", - "isocurrencycode" : "480", - "baseunit" : "cents", - "denominationamount" : 1825, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "Rs", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 58, - "name" : "Malawian Kwacha", - "currencycode" : "MWK", - "isocurrencycode" : "454", - "baseunit" : "tambala", - "denominationamount" : 36500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "MK", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 14, - "name" : "Mexican Peso", - "currencycode" : "MXN", - "isocurrencycode" : "484", - "baseunit" : "centavos", - "denominationamount" : 1000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 7, - "name" : "Malaysian Ringgit", - "currencycode" : "MYR", - "isocurrencycode" : "458", - "baseunit" : "sen", - "denominationamount" : 200, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "RM", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 59, - "name" : "Mozambican New Metical", - "currencycode" : "MZN", - "isocurrencycode" : "943", - "baseunit" : "centavos", - "denominationamount" : 3100, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "MTn", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 60, - "name" : "Namibian Dollar", - "currencycode" : "NAD", - "isocurrencycode" : "516", - "baseunit" : "cents", - "denominationamount" : 725, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "N$", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 34, - "name" : "Naira", - "currencycode" : "NGN", - "isocurrencycode" : "566", - "baseunit" : "naira", - "denominationamount" : 18000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "₦", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 30, - "name" : "Norwegian Krone", - "currencycode" : "NOK", - "isocurrencycode" : "578", - "baseunit" : "øre", - "denominationamount" : 450, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "kr", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 82, - "name" : "Nepalese Rupee", - "currencycode" : "NPR", - "isocurrencycode" : "524", - "baseunit" : "Paisa", - "denominationamount" : 5500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "रू", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 8, - "name" : "New Zealand Dollar", - "currencycode" : "NZD", - "isocurrencycode" : "554", - "baseunit" : "cents", - "denominationamount" : 75, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "NZ$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 61, - "name" : "Omani Rial", - "currencycode" : "OMR", - "isocurrencycode" : "512", - "baseunit" : "baisa ", - "denominationamount" : 190, - "decimals" : 3, - "hiddenDecimals" : 0, - "symbol" : "ر.ع.", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 32, - "name" : "Nuevo sol", - "currencycode" : "PEN", - "isocurrencycode" : "604", - "baseunit" : "nuevo sol", - "denominationamount" : 165, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "S/.", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 62, - "name" : "Papua New Guinean Kina", - "currencycode" : "PGK", - "isocurrencycode" : "598", - "baseunit" : "toea", - "denominationamount" : 170, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "K", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 17, - "name" : "Philippines Pesos", - "currencycode" : "PHP", - "isocurrencycode" : "608", - "baseunit" : "pesos", - "denominationamount" : 2500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "₱", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 81, - "name" : "Pakistani Rupee", - "currencycode" : "PKR", - "isocurrencycode" : "586", - "baseunit" : "Paisa", - "denominationamount" : 7500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "Rs", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 19, - "name" : "Polish Zloty", - "currencycode" : "PLN", - "isocurrencycode" : "985", - "baseunit" : "grosz", - "denominationamount" : 200, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "zł", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 63, - "name" : "Qatari Riyal", - "currencycode" : "QAR", - "isocurrencycode" : "634", - "baseunit" : "dirham", - "denominationamount" : 185, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "ر.ق", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 77, - "name" : "Romanian Leu", - "currencycode" : "RON", - "isocurrencycode" : "946", - "baseunit" : "bani", - "denominationamount" : 215, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "lei", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 89, - "name" : "Serbian dinar", - "currencycode" : "RSD", - "isocurrencycode" : "941", - "baseunit" : "para", - "denominationamount" : 5000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "Дин.", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 22, - "name" : "Russian Ruble", - "currencycode" : "RUB", - "isocurrencycode" : "643", - "baseunit" : "rub", - "denominationamount" : 3000, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "руб", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 64, - "name" : "Solomon Islands Dollar", - "currencycode" : "SBD", - "isocurrencycode" : "90", - "baseunit" : "cents", - "denominationamount" : 400, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "SI$", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 65, - "name" : "Swedish Kronor", - "currencycode" : "SEK", - "isocurrencycode" : "752", - "baseunit" : "öre", - "denominationamount" : 475, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "kr", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 9, - "name" : "Singapore Dollar", - "currencycode" : "SGD", - "isocurrencycode" : "702", - "baseunit" : "cent", - "denominationamount" : 50, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "S$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 94, - "name" : "Salvadoran colón", - "currencycode" : "SVC", - "isocurrencycode" : "222", - "baseunit" : "cents", - "denominationamount" : 435, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "₡", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 66, - "name" : "Swazi Lilangeni", - "currencycode" : "SZL", - "isocurrencycode" : "748", - "baseunit" : "cents", - "denominationamount" : 730, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "E", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 25, - "name" : "Thailand Baht", - "currencycode" : "THB", - "isocurrencycode" : "764", - "baseunit" : "baht", - "denominationamount" : 1500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "฿", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 67, - "name" : "Tunisian Dinar", - "currencycode" : "TND", - "isocurrencycode" : "788", - "baseunit" : "millimes ", - "denominationamount" : 1420, - "decimals" : 3, - "hiddenDecimals" : 0, - "symbol" : "د.ت", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 68, - "name" : "Tongan Pa'anga", - "currencycode" : "TOP", - "isocurrencycode" : "776", - "baseunit" : "seniti", - "denominationamount" : 115, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "T$", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 24, - "name" : "Turkish Lira", - "currencycode" : "TRY", - "isocurrencycode" : "949", - "baseunit" : "lira", - "denominationamount" : 285, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "TL", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 10, - "name" : "New Taiwan Dollar", - "currencycode" : "TWD", - "isocurrencycode" : "901", - "baseunit" : "cents", - "denominationamount" : 15, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "NT$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 69, - "name" : "Ugandan Shilling", - "currencycode" : "UGX", - "isocurrencycode" : "800", - "baseunit" : "", - "denominationamount" : 1843, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "USh", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 11, - "name" : "United States Dollar", - "currencycode" : "USD", - "isocurrencycode" : "840", - "baseunit" : "cents", - "denominationamount" : 50, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 88, - "name" : "Uruguayan Peso", - "currencycode" : "UYU", - "isocurrencycode" : "858", - "baseunit" : "centésimos", - "denominationamount" : 1875, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "$", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 31, - "name" : "Vietnamese Dong", - "currencycode" : "VND", - "isocurrencycode" : "704", - "baseunit" : "xu", - "denominationamount" : 1157500, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "₫", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 70, - "name" : "Vanuatu Vatu", - "currencycode" : "VUV", - "isocurrencycode" : "548", - "baseunit" : "", - "denominationamount" : 58, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "VT", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 71, - "name" : "Samoan Tālā", - "currencycode" : "WST", - "isocurrencycode" : "882", - "baseunit" : "sene", - "denominationamount" : 135, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "T", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 72, - "name" : "CFP Franc", - "currencycode" : "XPF", - "isocurrencycode" : "953", - "baseunit" : "centimes", - "denominationamount" : 5400, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "F", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 13, - "name" : "Rand", - "currencycode" : "ZAR", - "isocurrencycode" : "710", - "baseunit" : "cents", - "denominationamount" : 725, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "R", - "exchangeable" : 1, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 73, - "name" : "Zambian Kwacha", - "currencycode" : "ZMW", - "isocurrencycode" : "967", - "baseunit" : "ngwee", - "denominationamount" : 665, - "decimals" : 2, - "hiddenDecimals" : 0, - "symbol" : "ZMK", - "exchangeable" : 0, - "governmentissued" : 1, - "groupingUsed" : 1, - "fxTransactionVisible" : 1, - "displayedAs" : null - }, - { - "id" : 76, - "name" : "Other", - "currencycode" : "_O", - "isocurrencycode" : "_O", - "baseunit" : "", - "denominationamount" : 1, - "decimals" : 0, - "hiddenDecimals" : 0, - "symbol" : "$", - "exchangeable" : 0, - "governmentissued" : 0, - "groupingUsed" : 0, - "fxTransactionVisible" : 0, - "displayedAs" : "ANY" - } -] diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/CurrencyDetails.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/CurrencyDetails.java deleted file mode 100644 index 74ccb1a0e..000000000 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/CurrencyDetails.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.hyperwallet.android.ui.transfer; - - -public class CurrencyDetails { - - private Integer id; - private String name; - private String currencyCode; - private String isoCurrencyCode; - private String baseUnit; - private Integer denominationAmount; - private Integer decimals; - private Integer hiddenDecimals; - private Integer exchangeable; - private Integer governmentIssued; - private Integer groupingUsed; - private Integer fxTransactionVisible; - private String displayedAs; - private String symbol; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public void setCurrencyCode(String currencyCode) { - this.currencyCode = currencyCode; - } - - public String getIsoCurrencyCode() { - return isoCurrencyCode; - } - - public void setIsoCurrencyCode(String isoCurrencyCode) { - this.isoCurrencyCode = isoCurrencyCode; - } - - public String getBaseUnit() { - return baseUnit; - } - - public void setBaseUnit(String baseUnit) { - this.baseUnit = baseUnit; - } - - public Integer getDenominationAmount() { - return denominationAmount; - } - - public void setDenominationAmount(Integer denominationAmount) { - this.denominationAmount = denominationAmount; - } - - public Integer getDecimals() { - return decimals; - } - - public void setDecimals(Integer decimals) { - this.decimals = decimals; - } - - public Integer getHiddenDecimals() { - return hiddenDecimals; - } - - public void setHiddenDecimals(Integer hiddenDecimals) { - this.hiddenDecimals = hiddenDecimals; - } - - public String getSymbol() { - return symbol; - } - - public void setSymbol(String symbol) { - this.symbol = symbol; - } - - public Integer getExchangeable() { - return exchangeable; - } - - public void setExchangeable(Integer exchangeable) { - this.exchangeable = exchangeable; - } - - public Integer getGovernmentIssued() { - return governmentIssued; - } - - public void setGovernmentIssued(Integer governmentIssued) { - this.governmentIssued = governmentIssued; - } - - public Integer getGroupingUsed() { - return groupingUsed; - } - - public void setGroupingUsed(Integer groupingUsed) { - this.groupingUsed = groupingUsed; - } - - public Integer getFxTransactionVisible() { - return fxTransactionVisible; - } - - public void setFxTransactionVisible(Integer fxTransactionVisible) { - this.fxTransactionVisible = fxTransactionVisible; - } - - public String getDisplayedAs() { - return displayedAs; - } - - public void setDisplayedAs(String displayedAs) { - this.displayedAs = displayedAs; - } -} diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/CreateTransferActivity.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/CreateTransferActivity.java index f36c96d65..69c77e07b 100644 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/CreateTransferActivity.java +++ b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/CreateTransferActivity.java @@ -62,7 +62,6 @@ public class CreateTransferActivity extends AppCompatActivity implements OnNetwo @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_create_transfer); diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/CreateTransferFragment.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/CreateTransferFragment.java index b1ec288eb..65ba69e7c 100644 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/CreateTransferFragment.java +++ b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/CreateTransferFragment.java @@ -60,8 +60,10 @@ import com.hyperwallet.android.model.transfermethod.TransferMethod; import com.hyperwallet.android.ui.common.intent.HyperwalletIntent; import com.hyperwallet.android.ui.common.repository.Event; +import com.hyperwallet.android.ui.common.util.CurrencyDetails; +import com.hyperwallet.android.ui.common.util.CurrencyParser; +import com.hyperwallet.android.ui.common.util.LocaleDetails; import com.hyperwallet.android.ui.common.view.OneClickListener; -import com.hyperwallet.android.ui.transfer.CurrencyDetails; import com.hyperwallet.android.ui.transfer.R; import com.hyperwallet.android.ui.transfer.TransferSource; import com.hyperwallet.android.ui.transfer.viewmodel.CreateTransferViewModel; @@ -76,6 +78,7 @@ import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.Currency; +import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -231,6 +234,8 @@ public void onOneClick(View v) { sourceList); intent.putExtra(ListTransferSourceActivity.EXTRA_SELECTED_SOURCE_TOKEN, activeSource.getToken()); + intent.putExtra(ListTransferSourceActivity.EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, + mCreateTransferViewModel.isPortraitMode()); startActivityForResult(intent, SELECT_TRANSFER_SOURCE_REQUEST_CODE); } }); @@ -542,9 +547,18 @@ public void onChanged(final TransferMethod transferMethod) { CurrencyDetails currencyDetails = getNumberOfFractionDigits(mCurrencyCode); mNumberOfFractionDigits = currencyDetails == null ? 0 : currencyDetails.getDecimals(); mTransferCurrencyCode.setText(currencyDetails == null ? "" : currencyDetails.getSymbol()); - mTransferAmount.setText( - formattedAmount(stringToDouble(mTransferAmount.getText().toString()), - mCurrencyCode)); + if (mDecimalSeparator != null && mGroupSeparator != null) { + mTransferAmount.setText( + formattedAmount(stringToDouble( + mTransferAmount.getText().toString().replace(mGroupSeparator, + EMPTY_STRING).replace(mDecimalSeparator, + CURRENCY_DOT_SEPARATOR)), + mCurrencyCode)); + } else { + mTransferAmount.setText( + formattedAmount(stringToDouble(mTransferAmount.getText().toString()), + mCurrencyCode)); + } showTransferDestination(transferMethod); enableInputControls(); } else { @@ -584,6 +598,8 @@ public void onOneClick(View v) { sourceList); intent.putExtra(ListTransferSourceActivity.EXTRA_SELECTED_SOURCE_TOKEN, activeSource.getToken()); + intent.putExtra(ListTransferSourceActivity.EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, + mCreateTransferViewModel.isPortraitMode()); startActivityForResult(intent, SELECT_TRANSFER_SOURCE_REQUEST_CODE); } }); @@ -730,7 +746,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); @@ -739,23 +759,38 @@ 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) { - DecimalFormat currencyFormatter = (DecimalFormat) DecimalFormat.getCurrencyInstance(); - currencyFormatter.setMinimumFractionDigits(mNumberOfFractionDigits); + HashMap localeList = CurrencyParser.getInstance(requireContext()).getLocaleList(); + DecimalFormat currencyFormatter; + if(localeList.containsKey(currencyCode)) { + LocaleDetails locale = localeList.get(currencyCode); + currencyFormatter = (DecimalFormat) DecimalFormat.getCurrencyInstance((new Locale(locale.getLanguage(),locale.getCountryCode()))); + }else { + currencyFormatter = (DecimalFormat) DecimalFormat.getCurrencyInstance(); + } + if (mNumberOfFractionDigits < 3) { + currencyFormatter.setMaximumFractionDigits(mNumberOfFractionDigits); + } else { + currencyFormatter.setMinimumFractionDigits(mNumberOfFractionDigits); + } currencyFormatter.setCurrency(Currency.getInstance(currencyCode == null ? US_CURRENCY_CODE : currencyCode)); DecimalFormatSymbols decimalFormatSymbols = currencyFormatter.getDecimalFormatSymbols(); decimalFormatSymbols.setCurrencySymbol(""); diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferDestinationActivity.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferDestinationActivity.java index 4d96b8b56..1562a97eb 100644 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferDestinationActivity.java +++ b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferDestinationActivity.java @@ -60,7 +60,6 @@ public class ListTransferDestinationActivity extends AppCompatActivity implement @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_list_transfer_destination); diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferDestinationFragment.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferDestinationFragment.java index 450713d5f..ba6432e45 100644 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferDestinationFragment.java +++ b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferDestinationFragment.java @@ -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; @@ -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) { diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferSourceActivity.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferSourceActivity.java index 543cc50d1..3dca53bb4 100644 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferSourceActivity.java +++ b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferSourceActivity.java @@ -19,6 +19,7 @@ import android.app.Activity; import android.content.Intent; +import android.content.pm.ActivityInfo; import android.os.Bundle; import android.text.TextUtils; import android.view.WindowManager; @@ -44,13 +45,13 @@ public class ListTransferSourceActivity extends AppCompatActivity implements OnN public static final String EXTRA_SELECTED_SOURCE = "EXTRA_SELECTED_SOURCE"; public static final String EXTRA_SELECTED_SOURCE_TOKEN = "SELECTED_SOURCE_TOKEN"; public static final String EXTRA_TRANSFER_SOURCE_LIST = "TRANSFER_SOURCE_LIST"; + public static final String EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT = "EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT"; private ListTransferSourceViewModel mListTransferSourceViewModel; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_list_transfer_source); @@ -71,6 +72,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { R.id.list_source_fragment); } + if (getIntent().getBooleanExtra(EXTRA_LOCK_SCREEN_ORIENTATION_TO_PORTRAIT, false)) { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + } + registerObservers(); } diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferSourceFragment.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferSourceFragment.java index 1d21866ed..d47e08e19 100644 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferSourceFragment.java +++ b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ListTransferSourceFragment.java @@ -25,6 +25,7 @@ import android.content.Context; import android.os.Build; import android.os.Bundle; +import android.os.Parcelable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -88,6 +89,12 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mListTransferSourceViewModel = ViewModelProviders.of(requireActivity()).get( ListTransferSourceViewModel.class); + + if (savedInstanceState != null) { + mActiveTransferSourceToken = savedInstanceState.getString(ARGUMENT_SELECTED_TRANSFER_SOURCE_TOKEN); + mTransferSourceList = savedInstanceState.getParcelableArrayList(ARGUMENT_TRANSFER_SOURCE_LIST); + } + } @Override @@ -199,6 +206,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; @@ -209,8 +217,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; } @@ -225,14 +233,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 { @@ -245,4 +256,12 @@ void recycle() { itemView.setOnClickListener(null); } } + + @Override + public void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + outState.putString(ARGUMENT_SELECTED_TRANSFER_SOURCE_TOKEN,mActiveTransferSourceToken); + outState.putParcelableArrayList(ARGUMENT_TRANSFER_SOURCE_LIST,(ArrayList)mTransferSourceList); + + } } diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ScheduleTransferActivity.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ScheduleTransferActivity.java index da14b2492..953296025 100644 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ScheduleTransferActivity.java +++ b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ScheduleTransferActivity.java @@ -67,7 +67,6 @@ public class ScheduleTransferActivity extends AppCompatActivity implements OnNet @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_schedule_transfer); diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ScheduleTransferFragment.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ScheduleTransferFragment.java index 3ba2724b9..edc165ddd 100644 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ScheduleTransferFragment.java +++ b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/view/ScheduleTransferFragment.java @@ -18,8 +18,10 @@ 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; 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; @@ -139,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() { @@ -327,7 +336,8 @@ void bind(@NonNull final ForeignExchange fx) { buyValue.setText(itemView.getContext().getString(R.string.amount_currency_format, buyFormattedAmount, fx.getDestinationCurrency())); exchangeRateValue.setText(itemView.getContext().getString(R.string.exchange_rate_format, - sourceCurrency.getSymbol(),fx.getSourceCurrency(), destinationCurrency.getSymbol(),fx.getRate(), fx.getDestinationCurrency())); + sourceCurrency.getSymbol(),fx.getSourceCurrency(), destinationCurrency.getSymbol(), + getValueWithTruncateDecimals(fx.getRate(), 4), fx.getDestinationCurrency())); } } } diff --git a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/viewmodel/CreateTransferViewModel.java b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/viewmodel/CreateTransferViewModel.java index bd779095e..ffab8de51 100644 --- a/transferui/src/main/java/com/hyperwallet/android/ui/transfer/viewmodel/CreateTransferViewModel.java +++ b/transferui/src/main/java/com/hyperwallet/android/ui/transfer/viewmodel/CreateTransferViewModel.java @@ -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); @@ -555,6 +556,7 @@ public void onPrepaidCardListLoaded(@NonNull List 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); } diff --git a/transferui/src/main/res/layout/foreign_exchange.xml b/transferui/src/main/res/layout/foreign_exchange.xml index 8ce465d7d..a1ae8be66 100644 --- a/transferui/src/main/res/layout/foreign_exchange.xml +++ b/transferui/src/main/res/layout/foreign_exchange.xml @@ -104,14 +104,16 @@ @@ -127,7 +129,6 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" - android:textDirection="ltr" tools:text="@string/foreign_exchange_rate_placeholder" /> + + + app:layout_constraintTop_toBottomOf="@+id/transfer_source_description_2"/> \ No newline at end of file