File tree 1 file changed +8
-5
lines changed
Samples/MobileBuyIntegration/MobileBuyIntegration
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class CartManager: ObservableObject {
44
44
* Represents the `cart.totalTaxAmount.amount`
45
45
* Due to BuySDK throwing if you access a property that hasn't been requested
46
46
* this is separated off from the cart due to this behaviour, as the `totalTaxAmount` is
47
- * deprecated from cart operations except prepareForCompletion
47
+ * deprecated from cart operations except prepareForCompletion
48
48
*/
49
49
@Published var tax : Decimal ?
50
50
@Published var isDirty : Bool = false
@@ -418,20 +418,23 @@ class CartManager: ObservableObject {
418
418
419
419
guard
420
420
let result = payload. result as? Storefront . CartStatusReady ,
421
- let cartResult = result. cart
421
+ let cart = result. cart
422
422
else {
423
423
throw Errors . invariant (
424
424
message: " CartPrepareForCompletionResult is not CartStatusReady " )
425
425
}
426
426
427
427
DispatchQueue . main. async {
428
- self . cart = cartResult
429
- if let tax = cartResult. cost. totalTaxAmount? . amount {
428
+ self . cart = cart
429
+ /**
430
+ * Note - `totalTaxAmount` will not be available on self.cart, only access local value
431
+ */
432
+ if let tax = cart. cost. totalTaxAmount? . amount {
430
433
self . tax = tax
431
434
}
432
435
}
433
436
434
- return cartResult
437
+ return cart
435
438
} catch {
436
439
throw Errors . apiErrors ( requestName: " cartSubmitForCompletion " , message: " \( error) " )
437
440
}
You can’t perform that action at this time.
0 commit comments