forked from labd/commercetools-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types_order_edit.go
1637 lines (1442 loc) · 59.5 KB
/
types_order_edit.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
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Automatically generated, do not edit
package commercetools
import (
"encoding/json"
"errors"
"time"
)
// OrderEditResult uses type as discriminator attribute
type OrderEditResult interface{}
func mapDiscriminatorOrderEditResult(input interface{}) (OrderEditResult, error) {
var discriminator string
if data, ok := input.(map[string]interface{}); ok {
discriminator, ok = data["type"].(string)
if !ok {
return nil, errors.New("Error processing discriminator field 'type'")
}
} else {
return nil, errors.New("Invalid data")
}
switch discriminator {
case "Applied":
new := OrderEditApplied{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "NotProcessed":
new := OrderEditNotProcessed{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "PreviewFailure":
new := OrderEditPreviewFailure{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
for i := range new.Errors {
new.Errors[i], err = mapDiscriminatorErrorObject(new.Errors[i])
}
return new, nil
case "PreviewSuccess":
new := OrderEditPreviewSuccess{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
for i := range new.MessagePayloads {
new.MessagePayloads[i], err = mapDiscriminatorMessagePayload(new.MessagePayloads[i])
}
return new, nil
}
return nil, nil
}
// OrderEditUpdateAction uses action as discriminator attribute
type OrderEditUpdateAction interface{}
func mapDiscriminatorOrderEditUpdateAction(input interface{}) (OrderEditUpdateAction, error) {
var discriminator string
if data, ok := input.(map[string]interface{}); ok {
discriminator, ok = data["action"].(string)
if !ok {
return nil, errors.New("Error processing discriminator field 'action'")
}
} else {
return nil, errors.New("Invalid data")
}
switch discriminator {
case "addStagedAction":
new := OrderEditAddStagedActionAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
if new.StagedAction != nil {
new.StagedAction, err = mapDiscriminatorStagedOrderUpdateAction(new.StagedAction)
if err != nil {
return nil, err
}
}
return new, nil
case "setComment":
new := OrderEditSetCommentAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setCustomField":
new := OrderEditSetCustomFieldAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setCustomType":
new := OrderEditSetCustomTypeAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setKey":
new := OrderEditSetKeyAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
return new, nil
case "setStagedActions":
new := OrderEditSetStagedActionsAction{}
err := decodeStruct(input, &new)
if err != nil {
return nil, err
}
for i := range new.StagedActions {
new.StagedActions[i], err = mapDiscriminatorStagedOrderUpdateAction(new.StagedActions[i])
}
return new, nil
}
return nil, nil
}
// OrderEdit is of type BaseResource
type OrderEdit struct {
Version int `json:"version"`
StagedActions []StagedOrderUpdateAction `json:"stagedActions"`
Result OrderEditResult `json:"result"`
Resource *OrderReference `json:"resource"`
LastModifiedBy *LastModifiedBy `json:"lastModifiedBy,omitempty"`
LastModifiedAt time.Time `json:"lastModifiedAt"`
Key string `json:"key,omitempty"`
ID string `json:"id"`
Custom *CustomFields `json:"custom,omitempty"`
CreatedBy *CreatedBy `json:"createdBy,omitempty"`
CreatedAt time.Time `json:"createdAt"`
Comment string `json:"comment,omitempty"`
}
// UnmarshalJSON override to deserialize correct attribute types based
// on the discriminator value
func (obj *OrderEdit) UnmarshalJSON(data []byte) error {
type Alias OrderEdit
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil {
return err
}
if obj.Result != nil {
var err error
obj.Result, err = mapDiscriminatorOrderEditResult(obj.Result)
if err != nil {
return err
}
}
for i := range obj.StagedActions {
var err error
obj.StagedActions[i], err = mapDiscriminatorStagedOrderUpdateAction(obj.StagedActions[i])
if err != nil {
return err
}
}
return nil
}
// OrderEditAddStagedActionAction implements the interface OrderEditUpdateAction
type OrderEditAddStagedActionAction struct {
StagedAction StagedOrderUpdateAction `json:"stagedAction"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditAddStagedActionAction) MarshalJSON() ([]byte, error) {
type Alias OrderEditAddStagedActionAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addStagedAction", Alias: (*Alias)(&obj)})
}
// UnmarshalJSON override to deserialize correct attribute types based
// on the discriminator value
func (obj *OrderEditAddStagedActionAction) UnmarshalJSON(data []byte) error {
type Alias OrderEditAddStagedActionAction
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil {
return err
}
if obj.StagedAction != nil {
var err error
obj.StagedAction, err = mapDiscriminatorStagedOrderUpdateAction(obj.StagedAction)
if err != nil {
return err
}
}
return nil
}
// OrderEditApplied implements the interface OrderEditResult
type OrderEditApplied struct {
ExcerptBeforeEdit *OrderExcerpt `json:"excerptBeforeEdit"`
ExcerptAfterEdit *OrderExcerpt `json:"excerptAfterEdit"`
AppliedAt time.Time `json:"appliedAt"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditApplied) MarshalJSON() ([]byte, error) {
type Alias OrderEditApplied
return json.Marshal(struct {
Type string `json:"type"`
*Alias
}{Type: "Applied", Alias: (*Alias)(&obj)})
}
// OrderEditApply is a standalone struct
type OrderEditApply struct {
ResourceVersion int `json:"resourceVersion"`
EditVersion int `json:"editVersion"`
}
// OrderEditDraft is a standalone struct
type OrderEditDraft struct {
StagedActions []StagedOrderUpdateAction `json:"stagedActions,omitempty"`
Resource *OrderReference `json:"resource"`
Key string `json:"key,omitempty"`
DryRun bool `json:"dryRun"`
Custom *CustomFieldsDraft `json:"custom,omitempty"`
Comment string `json:"comment,omitempty"`
}
// UnmarshalJSON override to deserialize correct attribute types based
// on the discriminator value
func (obj *OrderEditDraft) UnmarshalJSON(data []byte) error {
type Alias OrderEditDraft
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil {
return err
}
for i := range obj.StagedActions {
var err error
obj.StagedActions[i], err = mapDiscriminatorStagedOrderUpdateAction(obj.StagedActions[i])
if err != nil {
return err
}
}
return nil
}
// OrderEditNotProcessed implements the interface OrderEditResult
type OrderEditNotProcessed struct{}
// MarshalJSON override to set the discriminator value
func (obj OrderEditNotProcessed) MarshalJSON() ([]byte, error) {
type Alias OrderEditNotProcessed
return json.Marshal(struct {
Type string `json:"type"`
*Alias
}{Type: "NotProcessed", Alias: (*Alias)(&obj)})
}
// OrderEditPagedQueryResponse is a standalone struct
type OrderEditPagedQueryResponse struct {
Total int `json:"total,omitempty"`
Results []OrderEdit `json:"results"`
Offset int `json:"offset"`
Limit int `json:"limit"`
Count int `json:"count"`
}
// OrderEditPreviewFailure implements the interface OrderEditResult
type OrderEditPreviewFailure struct {
Errors []ErrorObject `json:"errors"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditPreviewFailure) MarshalJSON() ([]byte, error) {
type Alias OrderEditPreviewFailure
return json.Marshal(struct {
Type string `json:"type"`
*Alias
}{Type: "PreviewFailure", Alias: (*Alias)(&obj)})
}
// UnmarshalJSON override to deserialize correct attribute types based
// on the discriminator value
func (obj *OrderEditPreviewFailure) UnmarshalJSON(data []byte) error {
type Alias OrderEditPreviewFailure
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil {
return err
}
for i := range obj.Errors {
var err error
obj.Errors[i], err = mapDiscriminatorErrorObject(obj.Errors[i])
if err != nil {
return err
}
}
return nil
}
// OrderEditPreviewSuccess implements the interface OrderEditResult
type OrderEditPreviewSuccess struct {
Preview *StagedOrder `json:"preview"`
MessagePayloads []MessagePayload `json:"messagePayloads"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditPreviewSuccess) MarshalJSON() ([]byte, error) {
type Alias OrderEditPreviewSuccess
return json.Marshal(struct {
Type string `json:"type"`
*Alias
}{Type: "PreviewSuccess", Alias: (*Alias)(&obj)})
}
// UnmarshalJSON override to deserialize correct attribute types based
// on the discriminator value
func (obj *OrderEditPreviewSuccess) UnmarshalJSON(data []byte) error {
type Alias OrderEditPreviewSuccess
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil {
return err
}
for i := range obj.MessagePayloads {
var err error
obj.MessagePayloads[i], err = mapDiscriminatorMessagePayload(obj.MessagePayloads[i])
if err != nil {
return err
}
}
return nil
}
// OrderEditReference implements the interface Reference
type OrderEditReference struct {
ID string `json:"id"`
Obj *OrderEdit `json:"obj,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditReference) MarshalJSON() ([]byte, error) {
type Alias OrderEditReference
return json.Marshal(struct {
TypeID string `json:"typeId"`
*Alias
}{TypeID: "order-edit", Alias: (*Alias)(&obj)})
}
// OrderEditResourceIdentifier implements the interface ResourceIdentifier
type OrderEditResourceIdentifier struct {
Key string `json:"key,omitempty"`
ID string `json:"id,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditResourceIdentifier) MarshalJSON() ([]byte, error) {
type Alias OrderEditResourceIdentifier
return json.Marshal(struct {
TypeID string `json:"typeId"`
*Alias
}{TypeID: "order-edit", Alias: (*Alias)(&obj)})
}
// OrderEditSetCommentAction implements the interface OrderEditUpdateAction
type OrderEditSetCommentAction struct {
Comment string `json:"comment,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditSetCommentAction) MarshalJSON() ([]byte, error) {
type Alias OrderEditSetCommentAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setComment", Alias: (*Alias)(&obj)})
}
// OrderEditSetCustomFieldAction implements the interface OrderEditUpdateAction
type OrderEditSetCustomFieldAction struct {
Value interface{} `json:"value,omitempty"`
Name string `json:"name"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditSetCustomFieldAction) MarshalJSON() ([]byte, error) {
type Alias OrderEditSetCustomFieldAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setCustomField", Alias: (*Alias)(&obj)})
}
// OrderEditSetCustomTypeAction implements the interface OrderEditUpdateAction
type OrderEditSetCustomTypeAction struct {
Type *TypeResourceIdentifier `json:"type,omitempty"`
Fields interface{} `json:"fields,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditSetCustomTypeAction) MarshalJSON() ([]byte, error) {
type Alias OrderEditSetCustomTypeAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setCustomType", Alias: (*Alias)(&obj)})
}
// OrderEditSetKeyAction implements the interface OrderEditUpdateAction
type OrderEditSetKeyAction struct {
Key string `json:"key,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditSetKeyAction) MarshalJSON() ([]byte, error) {
type Alias OrderEditSetKeyAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setKey", Alias: (*Alias)(&obj)})
}
// OrderEditSetStagedActionsAction implements the interface OrderEditUpdateAction
type OrderEditSetStagedActionsAction struct {
StagedActions []StagedOrderUpdateAction `json:"stagedActions"`
}
// MarshalJSON override to set the discriminator value
func (obj OrderEditSetStagedActionsAction) MarshalJSON() ([]byte, error) {
type Alias OrderEditSetStagedActionsAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setStagedActions", Alias: (*Alias)(&obj)})
}
// UnmarshalJSON override to deserialize correct attribute types based
// on the discriminator value
func (obj *OrderEditSetStagedActionsAction) UnmarshalJSON(data []byte) error {
type Alias OrderEditSetStagedActionsAction
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil {
return err
}
for i := range obj.StagedActions {
var err error
obj.StagedActions[i], err = mapDiscriminatorStagedOrderUpdateAction(obj.StagedActions[i])
if err != nil {
return err
}
}
return nil
}
// OrderEditUpdate is a standalone struct
type OrderEditUpdate struct {
Version int `json:"version"`
DryRun bool `json:"dryRun"`
Actions []OrderEditUpdateAction `json:"actions"`
}
// UnmarshalJSON override to deserialize correct attribute types based
// on the discriminator value
func (obj *OrderEditUpdate) UnmarshalJSON(data []byte) error {
type Alias OrderEditUpdate
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil {
return err
}
for i := range obj.Actions {
var err error
obj.Actions[i], err = mapDiscriminatorOrderEditUpdateAction(obj.Actions[i])
if err != nil {
return err
}
}
return nil
}
// OrderExcerpt is a standalone struct
type OrderExcerpt struct {
Version int `json:"version"`
TotalPrice TypedMoney `json:"totalPrice"`
TaxedPrice *TaxedPrice `json:"taxedPrice,omitempty"`
}
// UnmarshalJSON override to deserialize correct attribute types based
// on the discriminator value
func (obj *OrderExcerpt) UnmarshalJSON(data []byte) error {
type Alias OrderExcerpt
if err := json.Unmarshal(data, (*Alias)(obj)); err != nil {
return err
}
if obj.TotalPrice != nil {
var err error
obj.TotalPrice, err = mapDiscriminatorTypedMoney(obj.TotalPrice)
if err != nil {
return err
}
}
return nil
}
// StagedOrder is of type Order
type StagedOrder struct {
Version int `json:"version"`
TotalPrice TypedMoney `json:"totalPrice"`
TaxedPrice *TaxedPrice `json:"taxedPrice,omitempty"`
TaxRoundingMode RoundingMode `json:"taxRoundingMode,omitempty"`
TaxMode TaxMode `json:"taxMode,omitempty"`
TaxCalculationMode TaxCalculationMode `json:"taxCalculationMode,omitempty"`
SyncInfo []SyncInfo `json:"syncInfo"`
Store *StoreKeyReference `json:"store,omitempty"`
State *StateReference `json:"state,omitempty"`
ShippingRateInput ShippingRateInput `json:"shippingRateInput,omitempty"`
ShippingInfo *ShippingInfo `json:"shippingInfo,omitempty"`
ShippingAddress *Address `json:"shippingAddress,omitempty"`
ShipmentState ShipmentState `json:"shipmentState,omitempty"`
ReturnInfo []ReturnInfo `json:"returnInfo,omitempty"`
RefusedGifts []CartDiscountReference `json:"refusedGifts"`
PaymentState PaymentState `json:"paymentState,omitempty"`
PaymentInfo *PaymentInfo `json:"paymentInfo,omitempty"`
Origin CartOrigin `json:"origin"`
OrderState OrderState `json:"orderState"`
OrderNumber string `json:"orderNumber,omitempty"`
Locale string `json:"locale,omitempty"`
LineItems []LineItem `json:"lineItems"`
LastModifiedBy *LastModifiedBy `json:"lastModifiedBy,omitempty"`
LastModifiedAt time.Time `json:"lastModifiedAt"`
LastMessageSequenceNumber int `json:"lastMessageSequenceNumber"`
ItemShippingAddresses []Address `json:"itemShippingAddresses,omitempty"`
InventoryMode InventoryMode `json:"inventoryMode,omitempty"`
ID string `json:"id"`
DiscountCodes []DiscountCodeInfo `json:"discountCodes,omitempty"`
CustomerID string `json:"customerId,omitempty"`
CustomerGroup *CustomerGroupReference `json:"customerGroup,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
CustomLineItems []CustomLineItem `json:"customLineItems"`
Custom *CustomFields `json:"custom,omitempty"`
CreatedBy *CreatedBy `json:"createdBy,omitempty"`
CreatedAt time.Time `json:"createdAt"`
Country string `json:"country,omitempty"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
Cart *CartReference `json:"cart,omitempty"`
BillingAddress *Address `json:"billingAddress,omitempty"`
AnonymousID string `json:"anonymousId,omitempty"`
}
// StagedOrderAddCustomLineItemAction implements the interface StagedOrderUpdateAction
type StagedOrderAddCustomLineItemAction struct {
TaxCategory *TaxCategoryResourceIdentifier `json:"taxCategory,omitempty"`
Slug string `json:"slug"`
Quantity float64 `json:"quantity,omitempty"`
Name *LocalizedString `json:"name"`
Money *Money `json:"money"`
ExternalTaxRate *ExternalTaxRateDraft `json:"externalTaxRate,omitempty"`
Custom *CustomFieldsDraft `json:"custom,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderAddCustomLineItemAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderAddCustomLineItemAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addCustomLineItem", Alias: (*Alias)(&obj)})
}
// StagedOrderAddDeliveryAction implements the interface StagedOrderUpdateAction
type StagedOrderAddDeliveryAction struct {
Parcels []ParcelDraft `json:"parcels,omitempty"`
Items []DeliveryItem `json:"items,omitempty"`
Address *Address `json:"address,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderAddDeliveryAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderAddDeliveryAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addDelivery", Alias: (*Alias)(&obj)})
}
// StagedOrderAddDiscountCodeAction implements the interface StagedOrderUpdateAction
type StagedOrderAddDiscountCodeAction struct {
Code string `json:"code"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderAddDiscountCodeAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderAddDiscountCodeAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addDiscountCode", Alias: (*Alias)(&obj)})
}
// StagedOrderAddItemShippingAddressAction implements the interface StagedOrderUpdateAction
type StagedOrderAddItemShippingAddressAction struct {
Address *Address `json:"address"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderAddItemShippingAddressAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderAddItemShippingAddressAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addItemShippingAddress", Alias: (*Alias)(&obj)})
}
// StagedOrderAddLineItemAction implements the interface StagedOrderUpdateAction
type StagedOrderAddLineItemAction struct {
VariantID int `json:"variantId,omitempty"`
SupplyChannel *ChannelResourceIdentifier `json:"supplyChannel,omitempty"`
SKU string `json:"sku,omitempty"`
ShippingDetails *ItemShippingDetailsDraft `json:"shippingDetails,omitempty"`
Quantity float64 `json:"quantity,omitempty"`
ProductID string `json:"productId,omitempty"`
ExternalTotalPrice *ExternalLineItemTotalPrice `json:"externalTotalPrice,omitempty"`
ExternalTaxRate *ExternalTaxRateDraft `json:"externalTaxRate,omitempty"`
ExternalPrice *Money `json:"externalPrice,omitempty"`
DistributionChannel *ChannelResourceIdentifier `json:"distributionChannel,omitempty"`
Custom *CustomFieldsDraft `json:"custom,omitempty"`
AddedAt *time.Time `json:"addedAt,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderAddLineItemAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderAddLineItemAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addLineItem", Alias: (*Alias)(&obj)})
}
// StagedOrderAddParcelToDeliveryAction implements the interface StagedOrderUpdateAction
type StagedOrderAddParcelToDeliveryAction struct {
TrackingData *TrackingData `json:"trackingData,omitempty"`
Measurements *ParcelMeasurements `json:"measurements,omitempty"`
Items []DeliveryItem `json:"items,omitempty"`
DeliveryID string `json:"deliveryId"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderAddParcelToDeliveryAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderAddParcelToDeliveryAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addParcelToDelivery", Alias: (*Alias)(&obj)})
}
// StagedOrderAddPaymentAction implements the interface StagedOrderUpdateAction
type StagedOrderAddPaymentAction struct {
Payment *PaymentResourceIdentifier `json:"payment"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderAddPaymentAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderAddPaymentAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addPayment", Alias: (*Alias)(&obj)})
}
// StagedOrderAddReturnInfoAction implements the interface StagedOrderUpdateAction
type StagedOrderAddReturnInfoAction struct {
ReturnTrackingID string `json:"returnTrackingId,omitempty"`
ReturnDate *time.Time `json:"returnDate,omitempty"`
Items []ReturnItemDraft `json:"items"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderAddReturnInfoAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderAddReturnInfoAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addReturnInfo", Alias: (*Alias)(&obj)})
}
// StagedOrderAddShoppingListAction implements the interface StagedOrderUpdateAction
type StagedOrderAddShoppingListAction struct {
SupplyChannel *ChannelResourceIdentifier `json:"supplyChannel,omitempty"`
ShoppingList *ShoppingListResourceIdentifier `json:"shoppingList"`
DistributionChannel *ChannelResourceIdentifier `json:"distributionChannel,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderAddShoppingListAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderAddShoppingListAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "addShoppingList", Alias: (*Alias)(&obj)})
}
// StagedOrderChangeCustomLineItemMoneyAction implements the interface StagedOrderUpdateAction
type StagedOrderChangeCustomLineItemMoneyAction struct {
Money *Money `json:"money"`
CustomLineItemID string `json:"customLineItemId"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderChangeCustomLineItemMoneyAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderChangeCustomLineItemMoneyAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeCustomLineItemMoney", Alias: (*Alias)(&obj)})
}
// StagedOrderChangeCustomLineItemQuantityAction implements the interface StagedOrderUpdateAction
type StagedOrderChangeCustomLineItemQuantityAction struct {
Quantity float64 `json:"quantity"`
CustomLineItemID string `json:"customLineItemId"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderChangeCustomLineItemQuantityAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderChangeCustomLineItemQuantityAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeCustomLineItemQuantity", Alias: (*Alias)(&obj)})
}
// StagedOrderChangeLineItemQuantityAction implements the interface StagedOrderUpdateAction
type StagedOrderChangeLineItemQuantityAction struct {
Quantity float64 `json:"quantity"`
LineItemID string `json:"lineItemId"`
ExternalTotalPrice *ExternalLineItemTotalPrice `json:"externalTotalPrice,omitempty"`
ExternalPrice *Money `json:"externalPrice,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderChangeLineItemQuantityAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderChangeLineItemQuantityAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeLineItemQuantity", Alias: (*Alias)(&obj)})
}
// StagedOrderChangeOrderStateAction implements the interface StagedOrderUpdateAction
type StagedOrderChangeOrderStateAction struct {
OrderState OrderState `json:"orderState"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderChangeOrderStateAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderChangeOrderStateAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeOrderState", Alias: (*Alias)(&obj)})
}
// StagedOrderChangePaymentStateAction implements the interface StagedOrderUpdateAction
type StagedOrderChangePaymentStateAction struct {
PaymentState PaymentState `json:"paymentState,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderChangePaymentStateAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderChangePaymentStateAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changePaymentState", Alias: (*Alias)(&obj)})
}
// StagedOrderChangeShipmentStateAction implements the interface StagedOrderUpdateAction
type StagedOrderChangeShipmentStateAction struct {
ShipmentState ShipmentState `json:"shipmentState,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderChangeShipmentStateAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderChangeShipmentStateAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeShipmentState", Alias: (*Alias)(&obj)})
}
// StagedOrderChangeTaxCalculationModeAction implements the interface StagedOrderUpdateAction
type StagedOrderChangeTaxCalculationModeAction struct {
TaxCalculationMode TaxCalculationMode `json:"taxCalculationMode"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderChangeTaxCalculationModeAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderChangeTaxCalculationModeAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeTaxCalculationMode", Alias: (*Alias)(&obj)})
}
// StagedOrderChangeTaxModeAction implements the interface StagedOrderUpdateAction
type StagedOrderChangeTaxModeAction struct {
TaxMode TaxMode `json:"taxMode"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderChangeTaxModeAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderChangeTaxModeAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeTaxMode", Alias: (*Alias)(&obj)})
}
// StagedOrderChangeTaxRoundingModeAction implements the interface StagedOrderUpdateAction
type StagedOrderChangeTaxRoundingModeAction struct {
TaxRoundingMode RoundingMode `json:"taxRoundingMode"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderChangeTaxRoundingModeAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderChangeTaxRoundingModeAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "changeTaxRoundingMode", Alias: (*Alias)(&obj)})
}
// StagedOrderImportCustomLineItemStateAction implements the interface StagedOrderUpdateAction
type StagedOrderImportCustomLineItemStateAction struct {
State []ItemState `json:"state"`
CustomLineItemID string `json:"customLineItemId"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderImportCustomLineItemStateAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderImportCustomLineItemStateAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "importCustomLineItemState", Alias: (*Alias)(&obj)})
}
// StagedOrderImportLineItemStateAction implements the interface StagedOrderUpdateAction
type StagedOrderImportLineItemStateAction struct {
State []ItemState `json:"state"`
LineItemID string `json:"lineItemId"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderImportLineItemStateAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderImportLineItemStateAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "importLineItemState", Alias: (*Alias)(&obj)})
}
// StagedOrderRemoveCustomLineItemAction implements the interface StagedOrderUpdateAction
type StagedOrderRemoveCustomLineItemAction struct {
CustomLineItemID string `json:"customLineItemId"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderRemoveCustomLineItemAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderRemoveCustomLineItemAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeCustomLineItem", Alias: (*Alias)(&obj)})
}
// StagedOrderRemoveDeliveryAction implements the interface StagedOrderUpdateAction
type StagedOrderRemoveDeliveryAction struct {
DeliveryID string `json:"deliveryId"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderRemoveDeliveryAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderRemoveDeliveryAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeDelivery", Alias: (*Alias)(&obj)})
}
// StagedOrderRemoveDiscountCodeAction implements the interface StagedOrderUpdateAction
type StagedOrderRemoveDiscountCodeAction struct {
DiscountCode *DiscountCodeReference `json:"discountCode"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderRemoveDiscountCodeAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderRemoveDiscountCodeAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeDiscountCode", Alias: (*Alias)(&obj)})
}
// StagedOrderRemoveItemShippingAddressAction implements the interface StagedOrderUpdateAction
type StagedOrderRemoveItemShippingAddressAction struct {
AddressKey string `json:"addressKey"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderRemoveItemShippingAddressAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderRemoveItemShippingAddressAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeItemShippingAddress", Alias: (*Alias)(&obj)})
}
// StagedOrderRemoveLineItemAction implements the interface StagedOrderUpdateAction
type StagedOrderRemoveLineItemAction struct {
ShippingDetailsToRemove *ItemShippingDetailsDraft `json:"shippingDetailsToRemove,omitempty"`
Quantity float64 `json:"quantity,omitempty"`
LineItemID string `json:"lineItemId"`
ExternalTotalPrice *ExternalLineItemTotalPrice `json:"externalTotalPrice,omitempty"`
ExternalPrice *Money `json:"externalPrice,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderRemoveLineItemAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderRemoveLineItemAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeLineItem", Alias: (*Alias)(&obj)})
}
// StagedOrderRemoveParcelFromDeliveryAction implements the interface StagedOrderUpdateAction
type StagedOrderRemoveParcelFromDeliveryAction struct {
ParcelID string `json:"parcelId"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderRemoveParcelFromDeliveryAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderRemoveParcelFromDeliveryAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removeParcelFromDelivery", Alias: (*Alias)(&obj)})
}
// StagedOrderRemovePaymentAction implements the interface StagedOrderUpdateAction
type StagedOrderRemovePaymentAction struct {
Payment *PaymentResourceIdentifier `json:"payment"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderRemovePaymentAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderRemovePaymentAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "removePayment", Alias: (*Alias)(&obj)})
}
// StagedOrderSetBillingAddressAction implements the interface StagedOrderUpdateAction
type StagedOrderSetBillingAddressAction struct {
Address *Address `json:"address,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderSetBillingAddressAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderSetBillingAddressAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setBillingAddress", Alias: (*Alias)(&obj)})
}
// StagedOrderSetCountryAction implements the interface StagedOrderUpdateAction
type StagedOrderSetCountryAction struct {
Country string `json:"country,omitempty"`
}
// MarshalJSON override to set the discriminator value
func (obj StagedOrderSetCountryAction) MarshalJSON() ([]byte, error) {
type Alias StagedOrderSetCountryAction
return json.Marshal(struct {
Action string `json:"action"`
*Alias
}{Action: "setCountry", Alias: (*Alias)(&obj)})
}
// StagedOrderSetCustomFieldAction implements the interface StagedOrderUpdateAction
type StagedOrderSetCustomFieldAction struct {