From ac25dbde857721c083eb7b42806a59a77af6d310 Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Tue, 10 Sep 2019 18:13:23 +0200 Subject: [PATCH] Fix bug in transaction listing for admins (#187) --- api/payments.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/payments.go b/api/payments.go index 3045fa8..77548c3 100644 --- a/api/payments.go +++ b/api/payments.go @@ -513,8 +513,13 @@ func queryForOrder(db *gorm.DB, orderID string, log logrus.FieldLogger) (*models } func queryForTransactions(db *gorm.DB, log logrus.FieldLogger, clause, id string) ([]models.Transaction, *HTTPError) { + params := []interface{}{} + if clause != "" { + params = []interface{}{clause, id} + } + trans := []models.Transaction{} - if rsp := db.Find(&trans, clause, id); rsp.Error != nil { + if rsp := db.Find(&trans, params...); rsp.Error != nil { if rsp.RecordNotFound() { return nil, notFoundError("Transactions not found") }