more
This commit is contained in:
@@ -101,6 +101,7 @@ type CheckoutGrain struct {
|
|||||||
OrderId *string `json:"orderId"`
|
OrderId *string `json:"orderId"`
|
||||||
Deliveries []*CheckoutDelivery `json:"deliveries,omitempty"`
|
Deliveries []*CheckoutDelivery `json:"deliveries,omitempty"`
|
||||||
PaymentInProgress uint16 `json:"paymentInProgress"`
|
PaymentInProgress uint16 `json:"paymentInProgress"`
|
||||||
|
AmountInCentsRemaining int64 `json:"amountRemaining"`
|
||||||
InventoryReserved bool `json:"inventoryReserved"`
|
InventoryReserved bool `json:"inventoryReserved"`
|
||||||
Confirmation *ConfirmationStatus `json:"confirmationViewed,omitempty"`
|
Confirmation *ConfirmationStatus `json:"confirmationViewed,omitempty"`
|
||||||
Payments []*Payment `json:"payments,omitempty"`
|
Payments []*Payment `json:"payments,omitempty"`
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ func HandleInitializeCheckout(g *CheckoutGrain, m *messages.InitializeCheckout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g.CartTotalPrice = g.CartState.TotalPrice
|
g.CartTotalPrice = g.CartState.TotalPrice
|
||||||
|
g.AmountInCentsRemaining = g.CartTotalPrice.IncVat
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ func HandlePaymentCompleted(g *CheckoutGrain, m *messages.PaymentCompleted) erro
|
|||||||
|
|
||||||
// Update checkout status
|
// Update checkout status
|
||||||
g.PaymentInProgress--
|
g.PaymentInProgress--
|
||||||
|
sum := g.CartState.TotalPrice.IncVat
|
||||||
|
|
||||||
|
for _, payment := range g.SettledPayments() {
|
||||||
|
sum -= payment.Amount
|
||||||
|
}
|
||||||
|
g.AmountInCentsRemaining = sum
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user