Skip to content

Commit

Permalink
3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
adyen-git-manager committed Aug 29, 2019
1 parent 916244c commit 89119d6
Show file tree
Hide file tree
Showing 76 changed files with 1,483 additions and 548 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.adyen.checkout.adyen3ds2.exception.Authentication3DS2Exception;
import com.adyen.checkout.adyen3ds2.model.ChallengeResult;
import com.adyen.checkout.adyen3ds2.model.ChallengeToken;
import com.adyen.checkout.adyen3ds2.model.FingerprintToken;
Expand Down Expand Up @@ -235,6 +236,11 @@ public void run() {
private void challengeShopper(Activity activity, String encodedChallengeToken) throws ComponentException {
Logger.d(TAG, "challengeShopper");

if (mTransaction == null) {
notifyException(new Authentication3DS2Exception("Failed to make challenge, missing reference to initial transaction."));
return;
}

final String decodedChallengeToken = Base64Encoder.decode(encodedChallengeToken);

final JSONObject challengeTokenJson;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*
* This file is open source and available under the MIT license. See the LICENSE file for more info.
*
* Created by caiof on 3/7/2019.
* Created by caiof on 21/8/2019.
*/

package com.adyen.checkout.adyen3ds2;
package com.adyen.checkout.adyen3ds2.exception;

import android.support.annotation.NonNull;

Expand Down
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[//]: <> (A changelog is a file which contains a curated, chronologically ordered list of notable changes for each version of a project.)
[//]: <> (Types of changes: `Added` `Changed` `Deprecated` `Removed` `Fixed` `Security`)
[//]: <> (Example:)
[//]: <> (## [0.0.6] - 2014-12-12)
[//]: <> (### Added)
[//]: <> ( - New payment method)
[//]: <> ( ### Changed)
[//]: <> ( - DropIn service's package changed from `com.adyen.dropin` to `com.adyen.dropin.services`)
[//]: <> ( ### Deprecated)
[//]: <> ( - Configurations public constructor are deprecated, please use each Configuration's builder to make a Configuration object)
[//]: <>
[//]: <>
[//]: <> (Add changes that not released yet into `Unreleased` section)
[//]: <> (Comment `Unreleased` section if there are no changes)
[//]: <> (## [Unreleased])
## [3.2.1] - 2019-08-29
### Added
- Created Settings screen on Example app to facilitate testing instead of hard coding values.
### Changed
- All configurations are now `Parcelable`
- Authentication3DS2Exception moved from package `com.adyen.checkout.adyen3ds2` to `com.adyen.checkout.adyen3ds2.exception`
- Update 3DS2 to version `2.1.0-rc04`
### Fixed
- Issue related to [DropIn singleton configuration](https://github.com/Adyen/adyen-android/issues/89) fixed
- Check 3DS2 Transaction to avoid NPE related to [wrong flow implementation](https://github.com/Adyen/adyen-android/issues/101)
- Do not show payment methods that are not Ecommerce on shopper interaction.
- Issue related to [Adyen 3DS2](https://github.com/Adyen/adyen-android/issues/102) fixed
### Deprecated
- All configuration's public constructor were deprecated, instead you can use Builder class of each configuration.
- `DropInConfiguration.Builder(context, serviceClass)` deprecated because now you need to pass `resultHandlerIntent` to builder's constructor.
```kotlin
DropInConfiguration.Builder(context, resultHandlerIntent, serviceClass)
```
- `DropIn.INSTANCE` singleton deprecated, instead you can use the static method directly.
```kotlin
// Be aware that `dropInConfiguration` need to be initiate with new constructor mentioned above
DropIn.startPayment(context, paymentMethodsApiResponse, dropInConfiguration)
```
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ The Components are available through [jcenter][dl], you only need to add the Gra
Import the Component module for the Payment Method you want to use by adding it to your `build.gradle` file.
For example, for the Drop-in solution you should add:
```groovy
implementation "com.adyen.checkout:drop-in:3.2.0"
implementation "com.adyen.checkout:drop-in:3.2.1"
```
For a Credit Card component you should add:
```groovy
implementation "com.adyen.checkout:card-ui:3.2.0"
implementation "com.adyen.checkout:card-ui:3.2.1"
```
For and iDeal component you should add:
```groovy
implementation "com.adyen.checkout:ideal-ui:3.2.0"
implementation "com.adyen.checkout:ideal-ui:3.2.1"
```

## Drop-in
Expand Down
2 changes: 1 addition & 1 deletion RELEASE_NOTES
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<ul>
<li>Added support for "Google pay"</li>
<li>Bug fixes</li>
</ul>
2 changes: 1 addition & 1 deletion base-ui/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<resources>
<!-- Placeholder to be overridden by main app. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"/>
<style name="AppTheme" parent="Theme.AppCompat.DayNight"/>

<style name="AdyenCheckout" parent="AppTheme"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,75 @@

package com.adyen.checkout.base;

import android.os.Parcel;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.adyen.checkout.core.exeption.ModelSerializationException;
import com.adyen.checkout.core.model.JsonUtils;
import com.adyen.checkout.core.model.ModelObject;

import org.json.JSONException;
import org.json.JSONObject;

public class ActionComponentData {
@SuppressWarnings("MemberName")
public class ActionComponentData extends ModelObject {

private final JSONObject mDetails;
@NonNull
public static final Creator<ActionComponentData> CREATOR = new Creator<>(ActionComponentData.class);

public ActionComponentData(@NonNull JSONObject actionDetails) {
mDetails = actionDetails;
}
private static final String PAYMENT_DATA = "paymentData";
private static final String DETAILS = "details";

@NonNull
public static final ModelObject.Serializer<ActionComponentData> SERIALIZER = new ModelObject.Serializer<ActionComponentData>() {

@NonNull
@Override
public JSONObject serialize(@NonNull ActionComponentData modelObject) {
final JSONObject jsonObject = new JSONObject();
try {
jsonObject.putOpt(PAYMENT_DATA, modelObject.getPaymentData());
jsonObject.putOpt(DETAILS, modelObject.getDetails());
} catch (JSONException e) {
throw new ModelSerializationException(ActionComponentData.class, e);
}
return jsonObject;
}

@NonNull
@Override
public ActionComponentData deserialize(@NonNull JSONObject jsonObject) {
final ActionComponentData actionComponentData = new ActionComponentData();
actionComponentData.setPaymentData(jsonObject.optString(PAYMENT_DATA));
actionComponentData.setDetails(jsonObject.optJSONObject(DETAILS));
return actionComponentData;
}
};

private String paymentData;
private JSONObject details;

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
JsonUtils.writeToParcel(dest, SERIALIZER.serialize(this));
}

@Nullable
public String getPaymentData() {
return paymentData;
}

public void setPaymentData(@Nullable String paymentData) {
this.paymentData = paymentData;
}

@Nullable
public JSONObject getDetails() {
return mDetails;
return details;
}

public void setDetails(@Nullable JSONObject details) {
this.details = details;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.adyen.checkout.base.BuildConfig;
import com.adyen.checkout.core.exeption.CheckoutException;
import com.adyen.checkout.core.util.LocaleUtil;
import com.adyen.checkout.core.util.ParcelUtils;

import java.net.MalformedURLException;
import java.net.URL;
Expand Down Expand Up @@ -102,7 +103,7 @@ public static AnalyticEvent create(@NonNull Context context, @NonNull Flavor fla
return new AnalyticEvent(context.getPackageName(), flavorName, components, LocaleUtil.toLanguageTag(locale));
}

protected AnalyticEvent(@NonNull Parcel in) {
AnalyticEvent(@NonNull Parcel in) {
mFlavor = in.readString();
mComponent = in.readString();
mLocale = in.readString();
Expand Down Expand Up @@ -150,7 +151,7 @@ URL toUrl(@NonNull String baseUrl) throws MalformedURLException {

@Override
public int describeContents() {
return 0;
return ParcelUtils.NO_FILE_DESCRIPTOR;
}

@Override
Expand Down
24 changes: 22 additions & 2 deletions base-v3/src/main/java/com/adyen/checkout/base/api/ImageLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
import android.widget.ImageView;

import com.adyen.checkout.core.api.Environment;
import com.adyen.checkout.core.log.LogUtil;
import com.adyen.checkout.core.log.Logger;

import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;

@SuppressWarnings("SyntheticAccessor")
public class ImageLoader {
private static final String TAG = LogUtil.getTag();

private final LogoApi mLogoApi;
private final Map<String, LogoConnectionTask.LogoCallback> mCallbacks = new HashMap<>();
Expand All @@ -48,17 +51,32 @@ public void load(@NonNull String txVariant, @NonNull ImageView view) {
this.load(txVariant, view, 0, 0);
}

/**
* Load image to ImageView.
*/
public void load(@NonNull String txVariant, @Nullable String txSubVariant, @NonNull ImageView view) {
this.load(txVariant, txSubVariant, view, 0, 0);
}

/**
* Load image to ImageView with place holder before load and error fallback image.
*/
public void load(@NonNull String txVariant, @NonNull ImageView view, @Nullable @DrawableRes int placeholder,
@Nullable @DrawableRes final int errorFallback) {
this.load(txVariant, "", view, placeholder, errorFallback);
}

/**
* Load image to ImageView with place holder before load and error fallback image.
*/
public void load(@NonNull String txVariant, @NonNull String txSubVariant, @NonNull ImageView view, @Nullable @DrawableRes int placeholder,
@Nullable @DrawableRes final int errorFallback) {

if (placeholder != 0) {
view.setImageResource(placeholder);
}

final String id = txVariant + view.getId();
final String id = txVariant + txSubVariant + view.getId();

if (mCallbacks.containsKey(id)) {
mLogoApi.cancelLogoRequest(txVariant, null, null);
Expand All @@ -74,6 +92,8 @@ public void onLogoReceived(@NonNull BitmapDrawable drawable) {
final ImageView imageView = mImageViews.get(id).get();
if (imageView != null) {
imageView.setImageDrawable(drawable);
} else {
Logger.e(TAG, "ImageView is null for received Logo - " + id);
}

mCallbacks.remove(id);
Expand All @@ -95,6 +115,6 @@ public void onReceiveFailed() {

mImageViews.put(id, new WeakReference<>(view));
mCallbacks.put(id, callback);
mLogoApi.getLogo(txVariant, null, null, callback);
mLogoApi.getLogo(txVariant, txSubVariant, null, callback);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@
import com.adyen.checkout.core.exeption.CheckoutException;
import com.adyen.checkout.core.exeption.ComponentException;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

public abstract class BaseActionComponent extends AndroidViewModel implements ActionComponent {

private static final String DETAILS_KEY = "details";
private static final String PAYMENT_DATA_KEY = "paymentData";

private final MutableLiveData<ActionComponentData> mResultLiveData = new MutableLiveData<>();

private final MutableLiveData<ComponentError> mErrorMutableLiveData = new MutableLiveData<>();
Expand Down Expand Up @@ -79,16 +75,11 @@ public void observeErrors(@NonNull LifecycleOwner lifecycleOwner, @NonNull Obser
protected abstract void handleActionInternal(@NonNull Activity activity, @NonNull Action action) throws ComponentException;

protected void notifyDetails(@NonNull JSONObject details) throws ComponentException {
final ActionComponentData actionComponentData = new ActionComponentData();
actionComponentData.setDetails(details);
actionComponentData.setPaymentData(mPaymentData);

final JSONObject componentData = new JSONObject();
try {
componentData.putOpt(PAYMENT_DATA_KEY, mPaymentData);
componentData.accumulate(DETAILS_KEY, details);
} catch (JSONException e) {
throw new ComponentException("Unable to create ActionComponentData", e);
}

mResultLiveData.setValue(new ActionComponentData(componentData));
mResultLiveData.setValue(actionComponentData);
}

protected void notifyException(@NonNull CheckoutException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@

package com.adyen.checkout.base.component;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

import com.adyen.checkout.base.Configuration;
import com.adyen.checkout.core.api.Environment;
import com.adyen.checkout.core.util.ParcelUtils;

import java.util.Locale;

public abstract class BaseConfiguration implements Configuration {
public abstract class BaseConfiguration implements Configuration, Parcelable {

private final Locale mShopperLocale;
private final Environment mEnvironment;
Expand All @@ -25,6 +28,11 @@ protected BaseConfiguration(@NonNull Locale shopperLocale, @NonNull Environment
mEnvironment = environment;
}

protected BaseConfiguration(@NonNull Parcel in) {
mShopperLocale = (Locale) in.readSerializable();
mEnvironment = in.readParcelable(Environment.class.getClassLoader());
}

@NonNull
public Environment getEnvironment() {
return mEnvironment;
Expand All @@ -35,4 +43,15 @@ public Environment getEnvironment() {
public Locale getShopperLocale() {
return mShopperLocale;
}

@Override
public int describeContents() {
return ParcelUtils.NO_FILE_DESCRIPTOR;
}

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeSerializable(mShopperLocale);
dest.writeParcelable(mEnvironment, flags);
}
}
Loading

0 comments on commit 89119d6

Please sign in to comment.