Skip to content

Commit

Permalink
2.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
adyen-git-manager committed Mar 7, 2019
1 parent 1718e08 commit b4f8106
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 9 deletions.
4 changes: 2 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.3.2"
final checkoutVersion = "2.3.3"
implementation "com.adyen.checkout:ui:${checkoutVersion}"
implementation "com.adyen.checkout:nfc:${checkoutVersion}" // Optional; Integrates NFC card reader in card UI
implementation "com.adyen.checkout:wechatpay:${checkoutVersion}" // Optional; Integrates support for WeChat Pay
Expand Down Expand Up @@ -136,7 +136,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.3.2"
final checkoutVersion = "2.3.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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ ext {
"com.tencent.mm.opensdk:wechat-sdk-android-without-mta:9a15154c07c05eadba8351c110647c1754316e32d8f12f55e24679891b52739c:SHA-256",
]

versionCode = 208
versionName = "2.3.2"
versionCode = 209
versionName = "2.3.3"

testCoverageEnabled = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;

import com.adyen.checkout.core.CheckoutException;
import com.adyen.checkout.core.Observable;
import com.adyen.checkout.core.Observer;
import com.adyen.checkout.core.PaymentHandler;
import com.adyen.checkout.core.PaymentReference;
import com.adyen.checkout.core.PaymentResult;
import com.adyen.checkout.core.RedirectDetails;
import com.adyen.checkout.core.handler.ErrorHandler;
import com.adyen.checkout.core.handler.RedirectHandler;
import com.adyen.checkout.core.model.GooglePayConfiguration;
import com.adyen.checkout.core.model.GooglePayDetails;
import com.adyen.checkout.core.model.PaymentMethod;
Expand All @@ -36,14 +40,15 @@
import org.json.JSONException;

public class GooglePayDetailsActivity extends Activity {
private static final String TAG = GooglePayDetails.class.getSimpleName();
private static final String EXTRA_PAYMENT_REFERENCE = "EXTRA_PAYMENT_REFERENCE";

private static final String EXTRA_PAYMENT_METHOD = "EXTRA_PAYMENT_METHOD";

private static final int REQUEST_CODE_GOOGLE_PAY = 1;

private PaymentReference mPaymentReference;
private PaymentMethod mPaymentMethod;

private PaymentHandler mPaymentHandler;

@NonNull
Expand All @@ -61,9 +66,9 @@ protected void onCreate(@Nullable final Bundle savedInstanceState) {

Intent intent = getIntent();

PaymentReference paymentReference = intent.getParcelableExtra(EXTRA_PAYMENT_REFERENCE);
mPaymentReference = intent.getParcelableExtra(EXTRA_PAYMENT_REFERENCE);
mPaymentMethod = intent.getParcelableExtra(EXTRA_PAYMENT_METHOD);
mPaymentHandler = paymentReference.getPaymentHandler(this);
mPaymentHandler = mPaymentReference.getPaymentHandler(this);

final GooglePayConfiguration configuration;
try {
Expand Down Expand Up @@ -102,6 +107,34 @@ public void onChanged(@NonNull PaymentResult paymentResult) {
finish();
}
});
mPaymentHandler.setRedirectHandler(this, new RedirectHandler() {
@Override
public void onRedirectRequired(@NonNull RedirectDetails redirectDetails) {
handleRedirect(redirectDetails);
}
});
}

private void handleRedirect(RedirectDetails redirectDetails) {
Class<?> redirectActivityClass;
try {
redirectActivityClass = Class.forName("com.adyen.checkout.ui.internal.common.activity.RedirectHandlerActivity");
} catch (ClassNotFoundException e) {
Log.e(TAG, "Failed to get redirect class.", e);
return;
}

Intent redirectIntent = new Intent(GooglePayDetailsActivity.this, redirectActivityClass);

redirectIntent.putExtra(EXTRA_PAYMENT_REFERENCE, mPaymentReference);
redirectIntent.putExtra("EXTRA_REDIRECT_DETAILS", redirectDetails);

boolean isCallable = getPackageManager().queryIntentActivities(redirectIntent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
if (isCallable) {
startActivity(redirectIntent);
} else {
Log.e(TAG, "RedirectHandlerActivity not callable.");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import com.adyen.checkout.ui.internal.common.fragment.ProgressDialogFragment;
import com.adyen.checkout.ui.internal.common.model.CheckoutSessionProvider;

public abstract class CheckoutSessionActivity extends AppCompatActivity
implements CheckoutSessionProvider {
public abstract class CheckoutSessionActivity extends AppCompatActivity implements CheckoutSessionProvider {

@NonNull
public static final String EXTRA_PAYMENT_REFERENCE = "EXTRA_PAYMENT_REFERENCE";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.adyen.checkout.ui.internal.common.util.ThemeUtil;

public class RedirectHandlerActivity extends AppCompatActivity {

private static final String EXTRA_PAYMENT_REFERENCE = "EXTRA_PAYMENT_REFERENCE";

private static final String EXTRA_REDIRECT_DETAILS = "EXTRA_REDIRECT_DETAILS";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public final class PaymentSetupRequest implements Serializable {
@Json(name = "deliveryAddress")
private Address mDeliveryAddress;

@Json(name = "executeThreeD")
private String mExecuteThreeD;

public static final class Builder {
private final PaymentSetupRequest mPaymentSetupRequest;

Expand Down Expand Up @@ -161,6 +164,11 @@ public Builder setDeliveryAddress(@Nullable Address deliveryAddress) {
return this;
}

public Builder setExecuteThreeD(@Nullable String executeThreeD) {
mPaymentSetupRequest.mExecuteThreeD = executeThreeD;
return this;
}

@NonNull
public PaymentSetupRequest build() {
return mPaymentSetupRequest;
Expand Down

0 comments on commit b4f8106

Please sign in to comment.