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()