-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmodel_checkout.go
557 lines (466 loc) · 15.9 KB
/
model_checkout.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
/*
Conekta API
Conekta sdk
API version: 2.1.0
Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package conekta
import (
"encoding/json"
"fmt"
)
// checks if the Checkout type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Checkout{}
// Checkout It is a sub-resource of the Order model that can be stipulated in order to configure its corresponding checkout
type Checkout struct {
// Those are the payment methods that will be available for the link
AllowedPaymentMethods []string `json:"allowed_payment_methods"`
// It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 2 to 365 days (the valid range will be taken from the next day of the creation date at 00:01 hrs)
ExpiresAt int64 `json:"expires_at"`
// This flag allows you to specify if months without interest will be active.
MonthlyInstallmentsEnabled *bool `json:"monthly_installments_enabled,omitempty"`
// This field allows you to specify the number of months without interest.
MonthlyInstallmentsOptions []int32 `json:"monthly_installments_options,omitempty"`
// Indicates the 3DS2 mode for the order, either smart or strict.
ThreeDsMode *string `json:"three_ds_mode,omitempty"`
// Reason for charge
Name string `json:"name"`
// This flag allows you to fill in the shipping information at checkout.
NeedsShippingContact *bool `json:"needs_shipping_contact,omitempty"`
// This flag allows you to specify if the link will be on demand.
OnDemandEnabled NullableBool `json:"on_demand_enabled,omitempty"`
OrderTemplate CheckoutOrderTemplate `json:"order_template"`
// It is the number of payments that can be made through the link.
PaymentsLimitCount *int32 `json:"payments_limit_count,omitempty"`
// false: single use. true: multiple payments
Recurrent bool `json:"recurrent"`
// It is the type of link that will be created. It must be a valid type.
Type string `json:"type"`
AdditionalProperties map[string]interface{}
}
type _Checkout Checkout
// NewCheckout instantiates a new Checkout object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewCheckout(allowedPaymentMethods []string, expiresAt int64, name string, orderTemplate CheckoutOrderTemplate, recurrent bool, type_ string) *Checkout {
this := Checkout{}
this.AllowedPaymentMethods = allowedPaymentMethods
this.ExpiresAt = expiresAt
this.Name = name
this.OrderTemplate = orderTemplate
this.Recurrent = recurrent
this.Type = type_
return &this
}
// NewCheckoutWithDefaults instantiates a new Checkout object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewCheckoutWithDefaults() *Checkout {
this := Checkout{}
return &this
}
// GetAllowedPaymentMethods returns the AllowedPaymentMethods field value
func (o *Checkout) GetAllowedPaymentMethods() []string {
if o == nil {
var ret []string
return ret
}
return o.AllowedPaymentMethods
}
// GetAllowedPaymentMethodsOk returns a tuple with the AllowedPaymentMethods field value
// and a boolean to check if the value has been set.
func (o *Checkout) GetAllowedPaymentMethodsOk() ([]string, bool) {
if o == nil {
return nil, false
}
return o.AllowedPaymentMethods, true
}
// SetAllowedPaymentMethods sets field value
func (o *Checkout) SetAllowedPaymentMethods(v []string) {
o.AllowedPaymentMethods = v
}
// GetExpiresAt returns the ExpiresAt field value
func (o *Checkout) GetExpiresAt() int64 {
if o == nil {
var ret int64
return ret
}
return o.ExpiresAt
}
// GetExpiresAtOk returns a tuple with the ExpiresAt field value
// and a boolean to check if the value has been set.
func (o *Checkout) GetExpiresAtOk() (*int64, bool) {
if o == nil {
return nil, false
}
return &o.ExpiresAt, true
}
// SetExpiresAt sets field value
func (o *Checkout) SetExpiresAt(v int64) {
o.ExpiresAt = v
}
// GetMonthlyInstallmentsEnabled returns the MonthlyInstallmentsEnabled field value if set, zero value otherwise.
func (o *Checkout) GetMonthlyInstallmentsEnabled() bool {
if o == nil || IsNil(o.MonthlyInstallmentsEnabled) {
var ret bool
return ret
}
return *o.MonthlyInstallmentsEnabled
}
// GetMonthlyInstallmentsEnabledOk returns a tuple with the MonthlyInstallmentsEnabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Checkout) GetMonthlyInstallmentsEnabledOk() (*bool, bool) {
if o == nil || IsNil(o.MonthlyInstallmentsEnabled) {
return nil, false
}
return o.MonthlyInstallmentsEnabled, true
}
// HasMonthlyInstallmentsEnabled returns a boolean if a field has been set.
func (o *Checkout) HasMonthlyInstallmentsEnabled() bool {
if o != nil && !IsNil(o.MonthlyInstallmentsEnabled) {
return true
}
return false
}
// SetMonthlyInstallmentsEnabled gets a reference to the given bool and assigns it to the MonthlyInstallmentsEnabled field.
func (o *Checkout) SetMonthlyInstallmentsEnabled(v bool) {
o.MonthlyInstallmentsEnabled = &v
}
// GetMonthlyInstallmentsOptions returns the MonthlyInstallmentsOptions field value if set, zero value otherwise.
func (o *Checkout) GetMonthlyInstallmentsOptions() []int32 {
if o == nil || IsNil(o.MonthlyInstallmentsOptions) {
var ret []int32
return ret
}
return o.MonthlyInstallmentsOptions
}
// GetMonthlyInstallmentsOptionsOk returns a tuple with the MonthlyInstallmentsOptions field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Checkout) GetMonthlyInstallmentsOptionsOk() ([]int32, bool) {
if o == nil || IsNil(o.MonthlyInstallmentsOptions) {
return nil, false
}
return o.MonthlyInstallmentsOptions, true
}
// HasMonthlyInstallmentsOptions returns a boolean if a field has been set.
func (o *Checkout) HasMonthlyInstallmentsOptions() bool {
if o != nil && !IsNil(o.MonthlyInstallmentsOptions) {
return true
}
return false
}
// SetMonthlyInstallmentsOptions gets a reference to the given []int32 and assigns it to the MonthlyInstallmentsOptions field.
func (o *Checkout) SetMonthlyInstallmentsOptions(v []int32) {
o.MonthlyInstallmentsOptions = v
}
// GetThreeDsMode returns the ThreeDsMode field value if set, zero value otherwise.
func (o *Checkout) GetThreeDsMode() string {
if o == nil || IsNil(o.ThreeDsMode) {
var ret string
return ret
}
return *o.ThreeDsMode
}
// GetThreeDsModeOk returns a tuple with the ThreeDsMode field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Checkout) GetThreeDsModeOk() (*string, bool) {
if o == nil || IsNil(o.ThreeDsMode) {
return nil, false
}
return o.ThreeDsMode, true
}
// HasThreeDsMode returns a boolean if a field has been set.
func (o *Checkout) HasThreeDsMode() bool {
if o != nil && !IsNil(o.ThreeDsMode) {
return true
}
return false
}
// SetThreeDsMode gets a reference to the given string and assigns it to the ThreeDsMode field.
func (o *Checkout) SetThreeDsMode(v string) {
o.ThreeDsMode = &v
}
// GetName returns the Name field value
func (o *Checkout) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *Checkout) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *Checkout) SetName(v string) {
o.Name = v
}
// GetNeedsShippingContact returns the NeedsShippingContact field value if set, zero value otherwise.
func (o *Checkout) GetNeedsShippingContact() bool {
if o == nil || IsNil(o.NeedsShippingContact) {
var ret bool
return ret
}
return *o.NeedsShippingContact
}
// GetNeedsShippingContactOk returns a tuple with the NeedsShippingContact field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Checkout) GetNeedsShippingContactOk() (*bool, bool) {
if o == nil || IsNil(o.NeedsShippingContact) {
return nil, false
}
return o.NeedsShippingContact, true
}
// HasNeedsShippingContact returns a boolean if a field has been set.
func (o *Checkout) HasNeedsShippingContact() bool {
if o != nil && !IsNil(o.NeedsShippingContact) {
return true
}
return false
}
// SetNeedsShippingContact gets a reference to the given bool and assigns it to the NeedsShippingContact field.
func (o *Checkout) SetNeedsShippingContact(v bool) {
o.NeedsShippingContact = &v
}
// GetOnDemandEnabled returns the OnDemandEnabled field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Checkout) GetOnDemandEnabled() bool {
if o == nil || IsNil(o.OnDemandEnabled.Get()) {
var ret bool
return ret
}
return *o.OnDemandEnabled.Get()
}
// GetOnDemandEnabledOk returns a tuple with the OnDemandEnabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Checkout) GetOnDemandEnabledOk() (*bool, bool) {
if o == nil {
return nil, false
}
return o.OnDemandEnabled.Get(), o.OnDemandEnabled.IsSet()
}
// HasOnDemandEnabled returns a boolean if a field has been set.
func (o *Checkout) HasOnDemandEnabled() bool {
if o != nil && o.OnDemandEnabled.IsSet() {
return true
}
return false
}
// SetOnDemandEnabled gets a reference to the given NullableBool and assigns it to the OnDemandEnabled field.
func (o *Checkout) SetOnDemandEnabled(v bool) {
o.OnDemandEnabled.Set(&v)
}
// SetOnDemandEnabledNil sets the value for OnDemandEnabled to be an explicit nil
func (o *Checkout) SetOnDemandEnabledNil() {
o.OnDemandEnabled.Set(nil)
}
// UnsetOnDemandEnabled ensures that no value is present for OnDemandEnabled, not even an explicit nil
func (o *Checkout) UnsetOnDemandEnabled() {
o.OnDemandEnabled.Unset()
}
// GetOrderTemplate returns the OrderTemplate field value
func (o *Checkout) GetOrderTemplate() CheckoutOrderTemplate {
if o == nil {
var ret CheckoutOrderTemplate
return ret
}
return o.OrderTemplate
}
// GetOrderTemplateOk returns a tuple with the OrderTemplate field value
// and a boolean to check if the value has been set.
func (o *Checkout) GetOrderTemplateOk() (*CheckoutOrderTemplate, bool) {
if o == nil {
return nil, false
}
return &o.OrderTemplate, true
}
// SetOrderTemplate sets field value
func (o *Checkout) SetOrderTemplate(v CheckoutOrderTemplate) {
o.OrderTemplate = v
}
// GetPaymentsLimitCount returns the PaymentsLimitCount field value if set, zero value otherwise.
func (o *Checkout) GetPaymentsLimitCount() int32 {
if o == nil || IsNil(o.PaymentsLimitCount) {
var ret int32
return ret
}
return *o.PaymentsLimitCount
}
// GetPaymentsLimitCountOk returns a tuple with the PaymentsLimitCount field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Checkout) GetPaymentsLimitCountOk() (*int32, bool) {
if o == nil || IsNil(o.PaymentsLimitCount) {
return nil, false
}
return o.PaymentsLimitCount, true
}
// HasPaymentsLimitCount returns a boolean if a field has been set.
func (o *Checkout) HasPaymentsLimitCount() bool {
if o != nil && !IsNil(o.PaymentsLimitCount) {
return true
}
return false
}
// SetPaymentsLimitCount gets a reference to the given int32 and assigns it to the PaymentsLimitCount field.
func (o *Checkout) SetPaymentsLimitCount(v int32) {
o.PaymentsLimitCount = &v
}
// GetRecurrent returns the Recurrent field value
func (o *Checkout) GetRecurrent() bool {
if o == nil {
var ret bool
return ret
}
return o.Recurrent
}
// GetRecurrentOk returns a tuple with the Recurrent field value
// and a boolean to check if the value has been set.
func (o *Checkout) GetRecurrentOk() (*bool, bool) {
if o == nil {
return nil, false
}
return &o.Recurrent, true
}
// SetRecurrent sets field value
func (o *Checkout) SetRecurrent(v bool) {
o.Recurrent = v
}
// GetType returns the Type field value
func (o *Checkout) GetType() string {
if o == nil {
var ret string
return ret
}
return o.Type
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *Checkout) GetTypeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}
// SetType sets field value
func (o *Checkout) SetType(v string) {
o.Type = v
}
func (o Checkout) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Checkout) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["allowed_payment_methods"] = o.AllowedPaymentMethods
toSerialize["expires_at"] = o.ExpiresAt
if !IsNil(o.MonthlyInstallmentsEnabled) {
toSerialize["monthly_installments_enabled"] = o.MonthlyInstallmentsEnabled
}
if !IsNil(o.MonthlyInstallmentsOptions) {
toSerialize["monthly_installments_options"] = o.MonthlyInstallmentsOptions
}
if !IsNil(o.ThreeDsMode) {
toSerialize["three_ds_mode"] = o.ThreeDsMode
}
toSerialize["name"] = o.Name
if !IsNil(o.NeedsShippingContact) {
toSerialize["needs_shipping_contact"] = o.NeedsShippingContact
}
if o.OnDemandEnabled.IsSet() {
toSerialize["on_demand_enabled"] = o.OnDemandEnabled.Get()
}
toSerialize["order_template"] = o.OrderTemplate
if !IsNil(o.PaymentsLimitCount) {
toSerialize["payments_limit_count"] = o.PaymentsLimitCount
}
toSerialize["recurrent"] = o.Recurrent
toSerialize["type"] = o.Type
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Checkout) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"allowed_payment_methods",
"expires_at",
"name",
"order_template",
"recurrent",
"type",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err;
}
for _, requiredProperty := range(requiredProperties) {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varCheckout := _Checkout{}
err = json.Unmarshal(data, &varCheckout)
if err != nil {
return err
}
*o = Checkout(varCheckout)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "allowed_payment_methods")
delete(additionalProperties, "expires_at")
delete(additionalProperties, "monthly_installments_enabled")
delete(additionalProperties, "monthly_installments_options")
delete(additionalProperties, "three_ds_mode")
delete(additionalProperties, "name")
delete(additionalProperties, "needs_shipping_contact")
delete(additionalProperties, "on_demand_enabled")
delete(additionalProperties, "order_template")
delete(additionalProperties, "payments_limit_count")
delete(additionalProperties, "recurrent")
delete(additionalProperties, "type")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableCheckout struct {
value *Checkout
isSet bool
}
func (v NullableCheckout) Get() *Checkout {
return v.value
}
func (v *NullableCheckout) Set(val *Checkout) {
v.value = val
v.isSet = true
}
func (v NullableCheckout) IsSet() bool {
return v.isSet
}
func (v *NullableCheckout) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCheckout(val *Checkout) *NullableCheckout {
return &NullableCheckout{value: val, isSet: true}
}
func (v NullableCheckout) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCheckout) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}