Make money parameter optional in buyer verification flows#281
Open
realmeylisdev wants to merge 1 commit intosquare:masterfrom
Open
Make money parameter optional in buyer verification flows#281realmeylisdev wants to merge 1 commit intosquare:masterfrom
money parameter optional in buyer verification flows#281realmeylisdev wants to merge 1 commit intosquare:masterfrom
Conversation
The `money` parameter in `startBuyerVerificationFlow` and `startCardEntryFlowWithBuyerVerification` is now optional. When `buyerAction` is "Store" (verifying a saved card on file), the native SDKs on both Android and iOS ignore the money value entirely, so requiring callers to construct a dummy Money object was unnecessary. Changes across all three layers: - Dart: `required Money money` → `Money? money` with a debug assert that money is provided when buyerAction is "Charge" - Android: null-guard moneyMap before calling getMoney() - iOS: nil-guard moneyMap before calling _getMoney: - Docs: updated reference.md parameter tables This is a non-breaking change — existing callers passing money continue to work unchanged. Fixes square#258
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
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.
Summary
Fixes #258
The
moneyparameter instartBuyerVerificationFlowandstartCardEntryFlowWithBuyerVerificationis now optional (Money?). WhenbuyerActionis"Store"(verifying a saved card on file rather than a charge), the native SDKs on both Android and iOS discard the money value entirely — requiring callers to construct a dummyMoneyobject was unnecessary and non-intuitive.Problem
Both native SDKs model
BuyerActionas a discriminated union:BuyerAction.Store()vsBuyerAction.Charge(money)[SQIPBuyerAction storeAction]vs[SQIPBuyerAction chargeActionWithMoney:money]The Flutter plugin flattened this into
String buyerAction+required Money money, losing the parameter-action relationship. This forced callers using the"Store"action to pass a meaningless dummy:Reproducing steps
startBuyerVerificationFlowwithbuyerAction: "Store"and omitmoneymoneyis requiredChanges
lib/in_app_payments.dartrequired Money money→Money? money; added debugassertthat money is non-null for"Charge"; money serialized conditionallyCardEntryModule.javamoneyMapbeforegetMoney()in both methodsFSQIPCardEntry.mmoneyMapbefore_getMoney:in both methodsdoc/reference.mdAfter this fix
Backwards compatibility
This is a non-breaking change. Existing callers passing
moneycontinue to compile and work unchanged.Test plan
startBuyerVerificationFlowwithbuyerAction: "Store"and nomoney— should succeed on both Android and iOSstartBuyerVerificationFlowwithbuyerAction: "Charge"and validmoney— should succeed as beforestartBuyerVerificationFlowwithbuyerAction: "Charge"and nomoneyin debug mode — should hit assertstartCardEntryFlowWithBuyerVerification