Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Nov 15, 2023
1 parent 0e6e3f4 commit d0d91bf
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,42 @@ fun PurchaseResult.toPaymentDialogData(): PaymentDialogData? =
PaymentDialogData(
title = R.string.payment_pending_dialog_title,
message = R.string.payment_pending_dialog_message,
confirmAction = PaymentDialogAction.Close()
confirmAction = PaymentDialogAction.Close
)
// Success state
PurchaseResult.Completed.Success ->
PaymentDialogData(
title = R.string.payment_completed_dialog_title,
message = R.string.payment_completed_dialog_message,
icon = PaymentDialogIcon.SUCCESS,
confirmAction = PaymentDialogAction.Close(successfulPayment = true)
confirmAction = PaymentDialogAction.Close,
successfulPayment = true
)
// Error states
is PurchaseResult.Error.TransactionIdError ->
PaymentDialogData(
title = R.string.payment_obfuscation_id_error_dialog_title,
message = R.string.payment_obfuscation_id_error_dialog_message,
icon = PaymentDialogIcon.FAIL,
confirmAction = PaymentDialogAction.Close(),
dismissAction = PaymentDialogAction.RetryPurchase,
productId = this.productId
confirmAction = PaymentDialogAction.Close,
dismissAction = PaymentDialogAction.RetryPurchase(productId = this.productId),
)
is PurchaseResult.Error.FetchProductsError,
is PurchaseResult.Error.NoProductFound -> {
PaymentDialogData(
title = R.string.payment_billing_error_dialog_title,
message = R.string.payment_billing_error_dialog_message,
icon = PaymentDialogIcon.FAIL,
confirmAction = PaymentDialogAction.Close(),
dismissAction = PaymentDialogAction.RetryPurchase,
productId =
when (this) {
is PurchaseResult.Error.FetchProductsError -> this.productId
is PurchaseResult.Error.NoProductFound -> this.productId
else -> ProductId("")
}
confirmAction = PaymentDialogAction.Close,
dismissAction =
PaymentDialogAction.RetryPurchase(
productId =
when (this) {
is PurchaseResult.Error.FetchProductsError -> this.productId
is PurchaseResult.Error.NoProductFound -> this.productId
else -> ProductId("")
}
),
)
}
}

0 comments on commit d0d91bf

Please sign in to comment.