target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void getPaymentMethodTokenizationParameters_whenApiKeyIsNotNull_returnsExpectedObject() { PaymentMethodTokenizationParameters params = mAndroidPayConfiguration.getPaymentMethodTokenizationParameters(); assertNotNull(params); assertEquals(PaymentMethodTokenizationType.PAYMENT_GATEWAY, params.getPaymentMetho...
@Nullable public PaymentMethodTokenizationParameters getPaymentMethodTokenizationParameters() { if (TextUtils.isEmpty(mPublicApiKey)) { return null; } return PaymentMethodTokenizationParameters.newBuilder() .setPaymentMethodTokenizationType(PAYMENT_GATEWAY) .addParameter("gateway", "stripe") .addParameter("stripe:publi...
AndroidPayConfiguration { @Nullable public PaymentMethodTokenizationParameters getPaymentMethodTokenizationParameters() { if (TextUtils.isEmpty(mPublicApiKey)) { return null; } return PaymentMethodTokenizationParameters.newBuilder() .setPaymentMethodTokenizationType(PAYMENT_GATEWAY) .addParameter("gateway", "stripe") ....
AndroidPayConfiguration { @Nullable public PaymentMethodTokenizationParameters getPaymentMethodTokenizationParameters() { if (TextUtils.isEmpty(mPublicApiKey)) { return null; } return PaymentMethodTokenizationParameters.newBuilder() .setPaymentMethodTokenizationType(PAYMENT_GATEWAY) .addParameter("gateway", "stripe") ....
AndroidPayConfiguration { @Nullable public PaymentMethodTokenizationParameters getPaymentMethodTokenizationParameters() { if (TextUtils.isEmpty(mPublicApiKey)) { return null; } return PaymentMethodTokenizationParameters.newBuilder() .setPaymentMethodTokenizationType(PAYMENT_GATEWAY) .addParameter("gateway", "stripe") ....
AndroidPayConfiguration { @Nullable public PaymentMethodTokenizationParameters getPaymentMethodTokenizationParameters() { if (TextUtils.isEmpty(mPublicApiKey)) { return null; } return PaymentMethodTokenizationParameters.newBuilder() .setPaymentMethodTokenizationType(PAYMENT_GATEWAY) .addParameter("gateway", "stripe") ....
@Test public void generateFullWalletRequest_createsExpectedFullWalletRequest() { FullWalletRequest request = AndroidPayConfiguration.generateFullWalletRequest("123abc", mCart); assertEquals("123abc", request.getGoogleTransactionId()); assertNotNull(request.getCart()); assertEquals("10.00", request.getCart().getTotalPri...
@NonNull public static FullWalletRequest generateFullWalletRequest( @NonNull String googleTransactionId, @NonNull Cart cart) { return FullWalletRequest.newBuilder() .setGoogleTransactionId(googleTransactionId) .setCart(cart) .build(); }
AndroidPayConfiguration { @NonNull public static FullWalletRequest generateFullWalletRequest( @NonNull String googleTransactionId, @NonNull Cart cart) { return FullWalletRequest.newBuilder() .setGoogleTransactionId(googleTransactionId) .setCart(cart) .build(); } }
AndroidPayConfiguration { @NonNull public static FullWalletRequest generateFullWalletRequest( @NonNull String googleTransactionId, @NonNull Cart cart) { return FullWalletRequest.newBuilder() .setGoogleTransactionId(googleTransactionId) .setCart(cart) .build(); } @VisibleForTesting AndroidPayConfiguration( ...
AndroidPayConfiguration { @NonNull public static FullWalletRequest generateFullWalletRequest( @NonNull String googleTransactionId, @NonNull Cart cart) { return FullWalletRequest.newBuilder() .setGoogleTransactionId(googleTransactionId) .setCart(cart) .build(); } @VisibleForTesting AndroidPayConfiguration( ...
AndroidPayConfiguration { @NonNull public static FullWalletRequest generateFullWalletRequest( @NonNull String googleTransactionId, @NonNull Cart cart) { return FullWalletRequest.newBuilder() .setGoogleTransactionId(googleTransactionId) .setCart(cart) .build(); } @VisibleForTesting AndroidPayConfiguration( ...
@Test public void generateMaskedWalletRequest_withoutCart_returnsNull() { assertNull(mAndroidPayConfiguration.generateMaskedWalletRequest(null)); }
@Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); }
AndroidPayConfiguration { @Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); } }
AndroidPayConfiguration { @Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); } @VisibleForTesting AndroidPayConfiguration( @NonNull String publicA...
AndroidPayConfiguration { @Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); } @VisibleForTesting AndroidPayConfiguration( @NonNull String publicA...
AndroidPayConfiguration { @Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); } @VisibleForTesting AndroidPayConfiguration( @NonNull String publicA...
@Test public void generateMaskedWalletRequest_whenCartHasNoTotalPrice_returnsNull() { Cart noPriceCart = Cart.newBuilder().build(); assertNull(mAndroidPayConfiguration.generateMaskedWalletRequest(noPriceCart)); }
@Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); }
AndroidPayConfiguration { @Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); } }
AndroidPayConfiguration { @Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); } @VisibleForTesting AndroidPayConfiguration( @NonNull String publicA...
AndroidPayConfiguration { @Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); } @VisibleForTesting AndroidPayConfiguration( @NonNull String publicA...
AndroidPayConfiguration { @Nullable public MaskedWalletRequest generateMaskedWalletRequest(@Nullable Cart cart) { return generateMaskedWalletRequest( cart, mIsPhoneNumberRequired, mIsShippingAddressRequired, mCurrency.getCurrencyCode()); } @VisibleForTesting AndroidPayConfiguration( @NonNull String publicA...
@Test public void setCurrency_withLowerCaseString_stillSetsCurrency() { LineItemBuilder builder = new LineItemBuilder("eur"); LineItem item = builder.build(); assertEquals("EUR", item.getCurrencyCode()); }
public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null) { androidPayBuil...
LineItemBuilder { public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null...
LineItemBuilder { public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null...
LineItemBuilder { public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null...
LineItemBuilder { public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null...
@Test public void asCardBrand_whenNonemptyButWeird_returnsUnknown() { assertEquals(Card.UNKNOWN, asCardBrand("Awesome New Brand")); }
@Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Card.AMERICAN_EXPRESS; } else if (Card.MASTERCARD.equalsIgnoreCas...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
@Test public void fromJson_whenNotACustomer_returnsNull() { assertNull(Customer.fromString(NON_CUSTOMER_OBJECT)); }
@Nullable public static Customer fromString(String jsonString) { if (jsonString == null) { return null; } try { return fromJson(new JSONObject(jsonString)); } catch (JSONException ignored) { return null; } }
Customer extends StripeJsonModel { @Nullable public static Customer fromString(String jsonString) { if (jsonString == null) { return null; } try { return fromJson(new JSONObject(jsonString)); } catch (JSONException ignored) { return null; } } }
Customer extends StripeJsonModel { @Nullable public static Customer fromString(String jsonString) { if (jsonString == null) { return null; } try { return fromJson(new JSONObject(jsonString)); } catch (JSONException ignored) { return null; } } private Customer(); }
Customer extends StripeJsonModel { @Nullable public static Customer fromString(String jsonString) { if (jsonString == null) { return null; } try { return fromJson(new JSONObject(jsonString)); } catch (JSONException ignored) { return null; } } private Customer(); String getId(); String getDefaultSource(); ShippingInfor...
Customer extends StripeJsonModel { @Nullable public static Customer fromString(String jsonString) { if (jsonString == null) { return null; } try { return fromJson(new JSONObject(jsonString)); } catch (JSONException ignored) { return null; } } private Customer(); String getId(); String getDefaultSource(); ShippingInfor...
@Test(expected = RuntimeException.class) public void setCurrencyCode_whenInvalid_throwsRuntimeException() { new LineItemBuilder("notacurrency").build(); fail("Can't create a LineItemBuilder with an illegal currency."); }
public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null) { androidPayBuil...
LineItemBuilder { public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null...
LineItemBuilder { public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null...
LineItemBuilder { public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null...
LineItemBuilder { public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null...
@Test public void isWholeNumber_whenBigDecimalFromInteger_returnsTrue() { assertTrue(LineItemBuilder.isWholeNumber(BigDecimal.ZERO)); assertTrue(LineItemBuilder.isWholeNumber(BigDecimal.valueOf(555))); }
static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; }
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } }
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } LineItemBuilder(); LineItemBuilder(String currencyCode); }
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } LineItemBuilder(); LineItemBuilder(String currencyCode); LineItemBuilder setCurrencyCode(String currencyCode); LineItemBuilder setUnitPrice(long unitPrice); LineItemBuilder se...
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } LineItemBuilder(); LineItemBuilder(String currencyCode); LineItemBuilder setCurrencyCode(String currencyCode); LineItemBuilder setUnitPrice(long unitPrice); LineItemBuilder se...
@Test public void isWholeNumber_whenBigDecimalDoubleWithoutDecimalPart_returnsTrue() { assertTrue(LineItemBuilder.isWholeNumber(BigDecimal.valueOf(1.0000))); }
static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; }
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } }
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } LineItemBuilder(); LineItemBuilder(String currencyCode); }
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } LineItemBuilder(); LineItemBuilder(String currencyCode); LineItemBuilder setCurrencyCode(String currencyCode); LineItemBuilder setUnitPrice(long unitPrice); LineItemBuilder se...
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } LineItemBuilder(); LineItemBuilder(String currencyCode); LineItemBuilder setCurrencyCode(String currencyCode); LineItemBuilder setUnitPrice(long unitPrice); LineItemBuilder se...
@Test public void isWholeNumber_whenBigDecimalDoubleWithDecimalPart_returnsFalse() { assertFalse(LineItemBuilder.isWholeNumber(BigDecimal.valueOf(1.5))); assertFalse(LineItemBuilder.isWholeNumber(BigDecimal.valueOf(2.07))); }
static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; }
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } }
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } LineItemBuilder(); LineItemBuilder(String currencyCode); }
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } LineItemBuilder(); LineItemBuilder(String currencyCode); LineItemBuilder setCurrencyCode(String currencyCode); LineItemBuilder setUnitPrice(long unitPrice); LineItemBuilder se...
LineItemBuilder { static boolean isWholeNumber(BigDecimal number) { return number.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0; } LineItemBuilder(); LineItemBuilder(String currencyCode); LineItemBuilder setCurrencyCode(String currencyCode); LineItemBuilder setUnitPrice(long unitPrice); LineItemBuilder se...
@Test public void isPriceBreakdownConsistent_whenItemsMultiplyClosely_returnsTrue() { assertTrue(isPriceBreakdownConsistent(1000L, BigDecimal.TEN, 10000L)); }
static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(totalPrice); if (e...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
@Test public void isPriceBreakdownConsistent_whenAnyItemIsNull_returnsTrue() { assertTrue(isPriceBreakdownConsistent(null, BigDecimal.TEN, 1234L)); assertTrue(isPriceBreakdownConsistent(55L, null, 8888L)); assertTrue(isPriceBreakdownConsistent(33L, BigDecimal.ONE, null)); }
static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(totalPrice); if (e...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
@Test public void isPriceBreakdownConsistent_whenItemsAreOffByALot_returnsFalse() { assertFalse(isPriceBreakdownConsistent(55L, BigDecimal.ONE, 56L)); }
static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(totalPrice); if (e...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
@Test public void isPriceBreakdownConsistent_whenItemsAreOffByOnlyALittle_returnsTrue() { assertTrue(isPriceBreakdownConsistent(199L, BigDecimal.ONE, 200L)); }
static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(totalPrice); if (e...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
LineItemBuilder { static boolean isPriceBreakdownConsistent( Long unitPrice, BigDecimal quantity, Long totalPrice) { if (unitPrice == null || quantity == null || totalPrice == null) { return true; } BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice)); BigDecimal actualPrice = BigDecimal.valueOf(...
@Test public void matchesCurrencyPattern_whenValid_returnsTrue() { assertTrue(matchesCurrencyPatternOrEmpty(null)); assertTrue(matchesCurrencyPatternOrEmpty("")); assertTrue(matchesCurrencyPatternOrEmpty("10.00")); assertTrue(matchesCurrencyPatternOrEmpty("01.11")); assertTrue(matchesCurrencyPatternOrEmpty("5000.05"));...
public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); }
PaymentUtils { public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); } }
PaymentUtils { public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); } }
PaymentUtils { public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); } static boolean matchesCurrencyPatternOrEmpty(@Nullable...
PaymentUtils { public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); } static boolean matchesCurrencyPatternOrEmpty(@Nullable...
@Test public void matchesCurrencyPattern_whenInvalid_returnsFalse() { assertFalse(matchesCurrencyPatternOrEmpty(".99")); assertFalse(matchesCurrencyPatternOrEmpty("0.123")); assertFalse(matchesCurrencyPatternOrEmpty("1.")); }
public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); }
PaymentUtils { public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); } }
PaymentUtils { public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); } }
PaymentUtils { public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); } static boolean matchesCurrencyPatternOrEmpty(@Nullable...
PaymentUtils { public static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString) { if (TextUtils.isEmpty(priceString)) { return true; } Pattern pattern = Pattern.compile("^-?[0-9]+(\\.[0-9][0-9])?"); return pattern.matcher(priceString).matches(); } static boolean matchesCurrencyPatternOrEmpty(@Nullable...
@Test public void asCardBrand_whenMastercard_returnsMasterCard() { assertEquals(Card.MASTERCARD, asCardBrand("MasterCard")); }
@Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Card.AMERICAN_EXPRESS; } else if (Card.MASTERCARD.equalsIgnoreCas...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
@Test public void matchesQuantityPattern_whenValid_returnsTrue() { assertTrue(matchesQuantityPatternOrEmpty(null)); assertTrue(matchesQuantityPatternOrEmpty("")); assertTrue(matchesQuantityPatternOrEmpty("10.1")); assertTrue(matchesQuantityPatternOrEmpty("01")); assertTrue(matchesQuantityPatternOrEmpty("500000000000"))...
public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); }
PaymentUtils { public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); } }
PaymentUtils { public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); } }
PaymentUtils { public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); } static boolean matchesCurrencyPatternOrEmpty(@Nullabl...
PaymentUtils { public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); } static boolean matchesCurrencyPatternOrEmpty(@Nullabl...
@Test public void matchesQuantityPattern_whenInvalid_returnsFalse() { assertFalse(matchesQuantityPatternOrEmpty("1.23")); assertFalse(matchesQuantityPatternOrEmpty(".99")); assertFalse(matchesQuantityPatternOrEmpty("0.123")); assertFalse(matchesQuantityPatternOrEmpty("1.")); assertFalse(matchesQuantityPatternOrEmpty("-...
public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); }
PaymentUtils { public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); } }
PaymentUtils { public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); } }
PaymentUtils { public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); } static boolean matchesCurrencyPatternOrEmpty(@Nullabl...
PaymentUtils { public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); } static boolean matchesCurrencyPatternOrEmpty(@Nullabl...
@Test public void validateLineItemList_whenEmptyList_returnsNoErrors() { assertEmpty(validateLineItemList(new ArrayList<LineItem>(), "USD")); }
@NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentException) { car...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
@Test public void validateLineItemList_whenNull_returnsNoErrors() { assertEmpty(validateLineItemList(null, "JPY")); }
@NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentException) { car...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
@Test public void validateLineItemList_whenEmptyCurrencyCode_hasExpectedCartError() { List<CartError> errors = validateLineItemList(new ArrayList<LineItem>(), ""); assertEquals(1, errors.size()); CartError error = errors.get(0); assertEquals(CartError.CART_CURRENCY, error.getErrorType()); assertEquals("Cart does not ha...
@NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentException) { car...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
@Test public void validateLineItemList_whenInvalidCurrencyCode_hasExpectedCartError() { List<CartError> errors = validateLineItemList(new ArrayList<LineItem>(), "fakebucks"); assertEquals(1, errors.size()); CartError error = errors.get(0); assertEquals(CartError.CART_CURRENCY, error.getErrorType()); assertEquals("Cart ...
@NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentException) { car...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
@Test public void validateLineItems_whenOneOrZeroTaxItems_returnsNoErrors() { Locale.setDefault(Locale.US); LineItem item0 = new LineItemBuilder("USD").setTotalPrice(1000L).build(); LineItem item1 = new LineItemBuilder("USD").setTotalPrice(2000L) .setRole(LineItem.Role.TAX).build(); List<LineItem> noTaxList = new Array...
@NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentException) { car...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
@Test public void validateLineItems_whenTwoTaxItems_hasExpectedCartError() { Locale.setDefault(Locale.US); LineItem item0 = LineItem.newBuilder().setCurrencyCode("USD") .setRole(LineItem.Role.REGULAR).build(); LineItem item1 = LineItem.newBuilder().setCurrencyCode("USD") .setRole(LineItem.Role.TAX).build(); LineItem it...
@NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentException) { car...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
@Test public void validateLineItemList_withOneBadItem_hasExpectedCartError() { LineItem badItem = LineItem.newBuilder().setTotalPrice("10.999") .setCurrencyCode("USD").build(); LineItem goodItem0 = LineItem.newBuilder().setTotalPrice("10.00") .setCurrencyCode("USD").build(); LineItem goodItem1 = LineItem.newBuilder().s...
@NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentException) { car...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
@Test public void validateLineItemList_whenOneItemHasNoCurrency_hasExpectedCartError() { LineItem badItem = LineItem.newBuilder().setTotalPrice("10.99").build(); LineItem goodItem0 = LineItem.newBuilder().setTotalPrice("10.00") .setCurrencyCode("USD").build(); LineItem goodItem1 = LineItem.newBuilder().setTotalPrice("1...
@NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentException) { car...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
@Test public void asCardBrand_whenCapitalizedStrangely_stillRecognizesCard() { assertEquals(Card.MASTERCARD, asCardBrand("Mastercard")); }
@Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Card.AMERICAN_EXPRESS; } else if (Card.MASTERCARD.equalsIgnoreCas...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
@Test public void validateLineItemList_whenMixedCurrencies_hasExpectedCartErrors() { LineItem euroItem = LineItem.newBuilder().setTotalPrice("10.99") .setCurrencyCode("EUR").build(); LineItem dollarItem = LineItem.newBuilder().setTotalPrice("10.00") .setCurrencyCode("USD").build(); LineItem yenItem = LineItem.newBuilde...
@NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentException) { car...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
PaymentUtils { @NonNull public static List<CartError> validateLineItemList( List<LineItem> lineItems, @NonNull String currencyCode) { List<CartError> cartErrors = new ArrayList<>(); if (lineItems == null) { return cartErrors; } try { Currency.getInstance(currencyCode); } catch (IllegalArgumentException illegalArgumentE...
@Test public void searchLineItemForErrors_whenNoFieldsEntered_returnsNull() { assertNull(searchLineItemForErrors(LineItem.newBuilder().build())); }
public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required pattern of %s", lineI...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
@Test public void searchLineItemForErrors_whenNull_returnsNull() { assertNull(searchLineItemForErrors(null)); }
public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required pattern of %s", lineI...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
@Test public void searchLineItemForErrors_withAllNumericFieldsCorrect_returnsNull() { assertNull(searchLineItemForErrors(LineItem.newBuilder() .setTotalPrice("10.00") .setQuantity("1.3") .setUnitPrice("1.50") .build())); }
public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required pattern of %s", lineI...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
@Test public void searchLineItemForErrors_whenJustOneIncorrectField_returnsExpectedError() { LineItem badTotalPriceItem = LineItem.newBuilder() .setTotalPrice("10.999") .setQuantity("1.3") .setUnitPrice("1.50") .build(); CartError totalPriceError = searchLineItemForErrors(badTotalPriceItem); assertNotNull(totalPriceErr...
public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required pattern of %s", lineI...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
@Test public void searchLineItemForErrors_withOneCorrectFieldAndOthersNull_returnsNull() { assertNull(searchLineItemForErrors(LineItem.newBuilder() .setTotalPrice("10.00") .build())); }
public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required pattern of %s", lineI...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
PaymentUtils { public static CartError searchLineItemForErrors(LineItem lineItem) { if (lineItem == null) { return null; } if (!matchesCurrencyPatternOrEmpty(lineItem.getUnitPrice())) { return new CartError(CartError.LINE_ITEM_PRICE, String.format(Locale.ENGLISH, "Invalid price string: %s does not match required patter...
@Test public void getPriceLong_whenDecimalValueGiven_correctlyParsesResult() { assertEquals(Long.valueOf(1000L), getPriceLong("10.00", Currency.getInstance("USD"))); assertEquals(Long.valueOf(55555555L), getPriceLong("555555.55", Currency.getInstance("EUR"))); assertEquals(Long.valueOf(99L), getPriceLong("0.99", Curren...
@Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); } int fractionDi...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
@Test public void getPriceLong_whenNonDecimalValueGivenInNonDecimalCurrency_correctlyParsesResult() { assertEquals(Long.valueOf(999L), getPriceLong("999", Currency.getInstance("JPY"))); assertEquals(Long.valueOf(1L), getPriceLong("1", Currency.getInstance("KRW"))); }
@Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); } int fractionDi...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
@Test public void getPriceLong_whenNonDecimalValueGivenInDecimalCurrency_correctlyMovesUpResult() { assertEquals(Long.valueOf(1000L), getPriceLong("10", Currency.getInstance("USD"))); assertEquals(Long.valueOf(30000L), getPriceLong("30", Currency.getInstance("OMR"))); }
@Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); } int fractionDi...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
@Test(expected = NumberFormatException.class) public void getPriceLong_whenDecimalValueInNonDecimalCurrency_throwsNumberFormatException() { getPriceLong("100.00", Currency.getInstance("JPY")); fail("Should throw NumberFormatException when trying to convert decimal amounts of Yen"); }
@Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); } int fractionDi...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
@Test public void asCardBrand_whenVisa_returnsVisa() { assertEquals(Card.VISA, asCardBrand("visa")); }
@Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Card.AMERICAN_EXPRESS; } else if (Card.MASTERCARD.equalsIgnoreCas...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
@Test(expected = IllegalArgumentException.class) public void getPriceLong_whenPriceStringHasAlphaCharacters_throwsIllegalArgumentException() { getPriceLong("55 bucks", Currency.getInstance("USD")); fail("Should throw IllegalArgumentException when trying to convert illegal characters"); }
@Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); } int fractionDi...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
@Test(expected = IllegalArgumentException.class) public void getPriceLong_whenPriceStringHasNoLeadingZero_throwsIllegalArgumentException() { getPriceLong(".88", Currency.getInstance("USD")); fail("Should throw IllegalArgumentException when trying to parse bad Strings"); }
@Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); } int fractionDi...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
@Test(expected = IllegalArgumentException.class) public void getPriceLong_whenPriceStringHasSeparators_throwsIllegalArgumentException() { getPriceLong("1,000", Currency.getInstance("USD")); fail("Should throw IllegalArgumentException when trying to parse bad Strings"); }
@Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); } int fractionDi...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
@Test public void getPriceLong_whenPriceStringIsNegative_correctlyParsesValue() { assertEquals(Long.valueOf(-15L), getPriceLong("-15", Currency.getInstance("JPY"))); assertEquals(Long.valueOf(-1500L), getPriceLong("-15", Currency.getInstance("USD"))); assertEquals(Long.valueOf(-9999L), getPriceLong("-99.99", Currency.g...
@Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); } int fractionDi...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
@Test public void getPriceLong_whenPriceStringIsEmpty_returnsNull() { assertNull(getPriceLong("", Currency.getInstance("USD"))); assertNull(getPriceLong(null, Currency.getInstance("KRW"))); }
@Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); } int fractionDi...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
PaymentUtils { @Nullable static Long getPriceLong(@Nullable String price, @NonNull Currency currency) { if (TextUtils.isEmpty(price)) { return null; } if (!matchesCurrencyPatternOrEmpty(price)) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "%s is not a valid price String for a LineItem", price)); }...
@Test public void getTotalPrice_forGroupOfStandardLineItemsInUsd_returnsExpectedValue() { Locale.setDefault(Locale.US); LineItem item1 = new LineItemBuilder("USD").setTotalPrice(1000L).build(); LineItem item2 = new LineItemBuilder("USD").setTotalPrice(2000L).build(); LineItem item3 = new LineItemBuilder("USD").setTotal...
@Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPrice(), currency);...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
@Test public void getTotalPrice_forGroupOfStandardLineItemsInKrw_returnsExpectedValue() { Locale.setDefault(Locale.KOREA); LineItem item1 = new LineItemBuilder("KRW").setTotalPrice(1000L).build(); LineItem item2 = new LineItemBuilder("KRW").setTotalPrice(2000L).build(); LineItem item3 = new LineItemBuilder("KRW").setTo...
@Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPrice(), currency);...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
@Test public void getTotalPrice_whenOneItemHasNoPrice_returnsExpectedValue() { Locale.setDefault(Locale.US); LineItem item1 = new LineItemBuilder("USD").setTotalPrice(1000L).build(); LineItem item2 = new LineItemBuilder("USD").build(); LineItem item3 = new LineItemBuilder("USD").setTotalPrice(3000L).build(); List<LineI...
@Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPrice(), currency);...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
@Test public void getTotalPrice_whenNoItemHasPrice_returnsZero() { Locale.setDefault(Locale.CANADA); LineItem item1 = new LineItemBuilder("CAD").build(); LineItem item2 = new LineItemBuilder("CAD").build(); List<LineItem> items = new ArrayList<>(); items.add(item1); items.add(item2); assertEquals(Long.valueOf(0L), getT...
@Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPrice(), currency);...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
@Test public void getTotalPrice_whenOneItemHasInvalidCurrency_returnsNull() { LineItem item1 = new LineItemBuilder("USD").setTotalPrice(100L).build(); LineItem item2 = new LineItemBuilder("CAD").setTotalPrice(100L).build(); List<LineItem> items = new ArrayList<>(); items.add(item1); items.add(item2); assertNull(getTota...
@Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPrice(), currency);...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
@Test public void asCardBrand_whenJcb_returnsJcb() { assertEquals(Card.JCB, asCardBrand("Jcb")); }
@Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Card.AMERICAN_EXPRESS; } else if (Card.MASTERCARD.equalsIgnoreCas...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
@Test public void getTotalPrice_whenEmptyList_returnsZero() { assertEquals(Long.valueOf(0L), getTotalPrice( new ArrayList<LineItem>(), Currency.getInstance("OMR"))); }
@Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPrice(), currency);...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
PaymentUtils { @Nullable static Long getTotalPrice(@NonNull Collection<LineItem> lineItems, @NonNull Currency currency) { Long totalPrice = null; for (LineItem lineItem : lineItems) { if (!currency.getCurrencyCode().equals(lineItem.getCurrencyCode())) { return null; } Long itemPrice = getPriceLong(lineItem.getTotalPric...
@Test public void getIsReadyToPayRequest_hasExpectedCardNetworks() { IsReadyToPayRequest isReadyToPayRequest = getStripeIsReadyToPayRequest(); Set<Integer> allowedNetworks = new HashSet<>(); allowedNetworks.addAll(isReadyToPayRequest.getAllowedCardNetworks()); assertEquals(5, allowedNetworks.size()); assertTrue(allowed...
public static IsReadyToPayRequest getStripeIsReadyToPayRequest() { return IsReadyToPayRequest.newBuilder() .addAllowedCardNetwork(WalletConstants.CardNetwork.AMEX) .addAllowedCardNetwork(WalletConstants.CardNetwork.DISCOVER) .addAllowedCardNetwork(WalletConstants.CardNetwork.JCB) .addAllowedCardNetwork(WalletConstants....
PaymentUtils { public static IsReadyToPayRequest getStripeIsReadyToPayRequest() { return IsReadyToPayRequest.newBuilder() .addAllowedCardNetwork(WalletConstants.CardNetwork.AMEX) .addAllowedCardNetwork(WalletConstants.CardNetwork.DISCOVER) .addAllowedCardNetwork(WalletConstants.CardNetwork.JCB) .addAllowedCardNetwork(W...
PaymentUtils { public static IsReadyToPayRequest getStripeIsReadyToPayRequest() { return IsReadyToPayRequest.newBuilder() .addAllowedCardNetwork(WalletConstants.CardNetwork.AMEX) .addAllowedCardNetwork(WalletConstants.CardNetwork.DISCOVER) .addAllowedCardNetwork(WalletConstants.CardNetwork.JCB) .addAllowedCardNetwork(W...
PaymentUtils { public static IsReadyToPayRequest getStripeIsReadyToPayRequest() { return IsReadyToPayRequest.newBuilder() .addAllowedCardNetwork(WalletConstants.CardNetwork.AMEX) .addAllowedCardNetwork(WalletConstants.CardNetwork.DISCOVER) .addAllowedCardNetwork(WalletConstants.CardNetwork.JCB) .addAllowedCardNetwork(W...
PaymentUtils { public static IsReadyToPayRequest getStripeIsReadyToPayRequest() { return IsReadyToPayRequest.newBuilder() .addAllowedCardNetwork(WalletConstants.CardNetwork.AMEX) .addAllowedCardNetwork(WalletConstants.CardNetwork.DISCOVER) .addAllowedCardNetwork(WalletConstants.CardNetwork.JCB) .addAllowedCardNetwork(W...
@Test public void removeErrorType_whenListContainsErrorsOfType_returnsListWithoutThoseErrors() { final CartError error1 = new CartError(CartError.DUPLICATE_TAX, "Dupe Tax"); final CartError error2 = new CartError(CartError.LINE_ITEM_CURRENCY, "Bad line item"); final CartError error3 = new CartError(CartError.LINE_ITEM_...
@NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(error); } retur...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
@Test public void removeErrorType_whenListHasNoErrorsOfType_returnsOriginalList() { final CartError error1 = new CartError(CartError.DUPLICATE_TAX, "Dupe Tax"); final CartError error2 = new CartError(CartError.CART_CURRENCY, "Bad line item"); List<CartError> errorList = new ArrayList<CartError>() {{ add(error1); add(er...
@NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(error); } retur...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
@Test public void removeErrorType_onEmptyList_returnsEmptyList() { assertEmpty(PaymentUtils.removeErrorType(new ArrayList<CartError>(), CartError.LINE_ITEM_QUANTITY)); }
@NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(error); } retur...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(...
@Test public void createCartManager_withoutCurrencyArgument_usesAndroidPayConfiguration() { AndroidPayConfiguration.getInstance().setCurrencyCode("JPY"); CartManager cartManager = new CartManager(); assertEquals("JPY", cartManager.getCurrencyCode()); }
@NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); }
CartManager { @NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); } }
CartManager { @NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); } CartManager(); CartManager(String currencyCode); CartManager(@NonNull Cart oldCart); CartManager(@NonNull Cart oldCart, boolean shouldKeepShipping, boolean shouldKeepTax); }
CartManager { @NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); } CartManager(); CartManager(String currencyCode); CartManager(@NonNull Cart oldCart); CartManager(@NonNull Cart oldCart, boolean shouldKeepShipping, boolean shouldKeepTax); @Nullable String addLineItem(@NonNull @Size(min = ...
CartManager { @NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); } CartManager(); CartManager(String currencyCode); CartManager(@NonNull Cart oldCart); CartManager(@NonNull Cart oldCart, boolean shouldKeepShipping, boolean shouldKeepTax); @Nullable String addLineItem(@NonNull @Size(min = ...
@Test public void createCartManager_withCurrencyDifferentFromConfiguration_changesConfigAndLogs() { ShadowLog.stream = System.out; AndroidPayConfiguration.getInstance().setCurrencyCode("KRW"); String expectedWarning = "Cart created with currency code GBP, which differs from " + "current AndroidPayConfiguration currency...
@NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); }
CartManager { @NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); } }
CartManager { @NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); } CartManager(); CartManager(String currencyCode); CartManager(@NonNull Cart oldCart); CartManager(@NonNull Cart oldCart, boolean shouldKeepShipping, boolean shouldKeepTax); }
CartManager { @NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); } CartManager(); CartManager(String currencyCode); CartManager(@NonNull Cart oldCart); CartManager(@NonNull Cart oldCart, boolean shouldKeepShipping, boolean shouldKeepTax); @Nullable String addLineItem(@NonNull @Size(min = ...
CartManager { @NonNull public String getCurrencyCode() { return mCurrency.getCurrencyCode(); } CartManager(); CartManager(String currencyCode); CartManager(@NonNull Cart oldCart); CartManager(@NonNull Cart oldCart, boolean shouldKeepShipping, boolean shouldKeepTax); @Nullable String addLineItem(@NonNull @Size(min = ...
@Test public void generateUuidForRole_beginsWithAppropriatePrefix() { String regularUuid = CartManager.generateUuidForRole(LineItem.Role.REGULAR); String shippingUuid = CartManager.generateUuidForRole(LineItem.Role.SHIPPING); assertTrue(regularUuid.startsWith(CartManager.REGULAR_ID)); assertTrue(shippingUuid.startsWith...
@NonNull static String generateUuidForRole(int role) { String baseId = UUID.randomUUID().toString(); String base = null; if (role == LineItem.Role.REGULAR) { base = REGULAR_ID; } else if (role == LineItem.Role.SHIPPING) { base = SHIPPING_ID; } StringBuilder builder = new StringBuilder(); if (base != null) { return buil...
CartManager { @NonNull static String generateUuidForRole(int role) { String baseId = UUID.randomUUID().toString(); String base = null; if (role == LineItem.Role.REGULAR) { base = REGULAR_ID; } else if (role == LineItem.Role.SHIPPING) { base = SHIPPING_ID; } StringBuilder builder = new StringBuilder(); if (base != null)...
CartManager { @NonNull static String generateUuidForRole(int role) { String baseId = UUID.randomUUID().toString(); String base = null; if (role == LineItem.Role.REGULAR) { base = REGULAR_ID; } else if (role == LineItem.Role.SHIPPING) { base = SHIPPING_ID; } StringBuilder builder = new StringBuilder(); if (base != null)...
CartManager { @NonNull static String generateUuidForRole(int role) { String baseId = UUID.randomUUID().toString(); String base = null; if (role == LineItem.Role.REGULAR) { base = REGULAR_ID; } else if (role == LineItem.Role.SHIPPING) { base = SHIPPING_ID; } StringBuilder builder = new StringBuilder(); if (base != null)...
CartManager { @NonNull static String generateUuidForRole(int role) { String baseId = UUID.randomUUID().toString(); String base = null; if (role == LineItem.Role.REGULAR) { base = REGULAR_ID; } else if (role == LineItem.Role.SHIPPING) { base = SHIPPING_ID; } StringBuilder builder = new StringBuilder(); if (base != null)...
@Test public void calculateTax_whenItemNotPresent_returnsZero() { AndroidPayConfiguration.getInstance().setCurrencyCode("KRW"); CartManager manager = new CartManager("KRW"); assertEquals(Long.valueOf(0L), manager.calculateTax()); }
public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); }
CartManager { public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); } }
CartManager { public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); } CartManager(); CartManager(String currencyCode); CartManager(@NonNu...
CartManager { public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); } CartManager(); CartManager(String currencyCode); CartManager(@NonNu...
CartManager { public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); } CartManager(); CartManager(String currencyCode); CartManager(@NonNu...
@Test public void getTotalPrice_whenSomeSectionsAreNull_returnsExpectedValue() { AndroidPayConfiguration.getInstance().setCurrencyCode("JPY"); Cart oldCart = generateCartWithAllItems("JPY"); CartManager manager = new CartManager(oldCart); assertEquals(Long.valueOf(7000L), manager.getTotalPrice()); }
@Nullable public Long getTotalPrice() { if (mCachedTotalPrice != null) { return mCachedTotalPrice; } Long[] sectionPrices = new Long[3]; sectionPrices[0] = calculateRegularItemTotal(); sectionPrices[1] = calculateShippingItemTotal(); sectionPrices[2] = calculateTax(); Long totalPrice = null; for (int i = 0 ; i < sectio...
CartManager { @Nullable public Long getTotalPrice() { if (mCachedTotalPrice != null) { return mCachedTotalPrice; } Long[] sectionPrices = new Long[3]; sectionPrices[0] = calculateRegularItemTotal(); sectionPrices[1] = calculateShippingItemTotal(); sectionPrices[2] = calculateTax(); Long totalPrice = null; for (int i = ...
CartManager { @Nullable public Long getTotalPrice() { if (mCachedTotalPrice != null) { return mCachedTotalPrice; } Long[] sectionPrices = new Long[3]; sectionPrices[0] = calculateRegularItemTotal(); sectionPrices[1] = calculateShippingItemTotal(); sectionPrices[2] = calculateTax(); Long totalPrice = null; for (int i = ...
CartManager { @Nullable public Long getTotalPrice() { if (mCachedTotalPrice != null) { return mCachedTotalPrice; } Long[] sectionPrices = new Long[3]; sectionPrices[0] = calculateRegularItemTotal(); sectionPrices[1] = calculateShippingItemTotal(); sectionPrices[2] = calculateTax(); Long totalPrice = null; for (int i = ...
CartManager { @Nullable public Long getTotalPrice() { if (mCachedTotalPrice != null) { return mCachedTotalPrice; } Long[] sectionPrices = new Long[3]; sectionPrices[0] = calculateRegularItemTotal(); sectionPrices[1] = calculateShippingItemTotal(); sectionPrices[2] = calculateTax(); Long totalPrice = null; for (int i = ...
@Test public void asCardBrand_whenDiscover_returnsDiscover() { assertEquals(Card.DISCOVER, asCardBrand("Discover")); }
@Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Card.AMERICAN_EXPRESS; } else if (Card.MASTERCARD.equalsIgnoreCas...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
@Test public void asCardBrand_whenDinersClub_returnsDinersClub() { assertEquals(Card.DINERS_CLUB, asCardBrand("Diners Club")); }
@Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Card.AMERICAN_EXPRESS; } else if (Card.MASTERCARD.equalsIgnoreCas...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
@Test public void asCardBrand_whenAmericanExpress_returnsAmericanExpress() { assertEquals(Card.AMERICAN_EXPRESS, asCardBrand("American express")); }
@Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Card.AMERICAN_EXPRESS; } else if (Card.MASTERCARD.equalsIgnoreCas...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @CardBrand public static String asCardBrand(@Nullable String possibleCardType) { if (possibleCardType == null || TextUtils.isEmpty(possibleCardType.trim())) { return null; } if (Card.AMERICAN_EXPRESS.equalsIgnoreCase(possibleCardType)) { return Car...
@Test public void asFundingType_whenDebit_returnsDebit() { assertEquals(Card.FUNDING_DEBIT, asFundingType("debit")); }
@Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)) { return Card.FUNDING_CREDIT; } else if (Card.FUNDING_DEBIT....
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
@Test public void asFundingType_whenCredit_returnsCredit() { assertEquals(Card.FUNDING_CREDIT, asFundingType("credit")); }
@Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)) { return Card.FUNDING_CREDIT; } else if (Card.FUNDING_DEBIT....
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
@Test public void asFundingType_whenCreditAndCapitalized_returnsCredit() { assertEquals(Card.FUNDING_CREDIT, asFundingType("Credit")); }
@Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)) { return Card.FUNDING_CREDIT; } else if (Card.FUNDING_DEBIT....
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
@Test public void testJSONConversion() { try { JSONObject rawConversion = new JSONObject(EXAMPLE_JSON_SHIPPING_ADDRESS); assertJsonEquals(mShippingMethod.toJson(), rawConversion); } catch (JSONException jsonException) { fail("Test Data failure: " + jsonException.getLocalizedMessage()); } }
@NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, mDetail); putStringIfNotNull(jsonObject, FIELD_IDENTIFIER, mIden...
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, m...
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, m...
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, m...
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, m...
@Test public void asFundingType_whenNull_returnsNull() { assertNull(asFundingType(null)); }
@Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)) { return Card.FUNDING_CREDIT; } else if (Card.FUNDING_DEBIT....
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
@Test public void asFundingType_whenBlank_returnsNull() { assertNull(asFundingType(" \t")); }
@Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)) { return Card.FUNDING_CREDIT; } else if (Card.FUNDING_DEBIT....
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
@Test public void asFundingType_whenUnknown_returnsUnknown() { assertEquals(Card.FUNDING_UNKNOWN, asFundingType("unknown")); }
@Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)) { return Card.FUNDING_CREDIT; } else if (Card.FUNDING_DEBIT....
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
@Test public void asFundingType_whenGobbledegook_returnsUnkown() { assertEquals(Card.FUNDING_UNKNOWN, asFundingType("personal iou")); }
@Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)) { return Card.FUNDING_CREDIT; } else if (Card.FUNDING_DEBIT....
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
Card extends StripeJsonModel implements StripePaymentSource { @Nullable @FundingType public static String asFundingType(@Nullable String possibleFundingType) { if (possibleFundingType == null || TextUtils.isEmpty(possibleFundingType.trim())) { return null; } if (Card.FUNDING_CREDIT.equalsIgnoreCase(possibleFundingType)...
@Test public void canInitializeWithMinimalArguments() { Card card = new Card("4242-4242-4242-4242", 12, 2050, "123"); assertTrue(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void testTypeReturnsCorrectlyForAmexCard() { Card card = new Card("3412123412341234", null, null, null); assertEquals(Card.AMERICAN_EXPRESS, card.getBrand()); }
@CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
@Test public void testTypeReturnsCorrectlyForDiscoverCard() { Card card = new Card("6452123412341234", null, null, null); assertEquals(Card.DISCOVER, card.getBrand()); }
@CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
@Test public void testTypeReturnsCorrectlyForJCBCard() { Card card = new Card("3512123412341234", null, null, null); assertEquals(Card.JCB, card.getBrand()); }
@CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
@Test public void testTypeReturnsCorrectlyForDinersClubCard() { Card card = new Card("3612123412341234", null, null, null); assertEquals(Card.DINERS_CLUB, card.getBrand()); }
@CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
@Test public void testTypeReturnsCorrectlyForVisaCard() { Card card = new Card("4112123412341234", null, null, null); assertEquals(Card.VISA, card.getBrand()); }
@CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
@Test public void testMapCreation() { assertMapEquals(mShippingMethod.toMap(), EXAMPLE_MAP_SHIPPING_ADDRESS); }
@NonNull @Override public Map<String, Object> toMap() { Map<String, Object> map = new HashMap<>(); map.put(FIELD_AMOUNT, mAmount); map.put(FIELD_CURRENCY_CODE, mCurrencyCode); map.put(FIELD_DETAIL, mDetail); map.put(FIELD_IDENTIFIER, mIdentifier); map.put(FIELD_LABEL, mLabel); return map; }
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public Map<String, Object> toMap() { Map<String, Object> map = new HashMap<>(); map.put(FIELD_AMOUNT, mAmount); map.put(FIELD_CURRENCY_CODE, mCurrencyCode); map.put(FIELD_DETAIL, mDetail); map.put(FIELD_IDENTIFIER, mIdentifier); map.put(F...
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public Map<String, Object> toMap() { Map<String, Object> map = new HashMap<>(); map.put(FIELD_AMOUNT, mAmount); map.put(FIELD_CURRENCY_CODE, mCurrencyCode); map.put(FIELD_DETAIL, mDetail); map.put(FIELD_IDENTIFIER, mIdentifier); map.put(F...
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public Map<String, Object> toMap() { Map<String, Object> map = new HashMap<>(); map.put(FIELD_AMOUNT, mAmount); map.put(FIELD_CURRENCY_CODE, mCurrencyCode); map.put(FIELD_DETAIL, mDetail); map.put(FIELD_IDENTIFIER, mIdentifier); map.put(F...
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public Map<String, Object> toMap() { Map<String, Object> map = new HashMap<>(); map.put(FIELD_AMOUNT, mAmount); map.put(FIELD_CURRENCY_CODE, mCurrencyCode); map.put(FIELD_DETAIL, mDetail); map.put(FIELD_IDENTIFIER, mIdentifier); map.put(F...
@Test public void testTypeReturnsCorrectlyForMasterCard() { Card card = new Card("5112123412341234", null, null, null); assertEquals(Card.MASTERCARD, card.getBrand()); }
@CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } }
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
Card extends StripeJsonModel implements StripePaymentSource { @CardBrand public String getBrand() { if (StripeTextUtils.isBlank(brand) && !StripeTextUtils.isBlank(number)) { brand = CardUtils.getPossibleCardType(number); } return brand; } Card( String number, Integer expMonth, Intege...
@Test public void shouldPassValidateNumberIfLuhnNumber() { Card card = new Card("4242-4242-4242-4242", null, null, null); assertTrue(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldFailValidateNumberIfNotLuhnNumber() { Card card = new Card("4242-4242-4242-4241", null, null, null); assertFalse(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldFailValidateNumberIfNull() { Card card = new Card(null, null, null, null); assertFalse(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldFailValidateNumberIfBlank() { Card card = new Card("", null, null, null); assertFalse(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldFailValidateNumberIfJustSpaces() { Card card = new Card(" ", null, null, null); assertFalse(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldFailValidateNumberIfTooShort() { Card card = new Card("0", null, null, null); assertFalse(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldFailValidateNumberIfContainsLetters() { Card card = new Card("424242424242a4242", null, null, null); assertFalse(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldPassValidateNumber() { Card card = new Card("4242424242424242", null, null, null); assertTrue(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldPassValidateNumberSpaces() { Card card = new Card("4242 4242 4242 4242", null, null, null); assertTrue(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void nullIfNullOrEmpty_returnsNullForNull() { assertNull(StripeJsonUtils.nullIfNullOrEmpty("null")); }
@Nullable static String nullIfNullOrEmpty(@Nullable String possibleNull) { return NULL.equals(possibleNull) || EMPTY.equals(possibleNull) ? null : possibleNull; }
StripeJsonUtils { @Nullable static String nullIfNullOrEmpty(@Nullable String possibleNull) { return NULL.equals(possibleNull) || EMPTY.equals(possibleNull) ? null : possibleNull; } }
StripeJsonUtils { @Nullable static String nullIfNullOrEmpty(@Nullable String possibleNull) { return NULL.equals(possibleNull) || EMPTY.equals(possibleNull) ? null : possibleNull; } }
StripeJsonUtils { @Nullable static String nullIfNullOrEmpty(@Nullable String possibleNull) { return NULL.equals(possibleNull) || EMPTY.equals(possibleNull) ? null : possibleNull; } }
StripeJsonUtils { @Nullable static String nullIfNullOrEmpty(@Nullable String possibleNull) { return NULL.equals(possibleNull) || EMPTY.equals(possibleNull) ? null : possibleNull; } }
@Test public void shouldPassValidateNumberDashes() { Card card = new Card("4242-4242-4242-4242", null, null, null); assertTrue(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldPassValidateNumberWithMixedSeparators() { Card card = new Card("4242-4 242 424-24 242", null, null, null); assertTrue(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldFailValidateNumberIfWithDot() { Card card = new Card("4242.4242.4242.4242", null, null, null); assertFalse(card.validateNumber()); }
public boolean validateNumber() { return CardUtils.isValidCardNumber(number); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateNumber() { return CardUtils.isValidCardNumber(number); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String addressLine1, ...
@Test public void shouldFailValidateExpiryDateIfNullYear() { Card card = new Card(null, 1, null, null); assertFalse(card.validateExpiryDate(calendar)); }
public boolean validateExpiryDate() { return validateExpiryDate(Calendar.getInstance()); }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateExpiryDate() { return validateExpiryDate(Calendar.getInstance()); } }
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateExpiryDate() { return validateExpiryDate(Calendar.getInstance()); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String address...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateExpiryDate() { return validateExpiryDate(Calendar.getInstance()); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String address...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateExpiryDate() { return validateExpiryDate(Calendar.getInstance()); } Card( String number, Integer expMonth, Integer expYear, String cvc, String name, String address...
@Test public void shouldFailValidateCVCIfNull() { Card card = new Card(null, null, null, null); assertFalse(card.validateCVC()); }
public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXPRESS.equals(updatedType) && cvcValue.length() == 4) || cvcValu...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
@Test public void shouldFailValidateCVCIfBlank() { Card card = new Card(null, null, null, ""); assertFalse(card.validateCVC()); }
public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXPRESS.equals(updatedType) && cvcValue.length() == 4) || cvcValu...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
@Test public void shouldFailValidateCVCIfUnknownTypeAndLength2() { Card card = new Card(null, null, null, "12"); assertFalse(card.validateCVC()); }
public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXPRESS.equals(updatedType) && cvcValue.length() == 4) || cvcValu...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
@Test public void shouldPassValidateCVCIfUnknownTypeAndLength3() { Card card = new Card(null, null, null, "123"); assertTrue(card.validateCVC()); }
public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXPRESS.equals(updatedType) && cvcValue.length() == 4) || cvcValu...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
@Test public void shouldPassValidateCVCIfUnknownTypeAndLength4() { Card card = new Card(null, null, null, "1234"); assertTrue(card.validateCVC()); }
public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXPRESS.equals(updatedType) && cvcValue.length() == 4) || cvcValu...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
@Test public void shouldFailValidateCVCIfUnknownTypeAndLength5() { Card card = new Card(null, null, null, "12345"); assertFalse(card.validateCVC()); }
public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXPRESS.equals(updatedType) && cvcValue.length() == 4) || cvcValu...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...
Card extends StripeJsonModel implements StripePaymentSource { public boolean validateCVC() { if (StripeTextUtils.isBlank(cvc)) { return false; } String cvcValue = cvc.trim(); String updatedType = getBrand(); boolean validLength = (updatedType == null && cvcValue.length() >= 3 && cvcValue.length() <= 4) || (AMERICAN_EXP...