generated from NdoleStudio/go-http-client
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathorder.go
66 lines (61 loc) · 2.94 KB
/
order.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package lemonsqueezy
import "time"
// OrderAttributes for an order which is created when a customer purchases a product.
type OrderAttributes struct {
StoreID int `json:"store_id"`
CustomerID int `json:"customer_id"`
Identifier string `json:"identifier"`
OrderNumber int `json:"order_number"`
UserName string `json:"user_name"`
UserEmail string `json:"user_email"`
Currency string `json:"currency"`
CurrencyRate string `json:"currency_rate"`
Subtotal int `json:"subtotal"`
DiscountTotal int `json:"discount_total"`
Tax int `json:"tax"`
Total int `json:"total"`
SubtotalUsd int `json:"subtotal_usd"`
DiscountTotalUsd int `json:"discount_total_usd"`
TaxUsd int `json:"tax_usd"`
TotalUsd int `json:"total_usd"`
TaxName string `json:"tax_name"`
TaxRate any `json:"tax_rate"`
Status string `json:"status"`
StatusFormatted string `json:"status_formatted"`
Refunded bool `json:"refunded"`
RefundedAt *time.Time `json:"refunded_at"`
SubtotalFormatted string `json:"subtotal_formatted"`
DiscountTotalFormatted string `json:"discount_total_formatted"`
TaxFormatted string `json:"tax_formatted"`
TotalFormatted string `json:"total_formatted"`
Urls struct {
Receipt string `json:"receipt"`
} `json:"urls"`
FirstOrderItem struct {
ID int `json:"id"`
OrderID int `json:"order_id"`
ProductID int `json:"product_id"`
VariantID int `json:"variant_id"`
ProductName string `json:"product_name"`
VariantName string `json:"variant_name"`
Price int `json:"price"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
TestMode bool `json:"test_mode"`
} `json:"first_order_item"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// APIResponseRelationshipsOrder relationships of an order
type APIResponseRelationshipsOrder struct {
Store ApiResponseLinks `json:"store"`
Customer ApiResponseLinks `json:"customer"`
OrderItems ApiResponseLinks `json:"order-items"`
Subscriptions ApiResponseLinks `json:"subscriptions"`
LicenseKeys ApiResponseLinks `json:"license-keys"`
DiscountRedemptions ApiResponseLinks `json:"discount-redemptions"`
}
// OrderAPIResponse is the api response for one order
type OrderAPIResponse = ApiResponse[OrderAttributes, APIResponseRelationshipsOrder]
// OrdersAPIResponse is the api response for a list of orders.
type OrdersAPIResponse = ApiResponseList[OrderAttributes, APIResponseRelationshipsOrder]