From 46f3f7596985dda00f45b0e309fb51b278e16287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Lewandowski?= Date: Fri, 20 Oct 2023 08:59:45 +0200 Subject: [PATCH] chore(BUX-297): log progres of finalizeP2PTransaction --- paymail.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/paymail.go b/paymail.go index 6f0ebda0..078ca631 100644 --- a/paymail.go +++ b/paymail.go @@ -156,6 +156,10 @@ func startP2PTransaction(client paymail.ClientInterface, // finalizeP2PTransaction will notify the paymail provider about the transaction func finalizeP2PTransaction(ctx context.Context, client paymail.ClientInterface, p4 *PaymailP4, transaction *Transaction) (*paymail.P2PTransactionPayload, error) { + if transaction.client != nil { + transaction.client.Logger().Info(ctx, fmt.Sprintf("finalizeP2PTransaction(): start %s for TxID: %s", p4.Format, transaction.ID)) + } + p2pTransaction, err := buildP2pTx(ctx, p4, transaction) if err != nil { return nil, err @@ -163,9 +167,15 @@ func finalizeP2PTransaction(ctx context.Context, client paymail.ClientInterface, response, err := client.SendP2PTransaction(p4.ReceiveEndpoint, p4.Alias, p4.Domain, p2pTransaction) if err != nil { + if transaction.client != nil { + transaction.client.Logger().Info(ctx, fmt.Sprintf("finalizeP2PTransaction(): error %s for TxID: %s, reason: %s", p4.Format, transaction.ID, err.Error())) + } return nil, err } + if transaction.client != nil { + transaction.client.Logger().Info(ctx, fmt.Sprintf("finalizeP2PTransaction(): successfully finished %s for TxID: %s", p4.Format, transaction.ID)) + } return &response.P2PTransactionPayload, nil }