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

Commit

Permalink
fix: record internal paymail tx
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalibalashka committed Jul 16, 2023
1 parent 07b6843 commit e37a9f3
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 e37a9f3

Please sign in to comment.