Skip to content

Commit

Permalink
3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
adyen-git-manager committed Oct 8, 2019
1 parent c760298 commit 3ab59ea
Show file tree
Hide file tree
Showing 154 changed files with 970 additions and 865 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import com.adyen.checkout.base.model.payments.response.Threeds2FingerprintAction;
import com.adyen.checkout.core.api.ThreadManager;
import com.adyen.checkout.core.code.Lint;
import com.adyen.checkout.core.exeption.CheckoutException;
import com.adyen.checkout.core.exeption.ComponentException;
import com.adyen.checkout.core.exception.CheckoutException;
import com.adyen.checkout.core.exception.ComponentException;
import com.adyen.checkout.core.log.LogUtil;
import com.adyen.checkout.core.log.Logger;
import com.adyen.checkout.core.util.StringUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import android.support.annotation.NonNull;

import com.adyen.checkout.core.exeption.ComponentException;
import com.adyen.checkout.core.exception.ComponentException;

/**
* This exception is just an indication that the 3DS2 Authentication did not finish as expected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

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

Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
[//]: <> (Add changes that not released yet into `Unreleased` section)
[//]: <> (Comment `Unreleased` section if there are no changes)
[//]: <> (## [Unreleased])
## [3.4.1] - 2019-10-07
### Added
- MolpayComponents can how handle multiple MolPay PaymentMethods (molpay_ebanking_fpx_MY, molpay_ebanking_TH, molpay_ebanking_VN)
- You can check which payment methods a Component can handle by calling `getSupportedPaymentMethodTypes()`
- Added option to show payment Amount on the DropIn pay button.
### Changed
- Deprecated `getPaymentMethodType()` in favor of `getSupportedPaymentMethodTypes()`.
- Merge Loading Activity into DropIn Activity to have single Activity for DropIn component.
- Configuration interface removed in favor of base class plus minor code improvements.
### Fixed
- Add margin left to CardListAdapter's layout.
- Fixed typo on package `com.adyen.checkout.core.exeption` to `com.adyen.checkout.core.exception`

## [3.4.0] - 2019-09-23
### Added
- Created standard style pattern for customizing XML layouts of the Components.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ 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.4.0"
implementation "com.adyen.checkout:drop-in:3.4.1"
```
For a Credit Card component you should add:
```groovy
implementation "com.adyen.checkout:card-ui:3.4.0"
implementation "com.adyen.checkout:card-ui:3.4.1"
```

## Drop-in
Expand Down
6 changes: 3 additions & 3 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ul>
<li>Created theming structure.</li>
<li>Created BCMC component.</li>
<li>Bug Fixes.</li>
<li>UI Updates</li>
<li>Update Molpay component to support Thailand and Vietnam</li>
<li>Bug Fixes</li>
</ul>
23 changes: 21 additions & 2 deletions base-ui/src/main/java/com/adyen/checkout/base/ComponentView.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* This file is open source and available under the MIT license. See the LICENSE file for more info.
*
* Created by arman on 20/2/2019.
* Created by arman on 30/9/2019.
*/

package com.adyen.checkout.base;
Expand All @@ -21,11 +21,30 @@ public interface ComponentView<ComponentT extends PaymentComponent> {
/**
* Attach the {@link PaymentComponent} to the view to interact with.
*
* @param component The component.
* @param component The component.
* @param lifecycleOwner The lifecycle owner where the view is.
*/
void attach(@NonNull ComponentT component, @NonNull LifecycleOwner lifecycleOwner);

/**
* This function will be called when the component got attached to the View.
* It's better to init ViewLess objects like ImageLoader here.
*/
void onComponentAttached();

/**
* This function will be called when the component is attached and the view is ready to get initialized.
* It's better to find sub views here and add listeners to inputs changes or make the view Visible or Gone depends on the configration of a
* component.
*/
void initView();

/**
* This function will be called after the component got attach and the view got initialize.
* It's better to Observer on live data objects here.
*/
void observeComponentChanges(@NonNull LifecycleOwner lifecycleOwner);

/**
* Tells if the view interaction requires confirmation from the user to start the payment flow.
* Confirmation usually is obtained by a "Pay" button the user need to press to start processing the payment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import android.util.TypedValue;

import com.adyen.checkout.base.ui.R;
import com.adyen.checkout.core.exeption.NoConstructorException;
import com.adyen.checkout.core.exception.NoConstructorException;

public final class ThemeUtil {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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 30/9/2019.
*/

package com.adyen.checkout.base.ui.view;

import android.arch.lifecycle.LifecycleOwner;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import com.adyen.checkout.base.ComponentView;
import com.adyen.checkout.base.component.BasePaymentComponent;

public abstract class AdyenLinearLayout<ComponentT extends BasePaymentComponent> extends LinearLayout implements
ComponentView<ComponentT> {

private ComponentT mComponent;

public AdyenLinearLayout(@NonNull Context context) {
super(context);
}

public AdyenLinearLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}

public AdyenLinearLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setVisibility(isInEditMode() ? VISIBLE : GONE);
}

@Override
public void attach(@NonNull ComponentT component, @NonNull LifecycleOwner lifecycleOwner) {
this.mComponent = component;

this.onComponentAttached();
this.initView();
setVisibility(VISIBLE);
mComponent.sendAnalyticsEvent(getContext());
this.observeComponentChanges(lifecycleOwner);
}

