Skip to content

Commit

Permalink
EACQAPW-4401_api_result_usage новый способ работать с результатом акт…
Browse files Browse the repository at this point in the history
…ивности
  • Loading branch information
jQwout committed Apr 3, 2023
1 parent 9bfb975 commit 8885561
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 8885561

Please sign in to comment.