-
Notifications
You must be signed in to change notification settings - Fork 6
/
payment_order_info.go
593 lines (444 loc) · 16.9 KB
/
payment_order_info.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
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
// Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
// Code generated; DO NOT EDIT.
package platformclientmodels
import (
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// PaymentOrderInfo Payment order info
//
// swagger:model Payment order info.
type PaymentOrderInfo struct {
// The time of the order authorised
// Format: date-time
AuthorisedTime *strfmt.DateTime `json:"authorisedTime,omitempty"`
// Payment order channel: EXTERNAL or INTERNAL
// Enum: ['EXTERNAL', 'INTERNAL']
// Required: true
Channel *string `json:"channel"`
// The time of the order chargeback reversed time
// Format: date-time
ChargebackReversedTime *strfmt.DateTime `json:"chargebackReversedTime,omitempty"`
// The time of the order chargeback time
// Format: date-time
ChargebackTime *strfmt.DateTime `json:"chargebackTime,omitempty"`
// The time of the order charged
// Format: date-time
ChargedTime *strfmt.DateTime `json:"chargedTime,omitempty"`
// if charging is true, means user have finished transaction, platform is waiting for payment notification
Charging bool `json:"charging"`
// createdAt
// Required: true
// Format: date-time
CreatedAt strfmt.DateTime `json:"createdAt"`
// The time of the order created
// Format: date-time
CreatedTime *strfmt.DateTime `json:"createdTime,omitempty"`
// Payment order currency info
// Required: true
Currency *CurrencySummary `json:"currency"`
// User custom parameters
CustomParameters interface{} `json:"customParameters,omitempty"`
// Order description
Description string `json:"description,omitempty"`
// External order number
// Required: true
ExtOrderNo *string `json:"extOrderNo"`
// optional, external user id, can be the character id
ExtUserID string `json:"extUserId,omitempty"`
// Order item type
// Enum: ['APP', 'BUNDLE', 'CODE', 'COINS', 'EXTENSION', 'INGAMEITEM', 'LOOTBOX', 'MEDIA', 'OPTIONBOX', 'SEASON', 'SUBSCRIPTION']
ItemType string `json:"itemType,omitempty"`
// Payment user language
Language string `json:"language,omitempty"`
// metadata
Metadata map[string]string `json:"metadata,omitempty"`
// Payment order namespace
// Required: true
Namespace *string `json:"namespace"`
// The notify url if customized
NotifyURL string `json:"notifyUrl,omitempty"`
// TEST PURPOSE, if set it will not send async notification to the API invoker, only can set true while this payment is sandbox
OmitNotification bool `json:"omitNotification"`
// Payment method
PaymentMethod string `json:"paymentMethod,omitempty"`
// Payment method fee
// Format: int32
PaymentMethodFee int32 `json:"paymentMethodFee,omitempty"`
// Payment order number
// Required: true
PaymentOrderNo *string `json:"paymentOrderNo"`
// Payment provider
// Enum: ['ADYEN', 'ALIPAY', 'CHECKOUT', 'NEONPAY', 'PAYPAL', 'STRIPE', 'WALLET', 'WXPAY', 'XSOLLA']
PaymentProvider string `json:"paymentProvider,omitempty"`
// Payment provider fee
// Format: int32
PaymentProviderFee int32 `json:"paymentProviderFee,omitempty"`
// Payment url
PaymentStationURL string `json:"paymentStationUrl,omitempty"`
// Payment order price
// Required: true
// Format: int32
Price *int32 `json:"price"`
// recurring payment order which has recurring token, will do recurring payment if present, otherwise start normal payment flow
RecurringPaymentOrderNo string `json:"recurringPaymentOrderNo,omitempty"`
// The time of the order refunded
// Format: date-time
RefundedTime *strfmt.DateTime `json:"refundedTime,omitempty"`
// Payment user region
Region string `json:"region,omitempty"`
// The return url if customized
ReturnURL string `json:"returnUrl,omitempty"`
// Payment order sales tax
// Format: int32
SalesTax int32 `json:"salesTax,omitempty"`
// isSandbox, indicate if order is sandbox
// Required: true
Sandbox *bool `json:"sandbox"`
// optional, unique identity for the item
Sku string `json:"sku,omitempty"`
// Payment order status
// Enum: ['AUTHORISED', 'AUTHORISE_FAILED', 'CHARGEBACK', 'CHARGEBACK_REVERSED', 'CHARGED', 'CHARGE_FAILED', 'DELETED', 'INIT', 'NOTIFICATION_OF_CHARGEBACK', 'REFUNDED', 'REFUNDING', 'REFUND_FAILED', 'REQUEST_FOR_INFORMATION']
// Required: true
Status *string `json:"status"`
// Payment order status reason
StatusReason string `json:"statusReason,omitempty"`
// subscriptionId, payment token will be saved for recurring payment
SubscriptionID string `json:"subscriptionId,omitempty"`
// subtotal price
// Format: int32
SubtotalPrice int32 `json:"subtotalPrice,omitempty"`
// The game namespace if it's an external in-game-purchase that resides in publisher namespace
TargetNamespace string `json:"targetNamespace,omitempty"`
// The user id in game namespace if it's an external in-game-purchase that resides in publisher namespace
TargetUserID string `json:"targetUserId,omitempty"`
// Payment total tax
// Format: int32
Tax int32 `json:"tax,omitempty"`
// Order title
// Required: true
Title *string `json:"title"`
// total price
// Format: int32
TotalPrice int32 `json:"totalPrice,omitempty"`
// total tax
// Format: int32
TotalTax int32 `json:"totalTax,omitempty"`
// Payment order transactions
Transactions []*Transaction `json:"transactions,omitempty"`
// updatedAt
// Required: true
// Format: date-time
UpdatedAt strfmt.DateTime `json:"updatedAt"`
// User id
// Required: true
UserID *string `json:"userId"`
// Payment order VAT
// Format: int32
Vat int32 `json:"vat,omitempty"`
}
// Validate validates this Payment order info
func (m *PaymentOrderInfo) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateChannel(formats); err != nil {
res = append(res, err)
}
if err := m.validateCreatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateCurrency(formats); err != nil {
res = append(res, err)
}
if err := m.validateExtOrderNo(formats); err != nil {
res = append(res, err)
}
if err := m.validateNamespace(formats); err != nil {
res = append(res, err)
}
if err := m.validatePaymentOrderNo(formats); err != nil {
res = append(res, err)
}
if err := m.validatePrice(formats); err != nil {
res = append(res, err)
}
if err := m.validateSandbox(formats); err != nil {
res = append(res, err)
}
if err := m.validateStatus(formats); err != nil {
res = append(res, err)
}
if err := m.validateTitle(formats); err != nil {
res = append(res, err)
}
if err := m.validateUpdatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateUserID(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
var paymentOrderInfoTypeChannelPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["EXTERNAL", "INTERNAL"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
paymentOrderInfoTypeChannelPropEnum = append(paymentOrderInfoTypeChannelPropEnum, v)
}
}
const (
// PaymentOrderInfoChannelEXTERNAL captures enum value "EXTERNAL"
PaymentOrderInfoChannelEXTERNAL string = "EXTERNAL"
// PaymentOrderInfoChannelINTERNAL captures enum value "INTERNAL"
PaymentOrderInfoChannelINTERNAL string = "INTERNAL"
)
// prop value enum
func (m *PaymentOrderInfo) validateChannelEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, paymentOrderInfoTypeChannelPropEnum, true); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validateChannel(formats strfmt.Registry) error {
if err := validate.Required("channel", "body", m.Channel); err != nil {
return err
}
// value enum
if err := m.validateChannelEnum("channel", "body", *m.Channel); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validateCreatedAt(formats strfmt.Registry) error {
if err := validate.Required("createdAt", "body", strfmt.DateTime(m.CreatedAt)); err != nil {
return err
}
if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validateCurrency(formats strfmt.Registry) error {
if err := validate.Required("currency", "body", m.Currency); err != nil {
return err
}
if m.Currency != nil {
if err := m.Currency.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("currency")
}
return err
}
}
return nil
}
func (m *PaymentOrderInfo) validateExtOrderNo(formats strfmt.Registry) error {
if err := validate.Required("extOrderNo", "body", m.ExtOrderNo); err != nil {
return err
}
return nil
}
var paymentOrderInfoTypeItemTypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["APP", "BUNDLE", "CODE", "COINS", "EXTENSION", "INGAMEITEM", "LOOTBOX", "MEDIA", "OPTIONBOX", "SEASON", "SUBSCRIPTION"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
paymentOrderInfoTypeItemTypePropEnum = append(paymentOrderInfoTypeItemTypePropEnum, v)
}
}
const (
// PaymentOrderInfoItemTypeAPP captures enum value "APP"
PaymentOrderInfoItemTypeAPP string = "APP"
// PaymentOrderInfoItemTypeBUNDLE captures enum value "BUNDLE"
PaymentOrderInfoItemTypeBUNDLE string = "BUNDLE"
// PaymentOrderInfoItemTypeCODE captures enum value "CODE"
PaymentOrderInfoItemTypeCODE string = "CODE"
// PaymentOrderInfoItemTypeCOINS captures enum value "COINS"
PaymentOrderInfoItemTypeCOINS string = "COINS"
// PaymentOrderInfoItemTypeEXTENSION captures enum value "EXTENSION"
PaymentOrderInfoItemTypeEXTENSION string = "EXTENSION"
// PaymentOrderInfoItemTypeINGAMEITEM captures enum value "INGAMEITEM"
PaymentOrderInfoItemTypeINGAMEITEM string = "INGAMEITEM"
// PaymentOrderInfoItemTypeLOOTBOX captures enum value "LOOTBOX"
PaymentOrderInfoItemTypeLOOTBOX string = "LOOTBOX"
// PaymentOrderInfoItemTypeMEDIA captures enum value "MEDIA"
PaymentOrderInfoItemTypeMEDIA string = "MEDIA"
// PaymentOrderInfoItemTypeOPTIONBOX captures enum value "OPTIONBOX"
PaymentOrderInfoItemTypeOPTIONBOX string = "OPTIONBOX"
// PaymentOrderInfoItemTypeSEASON captures enum value "SEASON"
PaymentOrderInfoItemTypeSEASON string = "SEASON"
// PaymentOrderInfoItemTypeSUBSCRIPTION captures enum value "SUBSCRIPTION"
PaymentOrderInfoItemTypeSUBSCRIPTION string = "SUBSCRIPTION"
)
// prop value enum
func (m *PaymentOrderInfo) validateItemTypeEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, paymentOrderInfoTypeItemTypePropEnum, true); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validateNamespace(formats strfmt.Registry) error {
if err := validate.Required("namespace", "body", m.Namespace); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validatePaymentOrderNo(formats strfmt.Registry) error {
if err := validate.Required("paymentOrderNo", "body", m.PaymentOrderNo); err != nil {
return err
}
return nil
}
var paymentOrderInfoTypePaymentProviderPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["ADYEN", "ALIPAY", "CHECKOUT", "NEONPAY", "PAYPAL", "STRIPE", "WALLET", "WXPAY", "XSOLLA"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
paymentOrderInfoTypePaymentProviderPropEnum = append(paymentOrderInfoTypePaymentProviderPropEnum, v)
}
}
const (
// PaymentOrderInfoPaymentProviderADYEN captures enum value "ADYEN"
PaymentOrderInfoPaymentProviderADYEN string = "ADYEN"
// PaymentOrderInfoPaymentProviderALIPAY captures enum value "ALIPAY"
PaymentOrderInfoPaymentProviderALIPAY string = "ALIPAY"
// PaymentOrderInfoPaymentProviderCHECKOUT captures enum value "CHECKOUT"
PaymentOrderInfoPaymentProviderCHECKOUT string = "CHECKOUT"
// PaymentOrderInfoPaymentProviderNEONPAY captures enum value "NEONPAY"
PaymentOrderInfoPaymentProviderNEONPAY string = "NEONPAY"
// PaymentOrderInfoPaymentProviderPAYPAL captures enum value "PAYPAL"
PaymentOrderInfoPaymentProviderPAYPAL string = "PAYPAL"
// PaymentOrderInfoPaymentProviderSTRIPE captures enum value "STRIPE"
PaymentOrderInfoPaymentProviderSTRIPE string = "STRIPE"
// PaymentOrderInfoPaymentProviderWALLET captures enum value "WALLET"
PaymentOrderInfoPaymentProviderWALLET string = "WALLET"
// PaymentOrderInfoPaymentProviderWXPAY captures enum value "WXPAY"
PaymentOrderInfoPaymentProviderWXPAY string = "WXPAY"
// PaymentOrderInfoPaymentProviderXSOLLA captures enum value "XSOLLA"
PaymentOrderInfoPaymentProviderXSOLLA string = "XSOLLA"
)
// prop value enum
func (m *PaymentOrderInfo) validatePaymentProviderEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, paymentOrderInfoTypePaymentProviderPropEnum, true); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validatePrice(formats strfmt.Registry) error {
if err := validate.Required("price", "body", m.Price); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validateSandbox(formats strfmt.Registry) error {
if err := validate.Required("sandbox", "body", m.Sandbox); err != nil {
return err
}
return nil
}
var paymentOrderInfoTypeStatusPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["AUTHORISED", "AUTHORISE_FAILED", "CHARGEBACK", "CHARGEBACK_REVERSED", "CHARGED", "CHARGE_FAILED", "DELETED", "INIT", "NOTIFICATION_OF_CHARGEBACK", "REFUNDED", "REFUNDING", "REFUND_FAILED", "REQUEST_FOR_INFORMATION"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
paymentOrderInfoTypeStatusPropEnum = append(paymentOrderInfoTypeStatusPropEnum, v)
}
}
const (
// PaymentOrderInfoStatusAUTHORISED captures enum value "AUTHORISED"
PaymentOrderInfoStatusAUTHORISED string = "AUTHORISED"
// PaymentOrderInfoStatusAUTHORISEFAILED captures enum value "AUTHORISE_FAILED"
PaymentOrderInfoStatusAUTHORISEFAILED string = "AUTHORISE_FAILED"
// PaymentOrderInfoStatusCHARGEBACK captures enum value "CHARGEBACK"
PaymentOrderInfoStatusCHARGEBACK string = "CHARGEBACK"
// PaymentOrderInfoStatusCHARGEBACKREVERSED captures enum value "CHARGEBACK_REVERSED"
PaymentOrderInfoStatusCHARGEBACKREVERSED string = "CHARGEBACK_REVERSED"
// PaymentOrderInfoStatusCHARGED captures enum value "CHARGED"
PaymentOrderInfoStatusCHARGED string = "CHARGED"
// PaymentOrderInfoStatusCHARGEFAILED captures enum value "CHARGE_FAILED"
PaymentOrderInfoStatusCHARGEFAILED string = "CHARGE_FAILED"
// PaymentOrderInfoStatusDELETED captures enum value "DELETED"
PaymentOrderInfoStatusDELETED string = "DELETED"
// PaymentOrderInfoStatusINIT captures enum value "INIT"
PaymentOrderInfoStatusINIT string = "INIT"
// PaymentOrderInfoStatusNOTIFICATIONOFCHARGEBACK captures enum value "NOTIFICATION_OF_CHARGEBACK"
PaymentOrderInfoStatusNOTIFICATIONOFCHARGEBACK string = "NOTIFICATION_OF_CHARGEBACK"
// PaymentOrderInfoStatusREFUNDED captures enum value "REFUNDED"
PaymentOrderInfoStatusREFUNDED string = "REFUNDED"
// PaymentOrderInfoStatusREFUNDING captures enum value "REFUNDING"
PaymentOrderInfoStatusREFUNDING string = "REFUNDING"
// PaymentOrderInfoStatusREFUNDFAILED captures enum value "REFUND_FAILED"
PaymentOrderInfoStatusREFUNDFAILED string = "REFUND_FAILED"
// PaymentOrderInfoStatusREQUESTFORINFORMATION captures enum value "REQUEST_FOR_INFORMATION"
PaymentOrderInfoStatusREQUESTFORINFORMATION string = "REQUEST_FOR_INFORMATION"
)
// prop value enum
func (m *PaymentOrderInfo) validateStatusEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, paymentOrderInfoTypeStatusPropEnum, true); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validateStatus(formats strfmt.Registry) error {
if err := validate.Required("status", "body", m.Status); err != nil {
return err
}
// value enum
if err := m.validateStatusEnum("status", "body", *m.Status); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validateTitle(formats strfmt.Registry) error {
if err := validate.Required("title", "body", m.Title); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validateUpdatedAt(formats strfmt.Registry) error {
if err := validate.Required("updatedAt", "body", strfmt.DateTime(m.UpdatedAt)); err != nil {
return err
}
if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
return err
}
return nil
}
func (m *PaymentOrderInfo) validateUserID(formats strfmt.Registry) error {
if err := validate.Required("userId", "body", m.UserID); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *PaymentOrderInfo) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PaymentOrderInfo) UnmarshalBinary(b []byte) error {
var res PaymentOrderInfo
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}