update
This commit is contained in:
@@ -311,8 +311,8 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
|
|||||||
if msg.Tax > 0 {
|
if msg.Tax > 0 {
|
||||||
tax = int(msg.Tax)
|
tax = int(msg.Tax)
|
||||||
}
|
}
|
||||||
total := int(msg.Price) * int(msg.Quantity)
|
|
||||||
taxAmount := GetTaxAmount(total, tax)
|
taxAmount := GetTaxAmount(int(msg.Price), tax)
|
||||||
|
|
||||||
c.Items = append(c.Items, &CartItem{
|
c.Items = append(c.Items, &CartItem{
|
||||||
Id: c.lastItemId,
|
Id: c.lastItemId,
|
||||||
@@ -466,13 +466,13 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
orderLines := make([]*Line, 0, len(c.Items))
|
orderLines := make([]*Line, 0, len(c.Items))
|
||||||
totalTax := 0
|
|
||||||
c.PaymentInProgress = true
|
c.PaymentInProgress = true
|
||||||
c.Processing = true
|
c.Processing = true
|
||||||
for _, item := range c.Items {
|
for _, item := range c.Items {
|
||||||
total := int(item.Price) * item.Quantity
|
total := int(item.Price) * item.Quantity
|
||||||
taxAmount := GetTaxAmount(total, item.Tax)
|
taxAmount := int(item.Tax) * item.Quantity
|
||||||
totalTax += taxAmount
|
|
||||||
orderLines = append(orderLines, &Line{
|
orderLines = append(orderLines, &Line{
|
||||||
Type: "physical",
|
Type: "physical",
|
||||||
Reference: item.Sku,
|
Reference: item.Sku,
|
||||||
@@ -491,7 +491,7 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
|
|||||||
PurchaseCurrency: "SEK",
|
PurchaseCurrency: "SEK",
|
||||||
Locale: "sv-se",
|
Locale: "sv-se",
|
||||||
OrderAmount: int(c.TotalPrice),
|
OrderAmount: int(c.TotalPrice),
|
||||||
OrderTaxAmount: totalTax,
|
OrderTaxAmount: int(c.TotalTax),
|
||||||
OrderLines: orderLines,
|
OrderLines: orderLines,
|
||||||
MerchantReference1: c.Id.String(),
|
MerchantReference1: c.Id.String(),
|
||||||
MerchantURLS: &CheckoutMerchantURLS{
|
MerchantURLS: &CheckoutMerchantURLS{
|
||||||
|
|||||||
Reference in New Issue
Block a user