-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: remove tax fields from cart queries unless its prepare for completion #280
base: main
Are you sure you want to change the base?
fix: remove tax fields from cart queries unless its prepare for completion #280
Conversation
Samples/MobileBuyIntegration/MobileBuyIntegration/CartManager.swift
Outdated
Show resolved
Hide resolved
ab14282
to
332608a
Compare
|
||
do { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this ensures prepare is called even if updating the shipping options fails, which happens regularly at the moment due to a 500 server error atm
let shippingContact = payment.shippingContact, | ||
payment.shippingContact?.postalAddress?.isoCountryCode == "US" | ||
let shippingContact = payment.shippingContact | ||
// payment.shippingContact?.postalAddress?.isoCountryCode == "US" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disabled this us country code restriction that only applies to tiagos store, will remove this going forwards i think
* update the buyerIdentity with the shippingContact.email | ||
*/ | ||
guard | ||
let emailAddress = shippingContact.emailAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
email guard moved in to vaulted state check as we require it via apple payment so its guaranteed to be set outside of this flow
@@ -345,7 +351,7 @@ class CartManager: ObservableObject { | |||
|
|||
let mutation = Storefront.buildMutation(inContext: CartManager.ContextDirective) { | |||
$0.cartPaymentUpdate(cartId: cartId, payment: paymentInput) { | |||
$0.cart { $0.cartManagerFragment() } | |||
$0.cart { $0.cartPrepareForCompletionFragment() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change adds tax pulling for the payment update which is still not deprecated
I've just pushed some changes whilst debugging issues with american addresses, so converted back to draft. |
What changes are you making?
There is a graphql schema issue (currently being tracked elsewhere, issue # TBT) where the total tax amount has been marked as deprecated on cart, but this should only be true for non cartCompletion requests
This PR adds an additional fragment specifically for cart completion that accesses this, and separates it from the original cart object for the sake of clarity (and safety, as the Buy sdk will throw if it you access a property that wasn't queried)
How to test
Open apple pay and ensure the requests that happen on open (
cartBuyerIdentityUpdate
,cartSelectedDeliveryOptionsUpdate
) do not request the totalTax amount, but thecartPrepareForCompletion
after each doesBefore you merge
Important
Checklist for releasing a new version
podspec
file.Tip
See the Contributing documentation for instructions on how to publish a new version of the library.