-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Continuous Order Number #46
Comments
Should only be set when the payment goes through |
Allow searching by this order number as well. |
Fixed in #86 |
While going through the code I noticed this can still happen. E.g. when a transaction is failing, the invoice number is increased anyways. invoiceNumber, err := models.NextInvoiceNumber(tx, order.InstanceID)
if err != nil {
tx.Rollback()
return internalServerError("We failed to generate a valid invoice ID, please try again later: %v", err)
}
tr := models.NewTransaction(order)
processorID, err := charge(params.Amount, params.Currency, order, invoiceNumber)
tr.ProcessorID = processorID
tr.InvoiceNumber = invoiceNumber
if err != nil {
tr.FailureCode = strconv.FormatInt(http.StatusInternalServerError, 10)
tr.FailureDescription = err.Error()
tr.Status = models.FailedState
tx.Create(tr)
tx.Commit()
return internalServerError("There was an error charging your card: %v", err).WithInternalError(err)
} The error case should rollback the invoice id. And the transaction should probably not get one if failed. |
Fixed by #182 |
For accounting reasons we need a continuous order number for each sale, that we can use in invoices.
We'll still keep the UUID for each order (since it's useful for linking to the order when handling anonymous orders), but introduce and incrementing field as well.
The text was updated successfully, but these errors were encountered: