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

Commit 0dfe41a

Browse files
committed
Assume BTC is the currency if a super old order
1 parent 630d7ab commit 0dfe41a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

repo/buyer_order.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package repo
22

33
import (
4+
"math/big"
5+
46
"github.com/OpenBazaar/openbazaar-go/pb"
57
"github.com/golang/protobuf/proto"
6-
"math/big"
78
)
89

910
// ToV5Order scans through the order looking for any deprecated fields and turns them into their v5 counterpart.
@@ -35,6 +36,10 @@ func ToV5Order(order *pb.Order, lookupFunc func(currencyCode string) (CurrencyDe
3536
newOrder.Payment.Amount = 0
3637
}
3738

39+
if order.Payment.AmountCurrency == nil && order.Payment.Coin == "" {
40+
order.Payment.Coin = "BTC"
41+
}
42+
3843
if order.Payment.Coin != "" && order.Payment.AmountCurrency == nil {
3944
def, err := lookupFunc(order.Payment.Coin)
4045
if err != nil {
@@ -46,5 +51,6 @@ func ToV5Order(order *pb.Order, lookupFunc func(currencyCode string) (CurrencyDe
4651
}
4752
newOrder.Payment.Coin = ""
4853
}
54+
4955
return newOrder, nil
5056
}

0 commit comments

Comments
 (0)