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

Commit 8684637

Browse files
committed
Fix patching profie with moderator fee
1 parent 1c9222c commit 8684637

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

core/profile.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ func (n *OpenBazaarNode) PatchProfile(patch map[string]interface{}) error {
195195

196196
repoProfile.NormalizeDataForAllSchemas()
197197

198+
if repoProfile.GetProtobuf().ModeratorInfo != nil && repoProfile.GetProtobuf().ModeratorInfo.Fee != nil {
199+
if repoProfile.GetProtobuf().ModeratorInfo.Fee.FeeType == pb.Moderator_Fee_PERCENTAGE {
200+
repoProfile.GetProtobuf().ModeratorInfo.Fee.FixedFee = nil
201+
}
202+
}
203+
198204
if err := repoProfile.Valid(); err != nil {
199205
return fmt.Errorf("invalid profile: %s", err.Error())
200206
}

repo/listing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,8 @@ func (cs ListingCoupons) GetProtobuf() []*pb.Listing_Coupon {
919919
var cspb = make([]*pb.Listing_Coupon, len(cs))
920920
for i, c := range cs {
921921
cspb[i] = &pb.Listing_Coupon{
922-
Title: c.GetTitle(),
923-
PercentDiscount: c.GetPercentOff(),
922+
Title: c.GetTitle(),
923+
PercentDiscount: c.GetPercentOff(),
924924
}
925925
if c.GetAmountOff() != nil {
926926
cspb[i].BigPriceDiscount = c.GetAmountOff().Amount.String()

0 commit comments

Comments
 (0)