Skip to content

Commit

Permalink
Fix setting paid state on transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
mraerino committed Sep 8, 2019
1 parent c5fa3d5 commit 85c5e87
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api/payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 85c5e87

Please sign in to comment.