From 8885561b54e72757a5e8c654b98c2d7dce998f7f Mon Sep 17 00:00:00 2001 From: jqwout Date: Mon, 3 Apr 2023 15:33:38 +0300 Subject: [PATCH] =?UTF-8?q?EACQAPW-4401=5Fapi=5Fresult=5Fusage=20=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D1=8B=D0=B9=20=D1=81=D0=BF=D0=BE=D1=81=D0=BE=D0=B1?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D1=82=D1=8C=20=D1=81=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D0=BC=20=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tinkoff/acquiring/sample/ui/DetailsActivity.kt | 14 +------------- .../tinkoff/acquiring/sample/ui/PayableActivity.kt | 4 ++-- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/sample/src/main/java/ru/tinkoff/acquiring/sample/ui/DetailsActivity.kt b/sample/src/main/java/ru/tinkoff/acquiring/sample/ui/DetailsActivity.kt index 9e014766..c1670cab 100644 --- a/sample/src/main/java/ru/tinkoff/acquiring/sample/ui/DetailsActivity.kt +++ b/sample/src/main/java/ru/tinkoff/acquiring/sample/ui/DetailsActivity.kt @@ -61,19 +61,7 @@ class DetailsActivity : PayableActivity() { private val paymentContract = registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) { result: ActivityResult -> - when (result.resultCode) { - RESULT_OK -> { - Toast.makeText(this, - R.string.notification_payment_success, - Toast.LENGTH_SHORT).show() - } - RESULT_CANCELED -> Toast.makeText(this, - R.string.payment_cancelled, - Toast.LENGTH_SHORT).show() - TinkoffAcquiring.RESULT_ERROR -> Toast.makeText(this, - R.string.payment_failed, - Toast.LENGTH_SHORT).show() - } + handlePaymentResult(result.resultCode, result.data) } public override fun onCreate(savedInstanceState: Bundle?) { diff --git a/sample/src/main/java/ru/tinkoff/acquiring/sample/ui/PayableActivity.kt b/sample/src/main/java/ru/tinkoff/acquiring/sample/ui/PayableActivity.kt index c6f3d317..fc8f0b35 100644 --- a/sample/src/main/java/ru/tinkoff/acquiring/sample/ui/PayableActivity.kt +++ b/sample/src/main/java/ru/tinkoff/acquiring/sample/ui/PayableActivity.kt @@ -271,7 +271,7 @@ open class PayableActivity : AppCompatActivity() { } } - private fun handlePaymentResult(resultCode: Int, data: Intent?) { + protected fun handlePaymentResult(resultCode: Int, data: Intent?) { when (resultCode) { RESULT_OK -> onSuccessPayment() RESULT_CANCELED -> Toast.makeText(this, R.string.payment_cancelled, Toast.LENGTH_SHORT).show() @@ -281,7 +281,7 @@ open class PayableActivity : AppCompatActivity() { } } - private fun handleYandexPayResult(resultCode: Int, data: Intent?) { + protected fun handleYandexPayResult(resultCode: Int, data: Intent?) { when (resultCode) { RESULT_OK -> { acqFragment?.options = createPaymentOptions()