@NonNull
public ComponentT getComponent() {
return mComponent;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.adyen.checkout.core.exeption.NoConstructorException;
import com.adyen.checkout.core.exception.NoConstructorException;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

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

public interface ComponentAvailableCallback<ConfigurationT extends Configuration> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import android.support.annotation.NonNull;

import com.adyen.checkout.core.exeption.CheckoutException;
import com.adyen.checkout.core.exception.CheckoutException;

/**
* Data about an error that happened inside a component.
Expand Down
37 changes: 0 additions & 37 deletions base-v3/src/main/java/com/adyen/checkout/base/Configuration.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@
public interface PaymentComponent extends Component<PaymentComponentState> {

/**
* @return The "type" of payment method supported by this Component.
* @deprecated Use {@link #getSupportedPaymentMethodTypes()} instead with a list of the supported payment method types.
* This method will only return the first value of the list.
*
* @return The first value of "type" of payment method supported by this Component.
*/
@Deprecated
@NonNull
String getPaymentMethodType();

/**
* @return An array of the supported {@link com.adyen.checkout.base.util.PaymentMethodTypes}
*/
@NonNull
String[] getSupportedPaymentMethodTypes();

/**
* @return The last {@link PaymentComponentState} of this Component.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

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

public interface PaymentComponentProvider<ComponentT extends PaymentComponent, ConfigurationT extends Configuration>
extends ComponentProvider<ComponentT> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import android.webkit.URLUtil;

import com.adyen.checkout.base.BuildConfig;
import com.adyen.checkout.core.exeption.CheckoutException;
import com.adyen.checkout.core.exception.CheckoutException;
import com.adyen.checkout.core.util.LocaleUtil;
import com.adyen.checkout.core.util.ParcelUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import com.adyen.checkout.base.ActionComponentData;
import com.adyen.checkout.base.ComponentError;
import com.adyen.checkout.base.model.payments.response.Action;
import com.adyen.checkout.core.exeption.CheckoutException;
import com.adyen.checkout.core.exeption.ComponentException;
import com.adyen.checkout.core.exception.CheckoutException;
import com.adyen.checkout.core.exception.ComponentException;
import com.adyen.checkout.core.log.LogUtil;
import com.adyen.checkout.core.log.Logger;
import com.adyen.checkout.core.util.StringUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import android.content.Context;
import android.support.annotation.NonNull;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
import android.support.annotation.WorkerThread;

import com.adyen.checkout.base.ComponentError;
import com.adyen.checkout.base.Configuration;
import com.adyen.checkout.base.PaymentComponentState;
import com.adyen.checkout.base.analytics.AnalyticEvent;
import com.adyen.checkout.base.analytics.AnalyticsDispatcher;
import com.adyen.checkout.base.component.lifecycle.PaymentComponentViewModel;
import com.adyen.checkout.base.model.paymentmethods.PaymentMethod;
import com.adyen.checkout.core.api.ThreadManager;
import com.adyen.checkout.core.code.Lint;
import com.adyen.checkout.core.exeption.CheckoutException;
import com.adyen.checkout.core.exception.CheckoutException;
import com.adyen.checkout.core.log.LogUtil;
import com.adyen.checkout.core.log.Logger;
import com.adyen.checkout.core.util.StringUtil;

public abstract class BasePaymentComponent<ConfigurationT extends Configuration, InputDataT extends InputData, OutputDataT extends OutputData>
extends PaymentComponentViewModel<ConfigurationT> {
Expand Down Expand Up @@ -61,6 +61,18 @@ public BasePaymentComponent(@NonNull PaymentMethod paymentMethod, @NonNull Confi
mOutputLiveData.setValue(mOutputData);
}

@SuppressWarnings("MissingDeprecated")
@Deprecated
@NonNull
@Override
public String getPaymentMethodType() {
if (getSupportedPaymentMethodTypes().length > 0) {
return getSupportedPaymentMethodTypes()[0];
} else {
throw new CheckoutException("Component supported types is empty");
}
}

@Override
public void observe(@NonNull LifecycleOwner lifecycleOwner, @NonNull Observer<PaymentComponentState> observer) {
mPaymentComponentStateLiveData.observe(lifecycleOwner, observer);
Expand Down Expand Up @@ -115,7 +127,12 @@ public void sendAnalyticsEvent(@NonNull Context context) {
flavor = AnalyticEvent.Flavor.COMPONENT;
}

final AnalyticEvent analyticEvent = AnalyticEvent.create(context, flavor, getPaymentMethodType(), getConfiguration().getShopperLocale());
final String type = getPaymentMethod().getType();
if (!StringUtil.hasContent(type)) {
throw new CheckoutException("Payment method has empty or null type");
}

final AnalyticEvent analyticEvent = AnalyticEvent.create(context, flavor, type, getConfiguration().getShopperLocale());
AnalyticsDispatcher.dispatchEvent(context, getConfiguration().getEnvironment(), analyticEvent);
}
}
Expand Down Expand Up @@ -168,7 +185,12 @@ private void assertSupported(@NonNull PaymentMethod paymentMethod) {
}

private boolean isSupported(@NonNull PaymentMethod paymentMethod) {
return getPaymentMethodType().equals(paymentMethod.getType());
for (String paymentMethodType : getSupportedPaymentMethodTypes()) {
if (paymentMethodType.equals(paymentMethod.getType())) {
return true;
}
}
return false;
}

public void setCreatedForDropIn() {
Expand Down
Loading

0 comments on commit 3ab59ea

Please sign in to comment.