StripeCryptoOnramp SDK: Better Cancellation Signaling#6322
StripeCryptoOnramp SDK: Better Cancellation Signaling#6322mliberatore merged 28 commits intomasterfrom
Conversation
jeanregisser
left a comment
There was a problem hiding this comment.
Thanks, I'll finish reviewing tomorrow,
Note that there's also this proposition: #6354
We can discuss during our sync meeting.
jeanregisser
left a comment
There was a problem hiding this comment.
Nice, this is a clean fix. One thought on the Apple Pay state. ✨
| /// if the Apple Pay flow is canceled or fails after `didCreatePaymentMethod` has already updated | ||
| /// `selectedPaymentSource`. This value should only represent pre-existing selection state for the | ||
| /// active Apple Pay attempt, and must be cleared once that attempt completes, fails, or the user logs out. | ||
| private var paymentSourceBeforeApplePay: SelectedPaymentSource? |
There was a problem hiding this comment.
Have we considered flipping the direction here? Instead of saving what we had before and restoring on cancel, we could use a pendingApplePayPaymentSource that only gets promoted to selectedPaymentSource in didCompleteWith(.success) - leaving it untouched on cancel/error, with nothing to restore. It'd also make cleanup symmetric: just pendingApplePayPaymentSource = nil at the end of didCompleteWith in all cases.
There was a problem hiding this comment.
Good idea, hadn't thought about it that way. It reduces the overall management of that state. I‘ve implemented the suggestion in 73a636f.
…’s usage and instead keeping a temporary apple pay payment source that then gets promoted on success to `selectedPaymentSource`
Summary
didSelectPaymentOptionBoolto signal from Link to Onramp that a payment option was selected or not. This helps CryptoOnramp know if a payment option was selected as part of collection, or was just preserved as part of a previous selection.paymentSourceBeforeApplePayto track an existing payment source during the Apple Pay flow, so that we can preserve the accuracy ofselectedPaymentSourceif the multi-step apple pay flow is not completed.Motivation
Making iOS payment collection more in line with how Android handles cancellation.
Testing