all the refactor
This commit is contained in:
+22
-17
@@ -9,6 +9,8 @@ import (
|
||||
"encoding/json"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.k6n.net/mats/platform/money"
|
||||
)
|
||||
|
||||
// Status is the order lifecycle state.
|
||||
@@ -57,21 +59,24 @@ type Line struct {
|
||||
Sku string `json:"sku"`
|
||||
Name string `json:"name"`
|
||||
Quantity int `json:"quantity"`
|
||||
UnitPrice int64 `json:"unitPrice"`
|
||||
TaxRate int `json:"taxRate"`
|
||||
TotalAmount int64 `json:"totalAmount"`
|
||||
TotalTax int64 `json:"totalTax"`
|
||||
UnitPrice money.Cents `json:"unitPrice"`
|
||||
TaxRate int `json:"taxRate"`
|
||||
TotalAmount money.Cents `json:"totalAmount"`
|
||||
TotalTax money.Cents `json:"totalTax"`
|
||||
// Location is the inventory location / store id to commit against (empty =
|
||||
// order country). Carried through to the order.created event for commit.
|
||||
Location string `json:"location,omitempty"`
|
||||
// Fulfilled tracks how many units of this line have shipped.
|
||||
Fulfilled int `json:"fulfilled"`
|
||||
}
|
||||
|
||||
// Payment records one authorization/capture against a provider.
|
||||
type Payment struct {
|
||||
Provider string `json:"provider"`
|
||||
Authorized int64 `json:"authorized"`
|
||||
Captured int64 `json:"captured"`
|
||||
Refunded int64 `json:"refunded"`
|
||||
AuthRef string `json:"authRef,omitempty"`
|
||||
Provider string `json:"provider"`
|
||||
Authorized money.Cents `json:"authorized"`
|
||||
Captured money.Cents `json:"captured"`
|
||||
Refunded money.Cents `json:"refunded"`
|
||||
AuthRef string `json:"authRef,omitempty"`
|
||||
CaptureRef string `json:"captureRef,omitempty"`
|
||||
AuthorizedAt string `json:"authorizedAt,omitempty"`
|
||||
CapturedAt string `json:"capturedAt,omitempty"`
|
||||
@@ -113,9 +118,9 @@ type Exchange struct {
|
||||
|
||||
// Refund records a refund issued against the order.
|
||||
type Refund struct {
|
||||
Provider string `json:"provider"`
|
||||
Amount int64 `json:"amount"`
|
||||
Reference string `json:"reference,omitempty"`
|
||||
Provider string `json:"provider"`
|
||||
Amount money.Cents `json:"amount"`
|
||||
Reference string `json:"reference,omitempty"`
|
||||
ReturnID string `json:"returnId,omitempty"`
|
||||
IssuedAt string `json:"issuedAt,omitempty"`
|
||||
}
|
||||
@@ -135,9 +140,9 @@ type OrderGrain struct {
|
||||
Locale string `json:"locale,omitempty"`
|
||||
Country string `json:"country,omitempty"`
|
||||
|
||||
TotalAmount int64 `json:"totalAmount"`
|
||||
TotalTax int64 `json:"totalTax"`
|
||||
Lines []Line `json:"lines,omitempty"`
|
||||
TotalAmount money.Cents `json:"totalAmount"`
|
||||
TotalTax money.Cents `json:"totalTax"`
|
||||
Lines []Line `json:"lines,omitempty"`
|
||||
|
||||
CustomerEmail string `json:"customerEmail,omitempty"`
|
||||
CustomerName string `json:"customerName,omitempty"`
|
||||
@@ -151,8 +156,8 @@ type OrderGrain struct {
|
||||
Refunds []Refund `json:"refunds,omitempty"`
|
||||
|
||||
|
||||
CapturedAmount int64 `json:"capturedAmount"`
|
||||
RefundedAmount int64 `json:"refundedAmount"`
|
||||
CapturedAmount money.Cents `json:"capturedAmount"`
|
||||
RefundedAmount money.Cents `json:"refundedAmount"`
|
||||
|
||||
PlacedAt string `json:"placedAt,omitempty"`
|
||||
UpdatedAt string `json:"updatedAt,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user