-
Notifications
You must be signed in to change notification settings - Fork 1
/
models_v2.go
185 lines (157 loc) · 6.69 KB
/
models_v2.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
package cloudloyalty_client
import (
"time"
"github.com/shopspring/decimal"
)
type V2CalculatePurchaseRequest struct {
OrderID string `json:"orderId,omitempty"`
CalculationQuery CalculationQuery `json:"calculationQuery"`
}
type SetPurchaseRequest struct {
TxID string `json:"txid"`
CalculationQuery CalculationQuery `json:"calculationQuery"`
}
type ConfirmTicketRequest struct {
TxID string `json:"txid"`
SessionNum *string `json:"sessionNum,omitempty"`
ReceiptNum *string `json:"receiptNum,omitempty"`
Ticket string `json:"ticket"`
}
type ConfirmTicketReply struct {
ClientBonuses *ClientBonusesReply `json:"-"`
}
type DiscardTicketRequest struct {
TxID string `json:"txid"`
Ticket string `json:"ticket"`
}
type DiscardTicketReply struct {
}
type CalculationQuery struct {
Client *ClientQuery `json:"client,omitempty"`
Shop ShopQuery `json:"shop"`
Cashier *CashierQuery `json:"cashier,omitempty"`
ExecutedAt *ValidRangeTime `json:"executedAt,omitempty"`
OrderID string `json:"orderId,omitempty"` // deprecated
Rows []CalculationQueryRow `json:"rows"`
ApplyBonuses *IntOrAuto `json:"applyBonuses,omitempty"`
CollectBonuses *IntOrAuto `json:"collectBonuses,omitempty"`
ApplyFactor *decimal.Decimal `json:"applyFactor,omitempty"`
CollectFactor *decimal.Decimal `json:"collectFactor,omitempty"`
Promocode string `json:"promocode,omitempty"`
DiscountRoundStep *float64 `json:"discountRoundStep,omitempty"`
ExtraFields ExtraFields `json:"extraFields,omitempty"`
}
type CalculationQueryRow struct {
ID *string `json:"id,omitempty"`
Product CalculationQueryRowProduct `json:"product"`
Qty float64 `json:"qty"`
AutoDiscount decimal.Decimal `json:"autoDiscount,omitempty"`
ManualDiscount decimal.Decimal `json:"manualDiscount,omitempty"`
NoApplyBonuses bool `json:"noApplyBonuses,omitempty"`
NoCollectBonuses bool `json:"noCollectBonuses,omitempty"`
NoPromocode bool `json:"noPromocode,omitempty"`
NoOffer bool `json:"noOffer,omitempty"`
MaxDiscount *decimal.Decimal `json:"maxDiscount,omitempty"`
DiscountRoundStep *float64 `json:"discountRoundStep,omitempty"`
}
type CalculationQueryRowProduct struct {
ExternalID string `json:"externalId,omitempty"`
SKU string `json:"sku"`
Title string `json:"title"`
Category string `json:"category,omitempty"`
CategoryExternalID string `json:"categoryExternalId,omitempty"`
BuyingPrice *decimal.Decimal `json:"buyingPrice,omitempty"`
BlackPrice decimal.Decimal `json:"blackPrice"`
RedPrice *decimal.Decimal `json:"redPrice,omitempty"`
MinPrice decimal.Decimal `json:"minPrice,omitempty"`
VatPercent Int `json:"vatPercent,omitempty"`
}
type V2CalculatePurchaseReply struct {
CalculationResult CalculationResult `json:"calculationResult"`
}
type SetPurchaseReply struct {
ClientBonuses *ClientBonusesReply `json:"clientBonuses,omitempty"`
CalculationResult CalculationResult `json:"calculationResult"`
Ticket string `json:"ticket"`
ReceiptInfo []ReceiptInfoLine `json:"receiptInfo,omitempty"`
}
type CalculationResult struct {
Rows []CalculationResultRow `json:"rows"`
Summary CalculationResultSummary `json:"summary"`
Bonuses *CalculationResultBonuses `json:"bonuses,omitempty"`
Promocode *CalculationResultPromocode `json:"promocode,omitempty"`
GiftCard *CalculationResultPromocode `json:"giftCard,omitempty"`
}
type CalculationResultRow struct {
ID *string `json:"id,omitempty"`
TotalDiscount decimal.Decimal `json:"totalDiscount"`
Discounts CalculationResultDiscounts `json:"discounts"`
Bonuses *CalculationResultRowBonuses `json:"bonuses,omitempty"`
Offers []CalculationResultRowOffer `json:"offers,omitempty"`
}
type CalculationResultDiscounts struct {
Auto decimal.Decimal `json:"auto"`
Manual decimal.Decimal `json:"manual"`
Bonuses decimal.Decimal `json:"bonuses"`
Promocode decimal.Decimal `json:"promocode"`
Offer decimal.Decimal `json:"offer"`
Rounding decimal.Decimal `json:"rounding"`
}
type CalculationResultRowBonuses struct {
Applied int `json:"applied"`
Collected int `json:"collected"`
}
type CalculationResultRowOffer struct {
ID int `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Bonuses int `json:"bonuses,omitempty"`
AvailableAt *time.Time `json:"availableAt,omitempty"`
ExpireAt *time.Time `json:"expireAt,omitempty"`
Amount decimal.Decimal `json:"amount,omitempty"`
}
type CalculationResultSummary struct {
TotalDiscount decimal.Decimal `json:"totalDiscount"`
Discounts CalculationResultDiscounts `json:"discounts"`
}
type CalculationResultBonuses struct {
Applied int `json:"applied"`
Collected int `json:"collected"`
MaxToApply int `json:"maxToApply"`
Error *CalculationResultError `json:"error,omitempty"`
}
type CalculationResultPromocode struct {
Applied bool `json:"applied"`
Error *CalculationResultError `json:"error,omitempty"`
}
type CalculationResultError struct {
Code int `json:"code"`
Description string `json:"description"`
Hint string `json:"hint,omitempty"`
}
type ReceiptInfoLine struct {
Type string `json:"type"`
Text *ReceiptInfoLineText `json:"text,omitempty"`
Table *ReceiptInfoLineTable `json:"table,omitempty"`
Barcode *ReceiptInfoLineBarcode `json:"barcode,omitempty"`
}
type ReceiptInfoLineText struct {
Align string `json:"align,omitempty"`
Value string `json:"value"`
}
type ReceiptInfoLineTable struct {
Left string `json:"left"`
Right string `json:"right"`
}
type ReceiptInfoLineBarcode struct {
Type string `json:"type"`
Data string `json:"data"`
}
type V2SetOrderRequest struct {
OrderID string `json:"orderId"`
CalculationQuery CalculationQuery `json:"calculationQuery"`
}
type V2SetOrderReply struct {
ClientBonuses *ClientBonusesReply `json:"clientBonuses,omitempty"`
CalculationResult CalculationResult `json:"calculationResult"`
}