-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_order.go
856 lines (724 loc) · 23 KB
/
model_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
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
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
// Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved.
// Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
/*
GrabFood
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
API version: 1.1.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package grabfood
import (
"encoding/json"
"time"
"fmt"
)
// checks if the Order type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Order{}
// Order A JSON object containing the order information.
type Order struct {
// The order's ID that is returned from GrabFood. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).
OrderID string `json:"orderID"`
// The GrabFood short order number. This is unique for each merchant per day. Refer to FAQs for more details about [orderID and shortOrderNumber](#section/Order/What's-the-difference-between-orderID-and-shortOrderNumber).
ShortOrderNumber string `json:"shortOrderNumber"`
// The merchant's ID that is in GrabFood's database.
MerchantID string `json:"merchantID"`
// The merchant's ID that is on the partner's database.
PartnerMerchantID *string `json:"partnerMerchantID,omitempty"`
// The payment method used. Refer to FAQs for more details about [paymentType](#section/Order/Does-the-paymentType-affect-partners).
PaymentType string `json:"paymentType"`
// The boolean value to indicate whether cutlery are needed or not. Refer to FAQs for more details about [cutlery](#section/Order/What-do-the-true-or-false-values-mean-for-cutlery).
Cutlery bool `json:"cutlery"`
// The UTC time that a consumer places the order, based on ISO_8601/RFC3339.
OrderTime string `json:"orderTime"`
// The order submit time, based on ISO_8601/RFC3339. Only present in the [List Orders](#tag/list-order) response.
SubmitTime *time.Time `json:"submitTime,omitempty"`
// The order complete time, based on ISO_8601/RFC3339. Only present in the [List Orders](#tag/list-order) response.
CompleteTime *time.Time `json:"completeTime,omitempty"`
// The order scheduled time, based on ISO_8601/RFC3339. Empty for non-scheduled orders.
ScheduledTime *string `json:"scheduledTime,omitempty"`
// The state of the order. Only present in the [List Orders](#tag/list-order) response. Refer to [Order States](#section/Order-states).
OrderState *string `json:"orderState,omitempty"`
Currency Currency `json:"currency"`
FeatureFlags OrderFeatureFlags `json:"featureFlags"`
// The items in an array of JSON Object. Refer to [Items](#items) for more information.
Items []OrderItem `json:"items"`
// The campaigns that are applicable for the order.`null` when there is no campaign applied.
Campaigns []OrderCampaign `json:"campaigns,omitempty"`
// An array of promotion objects. Only promotions that are funded by merchants will be sent.
Promos []OrderPromo `json:"promos,omitempty"`
Price OrderPrice `json:"price"`
DineIn *DineIn `json:"dineIn,omitempty"`
Receiver *Receiver `json:"receiver,omitempty"`
OrderReadyEstimation *OrderReadyEstimation `json:"orderReadyEstimation,omitempty"`
// Membership ID for loyalty project. Only present for loyalty program partners.
MembershipID *string `json:"membershipID,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Order Order
// NewOrder instantiates a new Order 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 NewOrder(orderID string, shortOrderNumber string, merchantID string, paymentType string, cutlery bool, orderTime string, currency Currency, featureFlags OrderFeatureFlags, items []OrderItem, price OrderPrice) *Order {
this := Order{}
this.OrderID = orderID
this.ShortOrderNumber = shortOrderNumber
this.MerchantID = merchantID
this.PaymentType = paymentType
this.Cutlery = cutlery
this.OrderTime = orderTime
this.Currency = currency
this.FeatureFlags = featureFlags
this.Items = items
this.Price = price
return &this
}
// NewOrderWithDefaults instantiates a new Order 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 NewOrderWithDefaults() *Order {
this := Order{}
return &this
}
// GetOrderID returns the OrderID field value
func (o *Order) GetOrderID() string {
if o == nil {
var ret string
return ret
}
return o.OrderID
}
// GetOrderIDOk returns a tuple with the OrderID field value
// and a boolean to check if the value has been set.
func (o *Order) GetOrderIDOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.OrderID, true
}
// SetOrderID sets field value
func (o *Order) SetOrderID(v string) {
o.OrderID = v
}
// GetShortOrderNumber returns the ShortOrderNumber field value
func (o *Order) GetShortOrderNumber() string {
if o == nil {
var ret string
return ret
}
return o.ShortOrderNumber
}
// GetShortOrderNumberOk returns a tuple with the ShortOrderNumber field value
// and a boolean to check if the value has been set.
func (o *Order) GetShortOrderNumberOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.ShortOrderNumber, true
}
// SetShortOrderNumber sets field value
func (o *Order) SetShortOrderNumber(v string) {
o.ShortOrderNumber = v
}
// GetMerchantID returns the MerchantID field value
func (o *Order) GetMerchantID() string {
if o == nil {
var ret string
return ret
}
return o.MerchantID
}
// GetMerchantIDOk returns a tuple with the MerchantID field value
// and a boolean to check if the value has been set.
func (o *Order) GetMerchantIDOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.MerchantID, true
}
// SetMerchantID sets field value
func (o *Order) SetMerchantID(v string) {
o.MerchantID = v
}
// GetPartnerMerchantID returns the PartnerMerchantID field value if set, zero value otherwise.
func (o *Order) GetPartnerMerchantID() string {
if o == nil || IsNil(o.PartnerMerchantID) {
var ret string
return ret
}
return *o.PartnerMerchantID
}
// GetPartnerMerchantIDOk returns a tuple with the PartnerMerchantID field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetPartnerMerchantIDOk() (*string, bool) {
if o == nil || IsNil(o.PartnerMerchantID) {
return nil, false
}
return o.PartnerMerchantID, true
}
// HasPartnerMerchantID returns a boolean if a field has been set.
func (o *Order) HasPartnerMerchantID() bool {
if o != nil && !IsNil(o.PartnerMerchantID) {
return true
}
return false
}
// SetPartnerMerchantID gets a reference to the given string and assigns it to the PartnerMerchantID field.
func (o *Order) SetPartnerMerchantID(v string) {
o.PartnerMerchantID = &v
}
// GetPaymentType returns the PaymentType field value
func (o *Order) GetPaymentType() string {
if o == nil {
var ret string
return ret
}
return o.PaymentType
}
// GetPaymentTypeOk returns a tuple with the PaymentType field value
// and a boolean to check if the value has been set.
func (o *Order) GetPaymentTypeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.PaymentType, true
}
// SetPaymentType sets field value
func (o *Order) SetPaymentType(v string) {
o.PaymentType = v
}
// GetCutlery returns the Cutlery field value
func (o *Order) GetCutlery() bool {
if o == nil {
var ret bool
return ret
}
return o.Cutlery
}
// GetCutleryOk returns a tuple with the Cutlery field value
// and a boolean to check if the value has been set.
func (o *Order) GetCutleryOk() (*bool, bool) {
if o == nil {
return nil, false
}
return &o.Cutlery, true
}
// SetCutlery sets field value
func (o *Order) SetCutlery(v bool) {
o.Cutlery = v
}
// GetOrderTime returns the OrderTime field value
func (o *Order) GetOrderTime() string {
if o == nil {
var ret string
return ret
}
return o.OrderTime
}
// GetOrderTimeOk returns a tuple with the OrderTime field value
// and a boolean to check if the value has been set.
func (o *Order) GetOrderTimeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.OrderTime, true
}
// SetOrderTime sets field value
func (o *Order) SetOrderTime(v string) {
o.OrderTime = v
}
// GetSubmitTime returns the SubmitTime field value if set, zero value otherwise.
func (o *Order) GetSubmitTime() time.Time {
if o == nil || IsNil(o.SubmitTime) {
var ret time.Time
return ret
}
return *o.SubmitTime
}
// GetSubmitTimeOk returns a tuple with the SubmitTime field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetSubmitTimeOk() (*time.Time, bool) {
if o == nil || IsNil(o.SubmitTime) {
return nil, false
}
return o.SubmitTime, true
}
// HasSubmitTime returns a boolean if a field has been set.
func (o *Order) HasSubmitTime() bool {
if o != nil && !IsNil(o.SubmitTime) {
return true
}
return false
}
// SetSubmitTime gets a reference to the given time.Time and assigns it to the SubmitTime field.
func (o *Order) SetSubmitTime(v time.Time) {
o.SubmitTime = &v
}
// GetCompleteTime returns the CompleteTime field value if set, zero value otherwise.
func (o *Order) GetCompleteTime() time.Time {
if o == nil || IsNil(o.CompleteTime) {
var ret time.Time
return ret
}
return *o.CompleteTime
}
// GetCompleteTimeOk returns a tuple with the CompleteTime field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetCompleteTimeOk() (*time.Time, bool) {
if o == nil || IsNil(o.CompleteTime) {
return nil, false
}
return o.CompleteTime, true
}
// HasCompleteTime returns a boolean if a field has been set.
func (o *Order) HasCompleteTime() bool {
if o != nil && !IsNil(o.CompleteTime) {
return true
}
return false
}
// SetCompleteTime gets a reference to the given time.Time and assigns it to the CompleteTime field.
func (o *Order) SetCompleteTime(v time.Time) {
o.CompleteTime = &v
}
// GetScheduledTime returns the ScheduledTime field value if set, zero value otherwise.
func (o *Order) GetScheduledTime() string {
if o == nil || IsNil(o.ScheduledTime) {
var ret string
return ret
}
return *o.ScheduledTime
}
// GetScheduledTimeOk returns a tuple with the ScheduledTime field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetScheduledTimeOk() (*string, bool) {
if o == nil || IsNil(o.ScheduledTime) {
return nil, false
}
return o.ScheduledTime, true
}
// HasScheduledTime returns a boolean if a field has been set.
func (o *Order) HasScheduledTime() bool {
if o != nil && !IsNil(o.ScheduledTime) {
return true
}
return false
}
// SetScheduledTime gets a reference to the given string and assigns it to the ScheduledTime field.
func (o *Order) SetScheduledTime(v string) {
o.ScheduledTime = &v
}
// GetOrderState returns the OrderState field value if set, zero value otherwise.
func (o *Order) GetOrderState() string {
if o == nil || IsNil(o.OrderState) {
var ret string
return ret
}
return *o.OrderState
}
// GetOrderStateOk returns a tuple with the OrderState field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetOrderStateOk() (*string, bool) {
if o == nil || IsNil(o.OrderState) {
return nil, false
}
return o.OrderState, true
}
// HasOrderState returns a boolean if a field has been set.
func (o *Order) HasOrderState() bool {
if o != nil && !IsNil(o.OrderState) {
return true
}
return false
}
// SetOrderState gets a reference to the given string and assigns it to the OrderState field.
func (o *Order) SetOrderState(v string) {
o.OrderState = &v
}
// GetCurrency returns the Currency field value
func (o *Order) GetCurrency() Currency {
if o == nil {
var ret Currency
return ret
}
return o.Currency
}
// GetCurrencyOk returns a tuple with the Currency field value
// and a boolean to check if the value has been set.
func (o *Order) GetCurrencyOk() (*Currency, bool) {
if o == nil {
return nil, false
}
return &o.Currency, true
}
// SetCurrency sets field value
func (o *Order) SetCurrency(v Currency) {
o.Currency = v
}
// GetFeatureFlags returns the FeatureFlags field value
func (o *Order) GetFeatureFlags() OrderFeatureFlags {
if o == nil {
var ret OrderFeatureFlags
return ret
}
return o.FeatureFlags
}
// GetFeatureFlagsOk returns a tuple with the FeatureFlags field value
// and a boolean to check if the value has been set.
func (o *Order) GetFeatureFlagsOk() (*OrderFeatureFlags, bool) {
if o == nil {
return nil, false
}
return &o.FeatureFlags, true
}
// SetFeatureFlags sets field value
func (o *Order) SetFeatureFlags(v OrderFeatureFlags) {
o.FeatureFlags = v
}
// GetItems returns the Items field value
func (o *Order) GetItems() []OrderItem {
if o == nil {
var ret []OrderItem
return ret
}
return o.Items
}
// GetItemsOk returns a tuple with the Items field value
// and a boolean to check if the value has been set.
func (o *Order) GetItemsOk() ([]OrderItem, bool) {
if o == nil {
return nil, false
}
return o.Items, true
}
// SetItems sets field value
func (o *Order) SetItems(v []OrderItem) {
o.Items = v
}
// GetCampaigns returns the Campaigns field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Order) GetCampaigns() []OrderCampaign {
if o == nil {
var ret []OrderCampaign
return ret
}
return o.Campaigns
}
// GetCampaignsOk returns a tuple with the Campaigns 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 *Order) GetCampaignsOk() ([]OrderCampaign, bool) {
if o == nil || IsNil(o.Campaigns) {
return nil, false
}
return o.Campaigns, true
}
// HasCampaigns returns a boolean if a field has been set.
func (o *Order) HasCampaigns() bool {
if o != nil && !IsNil(o.Campaigns) {
return true
}
return false
}
// SetCampaigns gets a reference to the given []OrderCampaign and assigns it to the Campaigns field.
func (o *Order) SetCampaigns(v []OrderCampaign) {
o.Campaigns = v
}
// GetPromos returns the Promos field value if set, zero value otherwise.
func (o *Order) GetPromos() []OrderPromo {
if o == nil || IsNil(o.Promos) {
var ret []OrderPromo
return ret
}
return o.Promos
}
// GetPromosOk returns a tuple with the Promos field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetPromosOk() ([]OrderPromo, bool) {
if o == nil || IsNil(o.Promos) {
return nil, false
}
return o.Promos, true
}
// HasPromos returns a boolean if a field has been set.
func (o *Order) HasPromos() bool {
if o != nil && !IsNil(o.Promos) {
return true
}
return false
}
// SetPromos gets a reference to the given []OrderPromo and assigns it to the Promos field.
func (o *Order) SetPromos(v []OrderPromo) {
o.Promos = v
}
// GetPrice returns the Price field value
func (o *Order) GetPrice() OrderPrice {
if o == nil {
var ret OrderPrice
return ret
}
return o.Price
}
// GetPriceOk returns a tuple with the Price field value
// and a boolean to check if the value has been set.
func (o *Order) GetPriceOk() (*OrderPrice, bool) {
if o == nil {
return nil, false
}
return &o.Price, true
}
// SetPrice sets field value
func (o *Order) SetPrice(v OrderPrice) {
o.Price = v
}
// GetDineIn returns the DineIn field value if set, zero value otherwise.
func (o *Order) GetDineIn() DineIn {
if o == nil || IsNil(o.DineIn) {
var ret DineIn
return ret
}
return *o.DineIn
}
// GetDineInOk returns a tuple with the DineIn field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetDineInOk() (*DineIn, bool) {
if o == nil || IsNil(o.DineIn) {
return nil, false
}
return o.DineIn, true
}
// HasDineIn returns a boolean if a field has been set.
func (o *Order) HasDineIn() bool {
if o != nil && !IsNil(o.DineIn) {
return true
}
return false
}
// SetDineIn gets a reference to the given DineIn and assigns it to the DineIn field.
func (o *Order) SetDineIn(v DineIn) {
o.DineIn = &v
}
// GetReceiver returns the Receiver field value if set, zero value otherwise.
func (o *Order) GetReceiver() Receiver {
if o == nil || IsNil(o.Receiver) {
var ret Receiver
return ret
}
return *o.Receiver
}
// GetReceiverOk returns a tuple with the Receiver field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetReceiverOk() (*Receiver, bool) {
if o == nil || IsNil(o.Receiver) {
return nil, false
}
return o.Receiver, true
}
// HasReceiver returns a boolean if a field has been set.
func (o *Order) HasReceiver() bool {
if o != nil && !IsNil(o.Receiver) {
return true
}
return false
}
// SetReceiver gets a reference to the given Receiver and assigns it to the Receiver field.
func (o *Order) SetReceiver(v Receiver) {
o.Receiver = &v
}
// GetOrderReadyEstimation returns the OrderReadyEstimation field value if set, zero value otherwise.
func (o *Order) GetOrderReadyEstimation() OrderReadyEstimation {
if o == nil || IsNil(o.OrderReadyEstimation) {
var ret OrderReadyEstimation
return ret
}
return *o.OrderReadyEstimation
}
// GetOrderReadyEstimationOk returns a tuple with the OrderReadyEstimation field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetOrderReadyEstimationOk() (*OrderReadyEstimation, bool) {
if o == nil || IsNil(o.OrderReadyEstimation) {
return nil, false
}
return o.OrderReadyEstimation, true
}
// HasOrderReadyEstimation returns a boolean if a field has been set.
func (o *Order) HasOrderReadyEstimation() bool {
if o != nil && !IsNil(o.OrderReadyEstimation) {
return true
}
return false
}
// SetOrderReadyEstimation gets a reference to the given OrderReadyEstimation and assigns it to the OrderReadyEstimation field.
func (o *Order) SetOrderReadyEstimation(v OrderReadyEstimation) {
o.OrderReadyEstimation = &v
}
// GetMembershipID returns the MembershipID field value if set, zero value otherwise.
func (o *Order) GetMembershipID() string {
if o == nil || IsNil(o.MembershipID) {
var ret string
return ret
}
return *o.MembershipID
}
// GetMembershipIDOk returns a tuple with the MembershipID field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Order) GetMembershipIDOk() (*string, bool) {
if o == nil || IsNil(o.MembershipID) {
return nil, false
}
return o.MembershipID, true
}
// HasMembershipID returns a boolean if a field has been set.
func (o *Order) HasMembershipID() bool {
if o != nil && !IsNil(o.MembershipID) {
return true
}
return false
}
// SetMembershipID gets a reference to the given string and assigns it to the MembershipID field.
func (o *Order) SetMembershipID(v string) {
o.MembershipID = &v
}
func (o Order) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Order) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["orderID"] = o.OrderID
toSerialize["shortOrderNumber"] = o.ShortOrderNumber
toSerialize["merchantID"] = o.MerchantID
if !IsNil(o.PartnerMerchantID) {
toSerialize["partnerMerchantID"] = o.PartnerMerchantID
}
toSerialize["paymentType"] = o.PaymentType
toSerialize["cutlery"] = o.Cutlery
toSerialize["orderTime"] = o.OrderTime
if !IsNil(o.SubmitTime) {
toSerialize["submitTime"] = o.SubmitTime
}
if !IsNil(o.CompleteTime) {
toSerialize["completeTime"] = o.CompleteTime
}
if !IsNil(o.ScheduledTime) {
toSerialize["scheduledTime"] = o.ScheduledTime
}
if !IsNil(o.OrderState) {
toSerialize["orderState"] = o.OrderState
}
toSerialize["currency"] = o.Currency
toSerialize["featureFlags"] = o.FeatureFlags
toSerialize["items"] = o.Items
if o.Campaigns != nil {
toSerialize["campaigns"] = o.Campaigns
}
if !IsNil(o.Promos) {
toSerialize["promos"] = o.Promos
}
toSerialize["price"] = o.Price
if !IsNil(o.DineIn) {
toSerialize["dineIn"] = o.DineIn
}
if !IsNil(o.Receiver) {
toSerialize["receiver"] = o.Receiver
}
if !IsNil(o.OrderReadyEstimation) {
toSerialize["orderReadyEstimation"] = o.OrderReadyEstimation
}
if !IsNil(o.MembershipID) {
toSerialize["membershipID"] = o.MembershipID
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Order) 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{
"orderID",
"shortOrderNumber",
"merchantID",
"paymentType",
"cutlery",
"orderTime",
"currency",
"featureFlags",
"items",
"price",
}
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)
}
}
varOrder := _Order{}
err = json.Unmarshal(data, &varOrder)
if err != nil {
return err
}
*o = Order(varOrder)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "orderID")
delete(additionalProperties, "shortOrderNumber")
delete(additionalProperties, "merchantID")
delete(additionalProperties, "partnerMerchantID")
delete(additionalProperties, "paymentType")
delete(additionalProperties, "cutlery")
delete(additionalProperties, "orderTime")
delete(additionalProperties, "submitTime")
delete(additionalProperties, "completeTime")
delete(additionalProperties, "scheduledTime")
delete(additionalProperties, "orderState")
delete(additionalProperties, "currency")
delete(additionalProperties, "featureFlags")
delete(additionalProperties, "items")
delete(additionalProperties, "campaigns")
delete(additionalProperties, "promos")
delete(additionalProperties, "price")
delete(additionalProperties, "dineIn")
delete(additionalProperties, "receiver")
delete(additionalProperties, "orderReadyEstimation")
delete(additionalProperties, "membershipID")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableOrder struct {
value *Order
isSet bool
}
func (v NullableOrder) Get() *Order {
return v.value
}
func (v *NullableOrder) Set(val *Order) {
v.value = val
v.isSet = true
}
func (v NullableOrder) IsSet() bool {
return v.isSet
}
func (v *NullableOrder) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableOrder(val *Order) *NullableOrder {
return &NullableOrder{value: val, isSet: true}
}
func (v NullableOrder) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableOrder) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}