Skip to content

Commit

Permalink
Release 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
adyen-git-manager committed Sep 28, 2018
1 parent af2a84f commit fb2ac94
Show file tree
Hide file tree
Showing 15 changed files with 229 additions and 99 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To give you as much flexibility as possible, our Android SDK can be integrated i
Import the quick integration modules by adding these lines to your build.gradle file.

```groovy
final checkoutVersion = "2.0.0"
final checkoutVersion = "2.0.3"
implementation "com.adyen.checkout:ui:${checkoutVersion}"
implementation "com.adyen.checkout:nfc:${checkoutVersion}" // Optional; Integrates NFC card reader in card UI
```
Expand Down Expand Up @@ -135,7 +135,7 @@ By default, we use the font that is declared in the theme that is used for check
#### Installation
Import the following modules by adding these line to your `build.gradle` file.
```groovy
final checkoutVersion = "2.0.0"
final checkoutVersion = "2.0.3"
implementation "com.adyen.checkout:core:${checkoutVersion}"
implementation "com.adyen.checkout:core-card:${checkoutVersion}" // Optional; Required for processing card payments.
implementation "com.adyen.checkout:nfc:${checkoutVersion}" // Optional; Enables reading of card information with the device"s NFC chip.
Expand Down Expand Up @@ -243,6 +243,17 @@ mPaymentHandler.initiatePayment(paymentMethod, paymentMethodDetails);
```


## Proguard Rules
If you are using ProGuard add the following options:
```proguard
#### Adyen Checkout ####
-keep class com.adyen.checkout.core.** { *; }
-dontwarn com.adyen.checkout.nfc.**
-dontwarn com.adyen.checkout.googlewallet.**
-dontwarn com.adyen.checkout.wechatpay.**
```


## Example App - Quick Start
Run `bash <(curl -s https://raw.githubusercontent.com/Adyen/adyen-android/master/setup.sh)`

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ ext {
"com.tencent.mm.opensdk:wechat-sdk-android-without-mta:aff8bb92f98aa96792b984e51982fb35a8562c7cdeec270a3f163384f37bf87b:SHA-256",
]

versionCode = 202
versionName = "2.0.2"
versionCode = 203
versionName = "2.0.3"

testCoverageEnabled = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public static Callable<Boolean> isReadyToPay(
@NonNull PaymentSession paymentSession,
@NonNull PaymentMethod paymentMethod
) {
if (isPlayServicesUnavailable(context)) {
return CALLABLE_FALSE;
}

return new IsReadyToPayCallable(context, paymentSession, paymentMethod);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public static Callable<Boolean> isReadyToPay(
@NonNull PaymentSession paymentSession,
@NonNull PaymentMethod paymentMethod
) {
if (isPlayServicesUnavailable(context)) {
return CALLABLE_FALSE;
}

return new IsReadyToPayCallable(context, paymentSession, paymentMethod);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.adyen.checkout.googlewallet.internal;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
Expand All @@ -12,6 +13,8 @@
import com.adyen.checkout.core.model.PaymentMethodDetails;
import com.adyen.checkout.core.model.PaymentSession;
import com.adyen.checkout.util.AmountFormat;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.wallet.Wallet;
import com.google.android.gms.wallet.WalletConstants;

Expand All @@ -22,6 +25,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;

/**
* Copyright (c) 2018 Adyen B.V.
Expand All @@ -33,8 +37,21 @@
public abstract class GoogleWalletUtil {
static final int TIMEOUT_DEFAULT_SECONDS = 4;

static final Callable<Boolean> CALLABLE_FALSE = new Callable<Boolean>() {
@Override
public Boolean call() {
return false;
}
};

private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.##");

static boolean isPlayServicesUnavailable(@NonNull Context context) {
int googlePlayServicesAvailable = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);

return ConnectionResult.SUCCESS != googlePlayServicesAvailable;
}

@NonNull
static Wallet.WalletOptions buildWalletOptions(int environment) {
return new Wallet.WalletOptions.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.graphics.drawable.AnimatedVectorDrawableCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.RecyclerView;
Expand Down Expand Up @@ -92,6 +91,8 @@ public class CardDetailsActivity extends CheckoutDetailsActivity

private EditText mCardNumberEditText;

private LockToCheckmarkAnimationDelegate mLockToCheckmarkAnimationDelegate;

private EditText mExpiryDateEditText;

private EditText mSecurityCodeEditText;
Expand Down Expand Up @@ -157,15 +158,7 @@ public void onDismiss(DialogInterface dialog) {
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);

if (Cards.VALIDATOR.validateNumber(mCardNumberEditText.getText().toString()).getValidity() == CardValidator.Validity.VALID) {
if (!mCardNumberEditText.hasFocus()) {
AnimatedVectorDrawableCompat animatedVectorDrawable = (AnimatedVectorDrawableCompat) mCardNumberEditText.getCompoundDrawables()[2];

if (animatedVectorDrawable != null) {
animatedVectorDrawable.start();
}
}
}
mLockToCheckmarkAnimationDelegate.onTextChanged();
}

@Override
Expand All @@ -181,6 +174,14 @@ protected void onCreate(@Nullable final Bundle savedInstanceState) {

mHolderNameEditText = findViewById(R.id.editText_holderName);
mCardNumberEditText = findViewById(R.id.editText_cardNumber);
mLockToCheckmarkAnimationDelegate = new LockToCheckmarkAnimationDelegate(
mCardNumberEditText,
new LockToCheckmarkAnimationDelegate.ValidationCallback() {
@Override
public boolean isValid() {
return isCardNumberValidForUser();
}
});
mExpiryDateEditText = findViewById(R.id.editText_expiryDate);
mSecurityCodeEditText = findViewById(R.id.editText_securityCode);
mPhoneNumberEditText = findViewById(R.id.editText_phoneNumber);
Expand Down Expand Up @@ -331,16 +332,6 @@ public void onFocusChange(View v, boolean hasFocus) {
}

private void setupCardNumberEditText(boolean requestFocus) {
final LockToCheckmarkAnimationDelegate animationDelegate = new LockToCheckmarkAnimationDelegate(
mCardNumberEditText,
new LockToCheckmarkAnimationDelegate.ValidationCallback() {
@Override
public boolean isValid() {
return isCardNumberValidForUser();
}
}
);

TextViewUtil.addInputFilter(
mCardNumberEditText,
new InputFilter.LengthFilter(CardValidator.NUMBER_MAXIMUM_LENGTH + CardValidator.NUMBER_MAXIMUM_LENGTH / 4)
Expand All @@ -349,7 +340,7 @@ public boolean isValid() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
validateCardNumberEditText();
animationDelegate.onFocusChanged();
mLockToCheckmarkAnimationDelegate.onFocusChanged();
}
});
mCardNumberEditText.addTextChangedListener(new SimpleTextWatcher() {
Expand All @@ -369,7 +360,7 @@ public void afterTextChanged(Editable s) {
KeyboardUtil.showAndSelect(mExpiryDateEditText);
}

animationDelegate.onTextChanged();
mLockToCheckmarkAnimationDelegate.onTextChanged();
}
});
Cards.FORMATTER.attachAsYouTypeNumberFormatter(mCardNumberEditText);
Expand Down
Loading

0 comments on commit fb2ac94

Please sign in to comment.