Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit c11f040

Browse files
committed
Restore calculate order total code
1 parent 2579b7c commit c11f040

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/order.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,12 +1098,21 @@ func (n *OpenBazaarNode) CalculateOrderTotal(contract *pb.RicardianContract) (*b
10981098

10991099
for _, item := range v5Order.Items {
11001100
var itemOriginAmt *repo.CurrencyValue
1101+
l, err := ParseContractForListing(item.ListingHash, contract)
1102+
if err != nil {
1103+
return big.NewInt(0), fmt.Errorf("listing not found in contract for item %s", item.ListingHash)
1104+
}
11011105

1102-
nrl, err := GetNormalizedListing(item.ListingHash, contract)
1106+
rl, err := repo.NewListingFromProtobuf(l)
11031107
if err != nil {
11041108
return big.NewInt(0), err
11051109
}
11061110

1111+
nrl, err := rl.Normalize()
1112+
if err != nil {
1113+
return big.NewInt(0), fmt.Errorf("normalize legacy listing: %s", err.Error())
1114+
}
1115+
11071116
// keep track of physical listings for shipping caluclation
11081117
if nrl.GetContractType() == pb.Listing_Metadata_PHYSICAL_GOOD.String() {
11091118
physicalGoods[item.ListingHash] = nrl

0 commit comments

Comments
 (0)