ultracart_api 4.1.12 → 4.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/docs/AffiliateApi.md +123 -167
- data/docs/AutoOrderApi.md +1250 -903
- data/docs/ChannelPartnerApi.md +1678 -1121
- data/docs/ChargebackApi.md +297 -405
- data/docs/CheckoutApi.md +1622 -1424
- data/docs/Conversation.md +4 -0
- data/docs/ConversationApi.md +4820 -6315
- data/docs/CouponApi.md +1522 -1443
- data/docs/CustomerApi.md +2570 -1845
- data/docs/DatawarehouseApi.md +555 -723
- data/docs/FulfillmentApi.md +567 -441
- data/docs/GiftCertificateApi.md +617 -598
- data/docs/IntegrationLogApi.md +290 -385
- data/docs/ItemApi.md +2174 -1746
- data/docs/ItemRestriction.md +2 -0
- data/docs/OauthApi.md +203 -163
- data/docs/OrderApi.md +2774 -2177
- data/docs/SsoApi.md +223 -288
- data/docs/StorefrontApi.md +9692 -12967
- data/docs/TaxApi.md +1541 -2017
- data/docs/UserApi.md +606 -790
- data/docs/WebhookApi.md +787 -628
- data/docs/WorkflowApi.md +666 -879
- data/lib/ultracart_api/models/conversation.rb +21 -1
- data/lib/ultracart_api/models/item_restriction.rb +11 -1
- data/lib/ultracart_api/version.rb +1 -1
- metadata +2 -2
data/docs/OrderApi.md
CHANGED
@@ -1,2177 +1,2774 @@
|
|
1
|
-
# UltracartClient::OrderApi
|
2
|
-
|
3
|
-
All URIs are relative to *https://secure.ultracart.com/rest/v2*
|
4
|
-
|
5
|
-
| Method | HTTP request | Description |
|
6
|
-
| ------ | ------------ | ----------- |
|
7
|
-
| [**adjust_order_total**](OrderApi.md#adjust_order_total) | **POST** /order/orders/{order_id}/adjust_order_total/{desired_total} | Adjusts an order total |
|
8
|
-
| [**cancel_order**](OrderApi.md#cancel_order) | **POST** /order/orders/{order_id}/cancel | Cancel an order |
|
9
|
-
| [**delete_order**](OrderApi.md#delete_order) | **DELETE** /order/orders/{order_id} | Delete an order |
|
10
|
-
| [**duplicate_order**](OrderApi.md#duplicate_order) | **POST** /order/orders/{order_id}/duplicate | Duplicate an order |
|
11
|
-
| [**format**](OrderApi.md#format) | **POST** /order/orders/{order_id}/format | Format order |
|
12
|
-
| [**generate_invoice**](OrderApi.md#generate_invoice) | **GET** /order/orders/{order_id}/invoice | Generate an invoice for this order. |
|
13
|
-
| [**generate_order_token**](OrderApi.md#generate_order_token) | **GET** /order/orders/token/{order_id} | Generate an order token for a given order id |
|
14
|
-
| [**generate_packing_slip_all_dc**](OrderApi.md#generate_packing_slip_all_dc) | **GET** /order/orders/{order_id}/packing_slip | Generate a packing slip for this order across all distribution centers. |
|
15
|
-
| [**generate_packing_slip_specific_dc**](OrderApi.md#generate_packing_slip_specific_dc) | **GET** /order/orders/{order_id}/packing_slip/{distribution_center_code} | Generate a packing slip for this order for the given distribution center. |
|
16
|
-
| [**get_accounts_receivable_retry_config**](OrderApi.md#get_accounts_receivable_retry_config) | **GET** /order/accountsReceivableRetryConfig | Retrieve A/R Retry Configuration |
|
17
|
-
| [**get_accounts_receivable_retry_stats**](OrderApi.md#get_accounts_receivable_retry_stats) | **GET** /order/accountsReceivableRetryConfig/stats | Retrieve A/R Retry Statistics |
|
18
|
-
| [**get_order**](OrderApi.md#get_order) | **GET** /order/orders/{order_id} | Retrieve an order |
|
19
|
-
| [**get_order_by_token**](OrderApi.md#get_order_by_token) | **POST** /order/orders/token | Retrieve an order using a token |
|
20
|
-
| [**get_order_edi_documents**](OrderApi.md#get_order_edi_documents) | **GET** /order/orders/{order_id}/edi | Retrieve EDI documents associated with this order. |
|
21
|
-
| [**get_orders**](OrderApi.md#get_orders) | **GET** /order/orders | Retrieve orders |
|
22
|
-
| [**get_orders_batch**](OrderApi.md#get_orders_batch) | **POST** /order/orders/batch | Retrieve order batch |
|
23
|
-
| [**get_orders_by_query**](OrderApi.md#get_orders_by_query) | **POST** /order/orders/query | Retrieve orders by query |
|
24
|
-
| [**insert_order**](OrderApi.md#insert_order) | **POST** /order/orders | Insert an order |
|
25
|
-
| [**is_refundable_order**](OrderApi.md#is_refundable_order) | **GET** /order/orders/{order_id}/refundable | Determine if an order can be refunded |
|
26
|
-
| [**process_payment**](OrderApi.md#process_payment) | **POST** /order/orders/{order_id}/process_payment | Process payment |
|
27
|
-
| [**refund_order**](OrderApi.md#refund_order) | **PUT** /order/orders/{order_id}/refund | Refund an order |
|
28
|
-
| [**refund_order_completely**](OrderApi.md#refund_order_completely) | **PUT** /order/orders/{order_id}/refund_completely | Refund an order completely |
|
29
|
-
| [**replacement**](OrderApi.md#replacement) | **POST** /order/orders/{order_id}/replacement | Replacement order |
|
30
|
-
| [**resend_receipt**](OrderApi.md#resend_receipt) | **POST** /order/orders/{order_id}/resend_receipt | Resend receipt |
|
31
|
-
| [**resend_shipment_confirmation**](OrderApi.md#resend_shipment_confirmation) | **POST** /order/orders/{order_id}/resend_shipment_confirmation | Resend shipment confirmation |
|
32
|
-
| [**update_accounts_receivable_retry_config**](OrderApi.md#update_accounts_receivable_retry_config) | **POST** /order/accountsReceivableRetryConfig | Update A/R Retry Configuration |
|
33
|
-
| [**update_order**](OrderApi.md#update_order) | **PUT** /order/orders/{order_id} | Update an order |
|
34
|
-
| [**validate_order**](OrderApi.md#validate_order) | **POST** /order/validate | Validate |
|
35
|
-
|
36
|
-
|
37
|
-
## adjust_order_total
|
38
|
-
|
39
|
-
> <BaseResponse> adjust_order_total(order_id, desired_total)
|
40
|
-
|
41
|
-
Adjusts an order total
|
42
|
-
|
43
|
-
Adjusts an order total. Adjusts individual items appropriately and considers taxes. Desired total should be provided in the same currency as the order and must be less than the current total and greater than zero. This call will change the order total. It returns true if the desired total is achieved. If the goal seeking algorithm falls short (usually by pennies), this method returns back false. View the merchant notes for the order for further details.
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
puts "
|
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
|
-
p
|
361
|
-
rescue UltracartClient::ApiError => e
|
362
|
-
puts "Error when calling OrderApi->
|
363
|
-
end
|
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
|
-
```ruby
|
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
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
data
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
Retrieve
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
#
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
#
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
[
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
#
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
###
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
order_id =
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
#
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
#
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
#
|
2049
|
-
#
|
2050
|
-
#
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
#### Using the
|
2069
|
-
|
2070
|
-
This returns an Array which contains the response data, status code and headers.
|
2071
|
-
|
2072
|
-
> <Array(<
|
2073
|
-
|
2074
|
-
```ruby
|
2075
|
-
begin
|
2076
|
-
#
|
2077
|
-
data, status_code, headers = api_instance.
|
2078
|
-
p status_code # => 2xx
|
2079
|
-
p headers # => { ... }
|
2080
|
-
p data # => <
|
2081
|
-
rescue UltracartClient::ApiError => e
|
2082
|
-
puts "Error when calling OrderApi->
|
2083
|
-
end
|
2084
|
-
```
|
2085
|
-
|
2086
|
-
### Parameters
|
2087
|
-
|
2088
|
-
| Name | Type | Description | Notes |
|
2089
|
-
| ---- | ---- | ----------- | ----- |
|
2090
|
-
| **order_id** | **String** | The order id to
|
2091
|
-
| **
|
2092
|
-
|
2093
|
-
|
2094
|
-
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2098
|
-
|
2099
|
-
|
2100
|
-
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
- **
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
### Examples
|
2117
|
-
|
2118
|
-
```ruby
|
2119
|
-
require '
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2125
|
-
#
|
2126
|
-
#
|
2127
|
-
#
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2168
|
-
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
1
|
+
# UltracartClient::OrderApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://secure.ultracart.com/rest/v2*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**adjust_order_total**](OrderApi.md#adjust_order_total) | **POST** /order/orders/{order_id}/adjust_order_total/{desired_total} | Adjusts an order total |
|
8
|
+
| [**cancel_order**](OrderApi.md#cancel_order) | **POST** /order/orders/{order_id}/cancel | Cancel an order |
|
9
|
+
| [**delete_order**](OrderApi.md#delete_order) | **DELETE** /order/orders/{order_id} | Delete an order |
|
10
|
+
| [**duplicate_order**](OrderApi.md#duplicate_order) | **POST** /order/orders/{order_id}/duplicate | Duplicate an order |
|
11
|
+
| [**format**](OrderApi.md#format) | **POST** /order/orders/{order_id}/format | Format order |
|
12
|
+
| [**generate_invoice**](OrderApi.md#generate_invoice) | **GET** /order/orders/{order_id}/invoice | Generate an invoice for this order. |
|
13
|
+
| [**generate_order_token**](OrderApi.md#generate_order_token) | **GET** /order/orders/token/{order_id} | Generate an order token for a given order id |
|
14
|
+
| [**generate_packing_slip_all_dc**](OrderApi.md#generate_packing_slip_all_dc) | **GET** /order/orders/{order_id}/packing_slip | Generate a packing slip for this order across all distribution centers. |
|
15
|
+
| [**generate_packing_slip_specific_dc**](OrderApi.md#generate_packing_slip_specific_dc) | **GET** /order/orders/{order_id}/packing_slip/{distribution_center_code} | Generate a packing slip for this order for the given distribution center. |
|
16
|
+
| [**get_accounts_receivable_retry_config**](OrderApi.md#get_accounts_receivable_retry_config) | **GET** /order/accountsReceivableRetryConfig | Retrieve A/R Retry Configuration |
|
17
|
+
| [**get_accounts_receivable_retry_stats**](OrderApi.md#get_accounts_receivable_retry_stats) | **GET** /order/accountsReceivableRetryConfig/stats | Retrieve A/R Retry Statistics |
|
18
|
+
| [**get_order**](OrderApi.md#get_order) | **GET** /order/orders/{order_id} | Retrieve an order |
|
19
|
+
| [**get_order_by_token**](OrderApi.md#get_order_by_token) | **POST** /order/orders/token | Retrieve an order using a token |
|
20
|
+
| [**get_order_edi_documents**](OrderApi.md#get_order_edi_documents) | **GET** /order/orders/{order_id}/edi | Retrieve EDI documents associated with this order. |
|
21
|
+
| [**get_orders**](OrderApi.md#get_orders) | **GET** /order/orders | Retrieve orders |
|
22
|
+
| [**get_orders_batch**](OrderApi.md#get_orders_batch) | **POST** /order/orders/batch | Retrieve order batch |
|
23
|
+
| [**get_orders_by_query**](OrderApi.md#get_orders_by_query) | **POST** /order/orders/query | Retrieve orders by query |
|
24
|
+
| [**insert_order**](OrderApi.md#insert_order) | **POST** /order/orders | Insert an order |
|
25
|
+
| [**is_refundable_order**](OrderApi.md#is_refundable_order) | **GET** /order/orders/{order_id}/refundable | Determine if an order can be refunded |
|
26
|
+
| [**process_payment**](OrderApi.md#process_payment) | **POST** /order/orders/{order_id}/process_payment | Process payment |
|
27
|
+
| [**refund_order**](OrderApi.md#refund_order) | **PUT** /order/orders/{order_id}/refund | Refund an order |
|
28
|
+
| [**refund_order_completely**](OrderApi.md#refund_order_completely) | **PUT** /order/orders/{order_id}/refund_completely | Refund an order completely |
|
29
|
+
| [**replacement**](OrderApi.md#replacement) | **POST** /order/orders/{order_id}/replacement | Replacement order |
|
30
|
+
| [**resend_receipt**](OrderApi.md#resend_receipt) | **POST** /order/orders/{order_id}/resend_receipt | Resend receipt |
|
31
|
+
| [**resend_shipment_confirmation**](OrderApi.md#resend_shipment_confirmation) | **POST** /order/orders/{order_id}/resend_shipment_confirmation | Resend shipment confirmation |
|
32
|
+
| [**update_accounts_receivable_retry_config**](OrderApi.md#update_accounts_receivable_retry_config) | **POST** /order/accountsReceivableRetryConfig | Update A/R Retry Configuration |
|
33
|
+
| [**update_order**](OrderApi.md#update_order) | **PUT** /order/orders/{order_id} | Update an order |
|
34
|
+
| [**validate_order**](OrderApi.md#validate_order) | **POST** /order/validate | Validate |
|
35
|
+
|
36
|
+
|
37
|
+
## adjust_order_total
|
38
|
+
|
39
|
+
> <BaseResponse> adjust_order_total(order_id, desired_total)
|
40
|
+
|
41
|
+
Adjusts an order total
|
42
|
+
|
43
|
+
Adjusts an order total. Adjusts individual items appropriately and considers taxes. Desired total should be provided in the same currency as the order and must be less than the current total and greater than zero. This call will change the order total. It returns true if the desired total is achieved. If the goal seeking algorithm falls short (usually by pennies), this method returns back false. View the merchant notes for the order for further details.
|
44
|
+
|
45
|
+
|
46
|
+
### Examples
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
# OrderApi.adjust_order_total() takes a desired order total and performs goal-seeking to adjust all items and taxes
|
50
|
+
# appropriately. This method was created for merchants dealing with Medicare and Medicaid. When selling their
|
51
|
+
# medical devices, they would often run into limits approved by Medicare. As such, they needed to adjust the
|
52
|
+
# order total to match the approved amount. This is a convenience method to adjust individual items and their
|
53
|
+
# taxes to match the desired total.
|
54
|
+
|
55
|
+
require_relative '../constants'
|
56
|
+
require 'ultracart_api'
|
57
|
+
|
58
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
59
|
+
|
60
|
+
order_id = 'DEMO-0009104390'
|
61
|
+
desired_total = '21.99'
|
62
|
+
api_response = order_api.adjust_order_total(order_id, desired_total)
|
63
|
+
|
64
|
+
if api_response.get_error != nil
|
65
|
+
# Log the error messages
|
66
|
+
puts "Developer Message: #{api_response.get_error.get_developer_message}"
|
67
|
+
puts "User Message: #{api_response.get_error.get_user_message}"
|
68
|
+
puts 'Order could not be adjusted. See ruby error log.'
|
69
|
+
exit
|
70
|
+
end
|
71
|
+
|
72
|
+
if api_response.get_success
|
73
|
+
puts 'Order was adjusted successfully. Use get_order() to retrieve the order if needed.'
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
77
|
+
|
78
|
+
#### Using the adjust_order_total_with_http_info variant
|
79
|
+
|
80
|
+
This returns an Array which contains the response data, status code and headers.
|
81
|
+
|
82
|
+
> <Array(<BaseResponse>, Integer, Hash)> adjust_order_total_with_http_info(order_id, desired_total)
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
begin
|
86
|
+
# Adjusts an order total
|
87
|
+
data, status_code, headers = api_instance.adjust_order_total_with_http_info(order_id, desired_total)
|
88
|
+
p status_code # => 2xx
|
89
|
+
p headers # => { ... }
|
90
|
+
p data # => <BaseResponse>
|
91
|
+
rescue UltracartClient::ApiError => e
|
92
|
+
puts "Error when calling OrderApi->adjust_order_total_with_http_info: #{e}"
|
93
|
+
end
|
94
|
+
```
|
95
|
+
|
96
|
+
### Parameters
|
97
|
+
|
98
|
+
| Name | Type | Description | Notes |
|
99
|
+
| ---- | ---- | ----------- | ----- |
|
100
|
+
| **order_id** | **String** | The order id to cancel. | |
|
101
|
+
| **desired_total** | **String** | The desired total with no formatting. example 123.45 | |
|
102
|
+
|
103
|
+
### Return type
|
104
|
+
|
105
|
+
[**BaseResponse**](BaseResponse.md)
|
106
|
+
|
107
|
+
### Authorization
|
108
|
+
|
109
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
110
|
+
|
111
|
+
### HTTP request headers
|
112
|
+
|
113
|
+
- **Content-Type**: Not defined
|
114
|
+
- **Accept**: application/json
|
115
|
+
|
116
|
+
|
117
|
+
## cancel_order
|
118
|
+
|
119
|
+
> <BaseResponse> cancel_order(order_id, opts)
|
120
|
+
|
121
|
+
Cancel an order
|
122
|
+
|
123
|
+
Cancel an order on the UltraCart account. If the success flag is false, then consult the error message for why it failed.
|
124
|
+
|
125
|
+
|
126
|
+
### Examples
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
# OrderApi.cancel_order() will do just that. It will cancel an order by rejecting it.
|
130
|
+
# However, the following restrictions apply:
|
131
|
+
# 1) If the order is already completed, this call will fail.
|
132
|
+
# 2) If the order has already been rejected, this call will fail.
|
133
|
+
# 3) If the order has already been transmitted to a fulfillment center, this call will fail.
|
134
|
+
# 4) If the order is queued for transmission to a distribution center, this call will fail.
|
135
|
+
|
136
|
+
require_relative '../constants'
|
137
|
+
require 'ultracart_api'
|
138
|
+
|
139
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
140
|
+
|
141
|
+
order_id = 'DEMO-0009104390'
|
142
|
+
api_response = order_api.cancel_order(order_id)
|
143
|
+
|
144
|
+
if api_response.get_error != nil
|
145
|
+
# Log the error messages
|
146
|
+
puts "Developer Message: #{api_response.get_error.get_developer_message}"
|
147
|
+
puts "User Message: #{api_response.get_error.get_user_message}"
|
148
|
+
puts 'Order could not be canceled. See ruby error log.'
|
149
|
+
exit
|
150
|
+
end
|
151
|
+
|
152
|
+
if api_response.get_success
|
153
|
+
puts 'Order was canceled successfully.'
|
154
|
+
end
|
155
|
+
```
|
156
|
+
|
157
|
+
|
158
|
+
#### Using the cancel_order_with_http_info variant
|
159
|
+
|
160
|
+
This returns an Array which contains the response data, status code and headers.
|
161
|
+
|
162
|
+
> <Array(<BaseResponse>, Integer, Hash)> cancel_order_with_http_info(order_id, opts)
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
begin
|
166
|
+
# Cancel an order
|
167
|
+
data, status_code, headers = api_instance.cancel_order_with_http_info(order_id, opts)
|
168
|
+
p status_code # => 2xx
|
169
|
+
p headers # => { ... }
|
170
|
+
p data # => <BaseResponse>
|
171
|
+
rescue UltracartClient::ApiError => e
|
172
|
+
puts "Error when calling OrderApi->cancel_order_with_http_info: #{e}"
|
173
|
+
end
|
174
|
+
```
|
175
|
+
|
176
|
+
### Parameters
|
177
|
+
|
178
|
+
| Name | Type | Description | Notes |
|
179
|
+
| ---- | ---- | ----------- | ----- |
|
180
|
+
| **order_id** | **String** | The order id to cancel. | |
|
181
|
+
| **lock_self_ship_orders** | **Boolean** | Flag to prevent a order shipping during a refund process | [optional] |
|
182
|
+
| **skip_refund_and_hold** | **Boolean** | Skip refund and move order to Held Orders department | [optional] |
|
183
|
+
|
184
|
+
### Return type
|
185
|
+
|
186
|
+
[**BaseResponse**](BaseResponse.md)
|
187
|
+
|
188
|
+
### Authorization
|
189
|
+
|
190
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
191
|
+
|
192
|
+
### HTTP request headers
|
193
|
+
|
194
|
+
- **Content-Type**: Not defined
|
195
|
+
- **Accept**: application/json
|
196
|
+
|
197
|
+
|
198
|
+
## delete_order
|
199
|
+
|
200
|
+
> delete_order(order_id)
|
201
|
+
|
202
|
+
Delete an order
|
203
|
+
|
204
|
+
Delete an order on the UltraCart account.
|
205
|
+
|
206
|
+
|
207
|
+
### Examples
|
208
|
+
|
209
|
+
```ruby
|
210
|
+
# OrderApi.delete_order() will do just that. It will delete an order.
|
211
|
+
# You might find it more useful to reject an order rather than delete it in order to leave an audit trail.
|
212
|
+
# However, deleting test orders will be useful to keep your order history tidy. Still, any order
|
213
|
+
# may be deleted.
|
214
|
+
|
215
|
+
require_relative '../constants'
|
216
|
+
require 'ultracart_api'
|
217
|
+
|
218
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
219
|
+
|
220
|
+
order_id = 'DEMO-0008104390'
|
221
|
+
order_api.delete_order(order_id)
|
222
|
+
puts 'Order was deleted successfully.'
|
223
|
+
```
|
224
|
+
|
225
|
+
|
226
|
+
#### Using the delete_order_with_http_info variant
|
227
|
+
|
228
|
+
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
229
|
+
|
230
|
+
> <Array(nil, Integer, Hash)> delete_order_with_http_info(order_id)
|
231
|
+
|
232
|
+
```ruby
|
233
|
+
begin
|
234
|
+
# Delete an order
|
235
|
+
data, status_code, headers = api_instance.delete_order_with_http_info(order_id)
|
236
|
+
p status_code # => 2xx
|
237
|
+
p headers # => { ... }
|
238
|
+
p data # => nil
|
239
|
+
rescue UltracartClient::ApiError => e
|
240
|
+
puts "Error when calling OrderApi->delete_order_with_http_info: #{e}"
|
241
|
+
end
|
242
|
+
```
|
243
|
+
|
244
|
+
### Parameters
|
245
|
+
|
246
|
+
| Name | Type | Description | Notes |
|
247
|
+
| ---- | ---- | ----------- | ----- |
|
248
|
+
| **order_id** | **String** | The order id to delete. | |
|
249
|
+
|
250
|
+
### Return type
|
251
|
+
|
252
|
+
nil (empty response body)
|
253
|
+
|
254
|
+
### Authorization
|
255
|
+
|
256
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
257
|
+
|
258
|
+
### HTTP request headers
|
259
|
+
|
260
|
+
- **Content-Type**: Not defined
|
261
|
+
- **Accept**: application/json
|
262
|
+
|
263
|
+
|
264
|
+
## duplicate_order
|
265
|
+
|
266
|
+
> <OrderResponse> duplicate_order(order_id, opts)
|
267
|
+
|
268
|
+
Duplicate an order
|
269
|
+
|
270
|
+
Perform a duplicate of the specified order_id and return a new order located in Accounts Receivable.
|
271
|
+
|
272
|
+
|
273
|
+
### Examples
|
274
|
+
|
275
|
+
```ruby
|
276
|
+
# OrderApi.duplicate_order() does not accomplish much on its own. The use-case for this method is to
|
277
|
+
# duplicate a customer's order and then charge them for it. duplicate_order() does not charge the customer again.
|
278
|
+
#
|
279
|
+
# These are the steps for cloning an existing order and charging the customer for it.
|
280
|
+
# 1. duplicate_order
|
281
|
+
# 2. update_order (if you wish to change any part of it)
|
282
|
+
# 3. process_payment to charge the customer.
|
283
|
+
#
|
284
|
+
# As a reminder, if you wish to create a new order from scratch, use the CheckoutApi or ChannelPartnerApi.
|
285
|
+
# The OrderApi is for managing existing orders.
|
286
|
+
|
287
|
+
require_relative '../constants'
|
288
|
+
require 'ultracart_api'
|
289
|
+
|
290
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
291
|
+
|
292
|
+
# Step 1. Duplicate the order
|
293
|
+
expansion = '_expand=items' # for this example, we're going to change the items after we duplicate the order, so
|
294
|
+
# the only expansion properties we need are the items.
|
295
|
+
# See: https://www.ultracart.com/api/ for a list of all expansions.
|
296
|
+
|
297
|
+
order_id_to_duplicate = 'DEMO-0009104436'
|
298
|
+
api_response = order_api.duplicate_order(order_id_to_duplicate, { '_expand' => expansion })
|
299
|
+
new_order = api_response.get_order
|
300
|
+
|
301
|
+
# Step 2. Update the items. Create a new items array and assign it to the order to remove the old ones completely.
|
302
|
+
items = []
|
303
|
+
item = UltracartClient::OrderItem.new
|
304
|
+
item.set_merchant_item_id('simple_teapot')
|
305
|
+
item.set_quantity(1)
|
306
|
+
item.set_description("A lovely teapot")
|
307
|
+
item.set_distribution_center_code('DFLT') # where is this item shipping out of?
|
308
|
+
|
309
|
+
cost = UltracartClient::Currency.new
|
310
|
+
cost.set_currency_code('USD')
|
311
|
+
cost.set_value(9.99)
|
312
|
+
item.set_cost(cost)
|
313
|
+
|
314
|
+
weight = UltracartClient::Weight.new
|
315
|
+
weight.set_uom("OZ")
|
316
|
+
weight.set_value(6)
|
317
|
+
item.set_weight(weight)
|
318
|
+
|
319
|
+
items << item
|
320
|
+
new_order.set_items(items)
|
321
|
+
update_response = order_api.update_order(new_order.get_order_id, new_order, { '_expand' => expansion })
|
322
|
+
|
323
|
+
updated_order = update_response.get_order
|
324
|
+
|
325
|
+
# Step 3. process the payment.
|
326
|
+
# the request object below takes two optional arguments.
|
327
|
+
# The first is an amount if you wish to bill for an amount different from the order.
|
328
|
+
# We do not bill differently in this example.
|
329
|
+
# The second is card_verification_number_token, which is a token you can create by using our hosted fields to
|
330
|
+
# upload a CVV value. This will create a token you may use here. However, most merchants using the duplicate
|
331
|
+
# order method will be setting up an auto order for a customer. Those will not make use of the CVV, so we're
|
332
|
+
# not including it here. That is why the request object below does not have any values set.
|
333
|
+
# For more info on hosted fields:
|
334
|
+
# See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377775/UltraCart+Hosted+Credit+Card+Fields
|
335
|
+
# See: https://github.com/UltraCart/sdk_samples/blob/master/hosted_fields/hosted_fields.html
|
336
|
+
|
337
|
+
process_payment_request = UltracartClient::OrderProcessPaymentRequest.new
|
338
|
+
payment_response = order_api.process_payment(new_order.get_order_id, process_payment_request)
|
339
|
+
transaction_details = payment_response.get_payment_transaction # do whatever you wish with this.
|
340
|
+
|
341
|
+
puts 'New Order (after updated items):'
|
342
|
+
p updated_order
|
343
|
+
puts '\nPayment Response:'
|
344
|
+
p payment_response
|
345
|
+
```
|
346
|
+
|
347
|
+
|
348
|
+
#### Using the duplicate_order_with_http_info variant
|
349
|
+
|
350
|
+
This returns an Array which contains the response data, status code and headers.
|
351
|
+
|
352
|
+
> <Array(<OrderResponse>, Integer, Hash)> duplicate_order_with_http_info(order_id, opts)
|
353
|
+
|
354
|
+
```ruby
|
355
|
+
begin
|
356
|
+
# Duplicate an order
|
357
|
+
data, status_code, headers = api_instance.duplicate_order_with_http_info(order_id, opts)
|
358
|
+
p status_code # => 2xx
|
359
|
+
p headers # => { ... }
|
360
|
+
p data # => <OrderResponse>
|
361
|
+
rescue UltracartClient::ApiError => e
|
362
|
+
puts "Error when calling OrderApi->duplicate_order_with_http_info: #{e}"
|
363
|
+
end
|
364
|
+
```
|
365
|
+
|
366
|
+
### Parameters
|
367
|
+
|
368
|
+
| Name | Type | Description | Notes |
|
369
|
+
| ---- | ---- | ----------- | ----- |
|
370
|
+
| **order_id** | **String** | The order id to duplicate. | |
|
371
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
372
|
+
|
373
|
+
### Return type
|
374
|
+
|
375
|
+
[**OrderResponse**](OrderResponse.md)
|
376
|
+
|
377
|
+
### Authorization
|
378
|
+
|
379
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
380
|
+
|
381
|
+
### HTTP request headers
|
382
|
+
|
383
|
+
- **Content-Type**: Not defined
|
384
|
+
- **Accept**: application/json
|
385
|
+
|
386
|
+
|
387
|
+
## format
|
388
|
+
|
389
|
+
> <OrderFormatResponse> format(order_id, format_options)
|
390
|
+
|
391
|
+
Format order
|
392
|
+
|
393
|
+
Format the order for display at text or html
|
394
|
+
|
395
|
+
|
396
|
+
### Examples
|
397
|
+
|
398
|
+
```ruby
|
399
|
+
# format() returns back a text-formatted or html block for displaying an order. It is similar to what you would
|
400
|
+
# see on a receipt page.
|
401
|
+
|
402
|
+
require_relative '../constants'
|
403
|
+
require 'ultracart_api'
|
404
|
+
|
405
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
406
|
+
|
407
|
+
# Configure format options
|
408
|
+
format_options = UltracartClient::OrderFormat.new
|
409
|
+
format_options.set_context('receipt') # unknown,receipt,shipment,refund,quote-request,quote
|
410
|
+
format_options.set_format('table') # text,div,table,email
|
411
|
+
format_options.set_show_contact_info(false)
|
412
|
+
format_options.set_show_payment_info(false) # might not want to show this to just anyone.
|
413
|
+
format_options.set_show_merchant_notes(false) # be careful showing these
|
414
|
+
format_options.set_email_as_link(true) # makes the email addresses web links
|
415
|
+
# if you only wish to show the items for a particular distribution center,
|
416
|
+
# this might be useful if you have set_context('shipment') and you're displaying this order to a fulfillment center, etc
|
417
|
+
# format_options.set_filter_distribution_center_oid(1234321)
|
418
|
+
format_options.set_link_file_attachments(true)
|
419
|
+
format_options.set_show_internal_information(true) # consider this carefully.
|
420
|
+
format_options.set_show_non_sensitive_payment_info(true) # what the customer usually sees
|
421
|
+
format_options.set_show_in_merchant_currency(true)
|
422
|
+
format_options.set_hide_bill_to_address(false)
|
423
|
+
# format_options.set_filter_to_items_in_container_oid(123454321) # you probably won't need this.
|
424
|
+
# when an order displays on the secure.ultracart.com site, we link the email to our order search so you can quickly
|
425
|
+
# search for all orders for that email. I doubt you would have use for that. But maybe.
|
426
|
+
format_options.set_dont_link_email_to_search(true)
|
427
|
+
format_options.set_translate(false) # if true, shows in customer's native language
|
428
|
+
|
429
|
+
order_id = 'DEMO-0009104390'
|
430
|
+
|
431
|
+
api_response = order_api.format(order_id, format_options)
|
432
|
+
|
433
|
+
formatted_result = api_response.get_formatted_result
|
434
|
+
|
435
|
+
# Render the formatted result (note: removed HTML wrapping per guidelines)
|
436
|
+
api_response.get_css_links.each do |link|
|
437
|
+
puts "<style type='text/css'>#{link}</style>"
|
438
|
+
end
|
439
|
+
puts formatted_result
|
440
|
+
```
|
441
|
+
|
442
|
+
|
443
|
+
#### Using the format_with_http_info variant
|
444
|
+
|
445
|
+
This returns an Array which contains the response data, status code and headers.
|
446
|
+
|
447
|
+
> <Array(<OrderFormatResponse>, Integer, Hash)> format_with_http_info(order_id, format_options)
|
448
|
+
|
449
|
+
```ruby
|
450
|
+
begin
|
451
|
+
# Format order
|
452
|
+
data, status_code, headers = api_instance.format_with_http_info(order_id, format_options)
|
453
|
+
p status_code # => 2xx
|
454
|
+
p headers # => { ... }
|
455
|
+
p data # => <OrderFormatResponse>
|
456
|
+
rescue UltracartClient::ApiError => e
|
457
|
+
puts "Error when calling OrderApi->format_with_http_info: #{e}"
|
458
|
+
end
|
459
|
+
```
|
460
|
+
|
461
|
+
### Parameters
|
462
|
+
|
463
|
+
| Name | Type | Description | Notes |
|
464
|
+
| ---- | ---- | ----------- | ----- |
|
465
|
+
| **order_id** | **String** | The order id to format | |
|
466
|
+
| **format_options** | [**OrderFormat**](OrderFormat.md) | Format options | |
|
467
|
+
|
468
|
+
### Return type
|
469
|
+
|
470
|
+
[**OrderFormatResponse**](OrderFormatResponse.md)
|
471
|
+
|
472
|
+
### Authorization
|
473
|
+
|
474
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
475
|
+
|
476
|
+
### HTTP request headers
|
477
|
+
|
478
|
+
- **Content-Type**: application/json
|
479
|
+
- **Accept**: application/json
|
480
|
+
|
481
|
+
|
482
|
+
## generate_invoice
|
483
|
+
|
484
|
+
> <OrderInvoiceResponse> generate_invoice(order_id)
|
485
|
+
|
486
|
+
Generate an invoice for this order.
|
487
|
+
|
488
|
+
The invoice PDF that is returned is base 64 encoded
|
489
|
+
|
490
|
+
|
491
|
+
### Examples
|
492
|
+
|
493
|
+
```ruby
|
494
|
+
# generate_invoice returns back a base64 encoded byte array of the given order's Invoice in PDF format.
|
495
|
+
|
496
|
+
require_relative '../constants'
|
497
|
+
require 'base64'
|
498
|
+
require 'ultracart_api'
|
499
|
+
|
500
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
501
|
+
|
502
|
+
order_id = 'DEMO-0009104976'
|
503
|
+
api_response = order_api.generate_invoice(order_id)
|
504
|
+
|
505
|
+
# the packing slip will return as a base64 encoded
|
506
|
+
# unpack, save off, email, whatever.
|
507
|
+
base64_pdf = api_response.get_pdf_base64
|
508
|
+
|
509
|
+
decoded_pdf = Base64.decode64(base64_pdf)
|
510
|
+
File.write('invoice.pdf', decoded_pdf)
|
511
|
+
|
512
|
+
# Note: Direct file serving is typically handled by web frameworks in Ruby
|
513
|
+
# This script just saves the PDF locally
|
514
|
+
puts 'Invoice PDF has been saved as invoice.pdf'
|
515
|
+
```
|
516
|
+
|
517
|
+
|
518
|
+
#### Using the generate_invoice_with_http_info variant
|
519
|
+
|
520
|
+
This returns an Array which contains the response data, status code and headers.
|
521
|
+
|
522
|
+
> <Array(<OrderInvoiceResponse>, Integer, Hash)> generate_invoice_with_http_info(order_id)
|
523
|
+
|
524
|
+
```ruby
|
525
|
+
begin
|
526
|
+
# Generate an invoice for this order.
|
527
|
+
data, status_code, headers = api_instance.generate_invoice_with_http_info(order_id)
|
528
|
+
p status_code # => 2xx
|
529
|
+
p headers # => { ... }
|
530
|
+
p data # => <OrderInvoiceResponse>
|
531
|
+
rescue UltracartClient::ApiError => e
|
532
|
+
puts "Error when calling OrderApi->generate_invoice_with_http_info: #{e}"
|
533
|
+
end
|
534
|
+
```
|
535
|
+
|
536
|
+
### Parameters
|
537
|
+
|
538
|
+
| Name | Type | Description | Notes |
|
539
|
+
| ---- | ---- | ----------- | ----- |
|
540
|
+
| **order_id** | **String** | Order ID | |
|
541
|
+
|
542
|
+
### Return type
|
543
|
+
|
544
|
+
[**OrderInvoiceResponse**](OrderInvoiceResponse.md)
|
545
|
+
|
546
|
+
### Authorization
|
547
|
+
|
548
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
549
|
+
|
550
|
+
### HTTP request headers
|
551
|
+
|
552
|
+
- **Content-Type**: Not defined
|
553
|
+
- **Accept**: application/json
|
554
|
+
|
555
|
+
|
556
|
+
## generate_order_token
|
557
|
+
|
558
|
+
> <OrderTokenResponse> generate_order_token(order_id)
|
559
|
+
|
560
|
+
Generate an order token for a given order id
|
561
|
+
|
562
|
+
Retrieves a single order token for a given order id. The token can be used with the getOrderByToken API.
|
563
|
+
|
564
|
+
|
565
|
+
### Examples
|
566
|
+
|
567
|
+
```ruby
|
568
|
+
require 'ultracart_api'
|
569
|
+
require_relative '../constants'
|
570
|
+
|
571
|
+
# This method generates a unique encrypted key for an Order. This is useful if you wish to provide links for
|
572
|
+
# customer orders without allowing someone to easily cycle through orders. By requiring order tokens, you
|
573
|
+
# control which orders are viewable with a public hyperlink.
|
574
|
+
#
|
575
|
+
# This method works in tandem with OrderApi.getOrderByToken()
|
576
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
577
|
+
|
578
|
+
order_id = 'DEMO-0009104436'
|
579
|
+
order_token_response = order_api.generate_order_token(order_id)
|
580
|
+
order_token = order_token_response.order_token
|
581
|
+
|
582
|
+
puts "Order Token is: #{order_token}"
|
583
|
+
|
584
|
+
# The token format will look something like this:
|
585
|
+
# DEMO:UJZOGiIRLqgE3a10yp5wmEozLPNsGrDHNPiHfxsi0iAEcxgo9H74J/l6SR3X8g==
|
586
|
+
```
|
587
|
+
|
588
|
+
|
589
|
+
#### Using the generate_order_token_with_http_info variant
|
590
|
+
|
591
|
+
This returns an Array which contains the response data, status code and headers.
|
592
|
+
|
593
|
+
> <Array(<OrderTokenResponse>, Integer, Hash)> generate_order_token_with_http_info(order_id)
|
594
|
+
|
595
|
+
```ruby
|
596
|
+
begin
|
597
|
+
# Generate an order token for a given order id
|
598
|
+
data, status_code, headers = api_instance.generate_order_token_with_http_info(order_id)
|
599
|
+
p status_code # => 2xx
|
600
|
+
p headers # => { ... }
|
601
|
+
p data # => <OrderTokenResponse>
|
602
|
+
rescue UltracartClient::ApiError => e
|
603
|
+
puts "Error when calling OrderApi->generate_order_token_with_http_info: #{e}"
|
604
|
+
end
|
605
|
+
```
|
606
|
+
|
607
|
+
### Parameters
|
608
|
+
|
609
|
+
| Name | Type | Description | Notes |
|
610
|
+
| ---- | ---- | ----------- | ----- |
|
611
|
+
| **order_id** | **String** | The order id to generate a token for. | |
|
612
|
+
|
613
|
+
### Return type
|
614
|
+
|
615
|
+
[**OrderTokenResponse**](OrderTokenResponse.md)
|
616
|
+
|
617
|
+
### Authorization
|
618
|
+
|
619
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
620
|
+
|
621
|
+
### HTTP request headers
|
622
|
+
|
623
|
+
- **Content-Type**: Not defined
|
624
|
+
- **Accept**: application/json
|
625
|
+
|
626
|
+
|
627
|
+
## generate_packing_slip_all_dc
|
628
|
+
|
629
|
+
> <OrderPackingSlipResponse> generate_packing_slip_all_dc(order_id)
|
630
|
+
|
631
|
+
Generate a packing slip for this order across all distribution centers.
|
632
|
+
|
633
|
+
The packing slip PDF that is returned is base 64 encoded
|
634
|
+
|
635
|
+
|
636
|
+
### Examples
|
637
|
+
|
638
|
+
|
639
|
+
(No example for this operation).
|
640
|
+
|
641
|
+
|
642
|
+
#### Using the generate_packing_slip_all_dc_with_http_info variant
|
643
|
+
|
644
|
+
This returns an Array which contains the response data, status code and headers.
|
645
|
+
|
646
|
+
> <Array(<OrderPackingSlipResponse>, Integer, Hash)> generate_packing_slip_all_dc_with_http_info(order_id)
|
647
|
+
|
648
|
+
```ruby
|
649
|
+
begin
|
650
|
+
# Generate a packing slip for this order across all distribution centers.
|
651
|
+
data, status_code, headers = api_instance.generate_packing_slip_all_dc_with_http_info(order_id)
|
652
|
+
p status_code # => 2xx
|
653
|
+
p headers # => { ... }
|
654
|
+
p data # => <OrderPackingSlipResponse>
|
655
|
+
rescue UltracartClient::ApiError => e
|
656
|
+
puts "Error when calling OrderApi->generate_packing_slip_all_dc_with_http_info: #{e}"
|
657
|
+
end
|
658
|
+
```
|
659
|
+
|
660
|
+
### Parameters
|
661
|
+
|
662
|
+
| Name | Type | Description | Notes |
|
663
|
+
| ---- | ---- | ----------- | ----- |
|
664
|
+
| **order_id** | **String** | Order ID | |
|
665
|
+
|
666
|
+
### Return type
|
667
|
+
|
668
|
+
[**OrderPackingSlipResponse**](OrderPackingSlipResponse.md)
|
669
|
+
|
670
|
+
### Authorization
|
671
|
+
|
672
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
673
|
+
|
674
|
+
### HTTP request headers
|
675
|
+
|
676
|
+
- **Content-Type**: Not defined
|
677
|
+
- **Accept**: application/json
|
678
|
+
|
679
|
+
|
680
|
+
## generate_packing_slip_specific_dc
|
681
|
+
|
682
|
+
> <OrderPackingSlipResponse> generate_packing_slip_specific_dc(distribution_center_code, order_id)
|
683
|
+
|
684
|
+
Generate a packing slip for this order for the given distribution center.
|
685
|
+
|
686
|
+
The packing slip PDF that is returned is base 64 encoded
|
687
|
+
|
688
|
+
|
689
|
+
### Examples
|
690
|
+
|
691
|
+
|
692
|
+
(No example for this operation).
|
693
|
+
|
694
|
+
|
695
|
+
#### Using the generate_packing_slip_specific_dc_with_http_info variant
|
696
|
+
|
697
|
+
This returns an Array which contains the response data, status code and headers.
|
698
|
+
|
699
|
+
> <Array(<OrderPackingSlipResponse>, Integer, Hash)> generate_packing_slip_specific_dc_with_http_info(distribution_center_code, order_id)
|
700
|
+
|
701
|
+
```ruby
|
702
|
+
begin
|
703
|
+
# Generate a packing slip for this order for the given distribution center.
|
704
|
+
data, status_code, headers = api_instance.generate_packing_slip_specific_dc_with_http_info(distribution_center_code, order_id)
|
705
|
+
p status_code # => 2xx
|
706
|
+
p headers # => { ... }
|
707
|
+
p data # => <OrderPackingSlipResponse>
|
708
|
+
rescue UltracartClient::ApiError => e
|
709
|
+
puts "Error when calling OrderApi->generate_packing_slip_specific_dc_with_http_info: #{e}"
|
710
|
+
end
|
711
|
+
```
|
712
|
+
|
713
|
+
### Parameters
|
714
|
+
|
715
|
+
| Name | Type | Description | Notes |
|
716
|
+
| ---- | ---- | ----------- | ----- |
|
717
|
+
| **distribution_center_code** | **String** | Distribution center code | |
|
718
|
+
| **order_id** | **String** | Order ID | |
|
719
|
+
|
720
|
+
### Return type
|
721
|
+
|
722
|
+
[**OrderPackingSlipResponse**](OrderPackingSlipResponse.md)
|
723
|
+
|
724
|
+
### Authorization
|
725
|
+
|
726
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
727
|
+
|
728
|
+
### HTTP request headers
|
729
|
+
|
730
|
+
- **Content-Type**: Not defined
|
731
|
+
- **Accept**: application/json
|
732
|
+
|
733
|
+
|
734
|
+
## get_accounts_receivable_retry_config
|
735
|
+
|
736
|
+
> <AccountsReceivableRetryConfigResponse> get_accounts_receivable_retry_config
|
737
|
+
|
738
|
+
Retrieve A/R Retry Configuration
|
739
|
+
|
740
|
+
Retrieve A/R Retry Configuration. This is primarily an internal API call. It is doubtful you would ever need to use it.
|
741
|
+
|
742
|
+
|
743
|
+
### Examples
|
744
|
+
|
745
|
+
```ruby
|
746
|
+
# This is primarily an internal API call. It is doubtful you would ever need to use it.
|
747
|
+
# We do not provide an example for this call.
|
748
|
+
```
|
749
|
+
|
750
|
+
|
751
|
+
#### Using the get_accounts_receivable_retry_config_with_http_info variant
|
752
|
+
|
753
|
+
This returns an Array which contains the response data, status code and headers.
|
754
|
+
|
755
|
+
> <Array(<AccountsReceivableRetryConfigResponse>, Integer, Hash)> get_accounts_receivable_retry_config_with_http_info
|
756
|
+
|
757
|
+
```ruby
|
758
|
+
begin
|
759
|
+
# Retrieve A/R Retry Configuration
|
760
|
+
data, status_code, headers = api_instance.get_accounts_receivable_retry_config_with_http_info
|
761
|
+
p status_code # => 2xx
|
762
|
+
p headers # => { ... }
|
763
|
+
p data # => <AccountsReceivableRetryConfigResponse>
|
764
|
+
rescue UltracartClient::ApiError => e
|
765
|
+
puts "Error when calling OrderApi->get_accounts_receivable_retry_config_with_http_info: #{e}"
|
766
|
+
end
|
767
|
+
```
|
768
|
+
|
769
|
+
### Parameters
|
770
|
+
|
771
|
+
This endpoint does not need any parameter.
|
772
|
+
|
773
|
+
### Return type
|
774
|
+
|
775
|
+
[**AccountsReceivableRetryConfigResponse**](AccountsReceivableRetryConfigResponse.md)
|
776
|
+
|
777
|
+
### Authorization
|
778
|
+
|
779
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
780
|
+
|
781
|
+
### HTTP request headers
|
782
|
+
|
783
|
+
- **Content-Type**: Not defined
|
784
|
+
- **Accept**: application/json
|
785
|
+
|
786
|
+
|
787
|
+
## get_accounts_receivable_retry_stats
|
788
|
+
|
789
|
+
> <AccountsReceivableRetryStatsResponse> get_accounts_receivable_retry_stats(opts)
|
790
|
+
|
791
|
+
Retrieve A/R Retry Statistics
|
792
|
+
|
793
|
+
Retrieve A/R Retry Statistics. This is primarily an internal API call. It is doubtful you would ever need to use it.
|
794
|
+
|
795
|
+
|
796
|
+
### Examples
|
797
|
+
|
798
|
+
```ruby
|
799
|
+
# This is primarily an internal API call. It is doubtful you would ever need to use it.
|
800
|
+
# We do not provide an example for this call.
|
801
|
+
```
|
802
|
+
|
803
|
+
|
804
|
+
#### Using the get_accounts_receivable_retry_stats_with_http_info variant
|
805
|
+
|
806
|
+
This returns an Array which contains the response data, status code and headers.
|
807
|
+
|
808
|
+
> <Array(<AccountsReceivableRetryStatsResponse>, Integer, Hash)> get_accounts_receivable_retry_stats_with_http_info(opts)
|
809
|
+
|
810
|
+
```ruby
|
811
|
+
begin
|
812
|
+
# Retrieve A/R Retry Statistics
|
813
|
+
data, status_code, headers = api_instance.get_accounts_receivable_retry_stats_with_http_info(opts)
|
814
|
+
p status_code # => 2xx
|
815
|
+
p headers # => { ... }
|
816
|
+
p data # => <AccountsReceivableRetryStatsResponse>
|
817
|
+
rescue UltracartClient::ApiError => e
|
818
|
+
puts "Error when calling OrderApi->get_accounts_receivable_retry_stats_with_http_info: #{e}"
|
819
|
+
end
|
820
|
+
```
|
821
|
+
|
822
|
+
### Parameters
|
823
|
+
|
824
|
+
| Name | Type | Description | Notes |
|
825
|
+
| ---- | ---- | ----------- | ----- |
|
826
|
+
| **from** | **String** | | [optional] |
|
827
|
+
| **to** | **String** | | [optional] |
|
828
|
+
|
829
|
+
### Return type
|
830
|
+
|
831
|
+
[**AccountsReceivableRetryStatsResponse**](AccountsReceivableRetryStatsResponse.md)
|
832
|
+
|
833
|
+
### Authorization
|
834
|
+
|
835
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
836
|
+
|
837
|
+
### HTTP request headers
|
838
|
+
|
839
|
+
- **Content-Type**: Not defined
|
840
|
+
- **Accept**: application/json
|
841
|
+
|
842
|
+
|
843
|
+
## get_order
|
844
|
+
|
845
|
+
> <OrderResponse> get_order(order_id, opts)
|
846
|
+
|
847
|
+
Retrieve an order
|
848
|
+
|
849
|
+
Retrieves a single order using the specified order id.
|
850
|
+
|
851
|
+
|
852
|
+
### Examples
|
853
|
+
|
854
|
+
```ruby
|
855
|
+
require 'ultracart_api'
|
856
|
+
require_relative '../constants'
|
857
|
+
|
858
|
+
# OrderApi.getOrder() retrieves a single order for a given order_id.
|
859
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
860
|
+
|
861
|
+
# The expansion variable instructs UltraCart how much information to return. The order object is large and
|
862
|
+
# while it's easily manageable for a single order, when querying thousands of orders, is useful to reduce
|
863
|
+
# payload size.
|
864
|
+
# see www.ultracart.com/api/ for all the expansion fields available (this list below may become stale)
|
865
|
+
=begin
|
866
|
+
Possible Order Expansions:
|
867
|
+
affiliate affiliate.ledger auto_order
|
868
|
+
billing channel_partner checkout
|
869
|
+
coupon customer_profile digital_order
|
870
|
+
edi fraud_score gift
|
871
|
+
gift_certificate internal item
|
872
|
+
linked_shipment marketing payment
|
873
|
+
payment.transaction quote salesforce
|
874
|
+
shipping shipping.tracking_number_details summary
|
875
|
+
taxes
|
876
|
+
=end
|
877
|
+
expansion = "item,summary,billing,shipping,shipping.tracking_number_details"
|
878
|
+
|
879
|
+
order_id = 'DEMO-0009104390'
|
880
|
+
opts = {
|
881
|
+
'_expand' => expansion
|
882
|
+
}
|
883
|
+
|
884
|
+
begin
|
885
|
+
api_response = order_api.get_order(order_id, opts)
|
886
|
+
|
887
|
+
# Check for errors
|
888
|
+
if api_response.error
|
889
|
+
puts "Developer Message: #{api_response.error.developer_message}"
|
890
|
+
puts "User Message: #{api_response.error.user_message}"
|
891
|
+
exit
|
892
|
+
end
|
893
|
+
|
894
|
+
order = api_response.order
|
895
|
+
|
896
|
+
# Using inspect instead of var_dump for Ruby-style object representation
|
897
|
+
puts order.inspect
|
898
|
+
rescue StandardError => e
|
899
|
+
puts "An error occurred: #{e.message}"
|
900
|
+
end
|
901
|
+
```
|
902
|
+
|
903
|
+
|
904
|
+
#### Using the get_order_with_http_info variant
|
905
|
+
|
906
|
+
This returns an Array which contains the response data, status code and headers.
|
907
|
+
|
908
|
+
> <Array(<OrderResponse>, Integer, Hash)> get_order_with_http_info(order_id, opts)
|
909
|
+
|
910
|
+
```ruby
|
911
|
+
begin
|
912
|
+
# Retrieve an order
|
913
|
+
data, status_code, headers = api_instance.get_order_with_http_info(order_id, opts)
|
914
|
+
p status_code # => 2xx
|
915
|
+
p headers # => { ... }
|
916
|
+
p data # => <OrderResponse>
|
917
|
+
rescue UltracartClient::ApiError => e
|
918
|
+
puts "Error when calling OrderApi->get_order_with_http_info: #{e}"
|
919
|
+
end
|
920
|
+
```
|
921
|
+
|
922
|
+
### Parameters
|
923
|
+
|
924
|
+
| Name | Type | Description | Notes |
|
925
|
+
| ---- | ---- | ----------- | ----- |
|
926
|
+
| **order_id** | **String** | The order id to retrieve. | |
|
927
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
928
|
+
|
929
|
+
### Return type
|
930
|
+
|
931
|
+
[**OrderResponse**](OrderResponse.md)
|
932
|
+
|
933
|
+
### Authorization
|
934
|
+
|
935
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
936
|
+
|
937
|
+
### HTTP request headers
|
938
|
+
|
939
|
+
- **Content-Type**: Not defined
|
940
|
+
- **Accept**: application/json
|
941
|
+
|
942
|
+
|
943
|
+
## get_order_by_token
|
944
|
+
|
945
|
+
> <OrderResponse> get_order_by_token(order_by_token_query, opts)
|
946
|
+
|
947
|
+
Retrieve an order using a token
|
948
|
+
|
949
|
+
Retrieves a single order using the specified order token.
|
950
|
+
|
951
|
+
|
952
|
+
### Examples
|
953
|
+
|
954
|
+
```ruby
|
955
|
+
require 'ultracart_api'
|
956
|
+
require_relative '../constants'
|
957
|
+
|
958
|
+
# OrderApi.getOrderByToken() was created for use within a custom thank-you page. The built-in StoreFront
|
959
|
+
# thank you page displays the customer receipt and allows for unlimited customization. However, many
|
960
|
+
# merchants wish to process the receipt page on their own servers to do custom processing.
|
961
|
+
#
|
962
|
+
# See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377199/Custom+Thank+You+Page+URL
|
963
|
+
#
|
964
|
+
# When setting up a custom thank-you url in the StoreFronts, you will provide a query parameter that will hold
|
965
|
+
# this order token. You many extract that from the $_GET object, then turn around and call getOrderByToken
|
966
|
+
# to get the order object.
|
967
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
968
|
+
|
969
|
+
# The expansion variable instructs UltraCart how much information to return. The order object is large and
|
970
|
+
# while it's easily manageable for a single order, when querying thousands of orders, is useful to reduce
|
971
|
+
# payload size.
|
972
|
+
# see www.ultracart.com/api/ for all the expansion fields available (this list below may become stale)
|
973
|
+
=begin
|
974
|
+
Possible Order Expansions:
|
975
|
+
affiliate affiliate.ledger auto_order
|
976
|
+
billing channel_partner checkout
|
977
|
+
coupon customer_profile digital_order
|
978
|
+
edi fraud_score gift
|
979
|
+
gift_certificate internal item
|
980
|
+
linked_shipment marketing payment
|
981
|
+
payment.transaction quote salesforce
|
982
|
+
shipping shipping.tracking_number_details summary
|
983
|
+
taxes
|
984
|
+
=end
|
985
|
+
|
986
|
+
expansion = "billing,checkout,coupon,customer_profile,item,payment,shipping,summary,taxes"
|
987
|
+
|
988
|
+
# the token will be in a $_GET parameter defined by you within your storefront.
|
989
|
+
# StoreFront -> Privacy and Tracking -> Advanced -> CustomThankYouUrl
|
990
|
+
# Example would be: www.mysite.com/receipt.php?orderToken=[OrderToken]
|
991
|
+
|
992
|
+
# TODO: Replace with actual method of retrieving order token in Ruby
|
993
|
+
# For example, if using Rack or Rails, you might use params[:order_token]
|
994
|
+
order_token = 'DEMO:UZBOGywSKKwD2a5wx5JwmkwyIPNsGrDHNPiHfxsi0iAEcxgo9H74J/l6SR3X8g=='
|
995
|
+
|
996
|
+
# TODO (for you, the merchant): handle missing order token (perhaps this page somehow called by a search engine, etc).
|
997
|
+
|
998
|
+
begin
|
999
|
+
opts = {
|
1000
|
+
'_expand' => expansion
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
api_response = order_api.get_order_by_token(order_token, opts)
|
1004
|
+
order = api_response.order
|
1005
|
+
|
1006
|
+
# Using inspect instead of var_dump for Ruby-style object representation
|
1007
|
+
puts order.inspect
|
1008
|
+
rescue StandardError => e
|
1009
|
+
puts "An error occurred: #{e.message}"
|
1010
|
+
end
|
1011
|
+
```
|
1012
|
+
|
1013
|
+
|
1014
|
+
#### Using the get_order_by_token_with_http_info variant
|
1015
|
+
|
1016
|
+
This returns an Array which contains the response data, status code and headers.
|
1017
|
+
|
1018
|
+
> <Array(<OrderResponse>, Integer, Hash)> get_order_by_token_with_http_info(order_by_token_query, opts)
|
1019
|
+
|
1020
|
+
```ruby
|
1021
|
+
begin
|
1022
|
+
# Retrieve an order using a token
|
1023
|
+
data, status_code, headers = api_instance.get_order_by_token_with_http_info(order_by_token_query, opts)
|
1024
|
+
p status_code # => 2xx
|
1025
|
+
p headers # => { ... }
|
1026
|
+
p data # => <OrderResponse>
|
1027
|
+
rescue UltracartClient::ApiError => e
|
1028
|
+
puts "Error when calling OrderApi->get_order_by_token_with_http_info: #{e}"
|
1029
|
+
end
|
1030
|
+
```
|
1031
|
+
|
1032
|
+
### Parameters
|
1033
|
+
|
1034
|
+
| Name | Type | Description | Notes |
|
1035
|
+
| ---- | ---- | ----------- | ----- |
|
1036
|
+
| **order_by_token_query** | [**OrderByTokenQuery**](OrderByTokenQuery.md) | Order by token query | |
|
1037
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
1038
|
+
|
1039
|
+
### Return type
|
1040
|
+
|
1041
|
+
[**OrderResponse**](OrderResponse.md)
|
1042
|
+
|
1043
|
+
### Authorization
|
1044
|
+
|
1045
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1046
|
+
|
1047
|
+
### HTTP request headers
|
1048
|
+
|
1049
|
+
- **Content-Type**: application/json
|
1050
|
+
- **Accept**: application/json
|
1051
|
+
|
1052
|
+
|
1053
|
+
## get_order_edi_documents
|
1054
|
+
|
1055
|
+
> <OrderEdiDocumentsResponse> get_order_edi_documents(order_id)
|
1056
|
+
|
1057
|
+
Retrieve EDI documents associated with this order.
|
1058
|
+
|
1059
|
+
Retrieve EDI documents associated with this order.
|
1060
|
+
|
1061
|
+
|
1062
|
+
### Examples
|
1063
|
+
|
1064
|
+
```ruby
|
1065
|
+
require 'ultracart_api'
|
1066
|
+
require_relative '../constants'
|
1067
|
+
|
1068
|
+
# getOrderEdiDocuments returns back all EDI documents associated with an order.
|
1069
|
+
#
|
1070
|
+
# Possible Errors:
|
1071
|
+
# Order.channelPartnerOid is null -> "Order is not associated with an EDI channel partner."
|
1072
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
1073
|
+
|
1074
|
+
order_id = 'DEMO-0009104976'
|
1075
|
+
|
1076
|
+
begin
|
1077
|
+
api_response = order_api.get_order_edi_documents(order_id)
|
1078
|
+
documents = api_response.edi_documents
|
1079
|
+
|
1080
|
+
# Using inspect instead of var_dump for Ruby-style object representation
|
1081
|
+
puts documents.inspect
|
1082
|
+
rescue StandardError => e
|
1083
|
+
puts "An error occurred: #{e.message}"
|
1084
|
+
end
|
1085
|
+
```
|
1086
|
+
|
1087
|
+
|
1088
|
+
#### Using the get_order_edi_documents_with_http_info variant
|
1089
|
+
|
1090
|
+
This returns an Array which contains the response data, status code and headers.
|
1091
|
+
|
1092
|
+
> <Array(<OrderEdiDocumentsResponse>, Integer, Hash)> get_order_edi_documents_with_http_info(order_id)
|
1093
|
+
|
1094
|
+
```ruby
|
1095
|
+
begin
|
1096
|
+
# Retrieve EDI documents associated with this order.
|
1097
|
+
data, status_code, headers = api_instance.get_order_edi_documents_with_http_info(order_id)
|
1098
|
+
p status_code # => 2xx
|
1099
|
+
p headers # => { ... }
|
1100
|
+
p data # => <OrderEdiDocumentsResponse>
|
1101
|
+
rescue UltracartClient::ApiError => e
|
1102
|
+
puts "Error when calling OrderApi->get_order_edi_documents_with_http_info: #{e}"
|
1103
|
+
end
|
1104
|
+
```
|
1105
|
+
|
1106
|
+
### Parameters
|
1107
|
+
|
1108
|
+
| Name | Type | Description | Notes |
|
1109
|
+
| ---- | ---- | ----------- | ----- |
|
1110
|
+
| **order_id** | **String** | The order id to retrieve EDI documents for. | |
|
1111
|
+
|
1112
|
+
### Return type
|
1113
|
+
|
1114
|
+
[**OrderEdiDocumentsResponse**](OrderEdiDocumentsResponse.md)
|
1115
|
+
|
1116
|
+
### Authorization
|
1117
|
+
|
1118
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1119
|
+
|
1120
|
+
### HTTP request headers
|
1121
|
+
|
1122
|
+
- **Content-Type**: Not defined
|
1123
|
+
- **Accept**: application/json
|
1124
|
+
|
1125
|
+
|
1126
|
+
## get_orders
|
1127
|
+
|
1128
|
+
> <OrdersResponse> get_orders(opts)
|
1129
|
+
|
1130
|
+
Retrieve orders
|
1131
|
+
|
1132
|
+
Retrieves a group of orders from the account. If no parameters are specified, the API call will fail with a bad request error. Always specify some parameters to limit the scope of the orders returned to ones you are truly interested in. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
|
1133
|
+
|
1134
|
+
|
1135
|
+
### Examples
|
1136
|
+
|
1137
|
+
```ruby
|
1138
|
+
# frozen_string_literal: true
|
1139
|
+
|
1140
|
+
require 'ultracart_api'
|
1141
|
+
require_relative '../constants'
|
1142
|
+
|
1143
|
+
# Increase script execution time limit
|
1144
|
+
Process.setrlimit(Process::RLIMIT_CPU, 3000)
|
1145
|
+
|
1146
|
+
=begin
|
1147
|
+
getOrders was the first order query provided by UltraCart. It still functions well, but it is extremely verbose
|
1148
|
+
because the query call takes a variable for every possible filter. You are advised to get getOrdersByQuery().
|
1149
|
+
It is easier to use and will result in less code. Still, we provide an example here to be thorough.
|
1150
|
+
|
1151
|
+
For this script, we will query all orders for a particular email address. The getOrdersByQuery() example
|
1152
|
+
illustrates using a date range to filter and select orders.
|
1153
|
+
=end
|
1154
|
+
|
1155
|
+
def get_order_chunk(order_api, offset, limit)
|
1156
|
+
# Possible Order Expansions:
|
1157
|
+
# affiliate affiliate.ledger auto_order
|
1158
|
+
# billing channel_partner checkout
|
1159
|
+
# coupon customer_profile digital_order
|
1160
|
+
# edi fraud_score gift
|
1161
|
+
# gift_certificate internal item
|
1162
|
+
# linked_shipment marketing payment
|
1163
|
+
# payment.transaction quote salesforce
|
1164
|
+
# shipping shipping.tracking_number_details summary
|
1165
|
+
# taxes
|
1166
|
+
|
1167
|
+
expansion = "item,summary,billing,shipping,shipping.tracking_number_details"
|
1168
|
+
|
1169
|
+
# Prepare opts hash with all parameters
|
1170
|
+
opts = {
|
1171
|
+
'order_id' => nil,
|
1172
|
+
'payment_method' => nil,
|
1173
|
+
'company' => nil,
|
1174
|
+
'first_name' => nil,
|
1175
|
+
'last_name' => nil,
|
1176
|
+
'city' => nil,
|
1177
|
+
'state_region' => nil,
|
1178
|
+
'postal_code' => nil,
|
1179
|
+
'country_code' => nil,
|
1180
|
+
'phone' => nil,
|
1181
|
+
'email' => 'support@ultracart.com', # Only filter we're using
|
1182
|
+
'cc_email' => nil,
|
1183
|
+
'total' => nil,
|
1184
|
+
'screen_branding_theme_code' => nil,
|
1185
|
+
'storefront_host_name' => nil,
|
1186
|
+
'creation_date_begin' => nil,
|
1187
|
+
'creation_date_end' => nil,
|
1188
|
+
'payment_date_begin' => nil,
|
1189
|
+
'payment_date_end' => nil,
|
1190
|
+
'shipment_date_begin' => nil,
|
1191
|
+
'shipment_date_end' => nil,
|
1192
|
+
'rma' => nil,
|
1193
|
+
'purchase_order_number' => nil,
|
1194
|
+
'item_id' => nil,
|
1195
|
+
'current_stage' => nil,
|
1196
|
+
'channel_partner_code' => nil,
|
1197
|
+
'channel_partner_order_id' => nil,
|
1198
|
+
'_sort' => nil,
|
1199
|
+
'_limit' => limit,
|
1200
|
+
'_offset' => offset,
|
1201
|
+
'_expand' => expansion
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
# Make API call
|
1205
|
+
api_response = order_api.get_orders(opts)
|
1206
|
+
|
1207
|
+
# Return orders or empty array
|
1208
|
+
api_response.orders || []
|
1209
|
+
end
|
1210
|
+
|
1211
|
+
# Initialize variables for order retrieval
|
1212
|
+
orders = []
|
1213
|
+
iteration = 1
|
1214
|
+
offset = 0
|
1215
|
+
limit = 200
|
1216
|
+
more_records_to_fetch = true
|
1217
|
+
|
1218
|
+
# Retrieve orders in chunks
|
1219
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
1220
|
+
|
1221
|
+
while more_records_to_fetch
|
1222
|
+
puts "executing iteration #{iteration}"
|
1223
|
+
|
1224
|
+
chunk_of_orders = get_order_chunk(order_api, offset, limit)
|
1225
|
+
orders.concat(chunk_of_orders)
|
1226
|
+
|
1227
|
+
offset += limit
|
1228
|
+
more_records_to_fetch = chunk_of_orders.length == limit
|
1229
|
+
iteration += 1
|
1230
|
+
end
|
1231
|
+
|
1232
|
+
# Output orders (without HTML wrapping as per guidelines)
|
1233
|
+
p orders
|
1234
|
+
```
|
1235
|
+
|
1236
|
+
|
1237
|
+
#### Using the get_orders_with_http_info variant
|
1238
|
+
|
1239
|
+
This returns an Array which contains the response data, status code and headers.
|
1240
|
+
|
1241
|
+
> <Array(<OrdersResponse>, Integer, Hash)> get_orders_with_http_info(opts)
|
1242
|
+
|
1243
|
+
```ruby
|
1244
|
+
begin
|
1245
|
+
# Retrieve orders
|
1246
|
+
data, status_code, headers = api_instance.get_orders_with_http_info(opts)
|
1247
|
+
p status_code # => 2xx
|
1248
|
+
p headers # => { ... }
|
1249
|
+
p data # => <OrdersResponse>
|
1250
|
+
rescue UltracartClient::ApiError => e
|
1251
|
+
puts "Error when calling OrderApi->get_orders_with_http_info: #{e}"
|
1252
|
+
end
|
1253
|
+
```
|
1254
|
+
|
1255
|
+
### Parameters
|
1256
|
+
|
1257
|
+
| Name | Type | Description | Notes |
|
1258
|
+
| ---- | ---- | ----------- | ----- |
|
1259
|
+
| **order_id** | **String** | Order Id | [optional] |
|
1260
|
+
| **payment_method** | **String** | Payment Method | [optional] |
|
1261
|
+
| **company** | **String** | Company | [optional] |
|
1262
|
+
| **first_name** | **String** | First Name | [optional] |
|
1263
|
+
| **last_name** | **String** | Last Name | [optional] |
|
1264
|
+
| **city** | **String** | City | [optional] |
|
1265
|
+
| **state_region** | **String** | State/Region | [optional] |
|
1266
|
+
| **postal_code** | **String** | Postal Code | [optional] |
|
1267
|
+
| **country_code** | **String** | Country Code (ISO-3166 two letter) | [optional] |
|
1268
|
+
| **phone** | **String** | Phone | [optional] |
|
1269
|
+
| **email** | **String** | Email | [optional] |
|
1270
|
+
| **cc_email** | **String** | CC Email | [optional] |
|
1271
|
+
| **total** | **Float** | Total | [optional] |
|
1272
|
+
| **screen_branding_theme_code** | **String** | Screen Branding Theme Code | [optional] |
|
1273
|
+
| **storefront_host_name** | **String** | StoreFront Host Name | [optional] |
|
1274
|
+
| **creation_date_begin** | **String** | Creation Date Begin | [optional] |
|
1275
|
+
| **creation_date_end** | **String** | Creation Date End | [optional] |
|
1276
|
+
| **payment_date_begin** | **String** | Payment Date Begin | [optional] |
|
1277
|
+
| **payment_date_end** | **String** | Payment Date End | [optional] |
|
1278
|
+
| **shipment_date_begin** | **String** | Shipment Date Begin | [optional] |
|
1279
|
+
| **shipment_date_end** | **String** | Shipment Date End | [optional] |
|
1280
|
+
| **rma** | **String** | RMA | [optional] |
|
1281
|
+
| **purchase_order_number** | **String** | Purchase Order Number | [optional] |
|
1282
|
+
| **item_id** | **String** | Item Id | [optional] |
|
1283
|
+
| **current_stage** | **String** | Current Stage | [optional] |
|
1284
|
+
| **channel_partner_code** | **String** | Channel Partner Code | [optional] |
|
1285
|
+
| **channel_partner_order_id** | **String** | Channel Partner Order ID | [optional] |
|
1286
|
+
| **_limit** | **Integer** | The maximum number of records to return on this one API call. (Maximum 200) | [optional][default to 100] |
|
1287
|
+
| **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
|
1288
|
+
| **_sort** | **String** | The sort order of the orders. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. | [optional] |
|
1289
|
+
| **_expand** | **String** | The object expansion to perform on the result. | [optional] |
|
1290
|
+
|
1291
|
+
### Return type
|
1292
|
+
|
1293
|
+
[**OrdersResponse**](OrdersResponse.md)
|
1294
|
+
|
1295
|
+
### Authorization
|
1296
|
+
|
1297
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1298
|
+
|
1299
|
+
### HTTP request headers
|
1300
|
+
|
1301
|
+
- **Content-Type**: Not defined
|
1302
|
+
- **Accept**: application/json
|
1303
|
+
|
1304
|
+
|
1305
|
+
## get_orders_batch
|
1306
|
+
|
1307
|
+
> <OrdersResponse> get_orders_batch(order_batch, opts)
|
1308
|
+
|
1309
|
+
Retrieve order batch
|
1310
|
+
|
1311
|
+
Retrieves a group of orders from the account based on an array of order ids. If more than 500 order ids are specified, the API call will fail with a bad request error.
|
1312
|
+
|
1313
|
+
|
1314
|
+
### Examples
|
1315
|
+
|
1316
|
+
```ruby
|
1317
|
+
# frozen_string_literal: true
|
1318
|
+
|
1319
|
+
require 'ultracart_api'
|
1320
|
+
require_relative '../constants'
|
1321
|
+
|
1322
|
+
=begin
|
1323
|
+
This method is useful when you need to query a defined set of orders and would like to avoid querying them
|
1324
|
+
one at a time.
|
1325
|
+
=end
|
1326
|
+
|
1327
|
+
# Possible Order Expansions:
|
1328
|
+
# affiliate affiliate.ledger auto_order
|
1329
|
+
# billing channel_partner checkout
|
1330
|
+
# coupon customer_profile digital_order
|
1331
|
+
# edi fraud_score gift
|
1332
|
+
# gift_certificate internal item
|
1333
|
+
# linked_shipment marketing payment
|
1334
|
+
# payment.transaction quote salesforce
|
1335
|
+
# shipping shipping.tracking_number_details summary
|
1336
|
+
# taxes
|
1337
|
+
|
1338
|
+
# Initialize API
|
1339
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
1340
|
+
|
1341
|
+
# Define expansion
|
1342
|
+
expansion = "item,summary,billing,shipping,shipping.tracking_number_details"
|
1343
|
+
|
1344
|
+
# Prepare order batch
|
1345
|
+
order_batch = UltracartClient::OrderQueryBatch.new(
|
1346
|
+
order_ids: ['DEMO-0009104390', 'DEMO-0009104391', 'DEMO-0009104392']
|
1347
|
+
)
|
1348
|
+
|
1349
|
+
# Retrieve orders
|
1350
|
+
begin
|
1351
|
+
api_response = order_api.get_orders_batch(
|
1352
|
+
order_query_batch: order_batch,
|
1353
|
+
opts: { '_expand' => expansion }
|
1354
|
+
)
|
1355
|
+
|
1356
|
+
# Check for errors
|
1357
|
+
if api_response.error
|
1358
|
+
warn "Developer Message: #{api_response.error.developer_message}"
|
1359
|
+
warn "User Message: #{api_response.error.user_message}"
|
1360
|
+
exit 1
|
1361
|
+
end
|
1362
|
+
|
1363
|
+
# Get orders
|
1364
|
+
orders = api_response.orders
|
1365
|
+
|
1366
|
+
if orders.empty?
|
1367
|
+
warn "There were no orders returned by this query."
|
1368
|
+
exit
|
1369
|
+
end
|
1370
|
+
|
1371
|
+
# Process each order
|
1372
|
+
orders.each do |order|
|
1373
|
+
# Access summary
|
1374
|
+
summary = order.summary
|
1375
|
+
actual_shipping_cost = summary.actual_shipping&.localized || 0
|
1376
|
+
|
1377
|
+
# Access shipping information
|
1378
|
+
s_addr = order.shipping
|
1379
|
+
tracking_numbers = s_addr.tracking_numbers || []
|
1380
|
+
tracking_numbers.each do |tnum|
|
1381
|
+
# Do something with tracking number here
|
1382
|
+
end
|
1383
|
+
|
1384
|
+
# Extract shipping address details
|
1385
|
+
sfname = s_addr.first_name
|
1386
|
+
slname = s_addr.last_name
|
1387
|
+
saddress1 = s_addr.address1
|
1388
|
+
saddress2 = s_addr.address2
|
1389
|
+
scity = s_addr.city
|
1390
|
+
sregion = s_addr.state_region
|
1391
|
+
sccode = s_addr.country_code
|
1392
|
+
spcode = s_addr.postal_code
|
1393
|
+
sdayphone = s_addr.day_phone
|
1394
|
+
shipping_method = s_addr.shipping_method
|
1395
|
+
|
1396
|
+
# Access billing information
|
1397
|
+
b_addr = order.billing
|
1398
|
+
b_addr.address1
|
1399
|
+
b_addr.address2
|
1400
|
+
b_addr.city
|
1401
|
+
b_addr.state_region
|
1402
|
+
b_addr.country_code
|
1403
|
+
b_addr.postal_code
|
1404
|
+
bemail = b_addr.email # email is located on the billing object
|
1405
|
+
|
1406
|
+
# Process order items
|
1407
|
+
items = order.items || []
|
1408
|
+
items.each do |item|
|
1409
|
+
qty = item.quantity
|
1410
|
+
item_id = item.merchant_item_id
|
1411
|
+
description = item.description
|
1412
|
+
cost = item.cost
|
1413
|
+
cost.localized # cost as float
|
1414
|
+
real_cost = cost.localized_formatted # cost with symbols
|
1415
|
+
end
|
1416
|
+
end
|
1417
|
+
|
1418
|
+
# Output orders
|
1419
|
+
p orders
|
1420
|
+
|
1421
|
+
rescue StandardError => e
|
1422
|
+
warn "An error occurred: #{e.message}"
|
1423
|
+
warn e.backtrace.join("\n")
|
1424
|
+
end
|
1425
|
+
```
|
1426
|
+
|
1427
|
+
|
1428
|
+
#### Using the get_orders_batch_with_http_info variant
|
1429
|
+
|
1430
|
+
This returns an Array which contains the response data, status code and headers.
|
1431
|
+
|
1432
|
+
> <Array(<OrdersResponse>, Integer, Hash)> get_orders_batch_with_http_info(order_batch, opts)
|
1433
|
+
|
1434
|
+
```ruby
|
1435
|
+
begin
|
1436
|
+
# Retrieve order batch
|
1437
|
+
data, status_code, headers = api_instance.get_orders_batch_with_http_info(order_batch, opts)
|
1438
|
+
p status_code # => 2xx
|
1439
|
+
p headers # => { ... }
|
1440
|
+
p data # => <OrdersResponse>
|
1441
|
+
rescue UltracartClient::ApiError => e
|
1442
|
+
puts "Error when calling OrderApi->get_orders_batch_with_http_info: #{e}"
|
1443
|
+
end
|
1444
|
+
```
|
1445
|
+
|
1446
|
+
### Parameters
|
1447
|
+
|
1448
|
+
| Name | Type | Description | Notes |
|
1449
|
+
| ---- | ---- | ----------- | ----- |
|
1450
|
+
| **order_batch** | [**OrderQueryBatch**](OrderQueryBatch.md) | Order batch | |
|
1451
|
+
| **_expand** | **String** | The object expansion to perform on the result. | [optional] |
|
1452
|
+
|
1453
|
+
### Return type
|
1454
|
+
|
1455
|
+
[**OrdersResponse**](OrdersResponse.md)
|
1456
|
+
|
1457
|
+
### Authorization
|
1458
|
+
|
1459
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1460
|
+
|
1461
|
+
### HTTP request headers
|
1462
|
+
|
1463
|
+
- **Content-Type**: application/json
|
1464
|
+
- **Accept**: application/json
|
1465
|
+
|
1466
|
+
|
1467
|
+
## get_orders_by_query
|
1468
|
+
|
1469
|
+
> <OrdersResponse> get_orders_by_query(order_query, opts)
|
1470
|
+
|
1471
|
+
Retrieve orders by query
|
1472
|
+
|
1473
|
+
Retrieves a group of orders from the account based on a query object. If no parameters are specified, the API call will fail with a bad request error. Always specify some parameters to limit the scope of the orders returned to ones you are truly interested in. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
|
1474
|
+
|
1475
|
+
|
1476
|
+
### Examples
|
1477
|
+
|
1478
|
+
```ruby
|
1479
|
+
# frozen_string_literal: true
|
1480
|
+
|
1481
|
+
require 'ultracart_api'
|
1482
|
+
require_relative '../constants'
|
1483
|
+
require 'date'
|
1484
|
+
|
1485
|
+
# Increase script execution time limit
|
1486
|
+
Process.setrlimit(Process::RLIMIT_CPU, 3000)
|
1487
|
+
|
1488
|
+
=begin
|
1489
|
+
This example illustrates how to query the OrderQuery object to select a range of records. It uses a subroutine
|
1490
|
+
to aggregate the records that span multiple API calls. This example illustrates a work-around to selecting
|
1491
|
+
all rejected orders. Because the UltraCart SDK does not have a way to query orders based on whether they
|
1492
|
+
were rejected, we can instead query based on the rejected_dts, which is null if the order is not rejected.
|
1493
|
+
So we will simply use a large time frame to ensure we query all rejections.
|
1494
|
+
=end
|
1495
|
+
|
1496
|
+
def get_order_chunk(order_api, offset, limit)
|
1497
|
+
# Possible Order Expansions:
|
1498
|
+
# affiliate affiliate.ledger auto_order
|
1499
|
+
# billing channel_partner checkout
|
1500
|
+
# coupon customer_profile digital_order
|
1501
|
+
# edi fraud_score gift
|
1502
|
+
# gift_certificate internal item
|
1503
|
+
# linked_shipment marketing payment
|
1504
|
+
# payment.transaction quote salesforce
|
1505
|
+
# shipping shipping.tracking_number_details summary
|
1506
|
+
# taxes
|
1507
|
+
|
1508
|
+
expansion = "item,summary,billing,shipping,shipping.tracking_number_details"
|
1509
|
+
|
1510
|
+
# Uncomment the next two lines to retrieve a single order. But there are simpler methods to do that.
|
1511
|
+
# order_id = "DEMO-0009104390"
|
1512
|
+
# order_query.order_id = order_id
|
1513
|
+
|
1514
|
+
# Create query with a very large date range
|
1515
|
+
begin_dts = (Date.today - 2000).strftime('%Y-%m-%d') + "T00:00:00+00:00"
|
1516
|
+
end_dts = Date.today.strftime('%Y-%m-%d') + "T00:00:00+00:00"
|
1517
|
+
|
1518
|
+
# Log date range (Ruby equivalent of PHP's error_log)
|
1519
|
+
warn begin_dts
|
1520
|
+
warn end_dts
|
1521
|
+
|
1522
|
+
# Prepare query
|
1523
|
+
query = UltracartClient::OrderQuery.new(
|
1524
|
+
refund_date_begin: begin_dts,
|
1525
|
+
refund_date_end: end_dts
|
1526
|
+
)
|
1527
|
+
|
1528
|
+
# Make API call
|
1529
|
+
api_response = order_api.get_orders_by_query(
|
1530
|
+
order_query: query,
|
1531
|
+
opts: {
|
1532
|
+
'_limit' => limit,
|
1533
|
+
'_offset' => offset,
|
1534
|
+
'_expand' => expansion
|
1535
|
+
}
|
1536
|
+
)
|
1537
|
+
|
1538
|
+
# Return orders or empty array
|
1539
|
+
api_response.orders || []
|
1540
|
+
end
|
1541
|
+
|
1542
|
+
# Initialize API
|
1543
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
1544
|
+
|
1545
|
+
# Initialize variables for order retrieval
|
1546
|
+
orders = []
|
1547
|
+
iteration = 1
|
1548
|
+
offset = 0
|
1549
|
+
limit = 200
|
1550
|
+
more_records_to_fetch = true
|
1551
|
+
|
1552
|
+
# Retrieve orders in chunks
|
1553
|
+
while more_records_to_fetch
|
1554
|
+
puts "executing iteration #{iteration}"
|
1555
|
+
|
1556
|
+
chunk_of_orders = get_order_chunk(order_api, offset, limit)
|
1557
|
+
orders.concat(chunk_of_orders)
|
1558
|
+
|
1559
|
+
offset += limit
|
1560
|
+
more_records_to_fetch = chunk_of_orders.length == limit
|
1561
|
+
iteration += 1
|
1562
|
+
end
|
1563
|
+
|
1564
|
+
# Output orders
|
1565
|
+
p orders
|
1566
|
+
```
|
1567
|
+
|
1568
|
+
|
1569
|
+
#### Using the get_orders_by_query_with_http_info variant
|
1570
|
+
|
1571
|
+
This returns an Array which contains the response data, status code and headers.
|
1572
|
+
|
1573
|
+
> <Array(<OrdersResponse>, Integer, Hash)> get_orders_by_query_with_http_info(order_query, opts)
|
1574
|
+
|
1575
|
+
```ruby
|
1576
|
+
begin
|
1577
|
+
# Retrieve orders by query
|
1578
|
+
data, status_code, headers = api_instance.get_orders_by_query_with_http_info(order_query, opts)
|
1579
|
+
p status_code # => 2xx
|
1580
|
+
p headers # => { ... }
|
1581
|
+
p data # => <OrdersResponse>
|
1582
|
+
rescue UltracartClient::ApiError => e
|
1583
|
+
puts "Error when calling OrderApi->get_orders_by_query_with_http_info: #{e}"
|
1584
|
+
end
|
1585
|
+
```
|
1586
|
+
|
1587
|
+
### Parameters
|
1588
|
+
|
1589
|
+
| Name | Type | Description | Notes |
|
1590
|
+
| ---- | ---- | ----------- | ----- |
|
1591
|
+
| **order_query** | [**OrderQuery**](OrderQuery.md) | Order query | |
|
1592
|
+
| **_limit** | **Integer** | The maximum number of records to return on this one API call. (Maximum 200) | [optional][default to 100] |
|
1593
|
+
| **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
|
1594
|
+
| **_sort** | **String** | The sort order of the orders. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. | [optional] |
|
1595
|
+
| **_expand** | **String** | The object expansion to perform on the result. | [optional] |
|
1596
|
+
|
1597
|
+
### Return type
|
1598
|
+
|
1599
|
+
[**OrdersResponse**](OrdersResponse.md)
|
1600
|
+
|
1601
|
+
### Authorization
|
1602
|
+
|
1603
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1604
|
+
|
1605
|
+
### HTTP request headers
|
1606
|
+
|
1607
|
+
- **Content-Type**: application/json
|
1608
|
+
- **Accept**: application/json
|
1609
|
+
|
1610
|
+
|
1611
|
+
## insert_order
|
1612
|
+
|
1613
|
+
> <OrderResponse> insert_order(order, opts)
|
1614
|
+
|
1615
|
+
Insert an order
|
1616
|
+
|
1617
|
+
Inserts a new order on the UltraCart account. This is probably NOT the method you want. This is for channel orders. For regular orders the customer is entering, use the CheckoutApi. It has many, many more features, checks, and validations.
|
1618
|
+
|
1619
|
+
|
1620
|
+
### Examples
|
1621
|
+
|
1622
|
+
```ruby
|
1623
|
+
# This is important:
|
1624
|
+
# You cannot use the Order API to insert an order.
|
1625
|
+
# Orders can only be created using the Checkout API. It contains a huge amount of validations and routines
|
1626
|
+
# to ensure order integrity. So the example below uses the Checkout API.
|
1627
|
+
#
|
1628
|
+
# This is equally important:
|
1629
|
+
# You cannot just add credit card numbers. The UltraCart system is designed from the "Security First".
|
1630
|
+
# As such, the system is designed so that merchants never touch credit card numbers. With that said, the API
|
1631
|
+
# must be able to interact with credit card numbers in a limited sense. To do so, you will need to use Hosted
|
1632
|
+
# Fields. Hosted fields are a set of javascript scripts designed for a web page that encapsulate credit card fields
|
1633
|
+
# inside iframes to prevent script attacks. If you need to provide credit cards (as the merchant) using the API,
|
1634
|
+
# you'll have to create a web page that has hosted fields, enter the credit card information, and then use
|
1635
|
+
# the subsequently provided token within your API objects to associate the credit card with the api object.
|
1636
|
+
#
|
1637
|
+
# Common objections to this insane amount of trouble to work with credit cards:
|
1638
|
+
# Objection 1: You can trust me.
|
1639
|
+
# Response 1: You? Maybe. The other guy? No. Experience has shown us that if we allow it, developers will misuse it.
|
1640
|
+
#
|
1641
|
+
# Objection 2: I need to automate something.
|
1642
|
+
# Response 2: There is nothing you need to automate with credit cards. Also, touching credit cards in any way moves
|
1643
|
+
# your code and your machines within PCI scope and could require you to provide expensive auditing of that code and
|
1644
|
+
# equipment should a payment company target you for an audit.
|
1645
|
+
#
|
1646
|
+
# Objection 3: My customers need to manage their information.
|
1647
|
+
# Response 3: We have tremendous tools and web pages already built and free to you, the merchant, that allow customers
|
1648
|
+
# to manage their own credit cards. We have email communication routines and powerful engines to keep track of customer
|
1649
|
+
# information and alert them to self-service any of their information should the need arise.
|
1650
|
+
#
|
1651
|
+
|
1652
|
+
# frozen_string_literal: true
|
1653
|
+
|
1654
|
+
require 'json'
|
1655
|
+
require 'ultracart_api'
|
1656
|
+
require_relative '../constants'
|
1657
|
+
|
1658
|
+
checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
|
1659
|
+
customer_api = UltracartClient::CustomerApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
|
1660
|
+
|
1661
|
+
# ----------------------------------------------------------------------------------
|
1662
|
+
# expansion should contain all the objects that will be needed throughout the checkout.
|
1663
|
+
# see https://www.ultracart.com/api/#Topic3 for the complete list.
|
1664
|
+
# This expansion list should be supplied for each get/put throughout or data may be lost on the return objects.
|
1665
|
+
expansion = 'billing,checkout,coupons,items,payment,settings.shipping.estimates,shipping,summary,taxes,coupons'
|
1666
|
+
# The expansion above doesn't include much of the item objects because they're not needed. For example, we don't
|
1667
|
+
# need the item multimedia because we're not showing this cart to an end customer like a javascript implementation would
|
1668
|
+
# if you needed to show images and such to a customer, then add 'items' to the csv above. Better, yet, if you need to do
|
1669
|
+
# all that, use javascript instead.
|
1670
|
+
# ----------------------------------------------------------------------------------
|
1671
|
+
|
1672
|
+
# look at an existing customer profile, grab the first shipping address, if any, and create a CartShipping object
|
1673
|
+
def get_shipping_from_profile(customer_profile)
|
1674
|
+
shipping = nil
|
1675
|
+
|
1676
|
+
if customer_profile.shipping&.length&.positive?
|
1677
|
+
shipping = UltracartClient::CartShipping.new
|
1678
|
+
shipping.company = customer_profile.shipping.company
|
1679
|
+
shipping.first_name = customer_profile.shipping.first_name
|
1680
|
+
shipping.last_name = customer_profile.shipping.last_name
|
1681
|
+
shipping.address1 = customer_profile.shipping.address1
|
1682
|
+
shipping.address2 = customer_profile.shipping.address2
|
1683
|
+
shipping.city = customer_profile.shipping.city
|
1684
|
+
shipping.postal_code = customer_profile.shipping.postal_code
|
1685
|
+
shipping.state_region = customer_profile.shipping.state_region
|
1686
|
+
shipping.country_code = customer_profile.shipping.country_code
|
1687
|
+
shipping.day_phone = customer_profile.shipping.day_phone
|
1688
|
+
shipping.evening_phone = customer_profile.shipping.evening_phone
|
1689
|
+
end
|
1690
|
+
|
1691
|
+
shipping
|
1692
|
+
end
|
1693
|
+
|
1694
|
+
# look at an existing customer profile, grab the first billing address, if any, and create a CartBilling object
|
1695
|
+
def get_billing_from_profile(customer_profile)
|
1696
|
+
billing = nil
|
1697
|
+
|
1698
|
+
if customer_profile.billing&.length&.positive?
|
1699
|
+
billing = UltracartClient::CartBilling.new
|
1700
|
+
billing.company = customer_profile.billing.company
|
1701
|
+
billing.first_name = customer_profile.billing.first_name
|
1702
|
+
billing.last_name = customer_profile.billing.last_name
|
1703
|
+
billing.address1 = customer_profile.billing.address1
|
1704
|
+
billing.address2 = customer_profile.billing.address2
|
1705
|
+
billing.city = customer_profile.billing.city
|
1706
|
+
billing.postal_code = customer_profile.billing.postal_code
|
1707
|
+
billing.state_region = customer_profile.billing.state_region
|
1708
|
+
billing.country_code = customer_profile.billing.country_code
|
1709
|
+
billing.day_phone = customer_profile.billing.day_phone
|
1710
|
+
billing.evening_phone = customer_profile.billing.evening_phone
|
1711
|
+
end
|
1712
|
+
|
1713
|
+
billing
|
1714
|
+
end
|
1715
|
+
|
1716
|
+
begin
|
1717
|
+
|
1718
|
+
email = 'test@test.com'
|
1719
|
+
cc_mask = 'XXXXXXXXXXXX1234'
|
1720
|
+
cvv_mask = 'XXX'
|
1721
|
+
cc_token = 'F893C8CBAE34830177F9EA9D97205400'
|
1722
|
+
cvv_token = '3FA7577E42F7580177F9EAA2FF1F5900'
|
1723
|
+
|
1724
|
+
get_response = checkout_api.get_cart(_expand: expansion)
|
1725
|
+
if get_response.errors&.length&.positive?
|
1726
|
+
# handle errors here.
|
1727
|
+
abort('System error. Could not retrieve shopping cart.')
|
1728
|
+
else
|
1729
|
+
cart = get_response.cart
|
1730
|
+
end
|
1731
|
+
|
1732
|
+
items = []
|
1733
|
+
item = UltracartClient::CartItem.new
|
1734
|
+
item.item_id = 'BONE'
|
1735
|
+
item.quantity = 1
|
1736
|
+
|
1737
|
+
# This 'Bone' item within the DEMO account has a single item option.
|
1738
|
+
# To get the name and possible values of, use the Item API and query the item.
|
1739
|
+
item_option = UltracartClient::CartItemOption.new
|
1740
|
+
item_option.name = 'Addon Treat'
|
1741
|
+
item_option.selected_value = 'No thanks'
|
1742
|
+
item.options = [item_option]
|
1743
|
+
|
1744
|
+
items.push(item)
|
1745
|
+
cart.items = items
|
1746
|
+
|
1747
|
+
# If the customer already has a customer profile, then load that profile and pull the shipping/billing from there.
|
1748
|
+
# otherwise populate it manually.
|
1749
|
+
customer_response = customer_api.get_customer_by_email(email, { _expand: 'shipping,billing,cards' })
|
1750
|
+
if customer_response&.customer
|
1751
|
+
|
1752
|
+
cp = customer_response.customer # cp is short for 'customer profile'
|
1753
|
+
cart.shipping = get_shipping_from_profile(cp)
|
1754
|
+
cart.billing = get_billing_from_profile(cp)
|
1755
|
+
|
1756
|
+
end
|
1757
|
+
|
1758
|
+
# if we didn't load the shipping from a customer profile, add it here (assume this data is collected from somewhere)
|
1759
|
+
unless cart.shipping
|
1760
|
+
shipping = UltracartClient::CartShipping.new
|
1761
|
+
shipping.company = 'UltraCart'
|
1762
|
+
shipping.first_name = 'Perry'
|
1763
|
+
shipping.last_name = 'Smith'
|
1764
|
+
shipping.address1 = '55 Main Street'
|
1765
|
+
shipping.address2 = 'Suite 101'
|
1766
|
+
shipping.city = 'Duluth'
|
1767
|
+
shipping.postal_code = '30097'
|
1768
|
+
shipping.state_region = 'GA'
|
1769
|
+
shipping.country_code = 'US'
|
1770
|
+
shipping.day_phone = '404-656-1776'
|
1771
|
+
shipping.evening_phone = '404-656-1776'
|
1772
|
+
cart.shipping = shipping
|
1773
|
+
end
|
1774
|
+
|
1775
|
+
unless cart.billing
|
1776
|
+
billing = UltracartClient::CartBilling.new
|
1777
|
+
billing.company = 'UltraCart'
|
1778
|
+
billing.first_name = 'Perry'
|
1779
|
+
billing.last_name = 'Smith'
|
1780
|
+
billing.address1 = '55 Main Street'
|
1781
|
+
billing.address2 = 'Suite 101'
|
1782
|
+
billing.city = 'Duluth'
|
1783
|
+
billing.postal_code = '30097'
|
1784
|
+
billing.state_region = 'GA'
|
1785
|
+
billing.country_code = 'US'
|
1786
|
+
billing.day_phone = '404-656-1776'
|
1787
|
+
billing.evening_phone = '404-656-1776'
|
1788
|
+
billing.email = email
|
1789
|
+
cart.billing = billing
|
1790
|
+
end
|
1791
|
+
|
1792
|
+
# --- Payment Block ---
|
1793
|
+
payment = UltracartClient::CartPayment.new
|
1794
|
+
credit_card = UltracartClient::CartPaymentCreditCard.new
|
1795
|
+
|
1796
|
+
credit_card.card_number = cc_mask
|
1797
|
+
credit_card.card_expiration_month = 3
|
1798
|
+
credit_card.card_expiration_year = 2031
|
1799
|
+
credit_card.card_type = 'Visa'
|
1800
|
+
credit_card.card_number_token = cc_token
|
1801
|
+
credit_card.card_verification_number = cvv_mask
|
1802
|
+
credit_card.card_verification_number_token = cvv_token
|
1803
|
+
|
1804
|
+
payment.payment_method = 'Credit Card'
|
1805
|
+
payment.credit_card = credit_card
|
1806
|
+
cart.payment = payment
|
1807
|
+
# --- End Payment Block ---
|
1808
|
+
|
1809
|
+
# add a coupon.
|
1810
|
+
coupon = UltracartClient::CartCoupon.new
|
1811
|
+
coupon.coupon_code = '10OFF' # you'll need to create a coupon first, you know?
|
1812
|
+
cart.coupons = [coupon]
|
1813
|
+
|
1814
|
+
# for best results, set the shipping address and update the server before
|
1815
|
+
# setting the shipping method. the cart that is returned below will have
|
1816
|
+
# the optimal shipping method estimates and ensure that you don't error
|
1817
|
+
# by selecting a shipping method that is somehow excluded from the possible
|
1818
|
+
# list for whatever reason (restrictions, locations, item-level constraints, etc)
|
1819
|
+
update_response = checkout_api.update_cart(cart, _expand: expansion)
|
1820
|
+
cart = update_response.cart
|
1821
|
+
|
1822
|
+
# for shipping, check the estimates and select one. for a completely non-interactive checkout such as this,
|
1823
|
+
# the shipping method will either be known beforehand (hard-coded) or use the least expensive method. The
|
1824
|
+
# least expensive method is always the first one, so for this example, I'll select the first shipping method.
|
1825
|
+
if cart.settings&.shipping
|
1826
|
+
shipping_settings = cart.settings.shipping
|
1827
|
+
estimates = shipping_settings.estimates
|
1828
|
+
if estimates != nil && estimates.length.positive?
|
1829
|
+
cart.shipping.shipping_method = estimates[0].name
|
1830
|
+
end
|
1831
|
+
end
|
1832
|
+
|
1833
|
+
update_response = checkout_api.update_cart(cart, _expand: expansion)
|
1834
|
+
cart = update_response.cart
|
1835
|
+
|
1836
|
+
# validate the cart to ensure everything is in order.
|
1837
|
+
validation_request = UltracartClient::CartValidationRequest.new
|
1838
|
+
validation_request.cart = cart # I don't set the checks variable. standard checks are usually sufficient.
|
1839
|
+
validation_response = checkout_api.validate_cart(validation_request)
|
1840
|
+
|
1841
|
+
errors = []
|
1842
|
+
order = nil
|
1843
|
+
|
1844
|
+
if validation_response.errors == nil || validation_response.errors.length.zero?
|
1845
|
+
finalize_request = UltracartClient::CartFinalizeOrderRequest.new
|
1846
|
+
finalize_request.cart = cart
|
1847
|
+
finalize_response = checkout_api.finalize_order(finalize_request)
|
1848
|
+
|
1849
|
+
if finalize_response
|
1850
|
+
if finalize_response.successful
|
1851
|
+
order = finalize_response.order
|
1852
|
+
else
|
1853
|
+
errors = finalize_response.errors
|
1854
|
+
end
|
1855
|
+
end
|
1856
|
+
|
1857
|
+
else
|
1858
|
+
errors = validation_response.errors
|
1859
|
+
end
|
1860
|
+
|
1861
|
+
rescue UltracartClient::ApiError => ex
|
1862
|
+
puts ex.to_json
|
1863
|
+
abort(ex.message)
|
1864
|
+
end
|
1865
|
+
|
1866
|
+
puts 'Errors follow:'
|
1867
|
+
puts errors.to_json
|
1868
|
+
|
1869
|
+
puts 'Order follows:'
|
1870
|
+
puts order.to_json
|
1871
|
+
```
|
1872
|
+
|
1873
|
+
|
1874
|
+
#### Using the insert_order_with_http_info variant
|
1875
|
+
|
1876
|
+
This returns an Array which contains the response data, status code and headers.
|
1877
|
+
|
1878
|
+
> <Array(<OrderResponse>, Integer, Hash)> insert_order_with_http_info(order, opts)
|
1879
|
+
|
1880
|
+
```ruby
|
1881
|
+
begin
|
1882
|
+
# Insert an order
|
1883
|
+
data, status_code, headers = api_instance.insert_order_with_http_info(order, opts)
|
1884
|
+
p status_code # => 2xx
|
1885
|
+
p headers # => { ... }
|
1886
|
+
p data # => <OrderResponse>
|
1887
|
+
rescue UltracartClient::ApiError => e
|
1888
|
+
puts "Error when calling OrderApi->insert_order_with_http_info: #{e}"
|
1889
|
+
end
|
1890
|
+
```
|
1891
|
+
|
1892
|
+
### Parameters
|
1893
|
+
|
1894
|
+
| Name | Type | Description | Notes |
|
1895
|
+
| ---- | ---- | ----------- | ----- |
|
1896
|
+
| **order** | [**Order**](Order.md) | Order to insert | |
|
1897
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
1898
|
+
|
1899
|
+
### Return type
|
1900
|
+
|
1901
|
+
[**OrderResponse**](OrderResponse.md)
|
1902
|
+
|
1903
|
+
### Authorization
|
1904
|
+
|
1905
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1906
|
+
|
1907
|
+
### HTTP request headers
|
1908
|
+
|
1909
|
+
- **Content-Type**: application/json; charset=UTF-8
|
1910
|
+
- **Accept**: application/json
|
1911
|
+
|
1912
|
+
|
1913
|
+
## is_refundable_order
|
1914
|
+
|
1915
|
+
> <OrderRefundableResponse> is_refundable_order(order_id)
|
1916
|
+
|
1917
|
+
Determine if an order can be refunded
|
1918
|
+
|
1919
|
+
Determine if an order can be refunded based upon payment method and age
|
1920
|
+
|
1921
|
+
|
1922
|
+
### Examples
|
1923
|
+
|
1924
|
+
```ruby
|
1925
|
+
require 'ultracart_api'
|
1926
|
+
require_relative '../constants'
|
1927
|
+
|
1928
|
+
# isRefundable queries the UltraCart system whether an order is refundable or not.
|
1929
|
+
# In addition to a simple boolean response, UltraCart also returns back any reasons why
|
1930
|
+
# an order is not refundable.
|
1931
|
+
# Finally, the response also contains any refund or return reasons configured on the account in the event
|
1932
|
+
# that this merchant account is configured to require a reason for a return or refund.
|
1933
|
+
|
1934
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
1935
|
+
|
1936
|
+
order_id = 'DEMO-0009104976'
|
1937
|
+
api_response = order_api.is_refundable_order(order_id)
|
1938
|
+
|
1939
|
+
p api_response
|
1940
|
+
```
|
1941
|
+
|
1942
|
+
|
1943
|
+
#### Using the is_refundable_order_with_http_info variant
|
1944
|
+
|
1945
|
+
This returns an Array which contains the response data, status code and headers.
|
1946
|
+
|
1947
|
+
> <Array(<OrderRefundableResponse>, Integer, Hash)> is_refundable_order_with_http_info(order_id)
|
1948
|
+
|
1949
|
+
```ruby
|
1950
|
+
begin
|
1951
|
+
# Determine if an order can be refunded
|
1952
|
+
data, status_code, headers = api_instance.is_refundable_order_with_http_info(order_id)
|
1953
|
+
p status_code # => 2xx
|
1954
|
+
p headers # => { ... }
|
1955
|
+
p data # => <OrderRefundableResponse>
|
1956
|
+
rescue UltracartClient::ApiError => e
|
1957
|
+
puts "Error when calling OrderApi->is_refundable_order_with_http_info: #{e}"
|
1958
|
+
end
|
1959
|
+
```
|
1960
|
+
|
1961
|
+
### Parameters
|
1962
|
+
|
1963
|
+
| Name | Type | Description | Notes |
|
1964
|
+
| ---- | ---- | ----------- | ----- |
|
1965
|
+
| **order_id** | **String** | The order id to check for refundable order. | |
|
1966
|
+
|
1967
|
+
### Return type
|
1968
|
+
|
1969
|
+
[**OrderRefundableResponse**](OrderRefundableResponse.md)
|
1970
|
+
|
1971
|
+
### Authorization
|
1972
|
+
|
1973
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
1974
|
+
|
1975
|
+
### HTTP request headers
|
1976
|
+
|
1977
|
+
- **Content-Type**: Not defined
|
1978
|
+
- **Accept**: application/json
|
1979
|
+
|
1980
|
+
|
1981
|
+
## process_payment
|
1982
|
+
|
1983
|
+
> <OrderProcessPaymentResponse> process_payment(order_id, process_payment_request)
|
1984
|
+
|
1985
|
+
Process payment
|
1986
|
+
|
1987
|
+
Process payment on order
|
1988
|
+
|
1989
|
+
|
1990
|
+
### Examples
|
1991
|
+
|
1992
|
+
```ruby
|
1993
|
+
require 'ultracart_api'
|
1994
|
+
require_relative '../constants'
|
1995
|
+
require_relative '../item_functions'
|
1996
|
+
|
1997
|
+
# OrderApi.process_payment() was designed to charge a customer for an order. It was created to work in tandem with
|
1998
|
+
# duplicate_order(), which does not accomplish payment on its own. The use-case for this method is to
|
1999
|
+
# duplicate a customer's order and then charge them for it. duplicate_order() does not charge the customer again,
|
2000
|
+
# which is why process_payment() exists.
|
2001
|
+
#
|
2002
|
+
# These are the steps for cloning an existing order and charging the customer for it.
|
2003
|
+
# 1. duplicate_order
|
2004
|
+
# 2. update_order (if you wish to change any part of it)
|
2005
|
+
# 3. process_payment to charge the customer.
|
2006
|
+
#
|
2007
|
+
# As a reminder, if you wish to create a new order from scratch, use the CheckoutApi or ChannelPartnerApi.
|
2008
|
+
# The OrderApi is for managing existing orders.
|
2009
|
+
|
2010
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
2011
|
+
|
2012
|
+
expansion = "items" # for this example, we're going to change the items after we duplicate the order, so
|
2013
|
+
# the only expansion properties we need are the items.
|
2014
|
+
# See: https://www.ultracart.com/api/ for a list of all expansions.
|
2015
|
+
|
2016
|
+
# Step 1. Duplicate the order
|
2017
|
+
order_id_to_duplicate = 'DEMO-0009104436'
|
2018
|
+
api_response = order_api.duplicate_order(order_id_to_duplicate, opts = { _expand: expansion })
|
2019
|
+
new_order = api_response.order
|
2020
|
+
|
2021
|
+
# Step 2. Update the items. I will create a new items array and assign it to the order to remove the old ones completely.
|
2022
|
+
items = []
|
2023
|
+
item = UltracartClient::OrderItem.new
|
2024
|
+
item.merchant_item_id = 'simple_teapot'
|
2025
|
+
item.quantity = 1
|
2026
|
+
item.description = "A lovely teapot"
|
2027
|
+
item.distribution_center_code = 'DFLT' # where is this item shipping out of?
|
2028
|
+
|
2029
|
+
cost = UltracartClient::Currency.new
|
2030
|
+
cost.currency_code = 'USD'
|
2031
|
+
cost.value = 9.99
|
2032
|
+
item.cost = cost
|
2033
|
+
|
2034
|
+
weight = UltracartClient::Weight.new
|
2035
|
+
weight.uom = "OZ"
|
2036
|
+
weight.value = 6
|
2037
|
+
item.weight = weight
|
2038
|
+
|
2039
|
+
items << item
|
2040
|
+
new_order.items = items
|
2041
|
+
update_response = order_api.update_order(new_order.order_id, new_order, opts = { _expand: expansion })
|
2042
|
+
|
2043
|
+
updated_order = update_response.order
|
2044
|
+
|
2045
|
+
# Step 3. process the payment.
|
2046
|
+
# the request object below takes two optional arguments.
|
2047
|
+
# The first is an amount if you wish to bill for an amount different from the order.
|
2048
|
+
# We do not bill differently in this example.
|
2049
|
+
# The second is card_verification_number_token, which is a token you can create by using our hosted fields to
|
2050
|
+
# upload a CVV value. This will create a token you may use here. However, most merchants using the duplicate
|
2051
|
+
# order method will be setting up an auto order for a customer. Those will not make use of the CVV, so we're
|
2052
|
+
# not including it here. That is why the request object below is does not have any values set.
|
2053
|
+
# For more info on hosted fields:
|
2054
|
+
# See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377775/UltraCart+Hosted+Credit+Card+Fields
|
2055
|
+
# See: https://github.com/UltraCart/sdk_samples/blob/master/hosted_fields/hosted_fields.html
|
2056
|
+
|
2057
|
+
process_payment_request = UltracartClient::OrderProcessPaymentRequest.new
|
2058
|
+
payment_response = order_api.process_payment(new_order.order_id, process_payment_request)
|
2059
|
+
transaction_details = payment_response.payment_transaction # do whatever you wish with this.
|
2060
|
+
|
2061
|
+
puts 'New Order (after updated items):'
|
2062
|
+
p updated_order
|
2063
|
+
puts 'Payment Response:'
|
2064
|
+
p payment_response
|
2065
|
+
```
|
2066
|
+
|
2067
|
+
|
2068
|
+
#### Using the process_payment_with_http_info variant
|
2069
|
+
|
2070
|
+
This returns an Array which contains the response data, status code and headers.
|
2071
|
+
|
2072
|
+
> <Array(<OrderProcessPaymentResponse>, Integer, Hash)> process_payment_with_http_info(order_id, process_payment_request)
|
2073
|
+
|
2074
|
+
```ruby
|
2075
|
+
begin
|
2076
|
+
# Process payment
|
2077
|
+
data, status_code, headers = api_instance.process_payment_with_http_info(order_id, process_payment_request)
|
2078
|
+
p status_code # => 2xx
|
2079
|
+
p headers # => { ... }
|
2080
|
+
p data # => <OrderProcessPaymentResponse>
|
2081
|
+
rescue UltracartClient::ApiError => e
|
2082
|
+
puts "Error when calling OrderApi->process_payment_with_http_info: #{e}"
|
2083
|
+
end
|
2084
|
+
```
|
2085
|
+
|
2086
|
+
### Parameters
|
2087
|
+
|
2088
|
+
| Name | Type | Description | Notes |
|
2089
|
+
| ---- | ---- | ----------- | ----- |
|
2090
|
+
| **order_id** | **String** | The order id to process payment on | |
|
2091
|
+
| **process_payment_request** | [**OrderProcessPaymentRequest**](OrderProcessPaymentRequest.md) | Process payment parameters | |
|
2092
|
+
|
2093
|
+
### Return type
|
2094
|
+
|
2095
|
+
[**OrderProcessPaymentResponse**](OrderProcessPaymentResponse.md)
|
2096
|
+
|
2097
|
+
### Authorization
|
2098
|
+
|
2099
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
2100
|
+
|
2101
|
+
### HTTP request headers
|
2102
|
+
|
2103
|
+
- **Content-Type**: application/json
|
2104
|
+
- **Accept**: application/json
|
2105
|
+
|
2106
|
+
|
2107
|
+
## refund_order
|
2108
|
+
|
2109
|
+
> <OrderResponse> refund_order(order_id, order, opts)
|
2110
|
+
|
2111
|
+
Refund an order
|
2112
|
+
|
2113
|
+
Perform a refund operation on an order and then update the order if successful. All of the object properties ending in _refunded should be the TOTAL amount that should end up being refunded. UltraCart will calculate the actual amount to refund based upon the prior refunds.
|
2114
|
+
|
2115
|
+
|
2116
|
+
### Examples
|
2117
|
+
|
2118
|
+
```ruby
|
2119
|
+
require 'ultracart_api'
|
2120
|
+
require_relative '../constants'
|
2121
|
+
|
2122
|
+
# refund_order() allows for both partial and complete refunds. Both are accomplished with the same steps.
|
2123
|
+
# 1) retrieve an order object using the SDK.
|
2124
|
+
# 2) input the refunded quantities for any or all items
|
2125
|
+
# 3) call refund_order, passing in the modified object.
|
2126
|
+
# 4) To do a full refund, set all item refund quantities to their purchased quantities.
|
2127
|
+
#
|
2128
|
+
# This example will perform a full refund.
|
2129
|
+
|
2130
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
2131
|
+
|
2132
|
+
# for the refund, I only need the items expanded to adjust their quantities.
|
2133
|
+
# See: https://www.ultracart.com/api/ for a list of all expansions.
|
2134
|
+
expansion = "items"
|
2135
|
+
|
2136
|
+
# Step 1. Retrieve the order
|
2137
|
+
order_id = 'DEMO-0009104436'
|
2138
|
+
order = order_api.get_order(order_id, opts = { _expand: expansion }).order
|
2139
|
+
|
2140
|
+
order.items.each do |item|
|
2141
|
+
item.quantity_refunded = item.quantity
|
2142
|
+
end
|
2143
|
+
|
2144
|
+
reject_after_refund = false
|
2145
|
+
skip_customer_notification = true
|
2146
|
+
cancel_associated_auto_orders = true # does not matter for this sample. the order is not a recurring order.
|
2147
|
+
consider_manual_refund_done_externally = false # no, I want an actual refund done through my gateway
|
2148
|
+
reverse_affiliate_transactions = true # can't let my affiliates get money on a refunded order. bad business.
|
2149
|
+
|
2150
|
+
opts = {
|
2151
|
+
_expand: expansion,
|
2152
|
+
'skip_customer_notification': skip_customer_notification,
|
2153
|
+
'cancel_associated_auto_orders': cancel_associated_auto_orders,
|
2154
|
+
'consider_manual_refund_done_externally': consider_manual_refund_done_externally,
|
2155
|
+
'reverse_affiliate_transactions': reverse_affiliate_transactions
|
2156
|
+
}
|
2157
|
+
|
2158
|
+
api_response = order_api.refund_order(order_id, order, opts)
|
2159
|
+
|
2160
|
+
refunded_order = api_response.order
|
2161
|
+
|
2162
|
+
# examined the subtotals and ensure everything was refunded correctly.
|
2163
|
+
p refunded_order
|
2164
|
+
```
|
2165
|
+
|
2166
|
+
|
2167
|
+
#### Using the refund_order_with_http_info variant
|
2168
|
+
|
2169
|
+
This returns an Array which contains the response data, status code and headers.
|
2170
|
+
|
2171
|
+
> <Array(<OrderResponse>, Integer, Hash)> refund_order_with_http_info(order_id, order, opts)
|
2172
|
+
|
2173
|
+
```ruby
|
2174
|
+
begin
|
2175
|
+
# Refund an order
|
2176
|
+
data, status_code, headers = api_instance.refund_order_with_http_info(order_id, order, opts)
|
2177
|
+
p status_code # => 2xx
|
2178
|
+
p headers # => { ... }
|
2179
|
+
p data # => <OrderResponse>
|
2180
|
+
rescue UltracartClient::ApiError => e
|
2181
|
+
puts "Error when calling OrderApi->refund_order_with_http_info: #{e}"
|
2182
|
+
end
|
2183
|
+
```
|
2184
|
+
|
2185
|
+
### Parameters
|
2186
|
+
|
2187
|
+
| Name | Type | Description | Notes |
|
2188
|
+
| ---- | ---- | ----------- | ----- |
|
2189
|
+
| **order_id** | **String** | The order id to refund. | |
|
2190
|
+
| **order** | [**Order**](Order.md) | Order to refund | |
|
2191
|
+
| **reject_after_refund** | **Boolean** | Reject order after refund | [optional][default to false] |
|
2192
|
+
| **skip_customer_notification** | **Boolean** | Skip customer email notification | [optional][default to false] |
|
2193
|
+
| **auto_order_cancel** | **Boolean** | Cancel associated auto orders | [optional][default to false] |
|
2194
|
+
| **manual_refund** | **Boolean** | Consider a manual refund done externally | [optional][default to false] |
|
2195
|
+
| **reverse_affiliate_transactions** | **Boolean** | Reverse affiliate transactions | [optional][default to true] |
|
2196
|
+
| **issue_store_credit** | **Boolean** | Issue a store credit instead of refunding the original payment method, loyalty must be configured on merchant account | [optional][default to false] |
|
2197
|
+
| **auto_order_cancel_reason** | **String** | Reason for auto orders cancellation | [optional] |
|
2198
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
2199
|
+
|
2200
|
+
### Return type
|
2201
|
+
|
2202
|
+
[**OrderResponse**](OrderResponse.md)
|
2203
|
+
|
2204
|
+
### Authorization
|
2205
|
+
|
2206
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
2207
|
+
|
2208
|
+
### HTTP request headers
|
2209
|
+
|
2210
|
+
- **Content-Type**: application/json; charset=UTF-8
|
2211
|
+
- **Accept**: application/json
|
2212
|
+
|
2213
|
+
|
2214
|
+
## refund_order_completely
|
2215
|
+
|
2216
|
+
> <OrderResponse> refund_order_completely(order_id, opts)
|
2217
|
+
|
2218
|
+
Refund an order completely
|
2219
|
+
|
2220
|
+
Perform a refund operation on an order and then update the order if successful.
|
2221
|
+
|
2222
|
+
|
2223
|
+
### Examples
|
2224
|
+
|
2225
|
+
|
2226
|
+
(No example for this operation).
|
2227
|
+
|
2228
|
+
|
2229
|
+
#### Using the refund_order_completely_with_http_info variant
|
2230
|
+
|
2231
|
+
This returns an Array which contains the response data, status code and headers.
|
2232
|
+
|
2233
|
+
> <Array(<OrderResponse>, Integer, Hash)> refund_order_completely_with_http_info(order_id, opts)
|
2234
|
+
|
2235
|
+
```ruby
|
2236
|
+
begin
|
2237
|
+
# Refund an order completely
|
2238
|
+
data, status_code, headers = api_instance.refund_order_completely_with_http_info(order_id, opts)
|
2239
|
+
p status_code # => 2xx
|
2240
|
+
p headers # => { ... }
|
2241
|
+
p data # => <OrderResponse>
|
2242
|
+
rescue UltracartClient::ApiError => e
|
2243
|
+
puts "Error when calling OrderApi->refund_order_completely_with_http_info: #{e}"
|
2244
|
+
end
|
2245
|
+
```
|
2246
|
+
|
2247
|
+
### Parameters
|
2248
|
+
|
2249
|
+
| Name | Type | Description | Notes |
|
2250
|
+
| ---- | ---- | ----------- | ----- |
|
2251
|
+
| **order_id** | **String** | The order id to refund. | |
|
2252
|
+
| **reject_after_refund** | **Boolean** | Reject order after refund | [optional][default to false] |
|
2253
|
+
| **skip_customer_notification** | **Boolean** | Skip customer email notification | [optional][default to false] |
|
2254
|
+
| **auto_order_cancel** | **Boolean** | Cancel associated auto orders | [optional][default to false] |
|
2255
|
+
| **manual_refund** | **Boolean** | Consider a manual refund done externally | [optional][default to false] |
|
2256
|
+
| **reverse_affiliate_transactions** | **Boolean** | Reverse affiliate transactions | [optional][default to true] |
|
2257
|
+
| **issue_store_credit** | **Boolean** | Issue a store credit instead of refunding the original payment method, loyalty must be configured on merchant account | [optional][default to false] |
|
2258
|
+
| **auto_order_cancel_reason** | **String** | Reason for auto orders cancellation | [optional] |
|
2259
|
+
| **refund_reason** | **String** | Reason for refund | [optional] |
|
2260
|
+
| **reject_reason** | **String** | Reason for reject | [optional] |
|
2261
|
+
|
2262
|
+
### Return type
|
2263
|
+
|
2264
|
+
[**OrderResponse**](OrderResponse.md)
|
2265
|
+
|
2266
|
+
### Authorization
|
2267
|
+
|
2268
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
2269
|
+
|
2270
|
+
### HTTP request headers
|
2271
|
+
|
2272
|
+
- **Content-Type**: Not defined
|
2273
|
+
- **Accept**: application/json
|
2274
|
+
|
2275
|
+
|
2276
|
+
## replacement
|
2277
|
+
|
2278
|
+
> <OrderReplacementResponse> replacement(order_id, replacement)
|
2279
|
+
|
2280
|
+
Replacement order
|
2281
|
+
|
2282
|
+
Create a replacement order based upon a previous order
|
2283
|
+
|
2284
|
+
|
2285
|
+
### Examples
|
2286
|
+
|
2287
|
+
```ruby
|
2288
|
+
require 'ultracart_api'
|
2289
|
+
require_relative '../constants'
|
2290
|
+
|
2291
|
+
# The use-case for replacement() is to create another order for a customer to replace the items of the existing
|
2292
|
+
# order. For example, a merchant is selling perishable goods and the goods arrive late, spoiled. replacement()
|
2293
|
+
# helps to create another order to send more goods to the customer.
|
2294
|
+
#
|
2295
|
+
# You MUST supply the items you desire in the replacement order. This is done with the OrderReplacement.items field.
|
2296
|
+
# All options are displayed below including whether to charge the customer for this replacement order or not.
|
2297
|
+
|
2298
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
2299
|
+
|
2300
|
+
# Step 1. Replace the order
|
2301
|
+
order_id_to_replace = 'DEMO-0009104436'
|
2302
|
+
replacement_options = UltracartClient::OrderReplacement.new
|
2303
|
+
replacement_options.original_order_id = order_id_to_replace
|
2304
|
+
|
2305
|
+
items = []
|
2306
|
+
|
2307
|
+
item1 = UltracartClient::OrderReplacementItem.new
|
2308
|
+
item1.merchant_item_id = 'TSHIRT'
|
2309
|
+
item1.quantity = 1
|
2310
|
+
# item1.arbitrary_unit_cost = 9.99
|
2311
|
+
items << item1
|
2312
|
+
|
2313
|
+
item2 = UltracartClient::OrderReplacementItem.new
|
2314
|
+
item2.merchant_item_id = 'BONE'
|
2315
|
+
item2.quantity = 2
|
2316
|
+
items << item2
|
2317
|
+
|
2318
|
+
replacement_options.items = items
|
2319
|
+
|
2320
|
+
# replacement_options.shipping_method = 'FedEx: Ground'
|
2321
|
+
replacement_options.immediate_charge = true
|
2322
|
+
replacement_options.skip_payment = true
|
2323
|
+
replacement_options.free = true
|
2324
|
+
replacement_options.custom_field1 = 'Whatever'
|
2325
|
+
replacement_options.custom_field4 = 'More Whatever'
|
2326
|
+
replacement_options.additional_merchant_notes_new_order = 'Replacement order for spoiled ice cream'
|
2327
|
+
replacement_options.additional_merchant_notes_original_order = 'This order was replaced.'
|
2328
|
+
|
2329
|
+
api_response = order_api.replacement(order_id_to_replace, replacement_options)
|
2330
|
+
|
2331
|
+
puts "Replacement Order: #{api_response.order_id}"
|
2332
|
+
puts "Success flag: #{api_response.successful}"
|
2333
|
+
```
|
2334
|
+
|
2335
|
+
|
2336
|
+
#### Using the replacement_with_http_info variant
|
2337
|
+
|
2338
|
+
This returns an Array which contains the response data, status code and headers.
|
2339
|
+
|
2340
|
+
> <Array(<OrderReplacementResponse>, Integer, Hash)> replacement_with_http_info(order_id, replacement)
|
2341
|
+
|
2342
|
+
```ruby
|
2343
|
+
begin
|
2344
|
+
# Replacement order
|
2345
|
+
data, status_code, headers = api_instance.replacement_with_http_info(order_id, replacement)
|
2346
|
+
p status_code # => 2xx
|
2347
|
+
p headers # => { ... }
|
2348
|
+
p data # => <OrderReplacementResponse>
|
2349
|
+
rescue UltracartClient::ApiError => e
|
2350
|
+
puts "Error when calling OrderApi->replacement_with_http_info: #{e}"
|
2351
|
+
end
|
2352
|
+
```
|
2353
|
+
|
2354
|
+
### Parameters
|
2355
|
+
|
2356
|
+
| Name | Type | Description | Notes |
|
2357
|
+
| ---- | ---- | ----------- | ----- |
|
2358
|
+
| **order_id** | **String** | The order id to generate a replacement for. | |
|
2359
|
+
| **replacement** | [**OrderReplacement**](OrderReplacement.md) | Replacement order details | |
|
2360
|
+
|
2361
|
+
### Return type
|
2362
|
+
|
2363
|
+
[**OrderReplacementResponse**](OrderReplacementResponse.md)
|
2364
|
+
|
2365
|
+
### Authorization
|
2366
|
+
|
2367
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
2368
|
+
|
2369
|
+
### HTTP request headers
|
2370
|
+
|
2371
|
+
- **Content-Type**: application/json
|
2372
|
+
- **Accept**: application/json
|
2373
|
+
|
2374
|
+
|
2375
|
+
## resend_receipt
|
2376
|
+
|
2377
|
+
> <BaseResponse> resend_receipt(order_id)
|
2378
|
+
|
2379
|
+
Resend receipt
|
2380
|
+
|
2381
|
+
Resend the receipt for an order on the UltraCart account.
|
2382
|
+
|
2383
|
+
|
2384
|
+
### Examples
|
2385
|
+
|
2386
|
+
```ruby
|
2387
|
+
require 'ultracart_api'
|
2388
|
+
require_relative '../constants'
|
2389
|
+
|
2390
|
+
# OrderApi.resend_receipt() will resend (email) a receipt to a customer.
|
2391
|
+
|
2392
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
2393
|
+
|
2394
|
+
order_id = 'DEMO-0009104436'
|
2395
|
+
|
2396
|
+
api_response = order_api.resend_receipt(order_id)
|
2397
|
+
|
2398
|
+
if api_response.error
|
2399
|
+
puts api_response.error.developer_message
|
2400
|
+
puts api_response.error.user_message
|
2401
|
+
puts 'Order could not be adjusted. See output above.'
|
2402
|
+
exit
|
2403
|
+
end
|
2404
|
+
|
2405
|
+
if api_response.success
|
2406
|
+
puts 'Receipt was resent.'
|
2407
|
+
else
|
2408
|
+
puts 'Failed to resend receipt.'
|
2409
|
+
end
|
2410
|
+
```
|
2411
|
+
|
2412
|
+
|
2413
|
+
#### Using the resend_receipt_with_http_info variant
|
2414
|
+
|
2415
|
+
This returns an Array which contains the response data, status code and headers.
|
2416
|
+
|
2417
|
+
> <Array(<BaseResponse>, Integer, Hash)> resend_receipt_with_http_info(order_id)
|
2418
|
+
|
2419
|
+
```ruby
|
2420
|
+
begin
|
2421
|
+
# Resend receipt
|
2422
|
+
data, status_code, headers = api_instance.resend_receipt_with_http_info(order_id)
|
2423
|
+
p status_code # => 2xx
|
2424
|
+
p headers # => { ... }
|
2425
|
+
p data # => <BaseResponse>
|
2426
|
+
rescue UltracartClient::ApiError => e
|
2427
|
+
puts "Error when calling OrderApi->resend_receipt_with_http_info: #{e}"
|
2428
|
+
end
|
2429
|
+
```
|
2430
|
+
|
2431
|
+
### Parameters
|
2432
|
+
|
2433
|
+
| Name | Type | Description | Notes |
|
2434
|
+
| ---- | ---- | ----------- | ----- |
|
2435
|
+
| **order_id** | **String** | The order id to resend the receipt for. | |
|
2436
|
+
|
2437
|
+
### Return type
|
2438
|
+
|
2439
|
+
[**BaseResponse**](BaseResponse.md)
|
2440
|
+
|
2441
|
+
### Authorization
|
2442
|
+
|
2443
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
2444
|
+
|
2445
|
+
### HTTP request headers
|
2446
|
+
|
2447
|
+
- **Content-Type**: Not defined
|
2448
|
+
- **Accept**: application/json
|
2449
|
+
|
2450
|
+
|
2451
|
+
## resend_shipment_confirmation
|
2452
|
+
|
2453
|
+
> <BaseResponse> resend_shipment_confirmation(order_id)
|
2454
|
+
|
2455
|
+
Resend shipment confirmation
|
2456
|
+
|
2457
|
+
Resend shipment confirmation for an order on the UltraCart account.
|
2458
|
+
|
2459
|
+
|
2460
|
+
### Examples
|
2461
|
+
|
2462
|
+
```ruby
|
2463
|
+
require 'ultracart_api'
|
2464
|
+
require_relative '../constants'
|
2465
|
+
|
2466
|
+
# OrderApi.resend_shipment_confirmation() will resend (email) a shipment confirmation to a customer.
|
2467
|
+
|
2468
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
2469
|
+
|
2470
|
+
order_id = 'DEMO-0009104436'
|
2471
|
+
|
2472
|
+
api_response = order_api.resend_shipment_confirmation(order_id)
|
2473
|
+
|
2474
|
+
if api_response.error
|
2475
|
+
puts api_response.error.developer_message
|
2476
|
+
puts api_response.error.user_message
|
2477
|
+
puts 'Order could not be adjusted. See output above.'
|
2478
|
+
exit
|
2479
|
+
end
|
2480
|
+
|
2481
|
+
if api_response.success
|
2482
|
+
puts 'Shipment confirmation was resent.'
|
2483
|
+
else
|
2484
|
+
puts 'Failed to resend shipment confirmation.'
|
2485
|
+
end
|
2486
|
+
```
|
2487
|
+
|
2488
|
+
|
2489
|
+
#### Using the resend_shipment_confirmation_with_http_info variant
|
2490
|
+
|
2491
|
+
This returns an Array which contains the response data, status code and headers.
|
2492
|
+
|
2493
|
+
> <Array(<BaseResponse>, Integer, Hash)> resend_shipment_confirmation_with_http_info(order_id)
|
2494
|
+
|
2495
|
+
```ruby
|
2496
|
+
begin
|
2497
|
+
# Resend shipment confirmation
|
2498
|
+
data, status_code, headers = api_instance.resend_shipment_confirmation_with_http_info(order_id)
|
2499
|
+
p status_code # => 2xx
|
2500
|
+
p headers # => { ... }
|
2501
|
+
p data # => <BaseResponse>
|
2502
|
+
rescue UltracartClient::ApiError => e
|
2503
|
+
puts "Error when calling OrderApi->resend_shipment_confirmation_with_http_info: #{e}"
|
2504
|
+
end
|
2505
|
+
```
|
2506
|
+
|
2507
|
+
### Parameters
|
2508
|
+
|
2509
|
+
| Name | Type | Description | Notes |
|
2510
|
+
| ---- | ---- | ----------- | ----- |
|
2511
|
+
| **order_id** | **String** | The order id to resend the shipment notification for. | |
|
2512
|
+
|
2513
|
+
### Return type
|
2514
|
+
|
2515
|
+
[**BaseResponse**](BaseResponse.md)
|
2516
|
+
|
2517
|
+
### Authorization
|
2518
|
+
|
2519
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
2520
|
+
|
2521
|
+
### HTTP request headers
|
2522
|
+
|
2523
|
+
- **Content-Type**: Not defined
|
2524
|
+
- **Accept**: application/json
|
2525
|
+
|
2526
|
+
|
2527
|
+
## update_accounts_receivable_retry_config
|
2528
|
+
|
2529
|
+
> <BaseResponse> update_accounts_receivable_retry_config(retry_config)
|
2530
|
+
|
2531
|
+
Update A/R Retry Configuration
|
2532
|
+
|
2533
|
+
Update A/R Retry Configuration. This is primarily an internal API call. It is doubtful you would ever need to use it.
|
2534
|
+
|
2535
|
+
|
2536
|
+
### Examples
|
2537
|
+
|
2538
|
+
```ruby
|
2539
|
+
# This is primarily an internal API call. It is doubtful you would ever need to use it.
|
2540
|
+
# We do not provide an example for this call.
|
2541
|
+
```
|
2542
|
+
|
2543
|
+
|
2544
|
+
#### Using the update_accounts_receivable_retry_config_with_http_info variant
|
2545
|
+
|
2546
|
+
This returns an Array which contains the response data, status code and headers.
|
2547
|
+
|
2548
|
+
> <Array(<BaseResponse>, Integer, Hash)> update_accounts_receivable_retry_config_with_http_info(retry_config)
|
2549
|
+
|
2550
|
+
```ruby
|
2551
|
+
begin
|
2552
|
+
# Update A/R Retry Configuration
|
2553
|
+
data, status_code, headers = api_instance.update_accounts_receivable_retry_config_with_http_info(retry_config)
|
2554
|
+
p status_code # => 2xx
|
2555
|
+
p headers # => { ... }
|
2556
|
+
p data # => <BaseResponse>
|
2557
|
+
rescue UltracartClient::ApiError => e
|
2558
|
+
puts "Error when calling OrderApi->update_accounts_receivable_retry_config_with_http_info: #{e}"
|
2559
|
+
end
|
2560
|
+
```
|
2561
|
+
|
2562
|
+
### Parameters
|
2563
|
+
|
2564
|
+
| Name | Type | Description | Notes |
|
2565
|
+
| ---- | ---- | ----------- | ----- |
|
2566
|
+
| **retry_config** | [**AccountsReceivableRetryConfig**](AccountsReceivableRetryConfig.md) | AccountsReceivableRetryConfig object | |
|
2567
|
+
|
2568
|
+
### Return type
|
2569
|
+
|
2570
|
+
[**BaseResponse**](BaseResponse.md)
|
2571
|
+
|
2572
|
+
### Authorization
|
2573
|
+
|
2574
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
2575
|
+
|
2576
|
+
### HTTP request headers
|
2577
|
+
|
2578
|
+
- **Content-Type**: application/json
|
2579
|
+
- **Accept**: application/json
|
2580
|
+
|
2581
|
+
|
2582
|
+
## update_order
|
2583
|
+
|
2584
|
+
> <OrderResponse> update_order(order_id, order, opts)
|
2585
|
+
|
2586
|
+
Update an order
|
2587
|
+
|
2588
|
+
Update a new order on the UltraCart account. This is probably NOT the method you want. It is rare to update a completed order. This will not trigger charges, emails, or any other automation.
|
2589
|
+
|
2590
|
+
|
2591
|
+
### Examples
|
2592
|
+
|
2593
|
+
```ruby
|
2594
|
+
require 'ultracart_api'
|
2595
|
+
require_relative '../constants'
|
2596
|
+
|
2597
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
2598
|
+
|
2599
|
+
expansion = "checkout" # see the get_order sample for expansion discussion
|
2600
|
+
|
2601
|
+
order_id = 'DEMO-0009104976'
|
2602
|
+
order = order_api.get_order(order_id, opts = { _expand: expansion }).order
|
2603
|
+
|
2604
|
+
p order
|
2605
|
+
|
2606
|
+
# TODO: do some updates to the order.
|
2607
|
+
|
2608
|
+
api_response = order_api.update_order(order_id, order, opts = { _expand: expansion })
|
2609
|
+
|
2610
|
+
if api_response.error
|
2611
|
+
puts api_response.error.developer_message
|
2612
|
+
puts api_response.error.user_message
|
2613
|
+
exit
|
2614
|
+
end
|
2615
|
+
|
2616
|
+
updated_order = api_response.order
|
2617
|
+
|
2618
|
+
puts 'After Update'
|
2619
|
+
p updated_order
|
2620
|
+
```
|
2621
|
+
|
2622
|
+
|
2623
|
+
#### Using the update_order_with_http_info variant
|
2624
|
+
|
2625
|
+
This returns an Array which contains the response data, status code and headers.
|
2626
|
+
|
2627
|
+
> <Array(<OrderResponse>, Integer, Hash)> update_order_with_http_info(order_id, order, opts)
|
2628
|
+
|
2629
|
+
```ruby
|
2630
|
+
begin
|
2631
|
+
# Update an order
|
2632
|
+
data, status_code, headers = api_instance.update_order_with_http_info(order_id, order, opts)
|
2633
|
+
p status_code # => 2xx
|
2634
|
+
p headers # => { ... }
|
2635
|
+
p data # => <OrderResponse>
|
2636
|
+
rescue UltracartClient::ApiError => e
|
2637
|
+
puts "Error when calling OrderApi->update_order_with_http_info: #{e}"
|
2638
|
+
end
|
2639
|
+
```
|
2640
|
+
|
2641
|
+
### Parameters
|
2642
|
+
|
2643
|
+
| Name | Type | Description | Notes |
|
2644
|
+
| ---- | ---- | ----------- | ----- |
|
2645
|
+
| **order_id** | **String** | The order id to update. | |
|
2646
|
+
| **order** | [**Order**](Order.md) | Order to update | |
|
2647
|
+
| **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
|
2648
|
+
|
2649
|
+
### Return type
|
2650
|
+
|
2651
|
+
[**OrderResponse**](OrderResponse.md)
|
2652
|
+
|
2653
|
+
### Authorization
|
2654
|
+
|
2655
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
2656
|
+
|
2657
|
+
### HTTP request headers
|
2658
|
+
|
2659
|
+
- **Content-Type**: application/json; charset=UTF-8
|
2660
|
+
- **Accept**: application/json
|
2661
|
+
|
2662
|
+
|
2663
|
+
## validate_order
|
2664
|
+
|
2665
|
+
> <OrderValidationResponse> validate_order(validation_request)
|
2666
|
+
|
2667
|
+
Validate
|
2668
|
+
|
2669
|
+
Validate the order for errors. Specific checks can be passed to fine tune what is validated. Read and write permissions are required because the validate method may fix obvious address issues automatically which require update permission.This rest call makes use of the built-in translation of rest objects to UltraCart internal objects which also contains a multitude of validation checks that cannot be trapped. Therefore any time this call is made, you should also trap api exceptions and examine their content because it may contain validation issues. So check the response object and trap any exceptions.
|
2670
|
+
|
2671
|
+
|
2672
|
+
### Examples
|
2673
|
+
|
2674
|
+
```ruby
|
2675
|
+
require 'ultracart_api'
|
2676
|
+
require_relative '../constants'
|
2677
|
+
|
2678
|
+
# validateOrder may be used to check for any and all validation errors that may result from an insert_order
|
2679
|
+
# or update_order call. Because those methods are built on our existing infrastructure, some validation
|
2680
|
+
# errors may not bubble up to the rest api call and instead be returned as generic "something went wrong" errors.
|
2681
|
+
# This call will return detail validation issues needing correction.
|
2682
|
+
#
|
2683
|
+
# Within the ValidationRequest, you may leave the 'checks' array null to check for everything, or pass
|
2684
|
+
# an array of the specific checks you desire. Here is a list of the checks:
|
2685
|
+
#
|
2686
|
+
# "Billing Address Provided"
|
2687
|
+
# "Billing Destination Restriction"
|
2688
|
+
# "Billing Phone Numbers Provided"
|
2689
|
+
# "Billing State Abbreviation Valid"
|
2690
|
+
# "Billing Validate City State Zip"
|
2691
|
+
# "Email provided if required"
|
2692
|
+
# "Gift Message Length"
|
2693
|
+
# "Item Quantity Valid"
|
2694
|
+
# "Items Present"
|
2695
|
+
# "Merchant Specific Item Relationships"
|
2696
|
+
# "One per customer violations"
|
2697
|
+
# "Referral Code Provided"
|
2698
|
+
# "Shipping Address Provided"
|
2699
|
+
# "Shipping Destination Restriction"
|
2700
|
+
# "Shipping Method Ignore Invalid"
|
2701
|
+
# "Shipping Method Provided"
|
2702
|
+
# "Shipping State Abbreviation Valid"
|
2703
|
+
# "Shipping Validate City State Zip"
|
2704
|
+
# "Special Instructions Length"
|
2705
|
+
|
2706
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
2707
|
+
|
2708
|
+
expansion = "checkout" # see the get_order sample for expansion discussion
|
2709
|
+
|
2710
|
+
order_id = 'DEMO-0009104976'
|
2711
|
+
order = order_api.get_order(order_id, opts = { _expand: expansion }).order
|
2712
|
+
|
2713
|
+
p order
|
2714
|
+
|
2715
|
+
# TODO: do some updates to the order.
|
2716
|
+
validation_request = UltracartClient::OrderValidationRequest.new
|
2717
|
+
validation_request.order = order
|
2718
|
+
validation_request.checks = nil # leaving this null to perform all validations.
|
2719
|
+
|
2720
|
+
api_response = order_api.validate_order(validation_request)
|
2721
|
+
|
2722
|
+
puts 'Validation errors:'
|
2723
|
+
if api_response.errors
|
2724
|
+
api_response.errors.each do |error|
|
2725
|
+
puts error
|
2726
|
+
end
|
2727
|
+
end
|
2728
|
+
|
2729
|
+
puts 'Validation messages:'
|
2730
|
+
if api_response.messages
|
2731
|
+
api_response.messages.each do |message|
|
2732
|
+
puts message
|
2733
|
+
end
|
2734
|
+
end
|
2735
|
+
```
|
2736
|
+
|
2737
|
+
|
2738
|
+
#### Using the validate_order_with_http_info variant
|
2739
|
+
|
2740
|
+
This returns an Array which contains the response data, status code and headers.
|
2741
|
+
|
2742
|
+
> <Array(<OrderValidationResponse>, Integer, Hash)> validate_order_with_http_info(validation_request)
|
2743
|
+
|
2744
|
+
```ruby
|
2745
|
+
begin
|
2746
|
+
# Validate
|
2747
|
+
data, status_code, headers = api_instance.validate_order_with_http_info(validation_request)
|
2748
|
+
p status_code # => 2xx
|
2749
|
+
p headers # => { ... }
|
2750
|
+
p data # => <OrderValidationResponse>
|
2751
|
+
rescue UltracartClient::ApiError => e
|
2752
|
+
puts "Error when calling OrderApi->validate_order_with_http_info: #{e}"
|
2753
|
+
end
|
2754
|
+
```
|
2755
|
+
|
2756
|
+
### Parameters
|
2757
|
+
|
2758
|
+
| Name | Type | Description | Notes |
|
2759
|
+
| ---- | ---- | ----------- | ----- |
|
2760
|
+
| **validation_request** | [**OrderValidationRequest**](OrderValidationRequest.md) | Validation request | |
|
2761
|
+
|
2762
|
+
### Return type
|
2763
|
+
|
2764
|
+
[**OrderValidationResponse**](OrderValidationResponse.md)
|
2765
|
+
|
2766
|
+
### Authorization
|
2767
|
+
|
2768
|
+
[ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
|
2769
|
+
|
2770
|
+
### HTTP request headers
|
2771
|
+
|
2772
|
+
- **Content-Type**: application/json
|
2773
|
+
- **Accept**: application/json
|
2774
|
+
|