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

Commit

Permalink
Merge pull request #336 from vitalibalashka/fix/record-internal-payma…
Browse files Browse the repository at this point in the history
…il-tx

fix(BUX-136): internal paymail transaction bug
  • Loading branch information
mergify[bot] authored Jul 17, 2023
2 parents 860c994 + e37a9f3 commit 9145d88
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion paymail_service_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,14 @@ func (p *PaymailDefaultServiceProvider) RecordTransaction(ctx context.Context,
metadata[p2pMetadataField] = p2pTx.MetaData
metadata[ReferenceIDField] = p2pTx.Reference

var draftID string
if tx, _ := p.client.GetTransactionByHex(ctx, p2pTx.Hex); tx != nil {
draftID = tx.DraftID
}

// Record the transaction
transaction, err := p.client.RecordTransaction(
ctx, "", p2pTx.Hex, "", []ModelOps{WithMetadatas(metadata)}...,
ctx, "", p2pTx.Hex, draftID, []ModelOps{WithMetadatas(metadata)}...,
)
// do not return an error if we already have the transaction
if err != nil && !errors.Is(err, datastore.ErrDuplicateKey) {
Expand Down

0 comments on commit 9145d88

Please sign in to comment.