Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
chore(BUX-297): log progres of finalizeP2PTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
pawellewandowski98 committed Oct 20, 2023
1 parent 997509c commit 4902c97
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions paymail.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,26 @@ 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
}

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
}

Expand Down

0 comments on commit 4902c97

Please sign in to comment.