Skip to content

Commit

Permalink
3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adyen-git-manager committed Aug 1, 2019
1 parent 1322cb0 commit 8c9a738
Show file tree
Hide file tree
Showing 133 changed files with 2,849 additions and 2,098 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Adyen Components for Android allows you to accept in-app payments by providing you with the building blocks you need to create a checkout experience.

For an overview of how you can integrate with Adyen on Android check out the [Documentation Website][docs.android]

## Installation

The Components are available through [jcenter][dl], you only need to add the Gradle dependency.
Expand All @@ -11,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.0.0"
implementation "com.adyen.checkout:drop-in:3.1.0"
```
For a Credit Card component you should add:
```groovy
implementation "com.adyen.checkout:card-ui:3.0.0"
implementation "com.adyen.checkout:card-ui:3.1.0"
```
For and iDeal component you should add:
```groovy
implementation "com.adyen.checkout:ideal-ui:3.0.0"
implementation "com.adyen.checkout:ideal-ui:3.1.0"
```

## Drop-in
Expand Down Expand Up @@ -132,14 +134,18 @@ You can also find the components that can handle the `action` object.

## See also

* [Adyen Checkout Documentation](https://docs.adyen.com/checkout/)
* [Android Documentation][docs.android]

* [Adyen Checkout Documentation][docs.checkout]

* [API Reference](https://docs.adyen.com/checkout/api-only/)

## License

This repository is open source and available under the MIT license. For more information, see the LICENSE file.

[docs.checkout]: https://docs.adyen.com/checkout/
[docs.android]: https://docs.adyen.com/checkout/android/
[dl]: https://jcenter.bintray.com/com/adyen/checkout/
[apiExplorer.paymentMethods]: https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v46/paymentMethods
[apiExplorer.payments]: https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v46/payments
Expand Down
8 changes: 7 additions & 1 deletion README_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Adyen Components for Android allows you to accept in-app payments by providing you with the building blocks you need to create a checkout experience.

For an overview of how you can integrate with Adyen on Android check out the [Documentation Website][docs.android]

## Installation

The Components are available through [jcenter][dl], you only need to add the Gradle dependency.
Expand Down Expand Up @@ -132,14 +134,18 @@ You can also find the components that can handle the `action` object.

## See also

* [Adyen Checkout Documentation](https://docs.adyen.com/checkout/)
* [Android Documentation][docs.android]

* [Adyen Checkout Documentation][docs.checkout]

* [API Reference](https://docs.adyen.com/checkout/api-only/)

## License

This repository is open source and available under the MIT license. For more information, see the LICENSE file.

[docs.checkout]: https://docs.adyen.com/checkout/
[docs.android]: https://docs.adyen.com/checkout/android/
[dl]: https://jcenter.bintray.com/com/adyen/checkout/
[apiExplorer.paymentMethods]: https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v46/paymentMethods
[apiExplorer.payments]: https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v46/payments
Expand Down
15 changes: 6 additions & 9 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#### Android Components (V3)
Version 3.x.x is a completely new way of integrating payments using the Checkout API (payments/) with our UI Components or Drop-in.
It is not compatible with the integrations of version 2.x.x, which used the SDK specific API (paymentSession/).
Version 2.x.x will only receive maintenance for bug fixes, not any new features.
Check the Readme page and documentation website for more information.

- Create default Configuration Builders.
- Add UiCustomization class to 3DS2 component.
- Bug fixes.
<ul>
<li>Add "One Click Payment" option for card payment.</li>
<li>Update UI/UX for Drop-In and components.</li>
<li>Changed PaymentComponent observer output to contain PaymentComponentData. PaymentMethodDetails is now inside of PaymentComponentData.</li>
<li>Bug fixes.</li>
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatImageView;
Expand All @@ -24,9 +27,13 @@
public class RoundCornerImageView extends AppCompatImageView {

private static final float DEFAULT_RADIUS = 9.0f;
private static final float DEFAULT_STROKE_WIDTH = 4f;
private static final int DEFAULT_STROKE_COLOR = Color.BLACK;

private float mRadius;
private final Path mPath = new Path();
private final Paint mStrokePaint = new Paint();
private float mStrokeWidth;
private int mStrokeColor;

public RoundCornerImageView(@NonNull Context context) {
this(context, null);
Expand All @@ -44,27 +51,59 @@ public RoundCornerImageView(@NonNull Context context, @Nullable AttributeSet att

final TypedArray typedArrayAttrs = context.getTheme().obtainStyledAttributes(attrs, R.styleable.RoundCornerImageView,
0, 0);
applyRadius(typedArrayAttrs);
applyAttrs(typedArrayAttrs);
}

public void setRadius(float radius) {
this.mRadius = radius;
invalidate();
}

private void applyRadius(TypedArray typedArrayAttrs) {
public void setStrokeColor(@ColorInt int color) {
this.mStrokeColor = color;
invalidate();
}

public void setStrokeWidth(float width) {
this.mStrokeWidth = width;
invalidate();
}

private void applyAttrs(TypedArray typedArrayAttrs) {
try {
mRadius = typedArrayAttrs.getFloat(R.styleable.RoundCornerImageView_radius, DEFAULT_RADIUS);
mStrokeColor = typedArrayAttrs.getColor(R.styleable.RoundCornerImageView_strokeColor, DEFAULT_STROKE_COLOR);
mStrokeWidth = typedArrayAttrs.getDimension(R.styleable.RoundCornerImageView_strokeWidth, DEFAULT_STROKE_WIDTH);
mRadius = typedArrayAttrs.getDimension(R.styleable.RoundCornerImageView_radius, DEFAULT_RADIUS);
} finally {
typedArrayAttrs.recycle();
}
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec + (int) mStrokeWidth * 2, heightMeasureSpec + (int) mStrokeWidth * 2);
}

@SuppressLint("DrawAllocation")
@Override
protected void onDraw(@NonNull Canvas canvas) {
final RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight());
mPath.addRoundRect(rect, mRadius, mRadius, Path.Direction.CW);
canvas.clipPath(mPath);
final RectF rect = new RectF(mStrokeWidth / 2, mStrokeWidth / 2,
getWidth() - (mStrokeWidth / 2),
getHeight() - (mStrokeWidth / 2));

mStrokePaint.reset();

mStrokePaint.setStyle(Paint.Style.STROKE);
mStrokePaint.setAntiAlias(true);
mStrokePaint.setColor(mStrokeColor);
mStrokePaint.setStrokeWidth(mStrokeWidth);

canvas.drawRoundRect(rect, mRadius, mRadius, mStrokePaint);

final Path path = new Path();
path.addRoundRect(rect, mRadius, mRadius, Path.Direction.CW);
canvas.clipPath(path);

super.onDraw(canvas);
}
}
30 changes: 18 additions & 12 deletions base-ui/src/main/res/layout/recycler_list_with_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,39 @@

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/standard_margin"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:clickable="true"
android:focusable="true">
android:focusable="true"
android:orientation="horizontal"
android:paddingStart="@dimen/standard_margin"
android:paddingLeft="@dimen/standard_margin"
android:paddingTop="@dimen/standard_three_quarters_margin"
android:paddingEnd="@dimen/standard_margin"
android:paddingRight="@dimen/standard_margin"
android:paddingBottom="@dimen/standard_three_quarters_margin">

<android.support.v7.widget.AppCompatImageView
<com.adyen.checkout.base.ui.view.RoundCornerImageView
android:id="@+id/imageView_logo"
android:layout_width="@dimen/logo_width"
android:layout_height="@dimen/logo_height"
android:minHeight="@dimen/logo_height"
android:maxHeight="@dimen/logo_width"
android:layout_marginRight="@dimen/standard_margin"
android:layout_marginEnd="@dimen/standard_margin"
android:scaleType="centerCrop"
android:layout_marginRight="@dimen/standard_margin"
android:contentDescription="@null"
android:maxHeight="@dimen/logo_width"
android:minHeight="@dimen/logo_height"
android:scaleType="fitCenter"
android:src="@drawable/ic_placeholder_image"
android:contentDescription="@null"/>
app:strokeColor="@color/stroke_color"/>

<android.support.v7.widget.AppCompatTextView
android:id="@+id/textView_text"
android:layout_width="match_parent"
android:maxHeight="@dimen/logo_width"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxHeight="@dimen/logo_width"
tools:text="Test"/>

</LinearLayout>
4 changes: 3 additions & 1 deletion base-ui/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

<resources>
<declare-styleable name="RoundCornerImageView">
<attr name="radius" format="float"/>
<attr name="radius" format="dimension"/>
<attr name="strokeWidth" format="dimension"/>
<attr name="strokeColor" format="color"/>
</declare-styleable>
</resources>
16 changes: 16 additions & 0 deletions base-ui/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2019 Adyen N.V.
~
~ This file is open source and available under the MIT license. See the LICENSE file for more info.
~
~ Created by arman on 10/7/2019.
-->

<resources>
<color name="stroke_color">#C9C9C9</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="primaryColor">#1A73E8</color>
<color name="textColor">#DE000000</color>
</resources>
1 change: 1 addition & 0 deletions base-ui/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<dimen name="standard_quarter_margin">4dp</dimen>
<dimen name="standard_half_margin">8dp</dimen>
<dimen name="standard_three_quarters_margin">12dp</dimen>
<dimen name="standard_margin">16dp</dimen>
<dimen name="standard_double_margin">32dp</dimen>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void isParsed() throws JSONException {

assert paymentMethodsApiResponse.getGroups() != null;
assert paymentMethodsApiResponse.getGroups().size() == 3;
assert paymentMethodsApiResponse.getOneClickPaymentMethods() == null;
assert paymentMethodsApiResponse.getStoredPaymentMethods() == null;
assert paymentMethodsApiResponse.getPaymentMethods() != null;
assert paymentMethodsApiResponse.getPaymentMethods().size() == 209;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

public class ActionComponentData {

private final JSONObject mData;
private final JSONObject mDetails;

public ActionComponentData(@NonNull JSONObject actionData) {
mData = actionData;
public ActionComponentData(@NonNull JSONObject actionDetails) {
mDetails = actionDetails;
}

@NonNull
public JSONObject getData() {
return mData;
public JSONObject getDetails() {
return mDetails;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

public interface ActionComponentProvider<ComponentT extends ActionComponent> {
public interface ActionComponentProvider<ComponentT extends ActionComponent> extends ComponentProvider<ComponentT> {

@NonNull
ComponentT get(@NonNull FragmentActivity activity);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019 Adyen N.V.
*
* This file is open source and available under the MIT license. See the LICENSE file for more info.
*
* Created by caiof on 23/7/2019.
*/

package com.adyen.checkout.base;

import android.support.annotation.NonNull;

import com.adyen.checkout.base.model.paymentmethods.PaymentMethod;

public interface ComponentAvailableCallback<ConfigurationT extends Configuration> {

void onAvailabilityResult(boolean isAvailable, @NonNull PaymentMethod paymentMethod, @NonNull ConfigurationT config);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2019 Adyen N.V.
*
* This file is open source and available under the MIT license. See the LICENSE file for more info.
*
* Created by caiof on 23/7/2019.
*/

package com.adyen.checkout.base;

/**
* This provider should be used to get an instance of a {@link Component} that is bound your lifecycle.
*/
public interface ComponentProvider<ComponentT extends Component> {
// Maker interface
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.adyen.checkout.base.model.payments.request.PaymentComponentData;
import com.adyen.checkout.base.model.payments.request.PaymentMethodDetails;

/**
* A component that handles collecting user input data. It handles validating and formatting the data for the UI.
* A valid {@link PaymentComponentState} contains {@link PaymentComponentData} to help compose the payments/ call on the backend.
* A valid {@link PaymentComponentState} contains {@link PaymentMethodDetails} to help compose the payments/ call on the backend.
*
* <p/>
* Should be used attached to a corresponding ComponentView to get data from.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,28 @@

package com.adyen.checkout.base;

import android.app.Application;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

import com.adyen.checkout.base.model.paymentmethods.PaymentMethod;
import com.adyen.checkout.core.exeption.CheckoutException;

public interface PaymentComponentProvider<ComponentT extends PaymentComponent, ConfigurationT extends Configuration> {
public interface PaymentComponentProvider<ComponentT extends PaymentComponent, ConfigurationT extends Configuration>
extends ComponentProvider<ComponentT> {

@NonNull
ComponentT get(@NonNull FragmentActivity activity, @NonNull PaymentMethod paymentMethod, @NonNull ConfigurationT config);
ComponentT get(@NonNull FragmentActivity activity, @NonNull PaymentMethod paymentMethod, @NonNull ConfigurationT configuration)
throws CheckoutException;

@NonNull
ComponentT get(@NonNull Fragment fragment, @NonNull PaymentMethod paymentMethod, @NonNull ConfigurationT config);
ComponentT get(@NonNull Fragment fragment, @NonNull PaymentMethod paymentMethod, @NonNull ConfigurationT configuration)
throws CheckoutException;

void isAvailable(
@NonNull Application applicationContext,
@NonNull PaymentMethod paymentMethod,
@NonNull ConfigurationT configuration,
@NonNull ComponentAvailableCallback<ConfigurationT> callback);
}
Loading

0 comments on commit 8c9a738

Please sign in to comment.