@@ -169,6 +169,7 @@ func (n *OpenBazaarNode) Purchase(data *repo.PurchaseData) (orderID string, paym
169
169
Code : defn .Code .String (),
170
170
Divisibility : uint32 (defn .Divisibility ),
171
171
}
172
+ payment .Coin = defn .Code .String ()
172
173
173
174
// Calculate payment amount
174
175
total , err := n .CalculateOrderTotal (contract )
@@ -181,6 +182,7 @@ func (n *OpenBazaarNode) Purchase(data *repo.PurchaseData) (orderID string, paym
181
182
}
182
183
183
184
payment .BigAmount = total .String ()
185
+ payment .Amount = total .Uint64 ()
184
186
185
187
contract , err = n .SignOrder (contract )
186
188
if err != nil {
@@ -238,11 +240,13 @@ func prepareModeratedOrderContract(data *repo.PurchaseData, n *OpenBazaarNode, c
238
240
Code : defn .Code .String (),
239
241
Divisibility : uint32 (defn .Divisibility ),
240
242
}
243
+ payment .Coin = defn .Code .String ()
241
244
total , err := n .CalculateOrderTotal (contract )
242
245
if err != nil {
243
246
return nil , err
244
247
}
245
248
payment .BigAmount = total .String ()
249
+ payment .Amount = total .Uint64 ()
246
250
contract .BuyerOrder .Payment = payment
247
251
248
252
fpb := wal .GetFeePerByte (wallet .NORMAL )
@@ -708,7 +712,6 @@ func getListing(n *OpenBazaarNode, contract *pb.RicardianContract, item repo.Ite
708
712
if err := sl .GetListing ().GetVendorID ().Valid (); err != nil {
709
713
return nil , fmt .Errorf ("invalid vendor info: %s" , err .Error ())
710
714
}
711
-
712
715
if err := sl .ValidateListing (n .TestNetworkEnabled () || n .RegressionNetworkEnabled ()); err != nil {
713
716
return nil , fmt .Errorf ("validating listing (%s): %s" , sl .GetSlug (), err .Error ())
714
717
}
@@ -982,7 +985,7 @@ func (n *OpenBazaarNode) CalculateOrderTotal(contract *pb.RicardianContract) (*b
982
985
}
983
986
for _ , vendorCoupon := range nrl .GetProtobuf ().Coupons {
984
987
if id .B58String () == vendorCoupon .GetHash () {
985
- if disc , ok := new (big.Int ).SetString (vendorCoupon .BigPriceDiscount , 10 ); ok && disc .Cmp (big .NewInt (0 )) > 0 {
988
+ if disc , ok := new (big.Int ).SetString (vendorCoupon .GetBigPriceDiscount () , 10 ); ok && disc .Cmp (big .NewInt (0 )) > 0 {
986
989
// apply fixed discount
987
990
itemOriginAmt = itemOriginAmt .SubBigInt (disc )
988
991
} else if discountF := vendorCoupon .GetPercentDiscount (); discountF > 0 {
0 commit comments