-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared.go
More file actions
296 lines (254 loc) · 7 KB
/
shared.go
File metadata and controls
296 lines (254 loc) · 7 KB
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
package gopwa
import (
"net/url"
"time"
)
type ResponseMetadata struct {
RequestId string
}
type OrderTotal struct {
CurrencyCode string
Amount string
}
func (o OrderTotal) AddValues(prefix string, v url.Values) url.Values {
if o.Amount != "" {
v.Set(prefix+"Amount", o.Amount)
}
if o.CurrencyCode != "" {
v.Set(prefix+"CurrencyCode", o.CurrencyCode)
}
return v
}
type Price struct {
CurrencyCode string
Amount string
}
func (p Price) AddValues(prefix string, v url.Values) url.Values {
if p.Amount != "" {
v.Set(prefix+"Amount", p.Amount)
}
if p.CurrencyCode != "" {
v.Set(prefix+"CurrencyCode", p.CurrencyCode)
}
return v
}
type SellerOrderAttributes struct {
SellerOrderId string
StoreName string
CustomInformation string
}
func (s SellerOrderAttributes) AddValues(prefix string, v url.Values) url.Values {
if s.SellerOrderId != "" {
v.Set(prefix+"SellerOrderId", s.SellerOrderId)
}
if s.StoreName != "" {
v.Set(prefix+"StoreName", s.StoreName)
}
if s.CustomInformation != "" {
v.Set(prefix+"CustomInformation", s.CustomInformation)
}
return v
}
type Address struct {
Name string
AddressLine1 string
AddressLine2 string
AddressLine3 string
City string
County string
District string
StateOrRegion string
PostalCode string
CountryCode string
Phone string
}
type Buyer struct {
Name string
Email string
Phone string
}
type Destination struct {
DestinationType string
PhysicalDestination Address
}
type Constraint struct {
ConstraintID string
Description string
}
type OrderReferenceStatus struct {
State OrderReferenceState
LastUpdateTimestamp time.Time
ReasonCode string
ReasonDescription string
}
type StatusCommon struct {
LastUpdateTimestamp time.Time
ReasonCode string
ReasonDescription string
}
type CaptureStatus struct {
State CaptureState
StatusCommon
}
type AuthorizationStatus struct {
State AuthorisationState
StatusCommon
}
type RefundStatus struct {
State RefundState
StatusCommon
}
type OrderReferenceAttributes struct {
PlatformId string
SellerNote string
OrderTotal OrderTotal
SellerOrderAttributes SellerOrderAttributes
}
func (o OrderReferenceAttributes) AddValues(prefix string, v url.Values) url.Values {
if o.PlatformId != "" {
v.Set(prefix+"PlatformId", o.PlatformId)
}
if o.SellerNote != "" {
v.Set(prefix+"SellerNote", o.SellerNote)
}
v = o.OrderTotal.AddValues(prefix+"OrderTotal.", v)
return o.SellerOrderAttributes.AddValues(prefix+"SellerOrderAttributes.", v)
}
type OrderReferenceDetails struct {
AmazonOrderReferenceId string
SellerNote string
PlatformId string
ReleaseEnvironment string
OrderLanguage string
CreationTimestamp time.Time
ExpirationTimestamp time.Time
BillingAddress Address
Constraints []Constraint
IdList []string
Buyer Buyer
OrderTotal OrderTotal
Destination Destination
OrderReferenceStatus OrderReferenceStatus
SellerOrderAttributes SellerOrderAttributes
}
type AuthorizationDetails struct {
AmazonAuthorizationId string
AuthorizationBillingAddress Address
AuthorizationReferenceId string
SellerAuthorizationNote string
AuthorizationAmount Price
CapturedAmount Price
AuthorizationFee Price
IdList []string
CreationTimestamp time.Time
ExpirationTimestamp time.Time
AuthorizationStatus AuthorizationStatus
SoftDecline bool
CaptureNow bool
SoftDescriptor string
}
type BillingAgreementAttributes struct {
PlatformId string
SellerNote string
SellerBillingAgreementAttributes SellerBillingAgreementAttributes
}
type SellerBillingAgreementAttributes struct {
SellerBillingAgreementId string
StoreName string
CustomInformation string
}
type BillingAgreementDetails struct {
AmazonBillingAgreementId string
BillingAddress Address
SellerNote string
PlatformId string
ReleaseEnvironment string
Constraints []Constraint
CreationTimestamp time.Time
BillingAgreementConsent bool
Buyer Buyer
Destination Destination
BillingAgreementLimits BillingAgreementLimits
BillingAgreementStatus BillingAgreementStatus
SellerBillingAgreementAttributes SellerBillingAgreementAttributes
}
type BillingAgreementLimits struct {
AmountLimitPerTimePeriod Price
TimePeriodStartDate time.Time
TimePeriodEndDate time.Time
CurrentRemainingBalance Price
}
type BillingAgreementStatus struct {
State BillingAgreementState
LastUpdatedTimestamp time.Time
ReasonCode string
ReasonDescription string
}
type CaptureDetails struct {
AmazonCaptureId string
CaptureReferenceId string
SellerCaptureNote string
CaptureAmount Price
RefundedAmount Price
CaptureFee Price
IdList []string
CreationTimestamp time.Time
CaptureStatus CaptureStatus
SoftDescriptor string
ConvertedAmount Price
ConversionRate string
}
type RefundDetails struct {
AmazonRefundId string
RefundReferenceId string
SellerRefundNote string
RefundType string
RefundAmount Price
FeeRefunded Price
CreationTimestamp time.Time
RefundStatus RefundStatus
SoftDescriptor string
ConvertedAmount Price
ConversionRate string
}
type Message struct {
Locale string
Text string
}
type GetServiceStatusResult struct {
Status string
Timestamp time.Time
MessageId string
Messages []Message
}
type OrderAttributes struct {
OrderTotal OrderTotal
PlatformID string
SellerNote string
SellerOrderAttributes SellerOrderAttributes
PaymentServiceProviderAttributes PaymentServiceProviderAttributes
}
func (o OrderAttributes) AddValues(prefix string, v url.Values) url.Values {
if o.PlatformID != "" {
v.Set(prefix+"PlatformID", o.PlatformID)
}
if o.SellerNote != "" {
v.Set(prefix+"SellerNote", o.SellerNote)
}
v = o.OrderTotal.AddValues(prefix+"OrderTotal.", v)
v = o.SellerOrderAttributes.AddValues(prefix+"SellerOrderAttributes.", v)
return o.PaymentServiceProviderAttributes.AddValues(prefix+"PaymentServiceProviderAttributes.", v)
}
type PaymentServiceProviderAttributes struct {
PaymentServiceProviderId string
PaymentServiceProviderOrderId string
}
func (p PaymentServiceProviderAttributes) AddValues(prefix string, v url.Values) url.Values {
if p.PaymentServiceProviderId != "" {
v.Set(prefix+"PaymentServiceProviderId", p.PaymentServiceProviderId)
}
if p.PaymentServiceProviderOrderId != "" {
v.Set(prefix+"PaymentServiceProviderOrderId", p.PaymentServiceProviderOrderId)
}
return v
}