ultracart_api 4.1.13 → 4.1.15

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