From 85c5e8769a267eddeca51db337d9a1eed2abad36 Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Sun, 8 Sep 2019 13:00:58 +0200 Subject: [PATCH] Fix setting paid state on transaction --- api/payments.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/payments.go b/api/payments.go index 8055025..0e8e307 100644 --- a/api/payments.go +++ b/api/payments.go @@ -86,7 +86,11 @@ func paymentComplete(r *http.Request, tx *gorm.DB, tr *models.Transaction, order config := gcontext.GetConfig(ctx) tr.Status = models.PaidState - tx.Create(tr) + if tx.NewRecord(tr) { + tx.Create(tr) + } else { + tx.Save(tr) + } order.PaymentState = models.PaidState tx.Save(order)