diff --git a/LICENSE b/LICENSE index 0aa5d89..aa22747 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ Payment SDK – MIT License |Open Source Recitals: PagoNxt will offer the payment SDK free of charge, to any person obtaining a copy of this software and associated documentation files under the conditions below. User has to verify the effects of Payment SDK on the implemented environment and will do that at its own risk. Digital downloads are software products. Their contents are protected under copyright and intellectual property law. -Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U.  All rights reserved. +Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/app/build.gradle b/app/build.gradle index 275359a..67519ad 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,28 +1,29 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 32 - + compileSdkVersion 33 defaultConfig { - multiDexEnabled true applicationId "com.sdkpay.ecom.examples" minSdkVersion 23 - targetSdkVersion 32 - versionCode 1 - versionName "1.0" + targetSdkVersion 33 + versionCode 2 + versionName "1.1.0" flavorDimensions "default" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - targetCompatibility JavaVersion.VERSION_1_8 - sourceCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + kotlinOptions { + jvmTarget = "11" } buildTypes { @@ -32,6 +33,11 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt') } } + configurations { + all { + exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx' + } + } productFlavors { normal { @@ -45,19 +51,15 @@ android { } } -repositories { - mavenLocal() -} - apply from: 'libs/dependencies.gradle' dependencies { implementation 'androidx.annotation:annotation:1.0.0' implementation 'androidx.cardview:cardview:1.0.0' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' + testImplementation "junit:junit:4.13.2" + androidTestImplementation "androidx.test.ext:junit:1.1.5" + androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1" implementation files('libs/alipay.aar') implementation files('libs/camera.aar') @@ -67,5 +69,9 @@ dependencies { implementation files('libs/paypal.aar') implementation files('libs/sepa.aar') implementation files('libs/wiretransfer.aar') + implementation files('libs/sofort.aar') + implementation files('libs/ratepay.aar') + implementation files('libs/blik.aar') + implementation files('libs/bizum.aar') -} \ No newline at end of file +} diff --git a/app/gradle.properties b/app/gradle.properties index dce38f9..d6803e8 100644 --- a/app/gradle.properties +++ b/app/gradle.properties @@ -1,5 +1,6 @@ # -# Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. +# Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. +# You may not use this file except in compliance with the License which is available at https://mit-license.org/ # # Project-wide Gradle settings. diff --git a/app/gradle/wrapper/gradle-wrapper.properties b/app/gradle/wrapper/gradle-wrapper.properties index aca89c4..0d322af 100644 --- a/app/gradle/wrapper/gradle-wrapper.properties +++ b/app/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ # -# Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. +# Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. +# You may not use this file except in compliance with the License which is available at https://mit-license.org/ # #Tue Nov 20 10:58:56 CET 2018 @@ -7,4 +8,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/app/gradlew b/app/gradlew index 52d5206..a894ad7 100644 --- a/app/gradlew +++ b/app/gradlew @@ -1,7 +1,8 @@ #!/usr/bin/env sh # -# Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. +# Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. +# You may not use this file except in compliance with the License which is available at https://mit-license.org/ # ############################################################################## diff --git a/app/libs/alipay.aar b/app/libs/alipay.aar index 3a358bf..b2b109d 100644 Binary files a/app/libs/alipay.aar and b/app/libs/alipay.aar differ diff --git a/app/libs/bizum.aar b/app/libs/bizum.aar new file mode 100644 index 0000000..8eb05da Binary files /dev/null and b/app/libs/bizum.aar differ diff --git a/app/libs/blik.aar b/app/libs/blik.aar new file mode 100644 index 0000000..045d23a Binary files /dev/null and b/app/libs/blik.aar differ diff --git a/app/libs/camera.aar b/app/libs/camera.aar index 653f100..7b965ae 100644 Binary files a/app/libs/camera.aar and b/app/libs/camera.aar differ diff --git a/app/libs/card.aar b/app/libs/card.aar index 49d7a37..fe5d5f8 100644 Binary files a/app/libs/card.aar and b/app/libs/card.aar differ diff --git a/app/libs/core.aar b/app/libs/core.aar index 0c4c510..b5bd594 100644 Binary files a/app/libs/core.aar and b/app/libs/core.aar differ diff --git a/app/libs/dependencies.gradle b/app/libs/dependencies.gradle index 227bd16..a62c76a 100644 --- a/app/libs/dependencies.gradle +++ b/app/libs/dependencies.gradle @@ -1,44 +1,56 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ dependencies { - implementation 'androidx.appcompat:appcompat:1.4.1' - implementation 'com.google.android.material:material:1.5.0' - implementation 'androidx.activity:activity-ktx:1.4.0' - implementation 'androidx.fragment:fragment-ktx:1.4.0' - implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' - implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' + def kotlinVersion = "1.8.20" + def appCompat = "1.6.1" + def material = "1.8.0" + def actvityKtx = "1.7.1" + def fragmentKtx = "1.5.7" + def rxKotlin = "2.2.0" + def rxAndroid = "2.1.0" + def constraint = "2.1.4" + def coreKtx = "1.10.0" + def lifecycleRuntimeKtx = "2.2.0" + def camerax = "1.0.2" - implementation 'io.reactivex.rxjava2:rxandroid:2.1.0' - implementation 'io.reactivex.rxjava2:rxkotlin:2.2.0' + implementation "androidx.appcompat:appcompat:$appCompat" + implementation "com.google.android.material:material:$material" + implementation "androidx.activity:activity-ktx:$actvityKtx" + implementation "androidx.fragment:fragment-ktx:$fragmentKtx" + implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0" + implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" - implementation 'com.squareup.retrofit2:retrofit:2.6.1' - implementation 'com.squareup.retrofit2:converter-simplexml:2.3.0' - implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0' - implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0' + implementation "io.reactivex.rxjava2:rxkotlin:$rxKotlin" + implementation "io.reactivex.rxjava2:rxandroid:$rxAndroid" + + implementation "com.squareup.retrofit2:retrofit:2.6.1" + implementation "com.squareup.retrofit2:converter-simplexml:2.3.0" + implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0" + implementation "com.squareup.okhttp3:logging-interceptor:3.11.0" implementation('org.simpleframework:simple-xml:2.7.1') { exclude group: 'stax', module: 'stax-api' exclude group: 'xpp3', module: 'xpp3' } - implementation 'com.scottyab:rootbeer-lib:0.1.0' + implementation "com.scottyab:rootbeer-lib:0.1.0" implementation "com.github.chuckerteam.chucker:library-no-op:3.5.2" - def kotlin_version = '1.0.2' - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.core:core-ktx:1.7.0' - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.constraintlayout:constraintlayout:2.1.2' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.5.2' - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0' - implementation 'com.jakewharton.timber:timber:4.7.1' - def camerax_version = '1.0.2' - implementation "androidx.camera:camera-camera2:$camerax_version" - implementation "androidx.camera:camera-lifecycle:$camerax_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" + implementation "androidx.core:core-ktx:$coreKtx" + implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleRuntimeKtx" + implementation "androidx.constraintlayout:constraintlayout:$constraint" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.5.2" + implementation "com.jakewharton.timber:timber:4.7.1" + implementation "androidx.camera:camera-camera2:$camerax" + implementation "androidx.camera:camera-lifecycle:$camerax" implementation "androidx.camera:camera-view:1.0.0-alpha32" implementation "com.google.android.gms:play-services-mlkit-text-recognition:17.0.0" - implementation 'org.iban4j:iban4j:3.2.1' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'com.google.android.gms:play-services-vision:17.0.2' - implementation 'androidx.browser:browser:1.0.0' -} \ No newline at end of file + implementation "org.iban4j:iban4j:3.2.1" + implementation "androidx.legacy:legacy-support-v4:1.0.0" + implementation "com.google.android.gms:play-services-vision:17.0.2" + implementation "androidx.browser:browser:1.4.0" + implementation 'com.github.BasemNasr:EasyMediaPicker:v0.1.4' +} diff --git a/app/libs/p24.aar b/app/libs/p24.aar index 9a21d4d..9a9b14e 100644 Binary files a/app/libs/p24.aar and b/app/libs/p24.aar differ diff --git a/app/libs/paypal.aar b/app/libs/paypal.aar index 5715356..e52c2da 100644 Binary files a/app/libs/paypal.aar and b/app/libs/paypal.aar differ diff --git a/app/libs/ratepay.aar b/app/libs/ratepay.aar new file mode 100644 index 0000000..fab55a4 Binary files /dev/null and b/app/libs/ratepay.aar differ diff --git a/app/libs/sepa.aar b/app/libs/sepa.aar index a507c68..ee7fbb9 100644 Binary files a/app/libs/sepa.aar and b/app/libs/sepa.aar differ diff --git a/app/libs/sofort.aar b/app/libs/sofort.aar new file mode 100644 index 0000000..ff44e2d Binary files /dev/null and b/app/libs/sofort.aar differ diff --git a/app/libs/wiretransfer.aar b/app/libs/wiretransfer.aar index 4b790e2..09b6292 100644 Binary files a/app/libs/wiretransfer.aar and b/app/libs/wiretransfer.aar differ diff --git a/app/src/androidTest/java/com/sdkpay/ecom/examples/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/sdkpay/ecom/examples/ExampleInstrumentedTest.java index 78a590b..b587d72 100644 --- a/app/src/androidTest/java/com/sdkpay/ecom/examples/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/com/sdkpay/ecom/examples/ExampleInstrumentedTest.java @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples; diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 035c63e..207a171 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ - \ No newline at end of file + diff --git a/app/src/main/java/com/sdkpay/ecom/examples/AnimatedCardFieldActivity.java b/app/src/main/java/com/sdkpay/ecom/examples/AnimatedCardFieldActivity.java index e7a2bea..e622c15 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/AnimatedCardFieldActivity.java +++ b/app/src/main/java/com/sdkpay/ecom/examples/AnimatedCardFieldActivity.java @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples; diff --git a/app/src/main/java/com/sdkpay/ecom/examples/CardFieldActivity.java b/app/src/main/java/com/sdkpay/ecom/examples/CardFieldActivity.java index dac7f31..407803e 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/CardFieldActivity.java +++ b/app/src/main/java/com/sdkpay/ecom/examples/CardFieldActivity.java @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples; diff --git a/app/src/main/java/com/sdkpay/ecom/examples/CardFieldFragmentImplFragment.kt b/app/src/main/java/com/sdkpay/ecom/examples/CardFieldFragmentImplFragment.kt index 1d672da..e7bf5f2 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/CardFieldFragmentImplFragment.kt +++ b/app/src/main/java/com/sdkpay/ecom/examples/CardFieldFragmentImplFragment.kt @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples diff --git a/app/src/main/java/com/sdkpay/ecom/examples/Constants.java b/app/src/main/java/com/sdkpay/ecom/examples/Constants.java index fd55a00..c6b35e1 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/Constants.java +++ b/app/src/main/java/com/sdkpay/ecom/examples/Constants.java @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples; @@ -7,4 +8,4 @@ public class Constants { public final static String URL_EE_TEST = "https://api-test.getneteurope.com"; public final static int REQUEST_TIMEOUT = 30; -} \ No newline at end of file +} diff --git a/app/src/main/java/com/sdkpay/ecom/examples/KotlinAnimatedCardFieldActivity.kt b/app/src/main/java/com/sdkpay/ecom/examples/KotlinAnimatedCardFieldActivity.kt index 22f216a..531f587 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/KotlinAnimatedCardFieldActivity.kt +++ b/app/src/main/java/com/sdkpay/ecom/examples/KotlinAnimatedCardFieldActivity.kt @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples diff --git a/app/src/main/java/com/sdkpay/ecom/examples/KotlinCardFieldActivity.kt b/app/src/main/java/com/sdkpay/ecom/examples/KotlinCardFieldActivity.kt index 1cea692..b70d729 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/KotlinCardFieldActivity.kt +++ b/app/src/main/java/com/sdkpay/ecom/examples/KotlinCardFieldActivity.kt @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples diff --git a/app/src/main/java/com/sdkpay/ecom/examples/KotlinCardFieldFragmentImplActivity.kt b/app/src/main/java/com/sdkpay/ecom/examples/KotlinCardFieldFragmentImplActivity.kt index 86ab191..1f57010 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/KotlinCardFieldFragmentImplActivity.kt +++ b/app/src/main/java/com/sdkpay/ecom/examples/KotlinCardFieldFragmentImplActivity.kt @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples diff --git a/app/src/main/java/com/sdkpay/ecom/examples/KotlinLoyaltyCardFieldActivity.kt b/app/src/main/java/com/sdkpay/ecom/examples/KotlinLoyaltyCardFieldActivity.kt index 0cbab75..a02d1cb 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/KotlinLoyaltyCardFieldActivity.kt +++ b/app/src/main/java/com/sdkpay/ecom/examples/KotlinLoyaltyCardFieldActivity.kt @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples diff --git a/app/src/main/java/com/sdkpay/ecom/examples/KotlinStartActivity.kt b/app/src/main/java/com/sdkpay/ecom/examples/KotlinStartActivity.kt index 64b1cad..21ad12e 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/KotlinStartActivity.kt +++ b/app/src/main/java/com/sdkpay/ecom/examples/KotlinStartActivity.kt @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples @@ -93,6 +94,36 @@ class KotlinStartActivity : AppCompatActivity() { .startPayment(mPaymentObjectProvider.p24Payment) } + fun makeSofortPayment(view: View?) { + Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.sofortPayment) + } + + fun makeRatepayInvoicePayment(view: View?) { + Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.ratepayInvoicePayment) + } + + fun makeRatepayElvPayment(view: View?) { + Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.ratepayElvPayment) + } + + fun makeBlikRedirectPayment(view: View?) { + Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.blikRedirectPayment) + } + + fun makeBlikLevel0Payment(view: View?) { + Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.blikLevel0Payment) + } + + fun makeBizumPayment(view: View?) { + Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.bizumPayment) + } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) @@ -106,4 +137,4 @@ class KotlinStartActivity : AppCompatActivity() { } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/sdkpay/ecom/examples/KotlinTokenAnimatedCardFieldActivity.kt b/app/src/main/java/com/sdkpay/ecom/examples/KotlinTokenAnimatedCardFieldActivity.kt index d53e8b7..646e039 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/KotlinTokenAnimatedCardFieldActivity.kt +++ b/app/src/main/java/com/sdkpay/ecom/examples/KotlinTokenAnimatedCardFieldActivity.kt @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples diff --git a/app/src/main/java/com/sdkpay/ecom/examples/ResponseHelper.java b/app/src/main/java/com/sdkpay/ecom/examples/ResponseHelper.java index 5a7abaa..b7093c9 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/ResponseHelper.java +++ b/app/src/main/java/com/sdkpay/ecom/examples/ResponseHelper.java @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples; diff --git a/app/src/main/java/com/sdkpay/ecom/examples/SignatureHelper.java b/app/src/main/java/com/sdkpay/ecom/examples/SignatureHelper.java index 839cfdc..03afa84 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/SignatureHelper.java +++ b/app/src/main/java/com/sdkpay/ecom/examples/SignatureHelper.java @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples; diff --git a/app/src/main/java/com/sdkpay/ecom/examples/StartActivity.java b/app/src/main/java/com/sdkpay/ecom/examples/StartActivity.java index b2b1ad8..38bcf3d 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/StartActivity.java +++ b/app/src/main/java/com/sdkpay/ecom/examples/StartActivity.java @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples; @@ -7,9 +8,9 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; -import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.view.View; +import android.widget.TextView; import android.widget.Toast; import com.sdkpay.ecom.Client; @@ -30,6 +31,10 @@ public class StartActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_start); + ((TextView)findViewById(R.id.version)).setText( + "App version: " + BuildConfig.VERSION_NAME + "_" + (BuildConfig.DEBUG ? "debug" : "release") + "\n" + + "SDK version: " + com.sdkpay.ecom.BuildConfig.VERSION_NAME + "_" + (com.sdkpay.ecom.BuildConfig.DEBUG ? "debug" : "release") + ); } public void makeSepaPayment(View view) { @@ -94,6 +99,36 @@ public void makeP24Payment(View view){ .startPayment(mPaymentObjectProvider.getP24Payment()); } + public void makeSofortPayment(View view){ + new Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.getSofortPayment()); + } + + public void makeRatepayInvoicePayment(View view){ + new Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.getRatepayInvoicePayment()); + } + + public void makeRatepayElvPayment(View view){ + new Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.getRatepayElvPayment()); + } + + public void makeBlikRedirectPayment(View view){ + new Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.getBlikRedirectPayment()); + } + + public void makeBlikLevel0Payment(View view){ + new Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.getBlikLevel0Payment()); + } + + public void makeBizumPayment(View view){ + new Client(mContext, URL_EE_TEST) + .startPayment(mPaymentObjectProvider.getBizumPayment()); + } + public void makeLoyaltyCard(View view){ startActivity(new Intent(mContext, KotlinLoyaltyCardFieldActivity.class)); } diff --git a/app/src/main/java/com/sdkpay/ecom/examples/TokenAnimatedCardFieldActivity.java b/app/src/main/java/com/sdkpay/ecom/examples/TokenAnimatedCardFieldActivity.java index fd6784d..46948a1 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/TokenAnimatedCardFieldActivity.java +++ b/app/src/main/java/com/sdkpay/ecom/examples/TokenAnimatedCardFieldActivity.java @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples; diff --git a/app/src/main/java/com/sdkpay/ecom/examples/providers/OptionalFieldsProvider.java b/app/src/main/java/com/sdkpay/ecom/examples/providers/OptionalFieldsProvider.java index 49d0209..e50c616 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/providers/OptionalFieldsProvider.java +++ b/app/src/main/java/com/sdkpay/ecom/examples/providers/OptionalFieldsProvider.java @@ -1,9 +1,11 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples.providers; +import com.sdkpay.ecom.card.model.CardFieldPayment; import com.sdkpay.ecom.card.model.CardPayment; import com.sdkpay.ecom.model.AccountHolder; import com.sdkpay.ecom.model.AccountInfo; @@ -35,7 +37,20 @@ public class OptionalFieldsProvider { public BasePayment appendThreeDSV2Fields(BasePayment payment){ + if(payment instanceof CardPayment){ + ((CardPayment)payment).setAttempt3d(true); + ((CardPayment)payment).setThreeDVersion("2.1.0"); + } + + if(payment instanceof CardFieldPayment){ + ((CardFieldPayment)payment).setAttempt3d(true); + ((CardFieldPayment)payment).setThreeDVersion("2.1.0"); + } + AccountHolder accountHolder = new AccountHolder(); + accountHolder.setFirstName("John"); + accountHolder.setLastName("Doe"); + accountHolder.setEmail("john.doe@email.com"); AccountInfo accountInfo = new AccountInfo(); accountInfo.setAuthenticationTimestamp(new Date(System.currentTimeMillis())); diff --git a/app/src/main/java/com/sdkpay/ecom/examples/providers/PaymentObjectProvider.java b/app/src/main/java/com/sdkpay/ecom/examples/providers/PaymentObjectProvider.java index c0240d4..1007e2e 100644 --- a/app/src/main/java/com/sdkpay/ecom/examples/providers/PaymentObjectProvider.java +++ b/app/src/main/java/com/sdkpay/ecom/examples/providers/PaymentObjectProvider.java @@ -1,5 +1,6 @@ /* - * Copyright © 2022 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. All rights reserved. + * Copyright © 2023 PagoNxt Merchant Solutions S.L. and Santander España Merchant Services, Entidad de Pago, S.L.U. + * You may not use this file except in compliance with the License which is available at https://mit-license.org/ */ package com.sdkpay.ecom.examples.providers; @@ -7,21 +8,30 @@ import static com.sdkpay.ecom.examples.Constants.URL_EE_TEST; import com.sdkpay.ecom.alipay.model.AlipayPayment; +import com.sdkpay.ecom.bizum.model.BizumPayment; +import com.sdkpay.ecom.blik.model.BlikLevel0Payment; +import com.sdkpay.ecom.blik.model.BlikRedirectPayment; import com.sdkpay.ecom.card.model.CardBundle; import com.sdkpay.ecom.card.model.CardFieldPayment; import com.sdkpay.ecom.card.model.CardPayment; import com.sdkpay.ecom.examples.SignatureHelper; import com.sdkpay.ecom.model.AccountHolder; +import com.sdkpay.ecom.model.Address; +import com.sdkpay.ecom.model.BankAccount; import com.sdkpay.ecom.model.CardToken; import com.sdkpay.ecom.model.Notification; import com.sdkpay.ecom.model.Notifications; import com.sdkpay.ecom.model.OrderItem; import com.sdkpay.ecom.model.OrderItemType; import com.sdkpay.ecom.model.RequestedAmount; +import com.sdkpay.ecom.model.Shipping; import com.sdkpay.ecom.model.TransactionType; import com.sdkpay.ecom.p24.model.P24Payment; import com.sdkpay.ecom.paypal.model.PayPalPayment; +import com.sdkpay.ecom.ratepay.model.RatepayElvPayment; +import com.sdkpay.ecom.ratepay.model.RatepayInvoicePayment; import com.sdkpay.ecom.sepa.model.SepaPayment; +import com.sdkpay.ecom.sofort.model.SofortPayment; import com.sdkpay.ecom.wiretransfer.model.WiretransferPayment; import java.math.BigDecimal; @@ -31,14 +41,14 @@ public class PaymentObjectProvider { OptionalFieldsProvider optionalFieldsProvider; - public PaymentObjectProvider(OptionalFieldsProvider optionalFieldsProvider){ + public PaymentObjectProvider(OptionalFieldsProvider optionalFieldsProvider) { this.optionalFieldsProvider = optionalFieldsProvider; } public SepaPayment getSepaPaymentObject() { String timestamp = SignatureHelper.generateTimestamp(); - String merchantID = "5c4ef296-46c5-482c-9143-509d13fcca34"; - String secretKey = "d60f0ba0-35cd-43f9-a0ef-1dab7880b1d7"; + String merchantID = "98beb2e5-85af-4ba0-8aea-1e76b330eb6b"; + String secretKey = "eaeeb74a-bc12-4d6d-818e-92a8cdfd6b76"; String requestID = UUID.randomUUID().toString(); TransactionType transactionType = TransactionType.AUTHORIZATION; BigDecimal amount = new BigDecimal(5); @@ -55,11 +65,11 @@ public SepaPayment getSepaPaymentObject() { .build(); } - public CardPayment getCardPaymentWithOptionalData(){ + public CardPayment getCardPaymentWithOptionalData() { return optionalFieldsProvider.appendCardOptionalData(getCardPayment(false, false)); } - public CardPayment getCardPayment(boolean isAnimated){ + public CardPayment getCardPayment(boolean isAnimated) { return this.getCardPayment(isAnimated, true); } @@ -85,12 +95,12 @@ public CardPayment getCardPayment(boolean isAnimated, boolean append3dsV2Fields) .build(); cardPayment.setRequireManualCardBrandSelection(true); cardPayment.setAnimatedCardPayment(isAnimated); - if(append3dsV2Fields) + if (append3dsV2Fields) return (CardPayment) optionalFieldsProvider.appendThreeDSV2Fields(cardPayment); else return cardPayment; } - public CardPayment getCardTokenPayment(){ + public CardPayment getCardTokenPayment() { String timestamp = SignatureHelper.generateTimestamp(); String merchantID = "5c4a8a42-04a8-4970-a595-262f0ba0a108"; String secretKey = "5ac555d4-e7f7-409f-8147-d82c8c10ed53"; @@ -111,8 +121,8 @@ public CardPayment getCardTokenPayment(){ cardPayment.setRequireManualCardBrandSelection(true); CardToken cardToken = new CardToken(); - cardToken.setTokenId("5524988500162004"); - cardToken.setMaskedAccountNumber("541333******2004"); + cardToken.setTokenId("5500971586101006"); + cardToken.setMaskedAccountNumber("541333******1006"); cardPayment.setCardToken(cardToken); @@ -147,7 +157,7 @@ public CardFieldPayment getCardFormPayment(CardBundle cardBundle) { return (CardFieldPayment) optionalFieldsProvider.appendThreeDSV2Fields(cardFieldPayment); } - public PayPalPayment getPayPalPayment(){ + public PayPalPayment getPayPalPayment() { String timestamp = SignatureHelper.generateTimestamp(); String merchantID = "bb342082-9761-4481-802e-20b10d92545d"; String secretKey = "fd1d35aa-952e-4549-9f3d-ea33c89c86c4"; @@ -180,14 +190,14 @@ public PayPalPayment getPayPalPayment(){ return payPalPayment; } - public AlipayPayment getAlipayPayment(){ + public AlipayPayment getAlipayPayment() { String timestamp = SignatureHelper.generateTimestamp(); String requestId = UUID.randomUUID().toString(); - String merchantId = ""; - String secretKey = ""; + String merchantId = "ALIPAY_MAID"; + String secretKey = "ALIPAY_SECRET"; TransactionType transactionType = TransactionType.DEBIT; BigDecimal amount = new BigDecimal(5); - String currency = "EUR"; + String currency = "USD"; String signature = SignatureHelper.generateSignature(timestamp, merchantId, requestId, transactionType.getValue(), amount, currency, secretKey); AlipayPayment payment = new AlipayPayment.Builder() @@ -203,11 +213,11 @@ public AlipayPayment getAlipayPayment(){ return payment; } - public WiretransferPayment getWiretransferPayment(){ + public WiretransferPayment getWiretransferPayment() { String timestamp = SignatureHelper.generateTimestamp(); String requestId = UUID.randomUUID().toString(); String merchantId = "9e035f8f-bf8d-4179-aafb-ca059128e089"; - String secretKey = "c3b39f09-5632-42fc-b1a6-2a1b386613dd"; + String secretKey = "c3b39f09-5632-42fc-b1a6-2a1b386613dd"; TransactionType transactionType = TransactionType.AUTHORIZATION; BigDecimal amount = new BigDecimal(5); String currency = "EUR"; @@ -235,11 +245,11 @@ public WiretransferPayment getWiretransferPayment(){ return payment; } - public P24Payment getP24Payment(){ + public P24Payment getP24Payment() { String timestamp = SignatureHelper.generateTimestamp(); String requestId = UUID.randomUUID().toString(); String merchantId = "39525cf9-fe90-4f99-9ce2-42815754d7c1"; - String secretKey = "6951db91-063a-4f28-b88e-02bde3ae555e"; + String secretKey = "6951db91-063a-4f28-b88e-02bde3ae555e"; TransactionType transactionType = TransactionType.DEBIT; BigDecimal amount = new BigDecimal(1); String currency = "PLN"; @@ -271,4 +281,251 @@ public P24Payment getP24Payment(){ return payment; } + public SofortPayment getSofortPayment() { + String timestamp = SignatureHelper.generateTimestamp(); + String requestId = UUID.randomUUID().toString(); + String merchantId = "cd553bc0-e8f1-4d4c-8a36-eb9b2040304f"; + String secretKey = "d069455a-9852-4494-95d1-5caedbdcf6ce"; + TransactionType transactionType = TransactionType.DEBIT; + BigDecimal amount = new BigDecimal(10); + String currency = "EUR"; + String signature = SignatureHelper.generateSignature(timestamp, merchantId, requestId, transactionType.getValue(), amount, currency, secretKey); + + SofortPayment payment = new SofortPayment.Builder() + .setSignature(signature) + .setRequestId(requestId) + .setMerchantAccountId(merchantId) + .setTransactionType(transactionType) + .setAmount(amount) + .setCurrency(currency) + .setAccountHolder( + new AccountHolder( + "Getnetbuyer", "Spintzyk", "sofort.buyer2@getneteurope.com" + ) + ) + .setOrderNumber("18040037092713285") + .setDescriptor("DESC180099798888") + .build(); + + return payment; + } + + public RatepayInvoicePayment getRatepayInvoicePayment() { + String timestamp = SignatureHelper.generateTimestamp(); + String requestId = UUID.randomUUID().toString(); + String merchantId = "1da76824-e28a-4b64-8f41-c74a0a0e0c0c"; + String secretKey = "fb9d2b5d-e89b-427b-be66-2c4704378908"; + TransactionType transactionType = TransactionType.AUTHORIZATION; + BigDecimal amount = new BigDecimal(15); + String currency = "EUR"; + String signature = SignatureHelper.generateSignature(timestamp, merchantId, requestId, transactionType.getValue(), amount, currency, secretKey); + + RatepayInvoicePayment payment = new RatepayInvoicePayment.Builder() + .setSignature(signature) + .setRequestId(requestId) + .setMerchantAccountId(merchantId) + .setTransactionType(transactionType) + .setAmount(amount) + .setCurrency(currency) + .setAccountHolder(getRatePayAccountHolder()) + .setOrderNumber(UUID.randomUUID().toString()) + .setOrderItems(getRatePayOrderItems()) + .setDeviceFingerprint("DeviceIdentToken") + .build(); + + return payment; + } + + public RatepayElvPayment getRatepayElvPayment() { + String timestamp = SignatureHelper.generateTimestamp(); + String requestId = UUID.randomUUID().toString(); + String merchantId = "5289ba2d-6094-4f7d-b6c2-346d1af638eb"; + String secretKey = "bb3ec883-9c5b-4e70-beff-c3151b17ecf4"; + TransactionType transactionType = TransactionType.AUTHORIZATION; + BigDecimal amount = new BigDecimal(15); + String currency = "EUR"; + String signature = SignatureHelper.generateSignature(timestamp, merchantId, requestId, transactionType.getValue(), amount, currency, secretKey); + BankAccount bankAccount = BankAccount.Companion.ibanBic( + "Danske Bank Hamburg", + "DE83203205004989123456", + "DABADEHHXXX" + ); + + RatepayElvPayment payment = new RatepayElvPayment.Builder() + .setSignature(signature) + .setRequestId(requestId) + .setMerchantAccountId(merchantId) + .setTransactionType(transactionType) + .setAmount(amount) + .setCurrency(currency) + .setAccountHolder(getRatePayAccountHolder()) + .setShippingAddress(getRatePayShipping()) + .setOrderNumber(UUID.randomUUID().toString()) + .setOrderItems(getRatePayOrderItems()) + .setBankAccount(bankAccount) + .setDeviceFingerprint("DeviceIdentToken") + .setCreditorId("DE12345667787") + .setMandateId("25874659562") + .build(); + + return payment; + } + + + private AccountHolder getRatePayAccountHolder() { + AccountHolder ratePayAccountHolder = new AccountHolder(); + Address address = new Address(); + address.setStreet1("Nicht Versenden Str. 5"); + address.setCity("Testhausen"); + address.setState("Berlin"); + address.setCountry("DE"); + address.setPostalCode("13353"); + ratePayAccountHolder.setFirstName("Test"); + ratePayAccountHolder.setLastName("Wischnewski"); + ratePayAccountHolder.setEmail("test@test.com"); + ratePayAccountHolder.setGender("Male"); + ratePayAccountHolder.setPhone("03018425165"); + ratePayAccountHolder.setAddress(address); + return ratePayAccountHolder; + } + + private Shipping getRatePayShipping() { + Shipping shipping = new Shipping(); + Address address = new Address(); + address.setStreet1("Nicht Versenden Str. 5"); + address.setCity("Testhausen"); + address.setState("Berlin"); + address.setCountry("DE"); + address.setPostalCode("13353"); + shipping.setFirstName("Hans-Jürgen"); + shipping.setLastName("Wischnewski"); + shipping.setPhone("+49123123123"); + shipping.setAddress(address); + return shipping; + } + + private ArrayList getRatePayOrderItems() { + OrderItem orderItem1 = new OrderItem(); + orderItem1.setName("Item A"); + orderItem1.setArticleNumber("123"); + orderItem1.setAmount(new RequestedAmount("5.0", "EUR")); + orderItem1.setTaxRate(new BigDecimal("0.0")); + orderItem1.setQuantity(1); + + OrderItem orderItem2 = new OrderItem(); + orderItem2.setName("Item B"); + orderItem2.setArticleNumber("456"); + orderItem2.setAmount(new RequestedAmount("10.0", "EUR")); + orderItem2.setTaxRate(new BigDecimal("0.0")); + orderItem2.setQuantity(1); + + OrderItem orderItem3 = new OrderItem(); + orderItem3.setName("Shipping Cost"); + orderItem3.setArticleNumber("789"); + orderItem3.setAmount(new RequestedAmount("5.0", "EUR")); + orderItem3.setTaxRate(new BigDecimal("0.0")); + orderItem3.setQuantity(1); + orderItem3.setType(OrderItemType.SHIPMENT_FEE); + + OrderItem orderItem4 = new OrderItem(); + orderItem4.setName("Discount"); + orderItem4.setArticleNumber("111"); + orderItem4.setAmount(new RequestedAmount("-5.0", "EUR")); + orderItem4.setTaxRate(new BigDecimal("0.0")); + orderItem4.setQuantity(1); + orderItem4.setType(OrderItemType.DISCOUNT); + + ArrayList items = new ArrayList(); + items.add(orderItem1); + items.add(orderItem2); + items.add(orderItem3); + items.add(orderItem4); + return items; + } + + private AccountHolder getBlikAccountHolder() { + AccountHolder ratePayAccountHolder = new AccountHolder(); + ratePayAccountHolder.setEmail("test@test.com"); + return ratePayAccountHolder; + } + + public BlikRedirectPayment getBlikRedirectPayment() { + String timestamp = SignatureHelper.generateTimestamp(); + String requestId = UUID.randomUUID().toString(); + String merchantId = "54c06d30-73a7-45b0-b1f6-6f5ae91cd40c"; + String secretKey = "285fe5af-09f0-4e99-b8a8-439f14d75e20"; + TransactionType transactionType = TransactionType.DEBIT; + BigDecimal amount = new BigDecimal(15); + String currency = "PLN"; + String signature = SignatureHelper.generateSignature(timestamp, merchantId, requestId, transactionType.getValue(), amount, currency, secretKey); + + BlikRedirectPayment payment = new BlikRedirectPayment.Builder() + .setSignature(signature) + .setRequestId(requestId) + .setMerchantAccountId(merchantId) + .setTransactionType(transactionType) + .setAmount(amount) + .setCurrency(currency) + .setAccountHolder(getBlikAccountHolder()) + .setOrderNumber("18040037092713285") + .setDescriptor("DESC180099798888") + .build(); + + return payment; + } + + public BlikLevel0Payment getBlikLevel0Payment() { + String timestamp = SignatureHelper.generateTimestamp(); + String requestId = UUID.randomUUID().toString(); + String merchantId = "54c06d30-73a7-45b0-b1f6-6f5ae91cd40c"; + String secretKey = "285fe5af-09f0-4e99-b8a8-439f14d75e20"; + TransactionType transactionType = TransactionType.DEBIT; + BigDecimal amount = new BigDecimal(15); + String currency = "PLN"; + String signature = SignatureHelper.generateSignature(timestamp, merchantId, requestId, transactionType.getValue(), amount, currency, secretKey); + + BlikLevel0Payment payment = new BlikLevel0Payment.Builder() + .setSignature(signature) + .setRequestId(requestId) + .setMerchantAccountId(merchantId) + .setTransactionType(transactionType) + .setAmount(amount) + .setCurrency(currency) + .setAccountHolder(getBlikAccountHolder()) + .setOrderNumber("18040037092713285") + .setDescriptor("DESC180099798888") + .build(); + + return payment; + } + + private AccountHolder getBizumAccountHolder() { + AccountHolder ratePayAccountHolder = new AccountHolder(); + ratePayAccountHolder.setPhone("+34700000000"); + return ratePayAccountHolder; + } + public BizumPayment getBizumPayment() { + String timestamp = SignatureHelper.generateTimestamp(); + String requestId = UUID.randomUUID().toString(); + String merchantId = "75237619-7053-439f-90c9-273b05cc254a"; + String secretKey = "6ce8c641-145b-4607-9f45-3a18dbe073a5"; + TransactionType transactionType = TransactionType.AUTHORIZATION; + BigDecimal amount = new BigDecimal(15); + String currency = "EUR"; + String signature = SignatureHelper.generateSignature(timestamp, merchantId, requestId, transactionType.getValue(), amount, currency, secretKey); + + BizumPayment payment = new BizumPayment.Builder() + .setSignature(signature) + .setRequestId(requestId) + .setMerchantAccountId(merchantId) + .setTransactionType(transactionType) + .setAmount(amount) + .setCurrency(currency) + .setAccountHolder(getBizumAccountHolder()) + .setOrderNumber("18040037092713285") + .setDescriptor("DESC180099798888") + .build(); + + return payment; + } } diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml index b79ba69..a0884de 100644 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -1,5 +1,6 @@ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index 04561fc..3ed114c 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,6 +1,7 @@ +