Skip to content

Commit cde172e

Browse files
committed
Add invoice number to transaction
1 parent 2ca0b10 commit cde172e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

api/payments.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ func (a *API) PaymentCreate(w http.ResponseWriter, r *http.Request) error {
164164
tr := models.NewTransaction(order)
165165
processorID, err := charge(params.Amount, params.Currency)
166166
tr.ProcessorID = processorID
167+
tr.InvoiceNumber = invoiceNumber
167168

168169
if err != nil {
169170
tr.FailureCode = strconv.FormatInt(http.StatusInternalServerError, 10)

models/transaction.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ const RefundTransactionType = "refund"
1515

1616
// Transaction is an transaction with a payment provider
1717
type Transaction struct {
18-
InstanceID string `json:"-"`
19-
ID string `json:"id"`
20-
Order *Order `json:"-"`
21-
OrderID string `json:"order_id"`
18+
InstanceID string `json:"-"`
19+
ID string `json:"id"`
20+
Order *Order `json:"-"`
21+
OrderID string `json:"order_id"`
22+
InvoiceNumber int64 `json:"invoice_number"`
2223

2324
ProcessorID string `json:"processor_id"`
2425

0 commit comments

Comments
 (0)