Skip to content

Commit

Permalink
Merge pull request #300 from Adyen/feature/blik_v3
Browse files Browse the repository at this point in the history
Blik on v3
  • Loading branch information
caiofaustino authored Dec 15, 2020
2 parents 5bd989b + ad113e8 commit fb1c46f
Show file tree
Hide file tree
Showing 59 changed files with 1,008 additions and 24 deletions.
19 changes: 19 additions & 0 deletions await-ui/src/main/java/com/adyen/checkout/await/AwaitView.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
Expand All @@ -25,6 +26,7 @@
import com.adyen.checkout.base.ActionComponentData;
import com.adyen.checkout.base.api.ImageLoader;
import com.adyen.checkout.base.ui.view.AdyenLinearLayout;
import com.adyen.checkout.base.util.PaymentMethodTypes;
import com.adyen.checkout.core.code.Lint;
import com.adyen.checkout.core.log.LogUtil;
import com.adyen.checkout.core.log.Logger;
Expand Down Expand Up @@ -95,6 +97,7 @@ public void onChanged(@Nullable AwaitOutputData awaitOutputData) {

if (mPaymentMethodType == null || !mPaymentMethodType.equals(awaitOutputData.getPaymentMethodType())) {
mPaymentMethodType = awaitOutputData.getPaymentMethodType();
updateMessageText();
updateLogo();
}
}
Expand All @@ -115,4 +118,20 @@ private void updateLogo() {
mImageLoader.load(mPaymentMethodType, mImageView);
}
}

private void updateMessageText() {
mTextViewOpenApp.setText(getMessageTextResource());
}

@StringRes
private Integer getMessageTextResource() {
switch (mPaymentMethodType) {
case PaymentMethodTypes.BLIK:
return R.string.checkout_await_message_blik;
case PaymentMethodTypes.MB_WAY:
return R.string.checkout_await_message_mbway;
default:
return R.string.checkout_await_message_blik;
}
}
}
7 changes: 4 additions & 3 deletions await-ui/src/main/res/layout/await_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@

<TextView
android:id="@+id/textView_open_app"
style="@style/AdyenCheckout.TextAppearance.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AdyenCheckout.TextAppearance.Primary"
android:layout_margin="@dimen/standard_margin"
android:layout_gravity="center_horizontal"
android:text="@string/checkout_await_open_app"/>
android:layout_margin="@dimen/standard_margin"
android:gravity="center"
android:text="@string/checkout_await_message_blik" />

