forked from gowebapi/webapi
/
request.go
2238 lines (2054 loc) · 68.3 KB
/
request.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
// Code generated by webidl-bind. DO NOT EDIT.
// +build !js
package request
import js "github.com/gowebapi/webapi/core/js"
import (
"github.com/gowebapi/webapi/dom/domcore"
"github.com/gowebapi/webapi/javascript"
)
// using following types:
// domcore.Event
// domcore.EventHandler
// domcore.EventTarget
// javascript.FrozenArray
// javascript.Object
// javascript.Promise
// javascript.PromiseBool
// javascript.PromiseFinally
// javascript.PromiseVoid
// source idl files:
// payment-request.idl
// promises.idl
// transform files:
// payment-request.go.md
// promises.go.md
// workaround for compiler error
func unused(value interface{}) {
// TODO remove this method
}
type Union struct {
Value js.Value
}
func (u *Union) JSValue() js.Value {
return u.Value
}
func UnionFromJS(value js.Value) *Union {
return &Union{Value: value}
}
// enum: PaymentComplete
type PaymentComplete int
const (
FailPaymentComplete PaymentComplete = iota
SuccessPaymentComplete
UnknownPaymentComplete
)
var paymentCompleteToWasmTable = []string{
"fail", "success", "unknown",
}
var paymentCompleteFromWasmTable = map[string]PaymentComplete{
"fail": FailPaymentComplete, "success": SuccessPaymentComplete, "unknown": UnknownPaymentComplete,
}
// JSValue is converting this enum into a javascript object
func (this *PaymentComplete) JSValue() js.Value {
return js.ValueOf(this.Value())
}
// Value is converting this into javascript defined
// string value
func (this PaymentComplete) Value() string {
idx := int(this)
if idx >= 0 && idx < len(paymentCompleteToWasmTable) {
return paymentCompleteToWasmTable[idx]
}
panic("unknown input value")
}
// PaymentCompleteFromJS is converting a javascript value into
// a PaymentComplete enum value.
func PaymentCompleteFromJS(value js.Value) PaymentComplete {
key := value.String()
conv, ok := paymentCompleteFromWasmTable[key]
if !ok {
panic("unable to convert '" + key + "'")
}
return conv
}
// enum: PaymentShippingType
type PaymentShippingType int
const (
ShippingPaymentShippingType PaymentShippingType = iota
DeliveryPaymentShippingType
PickupPaymentShippingType
)
var paymentShippingTypeToWasmTable = []string{
"shipping", "delivery", "pickup",
}
var paymentShippingTypeFromWasmTable = map[string]PaymentShippingType{
"shipping": ShippingPaymentShippingType, "delivery": DeliveryPaymentShippingType, "pickup": PickupPaymentShippingType,
}
// JSValue is converting this enum into a javascript object
func (this *PaymentShippingType) JSValue() js.Value {
return js.ValueOf(this.Value())
}
// Value is converting this into javascript defined
// string value
func (this PaymentShippingType) Value() string {
idx := int(this)
if idx >= 0 && idx < len(paymentShippingTypeToWasmTable) {
return paymentShippingTypeToWasmTable[idx]
}
panic("unknown input value")
}
// PaymentShippingTypeFromJS is converting a javascript value into
// a PaymentShippingType enum value.
func PaymentShippingTypeFromJS(value js.Value) PaymentShippingType {
key := value.String()
conv, ok := paymentShippingTypeFromWasmTable[key]
if !ok {
panic("unable to convert '" + key + "'")
}
return conv
}
// callback: PromiseTemplateOnFulfilled
type PromisePaymentDetailsUpdateOnFulfilledFunc func(value *PaymentDetailsUpdate)
// PromisePaymentDetailsUpdateOnFulfilled is a javascript function type.
//
// Call Release() when done to release resouces
// allocated to this type.
type PromisePaymentDetailsUpdateOnFulfilled js.Func
func PromisePaymentDetailsUpdateOnFulfilledToJS(callback PromisePaymentDetailsUpdateOnFulfilledFunc) *PromisePaymentDetailsUpdateOnFulfilled {
if callback == nil {
return nil
}
ret := PromisePaymentDetailsUpdateOnFulfilled(js.FuncOf(func(this js.Value, args []js.Value) interface{} {
var (
_p0 *PaymentDetailsUpdate // javascript: PaymentDetailsUpdate value
)
_p0 = PaymentDetailsUpdateFromJS(args[0])
callback(_p0)
// returning no return value
return nil
}))
return &ret
}
func PromisePaymentDetailsUpdateOnFulfilledFromJS(_value js.Value) PromisePaymentDetailsUpdateOnFulfilledFunc {
return func(value *PaymentDetailsUpdate) {
var (
_args [1]interface{}
_end int
)
_p0 := value.JSValue()
_args[0] = _p0
_end++
_value.Invoke(_args[0:_end]...)
return
}
}
// callback: PromiseTemplateOnRejected
type PromisePaymentDetailsUpdateOnRejectedFunc func(reason js.Value)
// PromisePaymentDetailsUpdateOnRejected is a javascript function type.
//
// Call Release() when done to release resouces
// allocated to this type.
type PromisePaymentDetailsUpdateOnRejected js.Func
func PromisePaymentDetailsUpdateOnRejectedToJS(callback PromisePaymentDetailsUpdateOnRejectedFunc) *PromisePaymentDetailsUpdateOnRejected {
if callback == nil {
return nil
}
ret := PromisePaymentDetailsUpdateOnRejected(js.FuncOf(func(this js.Value, args []js.Value) interface{} {
var (
_p0 js.Value // javascript: any reason
)
_p0 = args[0]
callback(_p0)
// returning no return value
return nil
}))
return &ret
}
func PromisePaymentDetailsUpdateOnRejectedFromJS(_value js.Value) PromisePaymentDetailsUpdateOnRejectedFunc {
return func(reason js.Value) {
var (
_args [1]interface{}
_end int
)
_p0 := reason
_args[0] = _p0
_end++
_value.Invoke(_args[0:_end]...)
return
}
}
// callback: PromiseTemplateOnFulfilled
type PromisePaymentResponseOnFulfilledFunc func(value *PaymentResponse)
// PromisePaymentResponseOnFulfilled is a javascript function type.
//
// Call Release() when done to release resouces
// allocated to this type.
type PromisePaymentResponseOnFulfilled js.Func
func PromisePaymentResponseOnFulfilledToJS(callback PromisePaymentResponseOnFulfilledFunc) *PromisePaymentResponseOnFulfilled {
if callback == nil {
return nil
}
ret := PromisePaymentResponseOnFulfilled(js.FuncOf(func(this js.Value, args []js.Value) interface{} {
var (
_p0 *PaymentResponse // javascript: PaymentResponse value
)
_p0 = PaymentResponseFromJS(args[0])
callback(_p0)
// returning no return value
return nil
}))
return &ret
}
func PromisePaymentResponseOnFulfilledFromJS(_value js.Value) PromisePaymentResponseOnFulfilledFunc {
return func(value *PaymentResponse) {
var (
_args [1]interface{}
_end int
)
_p0 := value.JSValue()
_args[0] = _p0
_end++
_value.Invoke(_args[0:_end]...)
return
}
}
// callback: PromiseTemplateOnRejected
type PromisePaymentResponseOnRejectedFunc func(reason js.Value)
// PromisePaymentResponseOnRejected is a javascript function type.
//
// Call Release() when done to release resouces
// allocated to this type.
type PromisePaymentResponseOnRejected js.Func
func PromisePaymentResponseOnRejectedToJS(callback PromisePaymentResponseOnRejectedFunc) *PromisePaymentResponseOnRejected {
if callback == nil {
return nil
}
ret := PromisePaymentResponseOnRejected(js.FuncOf(func(this js.Value, args []js.Value) interface{} {
var (
_p0 js.Value // javascript: any reason
)
_p0 = args[0]
callback(_p0)
// returning no return value
return nil
}))
return &ret
}
func PromisePaymentResponseOnRejectedFromJS(_value js.Value) PromisePaymentResponseOnRejectedFunc {
return func(reason js.Value) {
var (
_args [1]interface{}
_end int
)
_p0 := reason
_args[0] = _p0
_end++
_value.Invoke(_args[0:_end]...)
return
}
}
// dictionary: AddressErrors
type AddressErrors struct {
AddressLine string
City string
Country string
DependentLocality string
Organization string
Phone string
PostalCode string
Recipient string
Region string
SortingCode string
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *AddressErrors) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.AddressLine
out.Set("addressLine", value0)
value1 := _this.City
out.Set("city", value1)
value2 := _this.Country
out.Set("country", value2)
value3 := _this.DependentLocality
out.Set("dependentLocality", value3)
value4 := _this.Organization
out.Set("organization", value4)
value5 := _this.Phone
out.Set("phone", value5)
value6 := _this.PostalCode
out.Set("postalCode", value6)
value7 := _this.Recipient
out.Set("recipient", value7)
value8 := _this.Region
out.Set("region", value8)
value9 := _this.SortingCode
out.Set("sortingCode", value9)
return out
}
// AddressErrorsFromJS is allocating a new
// AddressErrors object and copy all values from
// input javascript object
func AddressErrorsFromJS(value js.Wrapper) *AddressErrors {
input := value.JSValue()
var out AddressErrors
var (
value0 string // javascript: DOMString {addressLine AddressLine addressLine}
value1 string // javascript: DOMString {city City city}
value2 string // javascript: DOMString {country Country country}
value3 string // javascript: DOMString {dependentLocality DependentLocality dependentLocality}
value4 string // javascript: DOMString {organization Organization organization}
value5 string // javascript: DOMString {phone Phone phone}
value6 string // javascript: DOMString {postalCode PostalCode postalCode}
value7 string // javascript: DOMString {recipient Recipient recipient}
value8 string // javascript: DOMString {region Region region}
value9 string // javascript: DOMString {sortingCode SortingCode sortingCode}
)
value0 = (input.Get("addressLine")).String()
out.AddressLine = value0
value1 = (input.Get("city")).String()
out.City = value1
value2 = (input.Get("country")).String()
out.Country = value2
value3 = (input.Get("dependentLocality")).String()
out.DependentLocality = value3
value4 = (input.Get("organization")).String()
out.Organization = value4
value5 = (input.Get("phone")).String()
out.Phone = value5
value6 = (input.Get("postalCode")).String()
out.PostalCode = value6
value7 = (input.Get("recipient")).String()
out.Recipient = value7
value8 = (input.Get("region")).String()
out.Region = value8
value9 = (input.Get("sortingCode")).String()
out.SortingCode = value9
return &out
}
// dictionary: AddressInit
type AddressInit struct {
Country string
AddressLine []string
Region string
City string
DependentLocality string
PostalCode string
SortingCode string
Organization string
Recipient string
Phone string
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *AddressInit) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.Country
out.Set("country", value0)
value1 := js.Global().Get("Array").New(len(_this.AddressLine))
for __idx1, __seq_in1 := range _this.AddressLine {
__seq_out1 := __seq_in1
value1.SetIndex(__idx1, __seq_out1)
}
out.Set("addressLine", value1)
value2 := _this.Region
out.Set("region", value2)
value3 := _this.City
out.Set("city", value3)
value4 := _this.DependentLocality
out.Set("dependentLocality", value4)
value5 := _this.PostalCode
out.Set("postalCode", value5)
value6 := _this.SortingCode
out.Set("sortingCode", value6)
value7 := _this.Organization
out.Set("organization", value7)
value8 := _this.Recipient
out.Set("recipient", value8)
value9 := _this.Phone
out.Set("phone", value9)
return out
}
// AddressInitFromJS is allocating a new
// AddressInit object and copy all values from
// input javascript object
func AddressInitFromJS(value js.Wrapper) *AddressInit {
input := value.JSValue()
var out AddressInit
var (
value0 string // javascript: DOMString {country Country country}
value1 []string // javascript: sequence<DOMString> {addressLine AddressLine addressLine}
value2 string // javascript: DOMString {region Region region}
value3 string // javascript: DOMString {city City city}
value4 string // javascript: DOMString {dependentLocality DependentLocality dependentLocality}
value5 string // javascript: DOMString {postalCode PostalCode postalCode}
value6 string // javascript: DOMString {sortingCode SortingCode sortingCode}
value7 string // javascript: DOMString {organization Organization organization}
value8 string // javascript: DOMString {recipient Recipient recipient}
value9 string // javascript: DOMString {phone Phone phone}
)
value0 = (input.Get("country")).String()
out.Country = value0
__length1 := input.Get("addressLine").Length()
__array1 := make([]string, __length1, __length1)
for __idx1 := 0; __idx1 < __length1; __idx1++ {
var __seq_out1 string
__seq_in1 := input.Get("addressLine").Index(__idx1)
__seq_out1 = (__seq_in1).String()
__array1[__idx1] = __seq_out1
}
value1 = __array1
out.AddressLine = value1
value2 = (input.Get("region")).String()
out.Region = value2
value3 = (input.Get("city")).String()
out.City = value3
value4 = (input.Get("dependentLocality")).String()
out.DependentLocality = value4
value5 = (input.Get("postalCode")).String()
out.PostalCode = value5
value6 = (input.Get("sortingCode")).String()
out.SortingCode = value6
value7 = (input.Get("organization")).String()
out.Organization = value7
value8 = (input.Get("recipient")).String()
out.Recipient = value8
value9 = (input.Get("phone")).String()
out.Phone = value9
return &out
}
// dictionary: MerchantValidationEventInit
type MerchantValidationEventInit struct {
Bubbles bool
Cancelable bool
Composed bool
MethodName string
ValidationURL string
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *MerchantValidationEventInit) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.Bubbles
out.Set("bubbles", value0)
value1 := _this.Cancelable
out.Set("cancelable", value1)
value2 := _this.Composed
out.Set("composed", value2)
value3 := _this.MethodName
out.Set("methodName", value3)
value4 := _this.ValidationURL
out.Set("validationURL", value4)
return out
}
// MerchantValidationEventInitFromJS is allocating a new
// MerchantValidationEventInit object and copy all values from
// input javascript object
func MerchantValidationEventInitFromJS(value js.Wrapper) *MerchantValidationEventInit {
input := value.JSValue()
var out MerchantValidationEventInit
var (
value0 bool // javascript: boolean {bubbles Bubbles bubbles}
value1 bool // javascript: boolean {cancelable Cancelable cancelable}
value2 bool // javascript: boolean {composed Composed composed}
value3 string // javascript: DOMString {methodName MethodName methodName}
value4 string // javascript: USVString {validationURL ValidationURL validationURL}
)
value0 = (input.Get("bubbles")).Bool()
out.Bubbles = value0
value1 = (input.Get("cancelable")).Bool()
out.Cancelable = value1
value2 = (input.Get("composed")).Bool()
out.Composed = value2
value3 = (input.Get("methodName")).String()
out.MethodName = value3
value4 = (input.Get("validationURL")).String()
out.ValidationURL = value4
return &out
}
// dictionary: PayerErrors
type PayerErrors struct {
Email string
Name string
Phone string
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *PayerErrors) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.Email
out.Set("email", value0)
value1 := _this.Name
out.Set("name", value1)
value2 := _this.Phone
out.Set("phone", value2)
return out
}
// PayerErrorsFromJS is allocating a new
// PayerErrors object and copy all values from
// input javascript object
func PayerErrorsFromJS(value js.Wrapper) *PayerErrors {
input := value.JSValue()
var out PayerErrors
var (
value0 string // javascript: DOMString {email Email email}
value1 string // javascript: DOMString {name Name name}
value2 string // javascript: DOMString {phone Phone phone}
)
value0 = (input.Get("email")).String()
out.Email = value0
value1 = (input.Get("name")).String()
out.Name = value1
value2 = (input.Get("phone")).String()
out.Phone = value2
return &out
}
// dictionary: PaymentCurrencyAmount
type PaymentCurrencyAmount struct {
Currency string
Value string
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *PaymentCurrencyAmount) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.Currency
out.Set("currency", value0)
value1 := _this.Value
out.Set("value", value1)
return out
}
// PaymentCurrencyAmountFromJS is allocating a new
// PaymentCurrencyAmount object and copy all values from
// input javascript object
func PaymentCurrencyAmountFromJS(value js.Wrapper) *PaymentCurrencyAmount {
input := value.JSValue()
var out PaymentCurrencyAmount
var (
value0 string // javascript: DOMString {currency Currency currency}
value1 string // javascript: DOMString {value Value value}
)
value0 = (input.Get("currency")).String()
out.Currency = value0
value1 = (input.Get("value")).String()
out.Value = value1
return &out
}
// dictionary: PaymentDetailsBase
type PaymentDetailsBase struct {
DisplayItems []*PaymentItem
ShippingOptions []*PaymentShippingOption
Modifiers []*PaymentDetailsModifier
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *PaymentDetailsBase) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := js.Global().Get("Array").New(len(_this.DisplayItems))
for __idx0, __seq_in0 := range _this.DisplayItems {
__seq_out0 := __seq_in0.JSValue()
value0.SetIndex(__idx0, __seq_out0)
}
out.Set("displayItems", value0)
value1 := js.Global().Get("Array").New(len(_this.ShippingOptions))
for __idx1, __seq_in1 := range _this.ShippingOptions {
__seq_out1 := __seq_in1.JSValue()
value1.SetIndex(__idx1, __seq_out1)
}
out.Set("shippingOptions", value1)
value2 := js.Global().Get("Array").New(len(_this.Modifiers))
for __idx2, __seq_in2 := range _this.Modifiers {
__seq_out2 := __seq_in2.JSValue()
value2.SetIndex(__idx2, __seq_out2)
}
out.Set("modifiers", value2)
return out
}
// PaymentDetailsBaseFromJS is allocating a new
// PaymentDetailsBase object and copy all values from
// input javascript object
func PaymentDetailsBaseFromJS(value js.Wrapper) *PaymentDetailsBase {
input := value.JSValue()
var out PaymentDetailsBase
var (
value0 []*PaymentItem // javascript: sequence<PaymentItem> {displayItems DisplayItems displayItems}
value1 []*PaymentShippingOption // javascript: sequence<PaymentShippingOption> {shippingOptions ShippingOptions shippingOptions}
value2 []*PaymentDetailsModifier // javascript: sequence<PaymentDetailsModifier> {modifiers Modifiers modifiers}
)
__length0 := input.Get("displayItems").Length()
__array0 := make([]*PaymentItem, __length0, __length0)
for __idx0 := 0; __idx0 < __length0; __idx0++ {
var __seq_out0 *PaymentItem
__seq_in0 := input.Get("displayItems").Index(__idx0)
__seq_out0 = PaymentItemFromJS(__seq_in0)
__array0[__idx0] = __seq_out0
}
value0 = __array0
out.DisplayItems = value0
__length1 := input.Get("shippingOptions").Length()
__array1 := make([]*PaymentShippingOption, __length1, __length1)
for __idx1 := 0; __idx1 < __length1; __idx1++ {
var __seq_out1 *PaymentShippingOption
__seq_in1 := input.Get("shippingOptions").Index(__idx1)
__seq_out1 = PaymentShippingOptionFromJS(__seq_in1)
__array1[__idx1] = __seq_out1
}
value1 = __array1
out.ShippingOptions = value1
__length2 := input.Get("modifiers").Length()
__array2 := make([]*PaymentDetailsModifier, __length2, __length2)
for __idx2 := 0; __idx2 < __length2; __idx2++ {
var __seq_out2 *PaymentDetailsModifier
__seq_in2 := input.Get("modifiers").Index(__idx2)
__seq_out2 = PaymentDetailsModifierFromJS(__seq_in2)
__array2[__idx2] = __seq_out2
}
value2 = __array2
out.Modifiers = value2
return &out
}
// dictionary: PaymentDetailsInit
type PaymentDetailsInit struct {
DisplayItems []*PaymentItem
ShippingOptions []*PaymentShippingOption
Modifiers []*PaymentDetailsModifier
Id string
Total *PaymentItem
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *PaymentDetailsInit) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := js.Global().Get("Array").New(len(_this.DisplayItems))
for __idx0, __seq_in0 := range _this.DisplayItems {
__seq_out0 := __seq_in0.JSValue()
value0.SetIndex(__idx0, __seq_out0)
}
out.Set("displayItems", value0)
value1 := js.Global().Get("Array").New(len(_this.ShippingOptions))
for __idx1, __seq_in1 := range _this.ShippingOptions {
__seq_out1 := __seq_in1.JSValue()
value1.SetIndex(__idx1, __seq_out1)
}
out.Set("shippingOptions", value1)
value2 := js.Global().Get("Array").New(len(_this.Modifiers))
for __idx2, __seq_in2 := range _this.Modifiers {
__seq_out2 := __seq_in2.JSValue()
value2.SetIndex(__idx2, __seq_out2)
}
out.Set("modifiers", value2)
value3 := _this.Id
out.Set("id", value3)
value4 := _this.Total.JSValue()
out.Set("total", value4)
return out
}
// PaymentDetailsInitFromJS is allocating a new
// PaymentDetailsInit object and copy all values from
// input javascript object
func PaymentDetailsInitFromJS(value js.Wrapper) *PaymentDetailsInit {
input := value.JSValue()
var out PaymentDetailsInit
var (
value0 []*PaymentItem // javascript: sequence<PaymentItem> {displayItems DisplayItems displayItems}
value1 []*PaymentShippingOption // javascript: sequence<PaymentShippingOption> {shippingOptions ShippingOptions shippingOptions}
value2 []*PaymentDetailsModifier // javascript: sequence<PaymentDetailsModifier> {modifiers Modifiers modifiers}
value3 string // javascript: DOMString {id Id id}
value4 *PaymentItem // javascript: PaymentItem {total Total total}
)
__length0 := input.Get("displayItems").Length()
__array0 := make([]*PaymentItem, __length0, __length0)
for __idx0 := 0; __idx0 < __length0; __idx0++ {
var __seq_out0 *PaymentItem
__seq_in0 := input.Get("displayItems").Index(__idx0)
__seq_out0 = PaymentItemFromJS(__seq_in0)
__array0[__idx0] = __seq_out0
}
value0 = __array0
out.DisplayItems = value0
__length1 := input.Get("shippingOptions").Length()
__array1 := make([]*PaymentShippingOption, __length1, __length1)
for __idx1 := 0; __idx1 < __length1; __idx1++ {
var __seq_out1 *PaymentShippingOption
__seq_in1 := input.Get("shippingOptions").Index(__idx1)
__seq_out1 = PaymentShippingOptionFromJS(__seq_in1)
__array1[__idx1] = __seq_out1
}
value1 = __array1
out.ShippingOptions = value1
__length2 := input.Get("modifiers").Length()
__array2 := make([]*PaymentDetailsModifier, __length2, __length2)
for __idx2 := 0; __idx2 < __length2; __idx2++ {
var __seq_out2 *PaymentDetailsModifier
__seq_in2 := input.Get("modifiers").Index(__idx2)
__seq_out2 = PaymentDetailsModifierFromJS(__seq_in2)
__array2[__idx2] = __seq_out2
}
value2 = __array2
out.Modifiers = value2
value3 = (input.Get("id")).String()
out.Id = value3
value4 = PaymentItemFromJS(input.Get("total"))
out.Total = value4
return &out
}
// dictionary: PaymentDetailsModifier
type PaymentDetailsModifier struct {
SupportedMethods string
Total *PaymentItem
AdditionalDisplayItems []*PaymentItem
Data *javascript.Object
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *PaymentDetailsModifier) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.SupportedMethods
out.Set("supportedMethods", value0)
value1 := _this.Total.JSValue()
out.Set("total", value1)
value2 := js.Global().Get("Array").New(len(_this.AdditionalDisplayItems))
for __idx2, __seq_in2 := range _this.AdditionalDisplayItems {
__seq_out2 := __seq_in2.JSValue()
value2.SetIndex(__idx2, __seq_out2)
}
out.Set("additionalDisplayItems", value2)
value3 := _this.Data.JSValue()
out.Set("data", value3)
return out
}
// PaymentDetailsModifierFromJS is allocating a new
// PaymentDetailsModifier object and copy all values from
// input javascript object
func PaymentDetailsModifierFromJS(value js.Wrapper) *PaymentDetailsModifier {
input := value.JSValue()
var out PaymentDetailsModifier
var (
value0 string // javascript: DOMString {supportedMethods SupportedMethods supportedMethods}
value1 *PaymentItem // javascript: PaymentItem {total Total total}
value2 []*PaymentItem // javascript: sequence<PaymentItem> {additionalDisplayItems AdditionalDisplayItems additionalDisplayItems}
value3 *javascript.Object // javascript: object {data Data data}
)
value0 = (input.Get("supportedMethods")).String()
out.SupportedMethods = value0
value1 = PaymentItemFromJS(input.Get("total"))
out.Total = value1
__length2 := input.Get("additionalDisplayItems").Length()
__array2 := make([]*PaymentItem, __length2, __length2)
for __idx2 := 0; __idx2 < __length2; __idx2++ {
var __seq_out2 *PaymentItem
__seq_in2 := input.Get("additionalDisplayItems").Index(__idx2)
__seq_out2 = PaymentItemFromJS(__seq_in2)
__array2[__idx2] = __seq_out2
}
value2 = __array2
out.AdditionalDisplayItems = value2
value3 = javascript.ObjectFromJS(input.Get("data"))
out.Data = value3
return &out
}
// dictionary: PaymentDetailsUpdate
type PaymentDetailsUpdate struct {
DisplayItems []*PaymentItem
ShippingOptions []*PaymentShippingOption
Modifiers []*PaymentDetailsModifier
Error string
Total *PaymentItem
ShippingAddressErrors *AddressErrors
PayerErrors *PayerErrors
PaymentMethodErrors *javascript.Object
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *PaymentDetailsUpdate) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := js.Global().Get("Array").New(len(_this.DisplayItems))
for __idx0, __seq_in0 := range _this.DisplayItems {
__seq_out0 := __seq_in0.JSValue()
value0.SetIndex(__idx0, __seq_out0)
}
out.Set("displayItems", value0)
value1 := js.Global().Get("Array").New(len(_this.ShippingOptions))
for __idx1, __seq_in1 := range _this.ShippingOptions {
__seq_out1 := __seq_in1.JSValue()
value1.SetIndex(__idx1, __seq_out1)
}
out.Set("shippingOptions", value1)
value2 := js.Global().Get("Array").New(len(_this.Modifiers))
for __idx2, __seq_in2 := range _this.Modifiers {
__seq_out2 := __seq_in2.JSValue()
value2.SetIndex(__idx2, __seq_out2)
}
out.Set("modifiers", value2)
value3 := _this.Error
out.Set("error", value3)
value4 := _this.Total.JSValue()
out.Set("total", value4)
value5 := _this.ShippingAddressErrors.JSValue()
out.Set("shippingAddressErrors", value5)
value6 := _this.PayerErrors.JSValue()
out.Set("payerErrors", value6)
value7 := _this.PaymentMethodErrors.JSValue()
out.Set("paymentMethodErrors", value7)
return out
}
// PaymentDetailsUpdateFromJS is allocating a new
// PaymentDetailsUpdate object and copy all values from
// input javascript object
func PaymentDetailsUpdateFromJS(value js.Wrapper) *PaymentDetailsUpdate {
input := value.JSValue()
var out PaymentDetailsUpdate
var (
value0 []*PaymentItem // javascript: sequence<PaymentItem> {displayItems DisplayItems displayItems}
value1 []*PaymentShippingOption // javascript: sequence<PaymentShippingOption> {shippingOptions ShippingOptions shippingOptions}
value2 []*PaymentDetailsModifier // javascript: sequence<PaymentDetailsModifier> {modifiers Modifiers modifiers}
value3 string // javascript: DOMString {error Error _error}
value4 *PaymentItem // javascript: PaymentItem {total Total total}
value5 *AddressErrors // javascript: AddressErrors {shippingAddressErrors ShippingAddressErrors shippingAddressErrors}
value6 *PayerErrors // javascript: PayerErrors {payerErrors PayerErrors payerErrors}
value7 *javascript.Object // javascript: object {paymentMethodErrors PaymentMethodErrors paymentMethodErrors}
)
__length0 := input.Get("displayItems").Length()
__array0 := make([]*PaymentItem, __length0, __length0)
for __idx0 := 0; __idx0 < __length0; __idx0++ {
var __seq_out0 *PaymentItem
__seq_in0 := input.Get("displayItems").Index(__idx0)
__seq_out0 = PaymentItemFromJS(__seq_in0)
__array0[__idx0] = __seq_out0
}
value0 = __array0
out.DisplayItems = value0
__length1 := input.Get("shippingOptions").Length()
__array1 := make([]*PaymentShippingOption, __length1, __length1)
for __idx1 := 0; __idx1 < __length1; __idx1++ {
var __seq_out1 *PaymentShippingOption
__seq_in1 := input.Get("shippingOptions").Index(__idx1)
__seq_out1 = PaymentShippingOptionFromJS(__seq_in1)
__array1[__idx1] = __seq_out1
}
value1 = __array1
out.ShippingOptions = value1
__length2 := input.Get("modifiers").Length()
__array2 := make([]*PaymentDetailsModifier, __length2, __length2)
for __idx2 := 0; __idx2 < __length2; __idx2++ {
var __seq_out2 *PaymentDetailsModifier
__seq_in2 := input.Get("modifiers").Index(__idx2)
__seq_out2 = PaymentDetailsModifierFromJS(__seq_in2)
__array2[__idx2] = __seq_out2
}
value2 = __array2
out.Modifiers = value2
value3 = (input.Get("error")).String()
out.Error = value3
value4 = PaymentItemFromJS(input.Get("total"))
out.Total = value4
value5 = AddressErrorsFromJS(input.Get("shippingAddressErrors"))
out.ShippingAddressErrors = value5
value6 = PayerErrorsFromJS(input.Get("payerErrors"))
out.PayerErrors = value6
value7 = javascript.ObjectFromJS(input.Get("paymentMethodErrors"))
out.PaymentMethodErrors = value7
return &out
}
// dictionary: PaymentItem
type PaymentItem struct {
Label string
Amount *PaymentCurrencyAmount
Pending bool
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *PaymentItem) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.Label
out.Set("label", value0)
value1 := _this.Amount.JSValue()
out.Set("amount", value1)
value2 := _this.Pending
out.Set("pending", value2)
return out
}
// PaymentItemFromJS is allocating a new
// PaymentItem object and copy all values from
// input javascript object
func PaymentItemFromJS(value js.Wrapper) *PaymentItem {
input := value.JSValue()
var out PaymentItem
var (
value0 string // javascript: DOMString {label Label label}
value1 *PaymentCurrencyAmount // javascript: PaymentCurrencyAmount {amount Amount amount}
value2 bool // javascript: boolean {pending Pending pending}
)
value0 = (input.Get("label")).String()
out.Label = value0
value1 = PaymentCurrencyAmountFromJS(input.Get("amount"))
out.Amount = value1
value2 = (input.Get("pending")).Bool()
out.Pending = value2
return &out
}
// dictionary: PaymentMethodChangeEventInit
type PaymentMethodChangeEventInit struct {
Bubbles bool
Cancelable bool
Composed bool
MethodName string
MethodDetails *javascript.Object
}
// JSValue is allocating a new javasript object and copy
// all values
func (_this *PaymentMethodChangeEventInit) JSValue() js.Value {
out := js.Global().Get("Object").New()
value0 := _this.Bubbles
out.Set("bubbles", value0)
value1 := _this.Cancelable
out.Set("cancelable", value1)
value2 := _this.Composed
out.Set("composed", value2)
value3 := _this.MethodName
out.Set("methodName", value3)
value4 := _this.MethodDetails.JSValue()
out.Set("methodDetails", value4)
return out
}
// PaymentMethodChangeEventInitFromJS is allocating a new
// PaymentMethodChangeEventInit object and copy all values from
// input javascript object
func PaymentMethodChangeEventInitFromJS(value js.Wrapper) *PaymentMethodChangeEventInit {
input := value.JSValue()
var out PaymentMethodChangeEventInit
var (
value0 bool // javascript: boolean {bubbles Bubbles bubbles}
value1 bool // javascript: boolean {cancelable Cancelable cancelable}