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.
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
- ### Examples
46
-
47
- ```ruby
48
- require 'time'
49
- require 'ultracart_api'
50
- require 'json'
51
- require 'yaml'
52
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
53
-
54
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
55
- # As such, this might not be the best way to use this object.
56
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
57
-
58
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
59
- order_id = 'order_id_example' # String | The order id to cancel.
60
- desired_total = 'desired_total_example' # String | The desired total with no formatting. example 123.45
61
-
62
- begin
63
- # Adjusts an order total
64
- result = api_instance.adjust_order_total(order_id, desired_total)
65
- p result
66
- rescue UltracartClient::ApiError => e
67
- puts "Error when calling OrderApi->adjust_order_total: #{e}"
68
- end
69
- ```
70
-
71
- #### Using the adjust_order_total_with_http_info variant
72
-
73
- This returns an Array which contains the response data, status code and headers.
74
-
75
- > <Array(<BaseResponse>, Integer, Hash)> adjust_order_total_with_http_info(order_id, desired_total)
76
-
77
- ```ruby
78
- begin
79
- # Adjusts an order total
80
- data, status_code, headers = api_instance.adjust_order_total_with_http_info(order_id, desired_total)
81
- p status_code # => 2xx
82
- p headers # => { ... }
83
- p data # => <BaseResponse>
84
- rescue UltracartClient::ApiError => e
85
- puts "Error when calling OrderApi->adjust_order_total_with_http_info: #{e}"
86
- end
87
- ```
88
-
89
- ### Parameters
90
-
91
- | Name | Type | Description | Notes |
92
- | ---- | ---- | ----------- | ----- |
93
- | **order_id** | **String** | The order id to cancel. | |
94
- | **desired_total** | **String** | The desired total with no formatting. example 123.45 | |
95
-
96
- ### Return type
97
-
98
- [**BaseResponse**](BaseResponse.md)
99
-
100
- ### Authorization
101
-
102
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
103
-
104
- ### HTTP request headers
105
-
106
- - **Content-Type**: Not defined
107
- - **Accept**: application/json
108
-
109
-
110
- ## cancel_order
111
-
112
- > <BaseResponse> cancel_order(order_id, opts)
113
-
114
- Cancel an order
115
-
116
- Cancel an order on the UltraCart account. If the success flag is false, then consult the error message for why it failed.
117
-
118
- ### Examples
119
-
120
- ```ruby
121
- require 'time'
122
- require 'ultracart_api'
123
- require 'json'
124
- require 'yaml'
125
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
126
-
127
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
128
- # As such, this might not be the best way to use this object.
129
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
130
-
131
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
132
- order_id = 'order_id_example' # String | The order id to cancel.
133
- opts = {
134
- lock_self_ship_orders: true, # Boolean | Flag to prevent a order shipping during a refund process
135
- skip_refund_and_hold: true # Boolean | Skip refund and move order to Held Orders department
136
- }
137
-
138
- begin
139
- # Cancel an order
140
- result = api_instance.cancel_order(order_id, opts)
141
- p result
142
- rescue UltracartClient::ApiError => e
143
- puts "Error when calling OrderApi->cancel_order: #{e}"
144
- end
145
- ```
146
-
147
- #### Using the cancel_order_with_http_info variant
148
-
149
- This returns an Array which contains the response data, status code and headers.
150
-
151
- > <Array(<BaseResponse>, Integer, Hash)> cancel_order_with_http_info(order_id, opts)
152
-
153
- ```ruby
154
- begin
155
- # Cancel an order
156
- data, status_code, headers = api_instance.cancel_order_with_http_info(order_id, opts)
157
- p status_code # => 2xx
158
- p headers # => { ... }
159
- p data # => <BaseResponse>
160
- rescue UltracartClient::ApiError => e
161
- puts "Error when calling OrderApi->cancel_order_with_http_info: #{e}"
162
- end
163
- ```
164
-
165
- ### Parameters
166
-
167
- | Name | Type | Description | Notes |
168
- | ---- | ---- | ----------- | ----- |
169
- | **order_id** | **String** | The order id to cancel. | |
170
- | **lock_self_ship_orders** | **Boolean** | Flag to prevent a order shipping during a refund process | [optional] |
171
- | **skip_refund_and_hold** | **Boolean** | Skip refund and move order to Held Orders department | [optional] |
172
-
173
- ### Return type
174
-
175
- [**BaseResponse**](BaseResponse.md)
176
-
177
- ### Authorization
178
-
179
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
180
-
181
- ### HTTP request headers
182
-
183
- - **Content-Type**: Not defined
184
- - **Accept**: application/json
185
-
186
-
187
- ## delete_order
188
-
189
- > delete_order(order_id)
190
-
191
- Delete an order
192
-
193
- Delete an order on the UltraCart account.
194
-
195
- ### Examples
196
-
197
- ```ruby
198
- require 'time'
199
- require 'ultracart_api'
200
- require 'json'
201
- require 'yaml'
202
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
203
-
204
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
205
- # As such, this might not be the best way to use this object.
206
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
207
-
208
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
209
- order_id = 'order_id_example' # String | The order id to delete.
210
-
211
- begin
212
- # Delete an order
213
- api_instance.delete_order(order_id)
214
- rescue UltracartClient::ApiError => e
215
- puts "Error when calling OrderApi->delete_order: #{e}"
216
- end
217
- ```
218
-
219
- #### Using the delete_order_with_http_info variant
220
-
221
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
222
-
223
- > <Array(nil, Integer, Hash)> delete_order_with_http_info(order_id)
224
-
225
- ```ruby
226
- begin
227
- # Delete an order
228
- data, status_code, headers = api_instance.delete_order_with_http_info(order_id)
229
- p status_code # => 2xx
230
- p headers # => { ... }
231
- p data # => nil
232
- rescue UltracartClient::ApiError => e
233
- puts "Error when calling OrderApi->delete_order_with_http_info: #{e}"
234
- end
235
- ```
236
-
237
- ### Parameters
238
-
239
- | Name | Type | Description | Notes |
240
- | ---- | ---- | ----------- | ----- |
241
- | **order_id** | **String** | The order id to delete. | |
242
-
243
- ### Return type
244
-
245
- nil (empty response body)
246
-
247
- ### Authorization
248
-
249
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
250
-
251
- ### HTTP request headers
252
-
253
- - **Content-Type**: Not defined
254
- - **Accept**: application/json
255
-
256
-
257
- ## duplicate_order
258
-
259
- > <OrderResponse> duplicate_order(order_id, opts)
260
-
261
- Duplicate an order
262
-
263
- Perform a duplicate of the specified order_id and return a new order located in Accounts Receivable.
264
-
265
- ### Examples
266
-
267
- ```ruby
268
- require 'time'
269
- require 'ultracart_api'
270
- require 'json'
271
- require 'yaml'
272
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
273
-
274
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
275
- # As such, this might not be the best way to use this object.
276
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
277
-
278
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
279
- order_id = 'order_id_example' # String | The order id to duplicate.
280
- opts = {
281
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
282
- }
283
-
284
- begin
285
- # Duplicate an order
286
- result = api_instance.duplicate_order(order_id, opts)
287
- p result
288
- rescue UltracartClient::ApiError => e
289
- puts "Error when calling OrderApi->duplicate_order: #{e}"
290
- end
291
- ```
292
-
293
- #### Using the duplicate_order_with_http_info variant
294
-
295
- This returns an Array which contains the response data, status code and headers.
296
-
297
- > <Array(<OrderResponse>, Integer, Hash)> duplicate_order_with_http_info(order_id, opts)
298
-
299
- ```ruby
300
- begin
301
- # Duplicate an order
302
- data, status_code, headers = api_instance.duplicate_order_with_http_info(order_id, opts)
303
- p status_code # => 2xx
304
- p headers # => { ... }
305
- p data # => <OrderResponse>
306
- rescue UltracartClient::ApiError => e
307
- puts "Error when calling OrderApi->duplicate_order_with_http_info: #{e}"
308
- end
309
- ```
310
-
311
- ### Parameters
312
-
313
- | Name | Type | Description | Notes |
314
- | ---- | ---- | ----------- | ----- |
315
- | **order_id** | **String** | The order id to duplicate. | |
316
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
317
-
318
- ### Return type
319
-
320
- [**OrderResponse**](OrderResponse.md)
321
-
322
- ### Authorization
323
-
324
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
325
-
326
- ### HTTP request headers
327
-
328
- - **Content-Type**: Not defined
329
- - **Accept**: application/json
330
-
331
-
332
- ## format
333
-
334
- > <OrderFormatResponse> format(order_id, format_options)
335
-
336
- Format order
337
-
338
- Format the order for display at text or html
339
-
340
- ### Examples
341
-
342
- ```ruby
343
- require 'time'
344
- require 'ultracart_api'
345
- require 'json'
346
- require 'yaml'
347
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
348
-
349
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
350
- # As such, this might not be the best way to use this object.
351
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
352
-
353
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
354
- order_id = 'order_id_example' # String | The order id to format
355
- format_options = UltracartClient::OrderFormat.new # OrderFormat | Format options
356
-
357
- begin
358
- # Format order
359
- result = api_instance.format(order_id, format_options)
360
- p result
361
- rescue UltracartClient::ApiError => e
362
- puts "Error when calling OrderApi->format: #{e}"
363
- end
364
- ```
365
-
366
- #### Using the format_with_http_info variant
367
-
368
- This returns an Array which contains the response data, status code and headers.
369
-
370
- > <Array(<OrderFormatResponse>, Integer, Hash)> format_with_http_info(order_id, format_options)
371
-
372
- ```ruby
373
- begin
374
- # Format order
375
- data, status_code, headers = api_instance.format_with_http_info(order_id, format_options)
376
- p status_code # => 2xx
377
- p headers # => { ... }
378
- p data # => <OrderFormatResponse>
379
- rescue UltracartClient::ApiError => e
380
- puts "Error when calling OrderApi->format_with_http_info: #{e}"
381
- end
382
- ```
383
-
384
- ### Parameters
385
-
386
- | Name | Type | Description | Notes |
387
- | ---- | ---- | ----------- | ----- |
388
- | **order_id** | **String** | The order id to format | |
389
- | **format_options** | [**OrderFormat**](OrderFormat.md) | Format options | |
390
-
391
- ### Return type
392
-
393
- [**OrderFormatResponse**](OrderFormatResponse.md)
394
-
395
- ### Authorization
396
-
397
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
398
-
399
- ### HTTP request headers
400
-
401
- - **Content-Type**: application/json
402
- - **Accept**: application/json
403
-
404
-
405
- ## generate_invoice
406
-
407
- > <OrderInvoiceResponse> generate_invoice(order_id)
408
-
409
- Generate an invoice for this order.
410
-
411
- The invoice PDF that is returned is base 64 encoded
412
-
413
- ### Examples
414
-
415
- ```ruby
416
- require 'time'
417
- require 'ultracart_api'
418
- require 'json'
419
- require 'yaml'
420
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
421
-
422
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
423
- # As such, this might not be the best way to use this object.
424
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
425
-
426
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
427
- order_id = 'order_id_example' # String | Order ID
428
-
429
- begin
430
- # Generate an invoice for this order.
431
- result = api_instance.generate_invoice(order_id)
432
- p result
433
- rescue UltracartClient::ApiError => e
434
- puts "Error when calling OrderApi->generate_invoice: #{e}"
435
- end
436
- ```
437
-
438
- #### Using the generate_invoice_with_http_info variant
439
-
440
- This returns an Array which contains the response data, status code and headers.
441
-
442
- > <Array(<OrderInvoiceResponse>, Integer, Hash)> generate_invoice_with_http_info(order_id)
443
-
444
- ```ruby
445
- begin
446
- # Generate an invoice for this order.
447
- data, status_code, headers = api_instance.generate_invoice_with_http_info(order_id)
448
- p status_code # => 2xx
449
- p headers # => { ... }
450
- p data # => <OrderInvoiceResponse>
451
- rescue UltracartClient::ApiError => e
452
- puts "Error when calling OrderApi->generate_invoice_with_http_info: #{e}"
453
- end
454
- ```
455
-
456
- ### Parameters
457
-
458
- | Name | Type | Description | Notes |
459
- | ---- | ---- | ----------- | ----- |
460
- | **order_id** | **String** | Order ID | |
461
-
462
- ### Return type
463
-
464
- [**OrderInvoiceResponse**](OrderInvoiceResponse.md)
465
-
466
- ### Authorization
467
-
468
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
469
-
470
- ### HTTP request headers
471
-
472
- - **Content-Type**: Not defined
473
- - **Accept**: application/json
474
-
475
-
476
- ## generate_order_token
477
-
478
- > <OrderTokenResponse> generate_order_token(order_id)
479
-
480
- Generate an order token for a given order id
481
-
482
- Retrieves a single order token for a given order id. The token can be used with the getOrderByToken API.
483
-
484
- ### Examples
485
-
486
- ```ruby
487
- require 'time'
488
- require 'ultracart_api'
489
- require 'json'
490
- require 'yaml'
491
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
492
-
493
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
494
- # As such, this might not be the best way to use this object.
495
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
496
-
497
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
498
- order_id = 'order_id_example' # String | The order id to generate a token for.
499
-
500
- begin
501
- # Generate an order token for a given order id
502
- result = api_instance.generate_order_token(order_id)
503
- p result
504
- rescue UltracartClient::ApiError => e
505
- puts "Error when calling OrderApi->generate_order_token: #{e}"
506
- end
507
- ```
508
-
509
- #### Using the generate_order_token_with_http_info variant
510
-
511
- This returns an Array which contains the response data, status code and headers.
512
-
513
- > <Array(<OrderTokenResponse>, Integer, Hash)> generate_order_token_with_http_info(order_id)
514
-
515
- ```ruby
516
- begin
517
- # Generate an order token for a given order id
518
- data, status_code, headers = api_instance.generate_order_token_with_http_info(order_id)
519
- p status_code # => 2xx
520
- p headers # => { ... }
521
- p data # => <OrderTokenResponse>
522
- rescue UltracartClient::ApiError => e
523
- puts "Error when calling OrderApi->generate_order_token_with_http_info: #{e}"
524
- end
525
- ```
526
-
527
- ### Parameters
528
-
529
- | Name | Type | Description | Notes |
530
- | ---- | ---- | ----------- | ----- |
531
- | **order_id** | **String** | The order id to generate a token for. | |
532
-
533
- ### Return type
534
-
535
- [**OrderTokenResponse**](OrderTokenResponse.md)
536
-
537
- ### Authorization
538
-
539
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
540
-
541
- ### HTTP request headers
542
-
543
- - **Content-Type**: Not defined
544
- - **Accept**: application/json
545
-
546
-
547
- ## generate_packing_slip_all_dc
548
-
549
- > <OrderPackingSlipResponse> generate_packing_slip_all_dc(order_id)
550
-
551
- Generate a packing slip for this order across all distribution centers.
552
-
553
- The packing slip PDF that is returned is base 64 encoded
554
-
555
- ### Examples
556
-
557
- ```ruby
558
- require 'time'
559
- require 'ultracart_api'
560
- require 'json'
561
- require 'yaml'
562
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
563
-
564
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
565
- # As such, this might not be the best way to use this object.
566
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
567
-
568
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
569
- order_id = 'order_id_example' # String | Order ID
570
-
571
- begin
572
- # Generate a packing slip for this order across all distribution centers.
573
- result = api_instance.generate_packing_slip_all_dc(order_id)
574
- p result
575
- rescue UltracartClient::ApiError => e
576
- puts "Error when calling OrderApi->generate_packing_slip_all_dc: #{e}"
577
- end
578
- ```
579
-
580
- #### Using the generate_packing_slip_all_dc_with_http_info variant
581
-
582
- This returns an Array which contains the response data, status code and headers.
583
-
584
- > <Array(<OrderPackingSlipResponse>, Integer, Hash)> generate_packing_slip_all_dc_with_http_info(order_id)
585
-
586
- ```ruby
587
- begin
588
- # Generate a packing slip for this order across all distribution centers.
589
- data, status_code, headers = api_instance.generate_packing_slip_all_dc_with_http_info(order_id)
590
- p status_code # => 2xx
591
- p headers # => { ... }
592
- p data # => <OrderPackingSlipResponse>
593
- rescue UltracartClient::ApiError => e
594
- puts "Error when calling OrderApi->generate_packing_slip_all_dc_with_http_info: #{e}"
595
- end
596
- ```
597
-
598
- ### Parameters
599
-
600
- | Name | Type | Description | Notes |
601
- | ---- | ---- | ----------- | ----- |
602
- | **order_id** | **String** | Order ID | |
603
-
604
- ### Return type
605
-
606
- [**OrderPackingSlipResponse**](OrderPackingSlipResponse.md)
607
-
608
- ### Authorization
609
-
610
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
611
-
612
- ### HTTP request headers
613
-
614
- - **Content-Type**: Not defined
615
- - **Accept**: application/json
616
-
617
-
618
- ## generate_packing_slip_specific_dc
619
-
620
- > <OrderPackingSlipResponse> generate_packing_slip_specific_dc(distribution_center_code, order_id)
621
-
622
- Generate a packing slip for this order for the given distribution center.
623
-
624
- The packing slip PDF that is returned is base 64 encoded
625
-
626
- ### Examples
627
-
628
- ```ruby
629
- require 'time'
630
- require 'ultracart_api'
631
- require 'json'
632
- require 'yaml'
633
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
634
-
635
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
636
- # As such, this might not be the best way to use this object.
637
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
638
-
639
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
640
- distribution_center_code = 'distribution_center_code_example' # String | Distribution center code
641
- order_id = 'order_id_example' # String | Order ID
642
-
643
- begin
644
- # Generate a packing slip for this order for the given distribution center.
645
- result = api_instance.generate_packing_slip_specific_dc(distribution_center_code, order_id)
646
- p result
647
- rescue UltracartClient::ApiError => e
648
- puts "Error when calling OrderApi->generate_packing_slip_specific_dc: #{e}"
649
- end
650
- ```
651
-
652
- #### Using the generate_packing_slip_specific_dc_with_http_info variant
653
-
654
- This returns an Array which contains the response data, status code and headers.
655
-
656
- > <Array(<OrderPackingSlipResponse>, Integer, Hash)> generate_packing_slip_specific_dc_with_http_info(distribution_center_code, order_id)
657
-
658
- ```ruby
659
- begin
660
- # Generate a packing slip for this order for the given distribution center.
661
- data, status_code, headers = api_instance.generate_packing_slip_specific_dc_with_http_info(distribution_center_code, order_id)
662
- p status_code # => 2xx
663
- p headers # => { ... }
664
- p data # => <OrderPackingSlipResponse>
665
- rescue UltracartClient::ApiError => e
666
- puts "Error when calling OrderApi->generate_packing_slip_specific_dc_with_http_info: #{e}"
667
- end
668
- ```
669
-
670
- ### Parameters
671
-
672
- | Name | Type | Description | Notes |
673
- | ---- | ---- | ----------- | ----- |
674
- | **distribution_center_code** | **String** | Distribution center code | |
675
- | **order_id** | **String** | Order ID | |
676
-
677
- ### Return type
678
-
679
- [**OrderPackingSlipResponse**](OrderPackingSlipResponse.md)
680
-
681
- ### Authorization
682
-
683
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
684
-
685
- ### HTTP request headers
686
-
687
- - **Content-Type**: Not defined
688
- - **Accept**: application/json
689
-
690
-
691
- ## get_accounts_receivable_retry_config
692
-
693
- > <AccountsReceivableRetryConfigResponse> get_accounts_receivable_retry_config
694
-
695
- Retrieve A/R Retry Configuration
696
-
697
- Retrieve A/R Retry Configuration. This is primarily an internal API call. It is doubtful you would ever need to use it.
698
-
699
- ### Examples
700
-
701
- ```ruby
702
- require 'time'
703
- require 'ultracart_api'
704
- require 'json'
705
- require 'yaml'
706
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
707
-
708
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
709
- # As such, this might not be the best way to use this object.
710
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
711
-
712
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
713
-
714
- begin
715
- # Retrieve A/R Retry Configuration
716
- result = api_instance.get_accounts_receivable_retry_config
717
- p result
718
- rescue UltracartClient::ApiError => e
719
- puts "Error when calling OrderApi->get_accounts_receivable_retry_config: #{e}"
720
- end
721
- ```
722
-
723
- #### Using the get_accounts_receivable_retry_config_with_http_info variant
724
-
725
- This returns an Array which contains the response data, status code and headers.
726
-
727
- > <Array(<AccountsReceivableRetryConfigResponse>, Integer, Hash)> get_accounts_receivable_retry_config_with_http_info
728
-
729
- ```ruby
730
- begin
731
- # Retrieve A/R Retry Configuration
732
- data, status_code, headers = api_instance.get_accounts_receivable_retry_config_with_http_info
733
- p status_code # => 2xx
734
- p headers # => { ... }
735
- p data # => <AccountsReceivableRetryConfigResponse>
736
- rescue UltracartClient::ApiError => e
737
- puts "Error when calling OrderApi->get_accounts_receivable_retry_config_with_http_info: #{e}"
738
- end
739
- ```
740
-
741
- ### Parameters
742
-
743
- This endpoint does not need any parameter.
744
-
745
- ### Return type
746
-
747
- [**AccountsReceivableRetryConfigResponse**](AccountsReceivableRetryConfigResponse.md)
748
-
749
- ### Authorization
750
-
751
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
752
-
753
- ### HTTP request headers
754
-
755
- - **Content-Type**: Not defined
756
- - **Accept**: application/json
757
-
758
-
759
- ## get_accounts_receivable_retry_stats
760
-
761
- > <AccountsReceivableRetryStatsResponse> get_accounts_receivable_retry_stats(opts)
762
-
763
- Retrieve A/R Retry Statistics
764
-
765
- Retrieve A/R Retry Statistics. This is primarily an internal API call. It is doubtful you would ever need to use it.
766
-
767
- ### Examples
768
-
769
- ```ruby
770
- require 'time'
771
- require 'ultracart_api'
772
- require 'json'
773
- require 'yaml'
774
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
775
-
776
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
777
- # As such, this might not be the best way to use this object.
778
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
779
-
780
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
781
- opts = {
782
- from: 'from_example', # String |
783
- to: 'to_example' # String |
784
- }
785
-
786
- begin
787
- # Retrieve A/R Retry Statistics
788
- result = api_instance.get_accounts_receivable_retry_stats(opts)
789
- p result
790
- rescue UltracartClient::ApiError => e
791
- puts "Error when calling OrderApi->get_accounts_receivable_retry_stats: #{e}"
792
- end
793
- ```
794
-
795
- #### Using the get_accounts_receivable_retry_stats_with_http_info variant
796
-
797
- This returns an Array which contains the response data, status code and headers.
798
-
799
- > <Array(<AccountsReceivableRetryStatsResponse>, Integer, Hash)> get_accounts_receivable_retry_stats_with_http_info(opts)
800
-
801
- ```ruby
802
- begin
803
- # Retrieve A/R Retry Statistics
804
- data, status_code, headers = api_instance.get_accounts_receivable_retry_stats_with_http_info(opts)
805
- p status_code # => 2xx
806
- p headers # => { ... }
807
- p data # => <AccountsReceivableRetryStatsResponse>
808
- rescue UltracartClient::ApiError => e
809
- puts "Error when calling OrderApi->get_accounts_receivable_retry_stats_with_http_info: #{e}"
810
- end
811
- ```
812
-
813
- ### Parameters
814
-
815
- | Name | Type | Description | Notes |
816
- | ---- | ---- | ----------- | ----- |
817
- | **from** | **String** | | [optional] |
818
- | **to** | **String** | | [optional] |
819
-
820
- ### Return type
821
-
822
- [**AccountsReceivableRetryStatsResponse**](AccountsReceivableRetryStatsResponse.md)
823
-
824
- ### Authorization
825
-
826
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
827
-
828
- ### HTTP request headers
829
-
830
- - **Content-Type**: Not defined
831
- - **Accept**: application/json
832
-
833
-
834
- ## get_order
835
-
836
- > <OrderResponse> get_order(order_id, opts)
837
-
838
- Retrieve an order
839
-
840
- Retrieves a single order using the specified order id.
841
-
842
- ### Examples
843
-
844
- ```ruby
845
- require 'time'
846
- require 'ultracart_api'
847
- require 'json'
848
- require 'yaml'
849
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
850
-
851
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
852
- # As such, this might not be the best way to use this object.
853
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
854
-
855
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
856
- order_id = 'order_id_example' # String | The order id to retrieve.
857
- opts = {
858
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
859
- }
860
-
861
- begin
862
- # Retrieve an order
863
- result = api_instance.get_order(order_id, opts)
864
- p result
865
- rescue UltracartClient::ApiError => e
866
- puts "Error when calling OrderApi->get_order: #{e}"
867
- end
868
- ```
869
-
870
- #### Using the get_order_with_http_info variant
871
-
872
- This returns an Array which contains the response data, status code and headers.
873
-
874
- > <Array(<OrderResponse>, Integer, Hash)> get_order_with_http_info(order_id, opts)
875
-
876
- ```ruby
877
- begin
878
- # Retrieve an order
879
- data, status_code, headers = api_instance.get_order_with_http_info(order_id, opts)
880
- p status_code # => 2xx
881
- p headers # => { ... }
882
- p data # => <OrderResponse>
883
- rescue UltracartClient::ApiError => e
884
- puts "Error when calling OrderApi->get_order_with_http_info: #{e}"
885
- end
886
- ```
887
-
888
- ### Parameters
889
-
890
- | Name | Type | Description | Notes |
891
- | ---- | ---- | ----------- | ----- |
892
- | **order_id** | **String** | The order id to retrieve. | |
893
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
894
-
895
- ### Return type
896
-
897
- [**OrderResponse**](OrderResponse.md)
898
-
899
- ### Authorization
900
-
901
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
902
-
903
- ### HTTP request headers
904
-
905
- - **Content-Type**: Not defined
906
- - **Accept**: application/json
907
-
908
-
909
- ## get_order_by_token
910
-
911
- > <OrderResponse> get_order_by_token(order_by_token_query, opts)
912
-
913
- Retrieve an order using a token
914
-
915
- Retrieves a single order using the specified order token.
916
-
917
- ### Examples
918
-
919
- ```ruby
920
- require 'time'
921
- require 'ultracart_api'
922
- require 'json'
923
- require 'yaml'
924
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
925
-
926
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
927
- # As such, this might not be the best way to use this object.
928
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
929
-
930
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
931
- order_by_token_query = UltracartClient::OrderByTokenQuery.new # OrderByTokenQuery | Order by token query
932
- opts = {
933
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
934
- }
935
-
936
- begin
937
- # Retrieve an order using a token
938
- result = api_instance.get_order_by_token(order_by_token_query, opts)
939
- p result
940
- rescue UltracartClient::ApiError => e
941
- puts "Error when calling OrderApi->get_order_by_token: #{e}"
942
- end
943
- ```
944
-
945
- #### Using the get_order_by_token_with_http_info variant
946
-
947
- This returns an Array which contains the response data, status code and headers.
948
-
949
- > <Array(<OrderResponse>, Integer, Hash)> get_order_by_token_with_http_info(order_by_token_query, opts)
950
-
951
- ```ruby
952
- begin
953
- # Retrieve an order using a token
954
- data, status_code, headers = api_instance.get_order_by_token_with_http_info(order_by_token_query, opts)
955
- p status_code # => 2xx
956
- p headers # => { ... }
957
- p data # => <OrderResponse>
958
- rescue UltracartClient::ApiError => e
959
- puts "Error when calling OrderApi->get_order_by_token_with_http_info: #{e}"
960
- end
961
- ```
962
-
963
- ### Parameters
964
-
965
- | Name | Type | Description | Notes |
966
- | ---- | ---- | ----------- | ----- |
967
- | **order_by_token_query** | [**OrderByTokenQuery**](OrderByTokenQuery.md) | Order by token query | |
968
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
969
-
970
- ### Return type
971
-
972
- [**OrderResponse**](OrderResponse.md)
973
-
974
- ### Authorization
975
-
976
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
977
-
978
- ### HTTP request headers
979
-
980
- - **Content-Type**: application/json
981
- - **Accept**: application/json
982
-
983
-
984
- ## get_order_edi_documents
985
-
986
- > <OrderEdiDocumentsResponse> get_order_edi_documents(order_id)
987
-
988
- Retrieve EDI documents associated with this order.
989
-
990
- Retrieve EDI documents associated with this order.
991
-
992
- ### Examples
993
-
994
- ```ruby
995
- require 'time'
996
- require 'ultracart_api'
997
- require 'json'
998
- require 'yaml'
999
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1000
-
1001
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1002
- # As such, this might not be the best way to use this object.
1003
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1004
-
1005
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1006
- order_id = 'order_id_example' # String | The order id to retrieve EDI documents for.
1007
-
1008
- begin
1009
- # Retrieve EDI documents associated with this order.
1010
- result = api_instance.get_order_edi_documents(order_id)
1011
- p result
1012
- rescue UltracartClient::ApiError => e
1013
- puts "Error when calling OrderApi->get_order_edi_documents: #{e}"
1014
- end
1015
- ```
1016
-
1017
- #### Using the get_order_edi_documents_with_http_info variant
1018
-
1019
- This returns an Array which contains the response data, status code and headers.
1020
-
1021
- > <Array(<OrderEdiDocumentsResponse>, Integer, Hash)> get_order_edi_documents_with_http_info(order_id)
1022
-
1023
- ```ruby
1024
- begin
1025
- # Retrieve EDI documents associated with this order.
1026
- data, status_code, headers = api_instance.get_order_edi_documents_with_http_info(order_id)
1027
- p status_code # => 2xx
1028
- p headers # => { ... }
1029
- p data # => <OrderEdiDocumentsResponse>
1030
- rescue UltracartClient::ApiError => e
1031
- puts "Error when calling OrderApi->get_order_edi_documents_with_http_info: #{e}"
1032
- end
1033
- ```
1034
-
1035
- ### Parameters
1036
-
1037
- | Name | Type | Description | Notes |
1038
- | ---- | ---- | ----------- | ----- |
1039
- | **order_id** | **String** | The order id to retrieve EDI documents for. | |
1040
-
1041
- ### Return type
1042
-
1043
- [**OrderEdiDocumentsResponse**](OrderEdiDocumentsResponse.md)
1044
-
1045
- ### Authorization
1046
-
1047
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1048
-
1049
- ### HTTP request headers
1050
-
1051
- - **Content-Type**: Not defined
1052
- - **Accept**: application/json
1053
-
1054
-
1055
- ## get_orders
1056
-
1057
- > <OrdersResponse> get_orders(opts)
1058
-
1059
- Retrieve orders
1060
-
1061
- 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.
1062
-
1063
- ### Examples
1064
-
1065
- ```ruby
1066
- require 'time'
1067
- require 'ultracart_api'
1068
- require 'json'
1069
- require 'yaml'
1070
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1071
-
1072
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1073
- # As such, this might not be the best way to use this object.
1074
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1075
-
1076
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1077
- opts = {
1078
- order_id: 'order_id_example', # String | Order Id
1079
- payment_method: 'payment_method_example', # String | Payment Method
1080
- company: 'company_example', # String | Company
1081
- first_name: 'first_name_example', # String | First Name
1082
- last_name: 'last_name_example', # String | Last Name
1083
- city: 'city_example', # String | City
1084
- state_region: 'state_region_example', # String | State/Region
1085
- postal_code: 'postal_code_example', # String | Postal Code
1086
- country_code: 'country_code_example', # String | Country Code (ISO-3166 two letter)
1087
- phone: 'phone_example', # String | Phone
1088
- email: 'email_example', # String | Email
1089
- cc_email: 'cc_email_example', # String | CC Email
1090
- total: 8.14, # Float | Total
1091
- screen_branding_theme_code: 'screen_branding_theme_code_example', # String | Screen Branding Theme Code
1092
- storefront_host_name: 'storefront_host_name_example', # String | StoreFront Host Name
1093
- creation_date_begin: 'creation_date_begin_example', # String | Creation Date Begin
1094
- creation_date_end: 'creation_date_end_example', # String | Creation Date End
1095
- payment_date_begin: 'payment_date_begin_example', # String | Payment Date Begin
1096
- payment_date_end: 'payment_date_end_example', # String | Payment Date End
1097
- shipment_date_begin: 'shipment_date_begin_example', # String | Shipment Date Begin
1098
- shipment_date_end: 'shipment_date_end_example', # String | Shipment Date End
1099
- rma: 'rma_example', # String | RMA
1100
- purchase_order_number: 'purchase_order_number_example', # String | Purchase Order Number
1101
- item_id: 'item_id_example', # String | Item Id
1102
- current_stage: 'current_stage_example', # String | Current Stage
1103
- channel_partner_code: 'channel_partner_code_example', # String | Channel Partner Code
1104
- channel_partner_order_id: 'channel_partner_order_id_example', # String | Channel Partner Order ID
1105
- _limit: 56, # Integer | The maximum number of records to return on this one API call. (Maximum 200)
1106
- _offset: 56, # Integer | Pagination of the record set. Offset is a zero based index.
1107
- _sort: '_sort_example', # String | The sort order of the orders. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
1108
- _expand: '_expand_example' # String | The object expansion to perform on the result.
1109
- }
1110
-
1111
- begin
1112
- # Retrieve orders
1113
- result = api_instance.get_orders(opts)
1114
- p result
1115
- rescue UltracartClient::ApiError => e
1116
- puts "Error when calling OrderApi->get_orders: #{e}"
1117
- end
1118
- ```
1119
-
1120
- #### Using the get_orders_with_http_info variant
1121
-
1122
- This returns an Array which contains the response data, status code and headers.
1123
-
1124
- > <Array(<OrdersResponse>, Integer, Hash)> get_orders_with_http_info(opts)
1125
-
1126
- ```ruby
1127
- begin
1128
- # Retrieve orders
1129
- data, status_code, headers = api_instance.get_orders_with_http_info(opts)
1130
- p status_code # => 2xx
1131
- p headers # => { ... }
1132
- p data # => <OrdersResponse>
1133
- rescue UltracartClient::ApiError => e
1134
- puts "Error when calling OrderApi->get_orders_with_http_info: #{e}"
1135
- end
1136
- ```
1137
-
1138
- ### Parameters
1139
-
1140
- | Name | Type | Description | Notes |
1141
- | ---- | ---- | ----------- | ----- |
1142
- | **order_id** | **String** | Order Id | [optional] |
1143
- | **payment_method** | **String** | Payment Method | [optional] |
1144
- | **company** | **String** | Company | [optional] |
1145
- | **first_name** | **String** | First Name | [optional] |
1146
- | **last_name** | **String** | Last Name | [optional] |
1147
- | **city** | **String** | City | [optional] |
1148
- | **state_region** | **String** | State/Region | [optional] |
1149
- | **postal_code** | **String** | Postal Code | [optional] |
1150
- | **country_code** | **String** | Country Code (ISO-3166 two letter) | [optional] |
1151
- | **phone** | **String** | Phone | [optional] |
1152
- | **email** | **String** | Email | [optional] |
1153
- | **cc_email** | **String** | CC Email | [optional] |
1154
- | **total** | **Float** | Total | [optional] |
1155
- | **screen_branding_theme_code** | **String** | Screen Branding Theme Code | [optional] |
1156
- | **storefront_host_name** | **String** | StoreFront Host Name | [optional] |
1157
- | **creation_date_begin** | **String** | Creation Date Begin | [optional] |
1158
- | **creation_date_end** | **String** | Creation Date End | [optional] |
1159
- | **payment_date_begin** | **String** | Payment Date Begin | [optional] |
1160
- | **payment_date_end** | **String** | Payment Date End | [optional] |
1161
- | **shipment_date_begin** | **String** | Shipment Date Begin | [optional] |
1162
- | **shipment_date_end** | **String** | Shipment Date End | [optional] |
1163
- | **rma** | **String** | RMA | [optional] |
1164
- | **purchase_order_number** | **String** | Purchase Order Number | [optional] |
1165
- | **item_id** | **String** | Item Id | [optional] |
1166
- | **current_stage** | **String** | Current Stage | [optional] |
1167
- | **channel_partner_code** | **String** | Channel Partner Code | [optional] |
1168
- | **channel_partner_order_id** | **String** | Channel Partner Order ID | [optional] |
1169
- | **_limit** | **Integer** | The maximum number of records to return on this one API call. (Maximum 200) | [optional][default to 100] |
1170
- | **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
1171
- | **_sort** | **String** | The sort order of the orders. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. | [optional] |
1172
- | **_expand** | **String** | The object expansion to perform on the result. | [optional] |
1173
-
1174
- ### Return type
1175
-
1176
- [**OrdersResponse**](OrdersResponse.md)
1177
-
1178
- ### Authorization
1179
-
1180
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1181
-
1182
- ### HTTP request headers
1183
-
1184
- - **Content-Type**: Not defined
1185
- - **Accept**: application/json
1186
-
1187
-
1188
- ## get_orders_batch
1189
-
1190
- > <OrdersResponse> get_orders_batch(order_batch, opts)
1191
-
1192
- Retrieve order batch
1193
-
1194
- 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.
1195
-
1196
- ### Examples
1197
-
1198
- ```ruby
1199
- require 'time'
1200
- require 'ultracart_api'
1201
- require 'json'
1202
- require 'yaml'
1203
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1204
-
1205
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1206
- # As such, this might not be the best way to use this object.
1207
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1208
-
1209
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1210
- order_batch = UltracartClient::OrderQueryBatch.new # OrderQueryBatch | Order batch
1211
- opts = {
1212
- _expand: '_expand_example' # String | The object expansion to perform on the result.
1213
- }
1214
-
1215
- begin
1216
- # Retrieve order batch
1217
- result = api_instance.get_orders_batch(order_batch, opts)
1218
- p result
1219
- rescue UltracartClient::ApiError => e
1220
- puts "Error when calling OrderApi->get_orders_batch: #{e}"
1221
- end
1222
- ```
1223
-
1224
- #### Using the get_orders_batch_with_http_info variant
1225
-
1226
- This returns an Array which contains the response data, status code and headers.
1227
-
1228
- > <Array(<OrdersResponse>, Integer, Hash)> get_orders_batch_with_http_info(order_batch, opts)
1229
-
1230
- ```ruby
1231
- begin
1232
- # Retrieve order batch
1233
- data, status_code, headers = api_instance.get_orders_batch_with_http_info(order_batch, opts)
1234
- p status_code # => 2xx
1235
- p headers # => { ... }
1236
- p data # => <OrdersResponse>
1237
- rescue UltracartClient::ApiError => e
1238
- puts "Error when calling OrderApi->get_orders_batch_with_http_info: #{e}"
1239
- end
1240
- ```
1241
-
1242
- ### Parameters
1243
-
1244
- | Name | Type | Description | Notes |
1245
- | ---- | ---- | ----------- | ----- |
1246
- | **order_batch** | [**OrderQueryBatch**](OrderQueryBatch.md) | Order batch | |
1247
- | **_expand** | **String** | The object expansion to perform on the result. | [optional] |
1248
-
1249
- ### Return type
1250
-
1251
- [**OrdersResponse**](OrdersResponse.md)
1252
-
1253
- ### Authorization
1254
-
1255
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1256
-
1257
- ### HTTP request headers
1258
-
1259
- - **Content-Type**: application/json
1260
- - **Accept**: application/json
1261
-
1262
-
1263
- ## get_orders_by_query
1264
-
1265
- > <OrdersResponse> get_orders_by_query(order_query, opts)
1266
-
1267
- Retrieve orders by query
1268
-
1269
- 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.
1270
-
1271
- ### Examples
1272
-
1273
- ```ruby
1274
- require 'time'
1275
- require 'ultracart_api'
1276
- require 'json'
1277
- require 'yaml'
1278
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1279
-
1280
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1281
- # As such, this might not be the best way to use this object.
1282
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1283
-
1284
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1285
- order_query = UltracartClient::OrderQuery.new # OrderQuery | Order query
1286
- opts = {
1287
- _limit: 56, # Integer | The maximum number of records to return on this one API call. (Maximum 200)
1288
- _offset: 56, # Integer | Pagination of the record set. Offset is a zero based index.
1289
- _sort: '_sort_example', # String | The sort order of the orders. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
1290
- _expand: '_expand_example' # String | The object expansion to perform on the result.
1291
- }
1292
-
1293
- begin
1294
- # Retrieve orders by query
1295
- result = api_instance.get_orders_by_query(order_query, opts)
1296
- p result
1297
- rescue UltracartClient::ApiError => e
1298
- puts "Error when calling OrderApi->get_orders_by_query: #{e}"
1299
- end
1300
- ```
1301
-
1302
- #### Using the get_orders_by_query_with_http_info variant
1303
-
1304
- This returns an Array which contains the response data, status code and headers.
1305
-
1306
- > <Array(<OrdersResponse>, Integer, Hash)> get_orders_by_query_with_http_info(order_query, opts)
1307
-
1308
- ```ruby
1309
- begin
1310
- # Retrieve orders by query
1311
- data, status_code, headers = api_instance.get_orders_by_query_with_http_info(order_query, opts)
1312
- p status_code # => 2xx
1313
- p headers # => { ... }
1314
- p data # => <OrdersResponse>
1315
- rescue UltracartClient::ApiError => e
1316
- puts "Error when calling OrderApi->get_orders_by_query_with_http_info: #{e}"
1317
- end
1318
- ```
1319
-
1320
- ### Parameters
1321
-
1322
- | Name | Type | Description | Notes |
1323
- | ---- | ---- | ----------- | ----- |
1324
- | **order_query** | [**OrderQuery**](OrderQuery.md) | Order query | |
1325
- | **_limit** | **Integer** | The maximum number of records to return on this one API call. (Maximum 200) | [optional][default to 100] |
1326
- | **_offset** | **Integer** | Pagination of the record set. Offset is a zero based index. | [optional][default to 0] |
1327
- | **_sort** | **String** | The sort order of the orders. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. | [optional] |
1328
- | **_expand** | **String** | The object expansion to perform on the result. | [optional] |
1329
-
1330
- ### Return type
1331
-
1332
- [**OrdersResponse**](OrdersResponse.md)
1333
-
1334
- ### Authorization
1335
-
1336
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1337
-
1338
- ### HTTP request headers
1339
-
1340
- - **Content-Type**: application/json
1341
- - **Accept**: application/json
1342
-
1343
-
1344
- ## insert_order
1345
-
1346
- > <OrderResponse> insert_order(order, opts)
1347
-
1348
- Insert an order
1349
-
1350
- 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.
1351
-
1352
- ### Examples
1353
-
1354
- ```ruby
1355
- require 'time'
1356
- require 'ultracart_api'
1357
- require 'json'
1358
- require 'yaml'
1359
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1360
-
1361
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1362
- # As such, this might not be the best way to use this object.
1363
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1364
-
1365
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1366
- order = UltracartClient::Order.new # Order | Order to insert
1367
- opts = {
1368
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
1369
- }
1370
-
1371
- begin
1372
- # Insert an order
1373
- result = api_instance.insert_order(order, opts)
1374
- p result
1375
- rescue UltracartClient::ApiError => e
1376
- puts "Error when calling OrderApi->insert_order: #{e}"
1377
- end
1378
- ```
1379
-
1380
- #### Using the insert_order_with_http_info variant
1381
-
1382
- This returns an Array which contains the response data, status code and headers.
1383
-
1384
- > <Array(<OrderResponse>, Integer, Hash)> insert_order_with_http_info(order, opts)
1385
-
1386
- ```ruby
1387
- begin
1388
- # Insert an order
1389
- data, status_code, headers = api_instance.insert_order_with_http_info(order, opts)
1390
- p status_code # => 2xx
1391
- p headers # => { ... }
1392
- p data # => <OrderResponse>
1393
- rescue UltracartClient::ApiError => e
1394
- puts "Error when calling OrderApi->insert_order_with_http_info: #{e}"
1395
- end
1396
- ```
1397
-
1398
- ### Parameters
1399
-
1400
- | Name | Type | Description | Notes |
1401
- | ---- | ---- | ----------- | ----- |
1402
- | **order** | [**Order**](Order.md) | Order to insert | |
1403
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1404
-
1405
- ### Return type
1406
-
1407
- [**OrderResponse**](OrderResponse.md)
1408
-
1409
- ### Authorization
1410
-
1411
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1412
-
1413
- ### HTTP request headers
1414
-
1415
- - **Content-Type**: application/json; charset=UTF-8
1416
- - **Accept**: application/json
1417
-
1418
-
1419
- ## is_refundable_order
1420
-
1421
- > <OrderRefundableResponse> is_refundable_order(order_id)
1422
-
1423
- Determine if an order can be refunded
1424
-
1425
- Determine if an order can be refunded based upon payment method and age
1426
-
1427
- ### Examples
1428
-
1429
- ```ruby
1430
- require 'time'
1431
- require 'ultracart_api'
1432
- require 'json'
1433
- require 'yaml'
1434
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1435
-
1436
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1437
- # As such, this might not be the best way to use this object.
1438
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1439
-
1440
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1441
- order_id = 'order_id_example' # String | The order id to check for refundable order.
1442
-
1443
- begin
1444
- # Determine if an order can be refunded
1445
- result = api_instance.is_refundable_order(order_id)
1446
- p result
1447
- rescue UltracartClient::ApiError => e
1448
- puts "Error when calling OrderApi->is_refundable_order: #{e}"
1449
- end
1450
- ```
1451
-
1452
- #### Using the is_refundable_order_with_http_info variant
1453
-
1454
- This returns an Array which contains the response data, status code and headers.
1455
-
1456
- > <Array(<OrderRefundableResponse>, Integer, Hash)> is_refundable_order_with_http_info(order_id)
1457
-
1458
- ```ruby
1459
- begin
1460
- # Determine if an order can be refunded
1461
- data, status_code, headers = api_instance.is_refundable_order_with_http_info(order_id)
1462
- p status_code # => 2xx
1463
- p headers # => { ... }
1464
- p data # => <OrderRefundableResponse>
1465
- rescue UltracartClient::ApiError => e
1466
- puts "Error when calling OrderApi->is_refundable_order_with_http_info: #{e}"
1467
- end
1468
- ```
1469
-
1470
- ### Parameters
1471
-
1472
- | Name | Type | Description | Notes |
1473
- | ---- | ---- | ----------- | ----- |
1474
- | **order_id** | **String** | The order id to check for refundable order. | |
1475
-
1476
- ### Return type
1477
-
1478
- [**OrderRefundableResponse**](OrderRefundableResponse.md)
1479
-
1480
- ### Authorization
1481
-
1482
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1483
-
1484
- ### HTTP request headers
1485
-
1486
- - **Content-Type**: Not defined
1487
- - **Accept**: application/json
1488
-
1489
-
1490
- ## process_payment
1491
-
1492
- > <OrderProcessPaymentResponse> process_payment(order_id, process_payment_request)
1493
-
1494
- Process payment
1495
-
1496
- Process payment on order
1497
-
1498
- ### Examples
1499
-
1500
- ```ruby
1501
- require 'time'
1502
- require 'ultracart_api'
1503
- require 'json'
1504
- require 'yaml'
1505
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1506
-
1507
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1508
- # As such, this might not be the best way to use this object.
1509
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1510
-
1511
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1512
- order_id = 'order_id_example' # String | The order id to process payment on
1513
- process_payment_request = UltracartClient::OrderProcessPaymentRequest.new # OrderProcessPaymentRequest | Process payment parameters
1514
-
1515
- begin
1516
- # Process payment
1517
- result = api_instance.process_payment(order_id, process_payment_request)
1518
- p result
1519
- rescue UltracartClient::ApiError => e
1520
- puts "Error when calling OrderApi->process_payment: #{e}"
1521
- end
1522
- ```
1523
-
1524
- #### Using the process_payment_with_http_info variant
1525
-
1526
- This returns an Array which contains the response data, status code and headers.
1527
-
1528
- > <Array(<OrderProcessPaymentResponse>, Integer, Hash)> process_payment_with_http_info(order_id, process_payment_request)
1529
-
1530
- ```ruby
1531
- begin
1532
- # Process payment
1533
- data, status_code, headers = api_instance.process_payment_with_http_info(order_id, process_payment_request)
1534
- p status_code # => 2xx
1535
- p headers # => { ... }
1536
- p data # => <OrderProcessPaymentResponse>
1537
- rescue UltracartClient::ApiError => e
1538
- puts "Error when calling OrderApi->process_payment_with_http_info: #{e}"
1539
- end
1540
- ```
1541
-
1542
- ### Parameters
1543
-
1544
- | Name | Type | Description | Notes |
1545
- | ---- | ---- | ----------- | ----- |
1546
- | **order_id** | **String** | The order id to process payment on | |
1547
- | **process_payment_request** | [**OrderProcessPaymentRequest**](OrderProcessPaymentRequest.md) | Process payment parameters | |
1548
-
1549
- ### Return type
1550
-
1551
- [**OrderProcessPaymentResponse**](OrderProcessPaymentResponse.md)
1552
-
1553
- ### Authorization
1554
-
1555
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1556
-
1557
- ### HTTP request headers
1558
-
1559
- - **Content-Type**: application/json
1560
- - **Accept**: application/json
1561
-
1562
-
1563
- ## refund_order
1564
-
1565
- > <OrderResponse> refund_order(order_id, order, opts)
1566
-
1567
- Refund an order
1568
-
1569
- 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.
1570
-
1571
- ### Examples
1572
-
1573
- ```ruby
1574
- require 'time'
1575
- require 'ultracart_api'
1576
- require 'json'
1577
- require 'yaml'
1578
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1579
-
1580
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1581
- # As such, this might not be the best way to use this object.
1582
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1583
-
1584
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1585
- order_id = 'order_id_example' # String | The order id to refund.
1586
- order = UltracartClient::Order.new # Order | Order to refund
1587
- opts = {
1588
- reject_after_refund: true, # Boolean | Reject order after refund
1589
- skip_customer_notification: true, # Boolean | Skip customer email notification
1590
- auto_order_cancel: true, # Boolean | Cancel associated auto orders
1591
- manual_refund: true, # Boolean | Consider a manual refund done externally
1592
- reverse_affiliate_transactions: true, # Boolean | Reverse affiliate transactions
1593
- issue_store_credit: true, # Boolean | Issue a store credit instead of refunding the original payment method, loyalty must be configured on merchant account
1594
- auto_order_cancel_reason: 'auto_order_cancel_reason_example', # String | Reason for auto orders cancellation
1595
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
1596
- }
1597
-
1598
- begin
1599
- # Refund an order
1600
- result = api_instance.refund_order(order_id, order, opts)
1601
- p result
1602
- rescue UltracartClient::ApiError => e
1603
- puts "Error when calling OrderApi->refund_order: #{e}"
1604
- end
1605
- ```
1606
-
1607
- #### Using the refund_order_with_http_info variant
1608
-
1609
- This returns an Array which contains the response data, status code and headers.
1610
-
1611
- > <Array(<OrderResponse>, Integer, Hash)> refund_order_with_http_info(order_id, order, opts)
1612
-
1613
- ```ruby
1614
- begin
1615
- # Refund an order
1616
- data, status_code, headers = api_instance.refund_order_with_http_info(order_id, order, opts)
1617
- p status_code # => 2xx
1618
- p headers # => { ... }
1619
- p data # => <OrderResponse>
1620
- rescue UltracartClient::ApiError => e
1621
- puts "Error when calling OrderApi->refund_order_with_http_info: #{e}"
1622
- end
1623
- ```
1624
-
1625
- ### Parameters
1626
-
1627
- | Name | Type | Description | Notes |
1628
- | ---- | ---- | ----------- | ----- |
1629
- | **order_id** | **String** | The order id to refund. | |
1630
- | **order** | [**Order**](Order.md) | Order to refund | |
1631
- | **reject_after_refund** | **Boolean** | Reject order after refund | [optional][default to false] |
1632
- | **skip_customer_notification** | **Boolean** | Skip customer email notification | [optional][default to false] |
1633
- | **auto_order_cancel** | **Boolean** | Cancel associated auto orders | [optional][default to false] |
1634
- | **manual_refund** | **Boolean** | Consider a manual refund done externally | [optional][default to false] |
1635
- | **reverse_affiliate_transactions** | **Boolean** | Reverse affiliate transactions | [optional][default to true] |
1636
- | **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] |
1637
- | **auto_order_cancel_reason** | **String** | Reason for auto orders cancellation | [optional] |
1638
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1639
-
1640
- ### Return type
1641
-
1642
- [**OrderResponse**](OrderResponse.md)
1643
-
1644
- ### Authorization
1645
-
1646
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1647
-
1648
- ### HTTP request headers
1649
-
1650
- - **Content-Type**: application/json; charset=UTF-8
1651
- - **Accept**: application/json
1652
-
1653
-
1654
- ## refund_order_completely
1655
-
1656
- > <OrderResponse> refund_order_completely(order_id, opts)
1657
-
1658
- Refund an order completely
1659
-
1660
- Perform a refund operation on an order and then update the order if successful.
1661
-
1662
- ### Examples
1663
-
1664
- ```ruby
1665
- require 'time'
1666
- require 'ultracart_api'
1667
- require 'json'
1668
- require 'yaml'
1669
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1670
-
1671
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1672
- # As such, this might not be the best way to use this object.
1673
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1674
-
1675
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1676
- order_id = 'order_id_example' # String | The order id to refund.
1677
- opts = {
1678
- reject_after_refund: true, # Boolean | Reject order after refund
1679
- skip_customer_notification: true, # Boolean | Skip customer email notification
1680
- auto_order_cancel: true, # Boolean | Cancel associated auto orders
1681
- manual_refund: true, # Boolean | Consider a manual refund done externally
1682
- reverse_affiliate_transactions: true, # Boolean | Reverse affiliate transactions
1683
- issue_store_credit: true, # Boolean | Issue a store credit instead of refunding the original payment method, loyalty must be configured on merchant account
1684
- auto_order_cancel_reason: 'auto_order_cancel_reason_example', # String | Reason for auto orders cancellation
1685
- refund_reason: 'refund_reason_example', # String | Reason for refund
1686
- reject_reason: 'reject_reason_example' # String | Reason for reject
1687
- }
1688
-
1689
- begin
1690
- # Refund an order completely
1691
- result = api_instance.refund_order_completely(order_id, opts)
1692
- p result
1693
- rescue UltracartClient::ApiError => e
1694
- puts "Error when calling OrderApi->refund_order_completely: #{e}"
1695
- end
1696
- ```
1697
-
1698
- #### Using the refund_order_completely_with_http_info variant
1699
-
1700
- This returns an Array which contains the response data, status code and headers.
1701
-
1702
- > <Array(<OrderResponse>, Integer, Hash)> refund_order_completely_with_http_info(order_id, opts)
1703
-
1704
- ```ruby
1705
- begin
1706
- # Refund an order completely
1707
- data, status_code, headers = api_instance.refund_order_completely_with_http_info(order_id, opts)
1708
- p status_code # => 2xx
1709
- p headers # => { ... }
1710
- p data # => <OrderResponse>
1711
- rescue UltracartClient::ApiError => e
1712
- puts "Error when calling OrderApi->refund_order_completely_with_http_info: #{e}"
1713
- end
1714
- ```
1715
-
1716
- ### Parameters
1717
-
1718
- | Name | Type | Description | Notes |
1719
- | ---- | ---- | ----------- | ----- |
1720
- | **order_id** | **String** | The order id to refund. | |
1721
- | **reject_after_refund** | **Boolean** | Reject order after refund | [optional][default to false] |
1722
- | **skip_customer_notification** | **Boolean** | Skip customer email notification | [optional][default to false] |
1723
- | **auto_order_cancel** | **Boolean** | Cancel associated auto orders | [optional][default to false] |
1724
- | **manual_refund** | **Boolean** | Consider a manual refund done externally | [optional][default to false] |
1725
- | **reverse_affiliate_transactions** | **Boolean** | Reverse affiliate transactions | [optional][default to true] |
1726
- | **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] |
1727
- | **auto_order_cancel_reason** | **String** | Reason for auto orders cancellation | [optional] |
1728
- | **refund_reason** | **String** | Reason for refund | [optional] |
1729
- | **reject_reason** | **String** | Reason for reject | [optional] |
1730
-
1731
- ### Return type
1732
-
1733
- [**OrderResponse**](OrderResponse.md)
1734
-
1735
- ### Authorization
1736
-
1737
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1738
-
1739
- ### HTTP request headers
1740
-
1741
- - **Content-Type**: Not defined
1742
- - **Accept**: application/json
1743
-
1744
-
1745
- ## replacement
1746
-
1747
- > <OrderReplacementResponse> replacement(order_id, replacement)
1748
-
1749
- Replacement order
1750
-
1751
- Create a replacement order based upon a previous order
1752
-
1753
- ### Examples
1754
-
1755
- ```ruby
1756
- require 'time'
1757
- require 'ultracart_api'
1758
- require 'json'
1759
- require 'yaml'
1760
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1761
-
1762
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1763
- # As such, this might not be the best way to use this object.
1764
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1765
-
1766
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1767
- order_id = 'order_id_example' # String | The order id to generate a replacement for.
1768
- replacement = UltracartClient::OrderReplacement.new # OrderReplacement | Replacement order details
1769
-
1770
- begin
1771
- # Replacement order
1772
- result = api_instance.replacement(order_id, replacement)
1773
- p result
1774
- rescue UltracartClient::ApiError => e
1775
- puts "Error when calling OrderApi->replacement: #{e}"
1776
- end
1777
- ```
1778
-
1779
- #### Using the replacement_with_http_info variant
1780
-
1781
- This returns an Array which contains the response data, status code and headers.
1782
-
1783
- > <Array(<OrderReplacementResponse>, Integer, Hash)> replacement_with_http_info(order_id, replacement)
1784
-
1785
- ```ruby
1786
- begin
1787
- # Replacement order
1788
- data, status_code, headers = api_instance.replacement_with_http_info(order_id, replacement)
1789
- p status_code # => 2xx
1790
- p headers # => { ... }
1791
- p data # => <OrderReplacementResponse>
1792
- rescue UltracartClient::ApiError => e
1793
- puts "Error when calling OrderApi->replacement_with_http_info: #{e}"
1794
- end
1795
- ```
1796
-
1797
- ### Parameters
1798
-
1799
- | Name | Type | Description | Notes |
1800
- | ---- | ---- | ----------- | ----- |
1801
- | **order_id** | **String** | The order id to generate a replacement for. | |
1802
- | **replacement** | [**OrderReplacement**](OrderReplacement.md) | Replacement order details | |
1803
-
1804
- ### Return type
1805
-
1806
- [**OrderReplacementResponse**](OrderReplacementResponse.md)
1807
-
1808
- ### Authorization
1809
-
1810
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1811
-
1812
- ### HTTP request headers
1813
-
1814
- - **Content-Type**: application/json
1815
- - **Accept**: application/json
1816
-
1817
-
1818
- ## resend_receipt
1819
-
1820
- > <BaseResponse> resend_receipt(order_id)
1821
-
1822
- Resend receipt
1823
-
1824
- Resend the receipt for an order on the UltraCart account.
1825
-
1826
- ### Examples
1827
-
1828
- ```ruby
1829
- require 'time'
1830
- require 'ultracart_api'
1831
- require 'json'
1832
- require 'yaml'
1833
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1834
-
1835
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1836
- # As such, this might not be the best way to use this object.
1837
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1838
-
1839
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1840
- order_id = 'order_id_example' # String | The order id to resend the receipt for.
1841
-
1842
- begin
1843
- # Resend receipt
1844
- result = api_instance.resend_receipt(order_id)
1845
- p result
1846
- rescue UltracartClient::ApiError => e
1847
- puts "Error when calling OrderApi->resend_receipt: #{e}"
1848
- end
1849
- ```
1850
-
1851
- #### Using the resend_receipt_with_http_info variant
1852
-
1853
- This returns an Array which contains the response data, status code and headers.
1854
-
1855
- > <Array(<BaseResponse>, Integer, Hash)> resend_receipt_with_http_info(order_id)
1856
-
1857
- ```ruby
1858
- begin
1859
- # Resend receipt
1860
- data, status_code, headers = api_instance.resend_receipt_with_http_info(order_id)
1861
- p status_code # => 2xx
1862
- p headers # => { ... }
1863
- p data # => <BaseResponse>
1864
- rescue UltracartClient::ApiError => e
1865
- puts "Error when calling OrderApi->resend_receipt_with_http_info: #{e}"
1866
- end
1867
- ```
1868
-
1869
- ### Parameters
1870
-
1871
- | Name | Type | Description | Notes |
1872
- | ---- | ---- | ----------- | ----- |
1873
- | **order_id** | **String** | The order id to resend the receipt for. | |
1874
-
1875
- ### Return type
1876
-
1877
- [**BaseResponse**](BaseResponse.md)
1878
-
1879
- ### Authorization
1880
-
1881
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1882
-
1883
- ### HTTP request headers
1884
-
1885
- - **Content-Type**: Not defined
1886
- - **Accept**: application/json
1887
-
1888
-
1889
- ## resend_shipment_confirmation
1890
-
1891
- > <BaseResponse> resend_shipment_confirmation(order_id)
1892
-
1893
- Resend shipment confirmation
1894
-
1895
- Resend shipment confirmation for an order on the UltraCart account.
1896
-
1897
- ### Examples
1898
-
1899
- ```ruby
1900
- require 'time'
1901
- require 'ultracart_api'
1902
- require 'json'
1903
- require 'yaml'
1904
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1905
-
1906
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1907
- # As such, this might not be the best way to use this object.
1908
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1909
-
1910
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1911
- order_id = 'order_id_example' # String | The order id to resend the shipment notification for.
1912
-
1913
- begin
1914
- # Resend shipment confirmation
1915
- result = api_instance.resend_shipment_confirmation(order_id)
1916
- p result
1917
- rescue UltracartClient::ApiError => e
1918
- puts "Error when calling OrderApi->resend_shipment_confirmation: #{e}"
1919
- end
1920
- ```
1921
-
1922
- #### Using the resend_shipment_confirmation_with_http_info variant
1923
-
1924
- This returns an Array which contains the response data, status code and headers.
1925
-
1926
- > <Array(<BaseResponse>, Integer, Hash)> resend_shipment_confirmation_with_http_info(order_id)
1927
-
1928
- ```ruby
1929
- begin
1930
- # Resend shipment confirmation
1931
- data, status_code, headers = api_instance.resend_shipment_confirmation_with_http_info(order_id)
1932
- p status_code # => 2xx
1933
- p headers # => { ... }
1934
- p data # => <BaseResponse>
1935
- rescue UltracartClient::ApiError => e
1936
- puts "Error when calling OrderApi->resend_shipment_confirmation_with_http_info: #{e}"
1937
- end
1938
- ```
1939
-
1940
- ### Parameters
1941
-
1942
- | Name | Type | Description | Notes |
1943
- | ---- | ---- | ----------- | ----- |
1944
- | **order_id** | **String** | The order id to resend the shipment notification for. | |
1945
-
1946
- ### Return type
1947
-
1948
- [**BaseResponse**](BaseResponse.md)
1949
-
1950
- ### Authorization
1951
-
1952
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1953
-
1954
- ### HTTP request headers
1955
-
1956
- - **Content-Type**: Not defined
1957
- - **Accept**: application/json
1958
-
1959
-
1960
- ## update_accounts_receivable_retry_config
1961
-
1962
- > <BaseResponse> update_accounts_receivable_retry_config(retry_config)
1963
-
1964
- Update A/R Retry Configuration
1965
-
1966
- Update A/R Retry Configuration. This is primarily an internal API call. It is doubtful you would ever need to use it.
1967
-
1968
- ### Examples
1969
-
1970
- ```ruby
1971
- require 'time'
1972
- require 'ultracart_api'
1973
- require 'json'
1974
- require 'yaml'
1975
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1976
-
1977
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1978
- # As such, this might not be the best way to use this object.
1979
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1980
-
1981
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1982
- retry_config = UltracartClient::AccountsReceivableRetryConfig.new # AccountsReceivableRetryConfig | AccountsReceivableRetryConfig object
1983
-
1984
- begin
1985
- # Update A/R Retry Configuration
1986
- result = api_instance.update_accounts_receivable_retry_config(retry_config)
1987
- p result
1988
- rescue UltracartClient::ApiError => e
1989
- puts "Error when calling OrderApi->update_accounts_receivable_retry_config: #{e}"
1990
- end
1991
- ```
1992
-
1993
- #### Using the update_accounts_receivable_retry_config_with_http_info variant
1994
-
1995
- This returns an Array which contains the response data, status code and headers.
1996
-
1997
- > <Array(<BaseResponse>, Integer, Hash)> update_accounts_receivable_retry_config_with_http_info(retry_config)
1998
-
1999
- ```ruby
2000
- begin
2001
- # Update A/R Retry Configuration
2002
- data, status_code, headers = api_instance.update_accounts_receivable_retry_config_with_http_info(retry_config)
2003
- p status_code # => 2xx
2004
- p headers # => { ... }
2005
- p data # => <BaseResponse>
2006
- rescue UltracartClient::ApiError => e
2007
- puts "Error when calling OrderApi->update_accounts_receivable_retry_config_with_http_info: #{e}"
2008
- end
2009
- ```
2010
-
2011
- ### Parameters
2012
-
2013
- | Name | Type | Description | Notes |
2014
- | ---- | ---- | ----------- | ----- |
2015
- | **retry_config** | [**AccountsReceivableRetryConfig**](AccountsReceivableRetryConfig.md) | AccountsReceivableRetryConfig object | |
2016
-
2017
- ### Return type
2018
-
2019
- [**BaseResponse**](BaseResponse.md)
2020
-
2021
- ### Authorization
2022
-
2023
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
2024
-
2025
- ### HTTP request headers
2026
-
2027
- - **Content-Type**: application/json
2028
- - **Accept**: application/json
2029
-
2030
-
2031
- ## update_order
2032
-
2033
- > <OrderResponse> update_order(order_id, order, opts)
2034
-
2035
- Update an order
2036
-
2037
- 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.
2038
-
2039
- ### Examples
2040
-
2041
- ```ruby
2042
- require 'time'
2043
- require 'ultracart_api'
2044
- require 'json'
2045
- require 'yaml'
2046
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
2047
-
2048
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
2049
- # As such, this might not be the best way to use this object.
2050
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
2051
-
2052
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
2053
- order_id = 'order_id_example' # String | The order id to update.
2054
- order = UltracartClient::Order.new # Order | Order to update
2055
- opts = {
2056
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
2057
- }
2058
-
2059
- begin
2060
- # Update an order
2061
- result = api_instance.update_order(order_id, order, opts)
2062
- p result
2063
- rescue UltracartClient::ApiError => e
2064
- puts "Error when calling OrderApi->update_order: #{e}"
2065
- end
2066
- ```
2067
-
2068
- #### Using the update_order_with_http_info variant
2069
-
2070
- This returns an Array which contains the response data, status code and headers.
2071
-
2072
- > <Array(<OrderResponse>, Integer, Hash)> update_order_with_http_info(order_id, order, opts)
2073
-
2074
- ```ruby
2075
- begin
2076
- # Update an order
2077
- data, status_code, headers = api_instance.update_order_with_http_info(order_id, order, opts)
2078
- p status_code # => 2xx
2079
- p headers # => { ... }
2080
- p data # => <OrderResponse>
2081
- rescue UltracartClient::ApiError => e
2082
- puts "Error when calling OrderApi->update_order_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 update. | |
2091
- | **order** | [**Order**](Order.md) | Order to update | |
2092
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
2093
-
2094
- ### Return type
2095
-
2096
- [**OrderResponse**](OrderResponse.md)
2097
-
2098
- ### Authorization
2099
-
2100
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
2101
-
2102
- ### HTTP request headers
2103
-
2104
- - **Content-Type**: application/json; charset=UTF-8
2105
- - **Accept**: application/json
2106
-
2107
-
2108
- ## validate_order
2109
-
2110
- > <OrderValidationResponse> validate_order(validation_request)
2111
-
2112
- Validate
2113
-
2114
- 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.
2115
-
2116
- ### Examples
2117
-
2118
- ```ruby
2119
- require 'time'
2120
- require 'ultracart_api'
2121
- require 'json'
2122
- require 'yaml'
2123
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
2124
-
2125
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
2126
- # As such, this might not be the best way to use this object.
2127
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
2128
-
2129
- api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
2130
- validation_request = UltracartClient::OrderValidationRequest.new # OrderValidationRequest | Validation request
2131
-
2132
- begin
2133
- # Validate
2134
- result = api_instance.validate_order(validation_request)
2135
- p result
2136
- rescue UltracartClient::ApiError => e
2137
- puts "Error when calling OrderApi->validate_order: #{e}"
2138
- end
2139
- ```
2140
-
2141
- #### Using the validate_order_with_http_info variant
2142
-
2143
- This returns an Array which contains the response data, status code and headers.
2144
-
2145
- > <Array(<OrderValidationResponse>, Integer, Hash)> validate_order_with_http_info(validation_request)
2146
-
2147
- ```ruby
2148
- begin
2149
- # Validate
2150
- data, status_code, headers = api_instance.validate_order_with_http_info(validation_request)
2151
- p status_code # => 2xx
2152
- p headers # => { ... }
2153
- p data # => <OrderValidationResponse>
2154
- rescue UltracartClient::ApiError => e
2155
- puts "Error when calling OrderApi->validate_order_with_http_info: #{e}"
2156
- end
2157
- ```
2158
-
2159
- ### Parameters
2160
-
2161
- | Name | Type | Description | Notes |
2162
- | ---- | ---- | ----------- | ----- |
2163
- | **validation_request** | [**OrderValidationRequest**](OrderValidationRequest.md) | Validation request | |
2164
-
2165
- ### Return type
2166
-
2167
- [**OrderValidationResponse**](OrderValidationResponse.md)
2168
-
2169
- ### Authorization
2170
-
2171
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
2172
-
2173
- ### HTTP request headers
2174
-
2175
- - **Content-Type**: application/json
2176
- - **Accept**: application/json
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
+