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

Commit 2067e23

Browse files
committed
Set payment notification fundingTotal to CurrencyValue
1 parent 296c3a6 commit 2067e23

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

repo/notification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ type PaymentNotification struct {
436436
ID string `json:"notificationId"`
437437
Type NotificationType `json:"type"`
438438
OrderId string `json:"orderId"`
439-
FundingTotal string `json:"fundingTotal"`
439+
FundingTotal *CurrencyValue `json:"fundingTotal"`
440440
CoinType string `json:"coinType"`
441441
}
442442

wallet/listeners/transaction_listener.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,21 @@ func (l *TransactionListener) processPurchasePayment(txid string, output wallet.
351351
}
352352
}
353353
}
354+
def, err := repo.AllCurrencies().Lookup(contract.BuyerOrder.Payment.AmountCurrency.Code)
355+
if err != nil {
356+
log.Errorf("Error looking up currency: %s", err)
357+
return
358+
}
359+
cv, err := repo.NewCurrencyValue(funding.String(), def)
360+
if err != nil {
361+
log.Errorf("Error creating currency value: %s", err)
362+
return
363+
}
354364
n := repo.PaymentNotification{
355365
ID: repo.NewNotificationID(),
356366
Type: "payment",
357367
OrderId: orderId,
358-
FundingTotal: funding.String(),
368+
FundingTotal: cv,
359369
CoinType: contract.BuyerOrder.Payment.AmountCurrency.Code,
360370
}
361371
l.broadcast <- n

0 commit comments

Comments
 (0)