feat: notify supplier and client after payment is done
This commit is contained in:
@@ -102,18 +102,22 @@ func (s *RestServer) onNotification(ctx context.Context, notifChan chan domain.N
|
||||
|
||||
order.Block = notif.BlockHash
|
||||
order.Tx = notif.Tx
|
||||
|
||||
if err := s.orderSrv.OrderCompleted(ctx, order); err != nil {
|
||||
order, err = s.orderSrv.OrderCompleted(ctx, order)
|
||||
if err != nil {
|
||||
log.Println("OrderCompleted:", err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Send email to client and provider
|
||||
if err := s.mailSrv.SendProviderConfirm(mail.SendOK{
|
||||
TxID: order.Tx,
|
||||
BlockHash: order.Block,
|
||||
DocHash: "",
|
||||
To: "doc.Email",
|
||||
Tx: order.Tx,
|
||||
Block: order.Block,
|
||||
Amount: order.Amount,
|
||||
ExplorerUrl: s.btcService.Explorer(order.Tx),
|
||||
CustomerID: order.ClientID,
|
||||
OrderID: order.OrderID,
|
||||
Timestamp: order.PaidAt,
|
||||
To: order.Email,
|
||||
}); err != nil {
|
||||
log.Println("error while send confirm email:", err)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user