[COMSE-27] Example app: Cash App Pay on-file vs one-time grant mode toggle#296
Closed
noahjalex wants to merge 1 commit into
Conversation
…oggle Add a UISegmentedControl to the cart screen so the V3 Cash App Pay flow can request either a `.oneTimePayment` (current behavior) or `.onFilePayment` PayKit grant. Both modes use the same Afterpay V3 CAP endpoints — only the PayKit PaymentAction differs. - ButtonCashAppPayCheckout: new CashAppPayMode enum, branched PaymentAction in createCustomerRequest, NSLog tracing across the checkoutV3 / customer-request / approval / confirm steps. - CartViewController: One-time / On-file segmented control, only shown with the V3-CAP button; threads selection through Event.didTapSingleUseCardButtonWithCashAppPay(CashAppPayMode). - PurchaseFlowController / PurchaseLogicController: forward mode to payWithAfterpayV3WithCashAppPay(mode:). No SDK API changes. Draft — not ready for review. Amp-Thread-ID: https://ampcode.com/threads/T-019de021-58ff-7799-b997-d3447d1abf2b Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linear: COMSE-27
Summary
Adds a One-time / On-file segmented control to the Example app's cart so the V3 Cash App Pay flow can request either PayKit grant type. Both modes hit the same Afterpay V3 CAP endpoints (
POST /v3/button,/v2/payments/sign-payment,/v3/button/confirm); only the PayKitPaymentActionattached to the customer request differs:.oneTimePayment(scopeID:, money:)— current behavior, single-use authorization..onFilePayment(scopeID:, accountReferenceID:)— grant suitable for on-file storage / merchant-initiated transactions.This is purely Example-app plumbing for support / validation work — no changes to the public Afterpay SDK API.
Changes
Example/Example/Purchase/ButtonCashAppPayCheckout.swiftCashAppPayModeenum (.oneTime/.onFile).checkoutV3(consumer:cartTotal:mode:)stores the selected mode and threads it throughcreateCustomerRequest, which now branches thePaymentAction.NSLog("[CAP-AP] …")traces acrosscheckoutV3, customer-request creation, PayKit state changes, approval, andconfirmCheckout.Example/Example/Purchase/CartViewController.swiftUISegmentedControl("One-time" / "On-file") above the V3-CAP button; hidden whenever the V3-CAP button is hidden.Event.didTapSingleUseCardButtonWithCashAppPay(CashAppPayMode).Example/Example/Purchase/PurchaseFlowController.swift/PurchaseLogicController.swiftmodethrough topayWithAfterpayV3WithCashAppPay(mode:).Out of scope
Afterpay.checkoutV3WithCashAppPay/checkoutV3ConfirmForCashAppPay) is unchanged.Test plan (not yet executed)
One-time, confirm Cash App Pay flow completes (existing path).On-file, confirm PayKit returns an approved customer request whosegrant.actionisonFilePaymentand that/v3/button/confirmsucceeds.[CAP-AP]logs for both modes.