From cce4a8df72380806cb797e02f77b2045c996fbb9 Mon Sep 17 00:00:00 2001
From: upillaipp <130433296+upillaipp@users.noreply.github.com>
Date: Tue, 24 Oct 2023 00:42:11 +0530
Subject: [PATCH] Bump to SDK 2.6.5
---
Examples/Example-Java/app/build.gradle | 1 +
.../app/src/main/AndroidManifest.xml | 4 +-
.../android/java_example/MainActivity.java | 10 +-
.../android/java_example/MainApplication.java | 2 +
.../java_example/ManualCardEntryActivity.java | 166 ++++++++++++++++
.../app/src/main/res/layout/activity_main.xml | 7 +
.../res/layout/activity_manual_card_entry.xml | 160 ++++++++++++++++
Examples/Example-Java/build.gradle | 2 +-
Examples/Example-Kotlin/app/build.gradle | 1 +
.../app/src/main/AndroidManifest.xml | 4 +-
.../android/kotlin_example/MainActivity.kt | 7 +
.../android/kotlin_example/MainApplication.kt | 2 +
.../kotlin_example/ManualCardEntryActivity.kt | 178 ++++++++++++++++++
.../kotlin_example/PaymentResultData.kt | 13 ++
.../app/src/main/res/layout/activity_main.xml | 7 +
.../res/layout/activity_manual_card_entry.xml | 160 ++++++++++++++++
Examples/Example-Kotlin/build.gradle | 2 +-
17 files changed, 721 insertions(+), 5 deletions(-)
create mode 100644 Examples/Example-Java/app/src/main/java/com/zettle/payments/android/java_example/ManualCardEntryActivity.java
create mode 100644 Examples/Example-Java/app/src/main/res/layout/activity_manual_card_entry.xml
create mode 100644 Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/ManualCardEntryActivity.kt
create mode 100644 Examples/Example-Kotlin/app/src/main/res/layout/activity_manual_card_entry.xml
diff --git a/Examples/Example-Java/app/build.gradle b/Examples/Example-Java/app/build.gradle
index 053532a..0ec57ae 100644
--- a/Examples/Example-Java/app/build.gradle
+++ b/Examples/Example-Java/app/build.gradle
@@ -43,6 +43,7 @@ dependencies {
implementation "com.zettle.sdk.feature.qrc:core:$zettle_version"
implementation "com.zettle.sdk.feature.qrc:paypal-ui:$zettle_version"
implementation "com.zettle.sdk.feature.qrc:venmo-ui:$zettle_version"
+ implementation "com.zettle.sdk.feature.manualcardentry:ui:$zettle_version"
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
diff --git a/Examples/Example-Java/app/src/main/AndroidManifest.xml b/Examples/Example-Java/app/src/main/AndroidManifest.xml
index 9314f06..f5da0d3 100644
--- a/Examples/Example-Java/app/src/main/AndroidManifest.xml
+++ b/Examples/Example-Java/app/src/main/AndroidManifest.xml
@@ -32,7 +32,9 @@
-
+
zettleSDK.login(this, Color.WHITE));
- logoutButton.setOnClickListener( v -> zettleSDK.logout());
+ logoutButton.setOnClickListener( v -> zettleSDK.logout(null));
openCardReaderButton.setOnClickListener( v -> {
Intent intent = new Intent(this, CardReaderActivity.class);
@@ -51,6 +54,11 @@ public void onCreate(Bundle savedInstanceState) {
Intent intent = new Intent(this, PayPalQrcActivity.class);
startActivity(intent);
});
+
+ openManualCardEntryButton.setOnClickListener( v -> {
+ Intent intent = new Intent(this, ManualCardEntryActivity.class);
+ startActivity(intent);
+ });
}
@SuppressLint("SetTextI18n")
diff --git a/Examples/Example-Java/app/src/main/java/com/zettle/payments/android/java_example/MainApplication.java b/Examples/Example-Java/app/src/main/java/com/zettle/payments/android/java_example/MainApplication.java
index 1cc9842..6116f3e 100644
--- a/Examples/Example-Java/app/src/main/java/com/zettle/payments/android/java_example/MainApplication.java
+++ b/Examples/Example-Java/app/src/main/java/com/zettle/payments/android/java_example/MainApplication.java
@@ -11,6 +11,7 @@
import com.zettle.sdk.feature.cardreader.ui.CardReaderFeature;
import com.zettle.sdk.feature.qrc.paypal.PayPalQrcFeature;
import com.zettle.sdk.feature.qrc.venmo.VenmoQrcFeature;
+import com.zettle.sdk.feature.manualcardentry.ui.ManualCardEntryFeature;
public class MainApplication extends MultiDexApplication {
@@ -47,6 +48,7 @@ public void initZettleSDK(boolean devMode) {
config.addFeature(CardReaderFeature.Configuration);
config.addFeature(PayPalQrcFeature.Configuration);
config.addFeature(VenmoQrcFeature.Configuration);
+ config.addFeature(ManualCardEntryFeature.Configuration);
ZettleSDK.configure(config);
ProcessLifecycleOwner.get().getLifecycle().addObserver(new ZettleSDKLifecycle());
diff --git a/Examples/Example-Java/app/src/main/java/com/zettle/payments/android/java_example/ManualCardEntryActivity.java b/Examples/Example-Java/app/src/main/java/com/zettle/payments/android/java_example/ManualCardEntryActivity.java
new file mode 100644
index 0000000..fd130ed
--- /dev/null
+++ b/Examples/Example-Java/app/src/main/java/com/zettle/payments/android/java_example/ManualCardEntryActivity.java
@@ -0,0 +1,166 @@
+package com.zettle.payments.android.java_example;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.widget.Button;
+import android.widget.EditText;
+
+import androidx.lifecycle.MutableLiveData;
+
+import android.os.Bundle;
+
+import static com.zettle.payments.android.java_example.Utils.parseLong;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.text.SpannableStringBuilder;
+import android.view.ViewGroup;
+
+import androidx.activity.result.ActivityResultLauncher;
+import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult;
+
+import com.google.android.material.snackbar.Snackbar;
+import com.zettle.sdk.feature.manualcardentry.ui.ManualCardEntryAction;
+import com.zettle.sdk.feature.manualcardentry.ui.payments.ManualCardEntryPaymentResult;
+import com.zettle.sdk.features.ActionUtils;
+import com.zettle.sdk.features.Transaction;
+import com.zettle.sdk.ui.ZettleResult;
+import com.zettle.sdk.ui.ZettleResultKt;
+
+import java.util.Objects;
+import java.util.UUID;
+
+public class ManualCardEntryActivity extends AppCompatActivity {
+
+ private Button chargeButton;
+ private Button settingsButton;
+ private EditText amountEditText;
+ private Button refundButton;
+ private Button retrieveButton;
+ private EditText refundAmountEditText;
+ private MutableLiveData lastPaymentTraceId;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_manual_card_entry);
+ chargeButton = findViewById(R.id.charge_btn);
+ settingsButton = findViewById(R.id.settings_btn);
+ amountEditText = findViewById(R.id.amount_input);
+ refundButton = findViewById(R.id.refund_btn);
+ retrieveButton = findViewById(R.id.retrieve_btn);
+ refundAmountEditText = findViewById(R.id.refund_amount_input);
+ lastPaymentTraceId = new MutableLiveData<>();
+
+ chargeButton.setOnClickListener(v -> onChargeClicked());
+ settingsButton.setOnClickListener(v -> onSettingsClicked());
+ refundButton.setOnClickListener(v -> onRefundLastPayment());
+ retrieveButton.setOnClickListener(v -> onRetrieveLastPayment());
+ }
+
+ private final ActivityResultLauncher paymentLauncher = registerForActivityResult(new StartActivityForResult(), result -> {
+ if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
+ ZettleResult parsed = ZettleResultKt.zettleResult(result.getData());
+ if (parsed instanceof ZettleResult.Completed) {
+ showSnackBar("Payment completed");
+ ManualCardEntryPaymentResult.Completed casted = (ManualCardEntryPaymentResult.Completed) parsed;
+ lastPaymentTraceId.setValue(Objects.requireNonNull(casted.getPayload().getReferenceId()));
+ refundAmountEditText.setText(new SpannableStringBuilder()
+ .append(String.valueOf(casted.getPayload().getAmount())));
+ } else if (parsed instanceof ZettleResult.Failed) {
+ showSnackBar("Payment failed " + ((ZettleResult.Failed) parsed).getReason());
+ } else if (parsed instanceof ZettleResult.Cancelled) {
+ showSnackBar("Payment canceled");
+ }
+ }
+ });
+
+ private final ActivityResultLauncher refundLauncher = registerForActivityResult(new StartActivityForResult(), result -> {
+ if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
+ ZettleResult parsed = ZettleResultKt.zettleResult(result.getData());
+ if (parsed instanceof ZettleResult.Completed) {
+ showSnackBar("Refund completed");
+ } else if (parsed instanceof ZettleResult.Failed) {
+ showSnackBar("Refund failed " + ((ZettleResult.Failed) parsed).getReason());
+ } else if (parsed instanceof ZettleResult.Cancelled) {
+ showSnackBar("Refund canceled");
+ }
+ }
+ });
+
+ private void showSnackBar(String text) {
+ ViewGroup viewGroup = findViewById(android.R.id.content);
+ Snackbar.make(viewGroup.getChildAt(0), text, Snackbar.LENGTH_LONG).show();
+ }
+
+ private void onChargeClicked() {
+ Long amount = parseLong(amountEditText.getText());
+ if (amount == null) {
+ showSnackBar("Invalid amount");
+ return;
+ }
+
+ String uuid = UUID.randomUUID().toString();
+ Intent intent;
+ ManualCardEntryAction.Payment payment = new ManualCardEntryAction.Payment(amount, uuid);
+ intent = ActionUtils.charge(payment, this);
+ paymentLauncher.launch(intent);
+ }
+
+ private void onRefundLastPayment() {
+ Long amount = parseLong(refundAmountEditText.getText());
+ String internalTraceId = lastPaymentTraceId.getValue();
+ boolean isDevMode = ((MainApplication) getApplication()).isDevMode();
+
+ if (internalTraceId == null && !isDevMode) {
+ showSnackBar("No payment taken");
+ return;
+ }
+ if (internalTraceId == null) {
+ internalTraceId = "";
+ }
+ if (amount == null) {
+ amount = ActionUtils.FULL_REFUND;
+ }
+
+ String uuid = UUID.randomUUID().toString();
+ Intent intent;
+ ManualCardEntryAction.Refund refund = new ManualCardEntryAction.Refund(amount, internalTraceId, uuid);
+ intent = ActionUtils.refund(refund, this);
+ refundLauncher.launch(intent);
+ }
+
+ private void onRetrieveLastPayment() {
+ String internalTraceId = lastPaymentTraceId.getValue();
+ boolean isDevMode = ((MainApplication) getApplication()).isDevMode();
+
+ if (internalTraceId == null && !isDevMode) {
+ showSnackBar("No payment taken");
+ return;
+ }
+ if (internalTraceId == null) {
+ internalTraceId = "";
+ }
+
+ Transaction transaction = new ManualCardEntryAction.Transaction(internalTraceId);
+
+ ActionUtils.retrieve(transaction, result -> {
+ if (result instanceof ZettleResult.Completed) {
+ showSnackBar("Retrieve completed");
+ } else if (result instanceof ZettleResult.Failed) {
+ showSnackBar("Retrieve failed " + ((ZettleResult.Failed) result).getReason());
+ } else if (result instanceof ZettleResult.Cancelled) {
+ showSnackBar("Retrieve canceled");
+ }
+ return null;
+ });
+ }
+
+ private void onSettingsClicked() {
+ Intent intent;
+ ManualCardEntryAction.Activation action = ManualCardEntryAction.Activation.INSTANCE;
+ intent = ActionUtils.show(action, this);
+ startActivity(intent);
+ }
+}
+
diff --git a/Examples/Example-Java/app/src/main/res/layout/activity_main.xml b/Examples/Example-Java/app/src/main/res/layout/activity_main.xml
index b74bbb6..3bc220d 100644
--- a/Examples/Example-Java/app/src/main/res/layout/activity_main.xml
+++ b/Examples/Example-Java/app/src/main/res/layout/activity_main.xml
@@ -103,5 +103,12 @@
android:layout_marginTop="8dp"
android:text="Open PayPal QRC" />
+
+
\ No newline at end of file
diff --git a/Examples/Example-Java/app/src/main/res/layout/activity_manual_card_entry.xml b/Examples/Example-Java/app/src/main/res/layout/activity_manual_card_entry.xml
new file mode 100644
index 0000000..e19862b
--- /dev/null
+++ b/Examples/Example-Java/app/src/main/res/layout/activity_manual_card_entry.xml
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Examples/Example-Java/build.gradle b/Examples/Example-Java/build.gradle
index cb3c9a5..d5743dd 100644
--- a/Examples/Example-Java/build.gradle
+++ b/Examples/Example-Java/build.gradle
@@ -2,7 +2,7 @@
buildscript {
- ext.zettle_version = '2.1.5'
+ ext.zettle_version = '2.6.5'
apply from: 'zettleSDK.gradle'
diff --git a/Examples/Example-Kotlin/app/build.gradle b/Examples/Example-Kotlin/app/build.gradle
index 0fd66bf..0d2177d 100644
--- a/Examples/Example-Kotlin/app/build.gradle
+++ b/Examples/Example-Kotlin/app/build.gradle
@@ -49,6 +49,7 @@ dependencies {
implementation "com.zettle.sdk.feature.qrc:core:$zettle_version"
implementation "com.zettle.sdk.feature.qrc:paypal-ui:$zettle_version"
implementation "com.zettle.sdk.feature.qrc:venmo-ui:$zettle_version"
+ implementation "com.zettle.sdk.feature.manualcardentry:ui:$zettle_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.6.1'
diff --git a/Examples/Example-Kotlin/app/src/main/AndroidManifest.xml b/Examples/Example-Kotlin/app/src/main/AndroidManifest.xml
index f589f6f..fe5ff87 100644
--- a/Examples/Example-Kotlin/app/src/main/AndroidManifest.xml
+++ b/Examples/Example-Kotlin/app/src/main/AndroidManifest.xml
@@ -32,7 +32,9 @@
-
+
onAuthStateChanged(state is User.AuthState.LoggedIn)
@@ -49,6 +51,11 @@ class MainActivity : AppCompatActivity() {
val intent = Intent(this, PayPalQrcActivity::class.java)
startActivity(intent)
}
+
+ openManualCardEntryButton.setOnClickListener {
+ val intent = Intent(this, ManualCardEntryActivity::class.java)
+ startActivity(intent)
+ }
}
@SuppressLint("SetTextI18n")
diff --git a/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/MainApplication.kt b/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/MainApplication.kt
index f6ab104..ba30d59 100644
--- a/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/MainApplication.kt
+++ b/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/MainApplication.kt
@@ -8,6 +8,7 @@ import com.zettle.sdk.feature.cardreader.ui.CardReaderFeature
import com.zettle.sdk.ZettleSDK
import com.zettle.sdk.ZettleSDKLifecycle
import com.zettle.sdk.config
+import com.zettle.sdk.feature.manualcardentry.ui.ManualCardEntryFeature
class MainApplication : MultiDexApplication() {
@@ -39,6 +40,7 @@ class MainApplication : MultiDexApplication() {
addFeature(CardReaderFeature)
addFeature(PayPalQrcFeature)
addFeature(VenmoQrcFeature)
+ addFeature(ManualCardEntryFeature)
}
ZettleSDK.configure(config)
//ZettleSDK.start()
diff --git a/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/ManualCardEntryActivity.kt b/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/ManualCardEntryActivity.kt
new file mode 100644
index 0000000..e416842
--- /dev/null
+++ b/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/ManualCardEntryActivity.kt
@@ -0,0 +1,178 @@
+package com.zettle.payments.android.kotlin_example
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import android.text.SpannableStringBuilder
+import android.view.ViewGroup
+import android.widget.Button
+import android.widget.EditText
+import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
+import androidx.appcompat.app.AppCompatActivity
+import androidx.lifecycle.MutableLiveData
+import com.google.android.material.snackbar.Snackbar
+import com.zettle.sdk.ZettleSDK
+import com.zettle.sdk.feature.manualcardentry.ui.ManualCardEntryAction
+import com.zettle.sdk.feature.manualcardentry.ui.payments.models.ManualCardEntryPaymentPayload
+import com.zettle.sdk.feature.manualcardentry.ui.refunds.models.ManualCardEntryRefundPayload
+import com.zettle.sdk.features.charge
+import com.zettle.sdk.features.refund
+import com.zettle.sdk.features.retrieve
+import com.zettle.sdk.features.show
+import com.zettle.sdk.ui.ZettleResult
+import com.zettle.sdk.ui.zettleResult
+import java.lang.Math.abs
+import java.util.UUID
+
+class ManualCardEntryActivity : AppCompatActivity() {
+
+ private lateinit var chargeButton: Button
+ private lateinit var retrieveButton: Button
+ private lateinit var settingsButton: Button
+ private lateinit var refundButton: Button
+ private lateinit var refundAmountEditText: EditText
+ private lateinit var amountEditText: EditText
+ private lateinit var lastPaymentTraceId: MutableLiveData
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (!ZettleSDK.isInitialized) {
+ finish()
+ }
+
+ setContentView(R.layout.activity_manual_card_entry)
+ chargeButton = findViewById(R.id.charge_btn)
+ retrieveButton = findViewById(R.id.retrieve_btn)
+ settingsButton = findViewById(R.id.settings_btn)
+ refundButton = findViewById(R.id.refund_btn)
+ refundAmountEditText = findViewById(R.id.refund_amount_input)
+ amountEditText = findViewById(R.id.amount_input)
+ lastPaymentTraceId = MutableLiveData()
+
+ chargeButton.setOnClickListener { onChargeClicked() }
+ retrieveButton.setOnClickListener { onRetrieveLastPayment() }
+ settingsButton.setOnClickListener { onSettingsClicked() }
+ refundButton.setOnClickListener { onRefundLastPayment() }
+ }
+
+ private fun onRefundLastPayment() {
+ val amount = refundAmountEditText.text.toLong()
+ val internalTraceId = lastPaymentTraceId.value
+ val isDevMode = (application as MainApplication).isDevMode
+
+ if (internalTraceId == null && !isDevMode) {
+ showSnackBar("No payment taken")
+ return
+ }
+
+ val refundIntent = ManualCardEntryAction.Refund(
+ amount = amount ?: 0L,
+ paymentReference = internalTraceId ?: "",
+ refundReference = UUID.randomUUID().toString()
+ )
+
+ refundLauncher.launch(refundIntent.refund(this))
+ }
+
+ private val paymentLauncher = registerForActivityResult(StartActivityForResult()) { r ->
+ if (r.resultCode != Activity.RESULT_OK) {
+ return@registerForActivityResult
+ }
+
+ when (val result = r.data?.zettleResult()) {
+ is ZettleResult.Completed<*> -> {
+ val payment: ManualCardEntryPaymentPayload = ManualCardEntryAction.fromPaymentResult(result)
+ showResultSheet(payment.toPaymentResultData())
+ lastPaymentTraceId.value = payment.referenceId
+ refundAmountEditText.text =
+ SpannableStringBuilder().append(payment.amount.toString())
+ }
+ is ZettleResult.Failed -> showSnackBar("Payment failed ${result.reason}")
+ is ZettleResult.Cancelled -> showSnackBar("Payment canceled")
+ null -> showSnackBar("Problem... null")
+ }
+ }
+
+ private val refundLauncher = registerForActivityResult(StartActivityForResult()) { r ->
+ if (r.resultCode != Activity.RESULT_OK) {
+ return@registerForActivityResult
+ }
+
+ when (val result = r.data?.zettleResult()) {
+ is ZettleResult.Completed<*> -> {
+ val refund: ManualCardEntryRefundPayload = ManualCardEntryAction.fromRefundResult(result)
+ showResultSheet(refund.toRefundResultData())
+ }
+ is ZettleResult.Failed -> showSnackBar("Refund failed ${result.reason}")
+ is ZettleResult.Cancelled -> showSnackBar("Refund canceled")
+ null -> showSnackBar("Problem... null")
+ }
+ }
+
+ private fun ManualCardEntryPaymentPayload.toPaymentResultData() = PaymentResultData(
+ title = "Manual Card Entry Payment",
+ amount = formatPaymentAmount(amount),
+ reference = referenceId,
+ resultList = toResultListItems()
+ )
+
+ private fun ManualCardEntryRefundPayload.toRefundResultData() = PaymentResultData(
+ title = "Manual Card Entry Refund",
+ amount = formatPaymentAmount(-1 * abs(amount)),
+ reference = reference,
+ resultList = toResultListItems(),
+ resultType = ResultType.REFUND
+ )
+
+ private fun showResultSheet(resultData: PaymentResultData) {
+ PaymentResultBottomSheet.newInstance(resultData)
+ .show(supportFragmentManager, PaymentResultBottomSheet.TAG)
+ }
+
+ private fun showSnackBar(text: String) {
+ findViewById(android.R.id.content).getChildAt(0).run {
+ Snackbar.make(this, text, Snackbar.LENGTH_LONG).show()
+ }
+ }
+
+ private fun onChargeClicked() {
+ val amount = amountEditText.text.toLong()
+ if (amount == null) {
+ showSnackBar("Invalid amount")
+ return
+ }
+
+ val uuid = UUID.randomUUID().toString()
+ val intent: Intent = ManualCardEntryAction.Payment(amount, uuid).charge(this)
+ paymentLauncher.launch(intent)
+ }
+
+ private fun onSettingsClicked() {
+ val intent = ManualCardEntryAction.Activation.show(this)
+ startActivity(intent)
+ }
+
+ private fun onRetrieveLastPayment() {
+
+ val internalTraceId = lastPaymentTraceId.value
+ val isDevMode = (application as MainApplication).isDevMode
+
+ if (internalTraceId == null && !isDevMode) {
+ showSnackBar("No payment taken")
+ return
+ }
+
+ val action = ManualCardEntryAction.Transaction(internalTraceId ?: "")
+
+ action.retrieve {
+ when (val result = it) {
+ is ZettleResult.Completed<*> -> {
+ val payment: ManualCardEntryPaymentPayload = ManualCardEntryAction.fromRetrieveTransactionResult(result)
+ showResultSheet(payment.toPaymentResultData())
+ }
+ is ZettleResult.Failed -> showSnackBar("Retrieve payment failed ${result.reason}")
+ is ZettleResult.Cancelled -> showSnackBar("Retrieve payment canceled")
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/PaymentResultData.kt b/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/PaymentResultData.kt
index dc8b5c2..1d24a1c 100644
--- a/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/PaymentResultData.kt
+++ b/Examples/Example-Kotlin/app/src/main/java/com/zettle/payments/android/kotlin_example/PaymentResultData.kt
@@ -6,6 +6,8 @@ import com.zettle.sdk.feature.qrc.ui.refund.QrcRefund
import com.zettle.sdk.feature.cardreader.payment.Transaction
import com.zettle.sdk.feature.cardreader.payment.refunds.CardPaymentPayload
import com.zettle.sdk.feature.cardreader.payment.refunds.RefundPayload
+import com.zettle.sdk.feature.manualcardentry.ui.payments.models.ManualCardEntryPaymentPayload
+import com.zettle.sdk.feature.manualcardentry.ui.refunds.models.ManualCardEntryRefundPayload
import kotlinx.parcelize.Parcelize
import java.math.BigDecimal
import java.text.DecimalFormat
@@ -43,6 +45,17 @@ fun QrcRefund.toResultListItems(): List = listOf(
ResultItem("Type", type.toString())
)
+fun ManualCardEntryPaymentPayload.toResultListItems(): List = listOf(
+ ResultItem("transactionId", transactionId),
+ ResultItem("referenceNumber", referenceNumber),
+)
+
+fun ManualCardEntryRefundPayload.toResultListItems(): List = listOf(
+ ResultItem("originalAmount", formatPaymentAmount(originalAmount)),
+ ResultItem("transactionId", transactionId),
+ ResultItem("referenceNumber", referenceNumber),
+)
+
fun Transaction.ResultPayload.toResultListItems(): List = listOf(
ResultItem("applicationIdentifier", applicationIdentifier),
ResultItem("applicationName", applicationName),
diff --git a/Examples/Example-Kotlin/app/src/main/res/layout/activity_main.xml b/Examples/Example-Kotlin/app/src/main/res/layout/activity_main.xml
index b74bbb6..3bc220d 100644
--- a/Examples/Example-Kotlin/app/src/main/res/layout/activity_main.xml
+++ b/Examples/Example-Kotlin/app/src/main/res/layout/activity_main.xml
@@ -103,5 +103,12 @@
android:layout_marginTop="8dp"
android:text="Open PayPal QRC" />
+
+
\ No newline at end of file
diff --git a/Examples/Example-Kotlin/app/src/main/res/layout/activity_manual_card_entry.xml b/Examples/Example-Kotlin/app/src/main/res/layout/activity_manual_card_entry.xml
new file mode 100644
index 0000000..26ded0a
--- /dev/null
+++ b/Examples/Example-Kotlin/app/src/main/res/layout/activity_manual_card_entry.xml
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Examples/Example-Kotlin/build.gradle b/Examples/Example-Kotlin/build.gradle
index 1555c51..09bb7b1 100644
--- a/Examples/Example-Kotlin/build.gradle
+++ b/Examples/Example-Kotlin/build.gradle
@@ -3,7 +3,7 @@
buildscript {
ext.kotlin_version = '1.8.22'
- ext.zettle_version = '2.6.4'
+ ext.zettle_version = '2.6.5'
apply from: 'zettleSDK.gradle'