<LinearLayout
android:layout_width="wrap_content"
Expand Down
3 changes: 2 additions & 1 deletion await-ui/src/main/res/template/values/strings.xml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">%%mbway.confirmPayment%%</string>
<string name="checkout_await_message_blik">%%blik.confirmPayment%%</string>
<string name="checkout_await_message_mbway">%%mbway.confirmPayment%%</string>
<string name="checkout_await_waiting_confirmation">%%await.waitForConfirmation%%</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-da-rDK/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Bekræft din betaling på appen MB WAY</string>
<string name="checkout_await_message_blik">Åbn din bankapp for at bekræfte betalingen.</string>
<string name="checkout_await_message_mbway">Bekræft din betaling på appen MB WAY</string>
<string name="checkout_await_waiting_confirmation">Venter på bekræftelse</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-de-rDE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Bestätigen Sie Ihre Zahlung in der MB WAY-App</string>
<string name="checkout_await_message_blik">Öffnen Sie Ihre Banking-App, um die Zahlung zu bestätigen.</string>
<string name="checkout_await_message_mbway">Bestätigen Sie Ihre Zahlung in der MB WAY-App</string>
<string name="checkout_await_waiting_confirmation">Warten auf Bestätigung</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-es-rES/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Confirme su pago en la aplicación MB WAY</string>
<string name="checkout_await_message_blik">Abra la aplicación de su banco para confirmar el pago.</string>
<string name="checkout_await_message_mbway">Confirme su pago en la aplicación MB WAY</string>
<string name="checkout_await_waiting_confirmation">Esperando confirmación</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-fi-rFI/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Vahvista maksusi MB WAY -sovelluksella</string>
<string name="checkout_await_message_blik">Avaa pankkisovelluksesi vahvistaaksesi maksun.</string>
<string name="checkout_await_message_mbway">Vahvista maksusi MB WAY -sovelluksella</string>
<string name="checkout_await_waiting_confirmation">Odottaa vahvistusta</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-fr-rFR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Confirmez votre paiement sur l\'application MB WAY</string>
<string name="checkout_await_message_blik">Ouvrez votre application bancaire pour confirmer le paiement.</string>
<string name="checkout_await_message_mbway">Confirmez votre paiement sur l\'application MB WAY</string>
<string name="checkout_await_waiting_confirmation">En attente de confirmation</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-it-rIT/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Conferma il pagamento con l\'app MB WAY</string>
<string name="checkout_await_message_blik">Apri l\'app della tua banca per confermare il pagamento.</string>
<string name="checkout_await_message_mbway">Conferma il pagamento con l\'app MB WAY</string>
<string name="checkout_await_waiting_confirmation">In attesa di conferma</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-ja-rJP/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">MB WAYアプリで支払を確認する</string>
<string name="checkout_await_message_blik">バンキングアプリを開いて、支払を確認してください。</string>
<string name="checkout_await_message_mbway">MB WAYアプリで支払を確認する</string>
<string name="checkout_await_waiting_confirmation">確認を待っています</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-ko-rKR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">MB WAY 앱에서 결제를 확인하십시오</string>
<string name="checkout_await_message_blik">뱅킹 앱을 열어서 결제를 확인하세요.</string>
<string name="checkout_await_message_mbway">MB WAY 앱에서 결제를 확인하십시오</string>
<string name="checkout_await_waiting_confirmation">확인 대기중</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-nb-rNO/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Bekreft betalingen din i MB WAY-appen</string>
<string name="checkout_await_message_blik">Åpne bank-appen din for å bekrefte betalingen.</string>
<string name="checkout_await_message_mbway">Bekreft betalingen din i MB WAY-appen</string>
<string name="checkout_await_waiting_confirmation">Venter på bekreftelse</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-nl-rNL/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Bevestig uw betaling via de MB WAY-app</string>
<string name="checkout_await_message_blik">Open uw bankapp om de betaling te bevestigen.</string>
<string name="checkout_await_message_mbway">Bevestig uw betaling via de MB WAY-app</string>
<string name="checkout_await_waiting_confirmation">Wacht op bevestiging</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-pl-rPL/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Potwierdź płatność w aplikacji MB WAY</string>
<string name="checkout_await_message_blik">Otwórz aplikację bankową, aby potwierdzić płatność.</string>
<string name="checkout_await_message_mbway">Potwierdź płatność w aplikacji MB WAY</string>
<string name="checkout_await_waiting_confirmation">Oczekiwanie na potwierdzenie</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Confirme seu pagamento no aplicativo MB WAY</string>
<string name="checkout_await_message_blik">Abra o aplicativo do seu banco para confirmar o pagamento.</string>
<string name="checkout_await_message_mbway">Confirme seu pagamento no aplicativo MB WAY</string>
<string name="checkout_await_waiting_confirmation">Aguardando confirmação</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Подтвердите оплату в приложении MB WAY</string>
<string name="checkout_await_message_blik">Для подтверждения оплаты откройте приложение банка.</string>
<string name="checkout_await_message_mbway">Подтвердите оплату в приложении MB WAY</string>
<string name="checkout_await_waiting_confirmation">Ожидание подтверждения</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-sv-rSE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Bekräfta din betalning i appen MB WAY</string>
<string name="checkout_await_message_blik">Öppna din bankapp för att bekräfta betalningen.</string>
<string name="checkout_await_message_mbway">Bekräfta din betalning i appen MB WAY</string>
<string name="checkout_await_waiting_confirmation">Väntar på bekräftelse</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">在 MB WAY 应用上确认您的付款</string>
<string name="checkout_await_message_blik">打开您的银行应用以确认支付。</string>
<string name="checkout_await_message_mbway">在 MB WAY 应用上确认您的付款</string>
<string name="checkout_await_waiting_confirmation">等待确认</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">在 MB WAY 應用程式上確認您的付款</string>
<string name="checkout_await_message_blik">開啟您的銀行應用程式以確認付款。</string>
<string name="checkout_await_message_mbway">在 MB WAY 應用程式上確認您的付款</string>
<string name="checkout_await_waiting_confirmation">正在等候確認</string>
</resources>
3 changes: 2 additions & 1 deletion await-ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->

<resources>
<string name="checkout_await_open_app">Confirm your payment on the MB WAY app</string>
<string name="checkout_await_message_blik">Open your banking app to confirm the payment.</string>
<string name="checkout_await_message_mbway">Confirm your payment on the MB WAY app</string>
<string name="checkout_await_waiting_confirmation">Waiting for confirmation</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright (c) 2020 Adyen N.V.
*
* This file is open source and available under the MIT license. See the LICENSE file for more info.
*
* Created by josephj on 4/12/2020.
*/

