Skip to content

Commit

Permalink
fix: payment selection by id
Browse files Browse the repository at this point in the history
Signed-off-by: Lawrence Zawila <113581282+darkmatterpool@users.noreply.github.com>
  • Loading branch information
darkmatterpool authored and flemzord committed Dec 20, 2022
1 parent e70d58b commit 824af11
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/app/storage/payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@ func (s *Storage) ListPayments(ctx context.Context, sort Sorter, pagination Pagi
}

func (s *Storage) GetPayment(ctx context.Context, id string) (*models.Payment, error) {
var payment *models.Payment
var payment models.Payment

err := s.db.NewSelect().Model(payment).
err := s.db.NewSelect().
Model(&payment).
Relation("Connector").
Relation("Metadata").
Relation("Adjustments").
Where("id = ?", id).
Where("payment.id = ?", id).
Scan(ctx)
if err != nil {
return nil, fmt.Errorf("failed to get payment %s: %w", id, err)
}

return payment, nil
return &payment, nil
}

func (s *Storage) UpsertPayments(ctx context.Context, provider models.ConnectorProvider, payments []*models.Payment) error {
Expand Down

0 comments on commit 824af11

Please sign in to comment.