Skip to content

Commit

Permalink
Fix bug in transaction listing for admins (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
mraerino authored Sep 10, 2019
1 parent fe0f2d7 commit ac25dbd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api/payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit ac25dbd

Please sign in to comment.