package com.adyen.checkout.base.model.payments.request;

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

import com.adyen.checkout.base.util.PaymentMethodTypes;
import com.adyen.checkout.core.exception.ModelSerializationException;
import com.adyen.checkout.core.model.JsonUtils;

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

@SuppressWarnings({"MemberName", "PMD.DataClass"})
public class BlikPaymentMethod extends PaymentMethodDetails {

@NonNull
public static final Creator<BlikPaymentMethod> CREATOR = new Creator<>(BlikPaymentMethod.class);

public static final String PAYMENT_METHOD_TYPE = PaymentMethodTypes.BLIK;

private static final String BLIK_CODE = "blikCode";

@NonNull
public static final Serializer<BlikPaymentMethod> SERIALIZER = new Serializer<BlikPaymentMethod>() {

@NonNull
@Override
public JSONObject serialize(@NonNull BlikPaymentMethod modelObject) {
final JSONObject jsonObject = new JSONObject();
try {
// getting parameters from parent class
jsonObject.putOpt(PaymentMethodDetails.TYPE, modelObject.getType());

jsonObject.putOpt(BLIK_CODE, modelObject.getBlikCode());
} catch (JSONException e) {
throw new ModelSerializationException(BlikPaymentMethod.class, e);
}
return jsonObject;
}

@NonNull
@Override
public BlikPaymentMethod deserialize(@NonNull JSONObject jsonObject) {
final BlikPaymentMethod blikPaymentMethod = new BlikPaymentMethod();

// getting parameters from parent class
blikPaymentMethod.setType(jsonObject.optString(PaymentMethodDetails.TYPE, null));

blikPaymentMethod.setBlikCode(jsonObject.optString(BLIK_CODE, null));

return blikPaymentMethod;
}
};

private String blikCode;

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

@Nullable
public String getBlikCode() {
return blikCode;
}

public void setBlikCode(@Nullable String blikCode) {
this.blikCode = blikCode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ static Serializer<? extends PaymentMethodDetails> getChildSerializer(@NonNull St
return AfterPayPaymentMethod.SERIALIZER;
case MBWayPaymentMethod.PAYMENT_METHOD_TYPE:
return MBWayPaymentMethod.SERIALIZER;
case BlikPaymentMethod.PAYMENT_METHOD_TYPE:
return BlikPaymentMethod.SERIALIZER;
default:
return GenericPaymentMethod.SERIALIZER;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public final class PaymentMethodTypes {
public static final String BCMC = "bcmc";
public static final String WECHAT_PAY_SDK = "wechatpaySDK";
public static final String MB_WAY = "mbway";
public static final String BLIK = "blik";

// Voucher payment methods that are not yet supported
public static final String MULTIBANCO = "multibanco";
Expand Down Expand Up @@ -101,6 +102,7 @@ public final class PaymentMethodTypes {
supportedPaymentMethods.add(SEPA);
supportedPaymentMethods.add(SCHEME);
supportedPaymentMethods.add(WECHAT_PAY_SDK);
supportedPaymentMethods.add(BLIK);

SUPPORTED_PAYMENT_METHODS = Collections.unmodifiableList(supportedPaymentMethods);

Expand Down
42 changes: 42 additions & 0 deletions blik-base/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2020 Adyen N.V.
*
* This file is open source and available under the MIT license. See the LICENSE file for more info.
*
* Created by josephj on 4/12/2020.
*/

// Maven artifact
ext.mavenArtifactId = "blik-base"
ext.mavenArtifactName = "Adyen checkout blik-base component"
ext.mavenArtifactDescription = "Adyen checkout blik-base component client for Adyen's Checkout API."

apply plugin: 'com.android.library'

android {
compileSdkVersion compile_sdk_version

defaultConfig {
minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version
versionCode version_code
versionName version_name

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}

dependencies {
//Tests
testImplementation "junit:junit:$junit_version"
androidTestImplementation "com.android.support.test:runner:$support_test_runner_version"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso_version"

// Checkout
api project(':base-v3')
}

// This sharedTasks.gradle script is applied at the end of this build.gradle script,
// since javadocs.gradle script is dependent on android.compileSdkVersion property,
// which is set on the android block above.
apply from: "../config/gradle/sharedTasks.gradle"
Loading

0 comments on commit fb1c46f

Please sign in to comment.