Skip to content

Commit

Permalink
Prevent panic when sending payment confirm email (#220)
Browse files Browse the repository at this point in the history
Also, only send order confirmation after confirmation, not when creating
the payment.
  • Loading branch information
mrdg committed Dec 9, 2021
1 parent 24ac5e8 commit 2152893
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/payments.go
Expand Up @@ -228,8 +228,6 @@ func (a *API) PaymentCreate(w http.ResponseWriter, r *http.Request) error {
return internalServerError("Saving payment failed").WithInternalError(err)
}

go sendOrderConfirmation(ctx, log, tr)

return sendJSON(w, http.StatusOK, tr)
}

Expand Down Expand Up @@ -271,6 +269,8 @@ func (a *API) PaymentConfirm(w http.ResponseWriter, r *http.Request) error {
return badRequestError("Order does not specify a payment provider")
}

trans.Order = order

provider := gcontext.GetPaymentProviders(ctx)[order.PaymentProcessor]
if provider == nil {
return badRequestError("Payment provider '%s' not configured", order.PaymentProcessor)
Expand Down

0 comments on commit 2152893

Please sign in to comment.