ultracart_api 4.1.166 → 4.1.168
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -3
- data/docs/AutoOrderApi.md +79 -23
- data/docs/ChannelPartnerApi.md +12 -12
- data/docs/CheckoutApi.md +17 -16
- data/docs/CouponApi.md +22 -22
- data/docs/CustomerApi.md +3 -3
- data/docs/FraudApi.md +210 -9
- data/docs/GiftCertificateApi.md +2 -4
- data/docs/OrderApi.md +140 -13
- data/docs/StorefrontApi.md +4 -2
- data/lib/ultracart_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a7f4754f78264cf68898eaf7dad3421dcbe656b37b7c4fd52d60854451eb2f58
|
|
4
|
+
data.tar.gz: 1fc1ed8254ed10d546cec9fa666d2354ab6cd13440420de25eb48f7188e4693e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c8666281be3c9e01602e209fb58eb0e310e02a4e195e9a92fe03d03a91e26e35430b8c13081c005f75887cedf52d1ba02661db2889bb04c1148dfd1e518c931
|
|
7
|
+
data.tar.gz: b68167847cce043ede4207626630e8b4c8d7fcb75bb2c93a4eb044dc541b39ba48f9d4480dfe568a5ac2663637f40846ced659e877c3ce972556460e9c9b2196
|
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Note: Every method has a sample for every language. See https://github.com/Ultr
|
|
|
7
7
|
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
8
8
|
|
|
9
9
|
- API version: 2.0.0
|
|
10
|
-
- Package version: 4.1.
|
|
10
|
+
- Package version: 4.1.168
|
|
11
11
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
|
12
12
|
- For more information, please visit [http://www.ultracart.com/api/](http://www.ultracart.com/api/)
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-g
|
|
|
16
16
|
gemfile:
|
|
17
17
|
|
|
18
18
|
```shell
|
|
19
|
-
gem 'ultracart_api', '4.1.
|
|
19
|
+
gem 'ultracart_api', '4.1.168'
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
install:
|
|
@@ -2015,12 +2015,15 @@ Class | Method | HTTP request | Description
|
|
|
2015
2015
|
|
|
2016
2016
|
|
|
2017
2017
|
|
|
2018
|
+
|
|
2019
|
+
|
|
2018
2020
|
# CHANGE LOG
|
|
2019
2021
|
Not every change is committed to every SDK.
|
|
2020
2022
|
|
|
2021
2023
|
| Version | Date | Comments |
|
|
2022
2024
|
| --: | :-: | --- |
|
|
2023
|
-
| 4.1.
|
|
2025
|
+
| 4.1.168 | 09/21/2026 | further automation testing |
|
|
2026
|
+
| 4.1.167 | 09/21/2026 | automation test |
|
|
2024
2027
|
| 4.1.165 | 09/21/2026 | automation testing |
|
|
2025
2028
|
| 4.1.164 | 09/20/2026 | automation testing |
|
|
2026
2029
|
| 4.1.163 | 09/20/2026 | automation testing |
|
data/docs/AutoOrderApi.md
CHANGED
|
@@ -90,8 +90,28 @@ Cancels a single item on an auto order identified by the original order id and t
|
|
|
90
90
|
|
|
91
91
|
### Examples
|
|
92
92
|
|
|
93
|
+
```ruby
|
|
94
|
+
# Cancel a single item on an auto order, identified by the reference (original) order id
|
|
95
|
+
# that placed the auto order and the original item id on that order. This is useful when
|
|
96
|
+
# you know the original UltraCart order id rather than the auto_order_oid.
|
|
93
97
|
|
|
94
|
-
|
|
98
|
+
require_relative '../constants'
|
|
99
|
+
require 'ultracart_api'
|
|
100
|
+
|
|
101
|
+
auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)
|
|
102
|
+
|
|
103
|
+
reference_order_id = "DEMO-12345678" # the UltraCart order id that placed the auto order
|
|
104
|
+
original_item_id = "ITEM001" # the merchant item id on that original order
|
|
105
|
+
expand = "items" # see https://www.ultracart.com/api/#resource_auto_order.html for list
|
|
106
|
+
|
|
107
|
+
response = auto_order_api.cancel_auto_order_item_by_reference_order_id(
|
|
108
|
+
reference_order_id,
|
|
109
|
+
original_item_id,
|
|
110
|
+
{ _expand: expand }
|
|
111
|
+
)
|
|
112
|
+
auto_order = response.auto_order
|
|
113
|
+
puts auto_order.inspect
|
|
114
|
+
```
|
|
95
115
|
|
|
96
116
|
|
|
97
117
|
#### Using the cancel_auto_order_item_by_reference_order_id_with_http_info variant
|
|
@@ -163,7 +183,7 @@ target_auto_order_oid = 123456789 # set getAutoOrdersByQuery for retrieving auto
|
|
|
163
183
|
consolidate_request = UltracartClient::AutoOrderConsolidate.new
|
|
164
184
|
consolidate_request.source_auto_order_oids = [23456789, 3456789] # these are the autoorder_oids you wish to consolidate into the target.
|
|
165
185
|
|
|
166
|
-
api_response = auto_order_api.consolidate_auto_orders(target_auto_order_oid, consolidate_request, { '_expand' => expand })
|
|
186
|
+
api_response = auto_order_api.consolidate_auto_orders(target_auto_order_oid, consolidate_request, { :'_expand' => expand })
|
|
167
187
|
|
|
168
188
|
consolidated_auto_order = api_response.auto_order
|
|
169
189
|
|
|
@@ -237,7 +257,7 @@ auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_
|
|
|
237
257
|
expand = "items,items.future_schedules,original_order,rebill_orders"
|
|
238
258
|
|
|
239
259
|
original_order_id = "DEMO-123457"
|
|
240
|
-
api_response = auto_order_api.establish_auto_order_by_reference_order_id(original_order_id, { '_expand' => expand })
|
|
260
|
+
api_response = auto_order_api.establish_auto_order_by_reference_order_id(original_order_id, { :'_expand' => expand })
|
|
241
261
|
|
|
242
262
|
empty_auto_order = api_response.auto_order
|
|
243
263
|
auto_order_oid = empty_auto_order.auto_order_oid
|
|
@@ -255,7 +275,7 @@ items << item
|
|
|
255
275
|
empty_auto_order.items = items
|
|
256
276
|
|
|
257
277
|
validate_original_order = 'No'
|
|
258
|
-
api_response = auto_order_api.update_auto_order(auto_order_oid, empty_auto_order, { '_expand' => expand, validate_original_order
|
|
278
|
+
api_response = auto_order_api.update_auto_order(auto_order_oid, empty_auto_order, { :'_expand' => expand, :'validate_original_order' => validate_original_order })
|
|
259
279
|
updated_auto_order = api_response.auto_order
|
|
260
280
|
puts updated_auto_order.inspect
|
|
261
281
|
```
|
|
@@ -322,7 +342,7 @@ auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_
|
|
|
322
342
|
# see https://www.ultracart.com/api/#resource_auto_order.html for list
|
|
323
343
|
expand = "items,items.future_schedules,original_order,rebill_orders"
|
|
324
344
|
auto_order_oid = 123456789 # If you don't know the oid, use getAutoOrdersByQuery for retrieving auto orders
|
|
325
|
-
api_response = auto_order_api.get_auto_order(auto_order_oid, { '_expand' => expand })
|
|
345
|
+
api_response = auto_order_api.get_auto_order(auto_order_oid, { :'_expand' => expand })
|
|
326
346
|
auto_order = api_response.auto_order
|
|
327
347
|
puts auto_order.inspect
|
|
328
348
|
```
|
|
@@ -451,7 +471,7 @@ auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_
|
|
|
451
471
|
|
|
452
472
|
expand = "items,items.future_schedules,original_order,rebill_orders" # contact us if you're unsure what you need
|
|
453
473
|
code = "RT2A9CBSX9"
|
|
454
|
-
api_response = auto_order_api.get_auto_order_by_code(code, { '_expand' => expand })
|
|
474
|
+
api_response = auto_order_api.get_auto_order_by_code(code, { :'_expand' => expand })
|
|
455
475
|
auto_order = api_response.auto_order
|
|
456
476
|
|
|
457
477
|
# this will be verbose...
|
|
@@ -577,7 +597,7 @@ auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_
|
|
|
577
597
|
|
|
578
598
|
expand = "items,items.future_schedules,original_order,rebill_orders" # contact us if you're unsure what you need
|
|
579
599
|
original_order_id = "DEMO-12345678"
|
|
580
|
-
api_response = auto_order_api.get_auto_order_by_reference_order_id(original_order_id, { '_expand' => expand })
|
|
600
|
+
api_response = auto_order_api.get_auto_order_by_reference_order_id(original_order_id, { :'_expand' => expand })
|
|
581
601
|
auto_order = api_response.auto_order
|
|
582
602
|
|
|
583
603
|
# this will be verbose...
|
|
@@ -635,8 +655,23 @@ Retrieves auto order cancel reasons.
|
|
|
635
655
|
|
|
636
656
|
### Examples
|
|
637
657
|
|
|
658
|
+
```ruby
|
|
659
|
+
require 'ultracart_api'
|
|
660
|
+
require_relative '../constants'
|
|
638
661
|
|
|
639
|
-
|
|
662
|
+
# Retrieves the list of cancel reasons that can be presented to customers when
|
|
663
|
+
# cancelling an auto order (e.g., in MyAccount). Each reason includes the reason
|
|
664
|
+
# text, an optional MyAccount alternate description, and whether the reason is
|
|
665
|
+
# visible in MyAccount.
|
|
666
|
+
|
|
667
|
+
auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_KEY)
|
|
668
|
+
|
|
669
|
+
api_response = auto_order_api.get_auto_order_cancel_reasons
|
|
670
|
+
|
|
671
|
+
api_response.cancel_reasons.each do |cancel_reason|
|
|
672
|
+
puts cancel_reason.inspect
|
|
673
|
+
end
|
|
674
|
+
```
|
|
640
675
|
|
|
641
676
|
|
|
642
677
|
#### Using the get_auto_order_cancel_reasons_with_http_info variant
|
|
@@ -797,10 +832,31 @@ def get_auto_order_chunk(auto_order_api, offset, limit)
|
|
|
797
832
|
sort = nil
|
|
798
833
|
|
|
799
834
|
# see all these parameters? that is why you should use getAutoOrdersByQuery() instead of getAutoOrders()
|
|
800
|
-
api_response = auto_order_api.get_auto_orders(
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
835
|
+
api_response = auto_order_api.get_auto_orders(
|
|
836
|
+
{
|
|
837
|
+
:'auto_order_code' => auto_order_code,
|
|
838
|
+
:'original_order_id' => original_order_id,
|
|
839
|
+
:'first_name' => first_name,
|
|
840
|
+
:'last_name' => last_name,
|
|
841
|
+
:'company' => company,
|
|
842
|
+
:'city' => city,
|
|
843
|
+
:'state' => state,
|
|
844
|
+
:'postal_code' => postal_code,
|
|
845
|
+
:'country_code' => country_code,
|
|
846
|
+
:'phone' => phone,
|
|
847
|
+
:'email' => email,
|
|
848
|
+
:'original_order_date_begin' => original_order_date_begin,
|
|
849
|
+
:'original_order_date_end' => original_order_date_end,
|
|
850
|
+
:'next_shipment_date_begin' => next_shipment_date_begin,
|
|
851
|
+
:'next_shipment_date_end' => next_shipment_date_end,
|
|
852
|
+
:'card_type' => card_type,
|
|
853
|
+
:'item_id' => item_id,
|
|
854
|
+
:'status' => status,
|
|
855
|
+
:'_limit' => limit,
|
|
856
|
+
:'_offset' => offset,
|
|
857
|
+
:'_since' => since,
|
|
858
|
+
:'_sort' => sort,
|
|
859
|
+
:'_expand' => expand })
|
|
804
860
|
|
|
805
861
|
api_response.auto_orders || []
|
|
806
862
|
end
|
|
@@ -954,7 +1010,7 @@ expand = "items,items.future_schedules,original_order,rebill_orders" # contact u
|
|
|
954
1010
|
auto_order_oids = [123456, 234567, 345678, 456789]
|
|
955
1011
|
batch_request = UltracartClient::AutoOrderQueryBatch.new
|
|
956
1012
|
batch_request.auto_order_oids = auto_order_oids
|
|
957
|
-
api_response = auto_order_api.get_auto_orders_batch(batch_request, { '_expand' => expand })
|
|
1013
|
+
api_response = auto_order_api.get_auto_orders_batch(batch_request, { :'_expand' => expand })
|
|
958
1014
|
auto_orders = api_response.auto_orders
|
|
959
1015
|
|
|
960
1016
|
# this will be verbose...
|
|
@@ -1112,10 +1168,10 @@ def get_auto_order_chunk(auto_order_api, offset, limit)
|
|
|
1112
1168
|
query.email = "support@ultracart.com"
|
|
1113
1169
|
|
|
1114
1170
|
opts = {
|
|
1115
|
-
_limit
|
|
1116
|
-
_offset
|
|
1117
|
-
_sort
|
|
1118
|
-
_expand
|
|
1171
|
+
:'_limit' => limit,
|
|
1172
|
+
:'_offset' => offset,
|
|
1173
|
+
:'_sort' => "next_shipment_dts",
|
|
1174
|
+
:'_expand' => expand
|
|
1119
1175
|
}
|
|
1120
1176
|
|
|
1121
1177
|
api_response = auto_order_api.get_auto_orders_by_query(query, opts)
|
|
@@ -1225,7 +1281,7 @@ auto_order_api = UltracartClient::AutoOrderApi.new_using_api_key(Constants::API_
|
|
|
1225
1281
|
|
|
1226
1282
|
expand = "items" # see https://www.ultracart.com/api/#resource_auto_order.html for list
|
|
1227
1283
|
auto_order_oid = 123456789 # get an auto order and update it. There are many ways to retrieve an auto order.
|
|
1228
|
-
get_response = auto_order_api.get_auto_order(auto_order_oid, {_expand
|
|
1284
|
+
get_response = auto_order_api.get_auto_order(auto_order_oid, {:'_expand' => expand})
|
|
1229
1285
|
auto_order = get_response.auto_order
|
|
1230
1286
|
|
|
1231
1287
|
pause_response = auto_order_api.pause_auto_order(auto_order_oid, auto_order)
|
|
@@ -1309,7 +1365,7 @@ email = 'test@test.com'
|
|
|
1309
1365
|
query = UltracartClient::AutoOrderQuery.new
|
|
1310
1366
|
query.email = email
|
|
1311
1367
|
expansion = 'items,items.future_schedules,items.simple_schedule,rebill_orders'
|
|
1312
|
-
ao_response = ao_api.get_auto_orders_by_query(query, { _expand
|
|
1368
|
+
ao_response = ao_api.get_auto_orders_by_query(query, { :'_expand' => expansion })
|
|
1313
1369
|
|
|
1314
1370
|
# there should only be one auto order for a customer. that's typical.
|
|
1315
1371
|
# If you are marketing more than one, than you must loop through the result set
|
|
@@ -1325,7 +1381,7 @@ auto_order.items.each do |auto_order_item|
|
|
|
1325
1381
|
end
|
|
1326
1382
|
|
|
1327
1383
|
# save the auto order with the updated item.
|
|
1328
|
-
ao_api.update_auto_order(auto_order, auto_order.auto_order_oid, { _expand
|
|
1384
|
+
ao_api.update_auto_order(auto_order, auto_order.auto_order_oid, { :'_expand' => expansion })
|
|
1329
1385
|
|
|
1330
1386
|
|
|
1331
1387
|
|
|
@@ -1640,9 +1696,9 @@ auto_orders_request = UltracartClient::AutoOrdersRequest.new
|
|
|
1640
1696
|
auto_orders_request.auto_orders = auto_orders
|
|
1641
1697
|
|
|
1642
1698
|
opts = {
|
|
1643
|
-
_expand
|
|
1644
|
-
_placeholders
|
|
1645
|
-
_async
|
|
1699
|
+
:'_expand' => expand,
|
|
1700
|
+
:'_placeholders' => placeholders,
|
|
1701
|
+
:'_async' => async
|
|
1646
1702
|
}
|
|
1647
1703
|
|
|
1648
1704
|
api_response = auto_order_api.update_auto_orders_batch(auto_orders_request, opts)
|
data/docs/ChannelPartnerApi.md
CHANGED
|
@@ -592,7 +592,7 @@ _expand = "item,summary,shipping"
|
|
|
592
592
|
|
|
593
593
|
# This order MUST be an order associated with this channel partner or you will receive a 400 Bad Request.
|
|
594
594
|
order_id = 'DEMO-0009110366'
|
|
595
|
-
api_response = channel_partner_api.get_channel_partner_order(order_id, { '_expand' => _expand })
|
|
595
|
+
api_response = channel_partner_api.get_channel_partner_order(order_id, { :'_expand' => _expand })
|
|
596
596
|
|
|
597
597
|
if api_response.error
|
|
598
598
|
STDERR.puts api_response.error.developer_message
|
|
@@ -690,7 +690,7 @@ _expand = "item,summary,shipping"
|
|
|
690
690
|
|
|
691
691
|
# This order MUST be an order associated with this channel partner or you will receive a 400 Bad Request.
|
|
692
692
|
channel_partner_order_id = 'MY-CALL-CENTER-BLAH-BLAH'
|
|
693
|
-
api_response = channel_partner_api.get_channel_partner_order_by_channel_partner_order_id(channel_partner_order_id, { '_expand' => _expand })
|
|
693
|
+
api_response = channel_partner_api.get_channel_partner_order_by_channel_partner_order_id(channel_partner_order_id, { :'_expand' => _expand })
|
|
694
694
|
|
|
695
695
|
if api_response.error
|
|
696
696
|
STDERR.puts api_response.error.developer_message
|
|
@@ -1482,7 +1482,7 @@ expansion = "item,summary,shipping"
|
|
|
1482
1482
|
|
|
1483
1483
|
# This order MUST be an order associated with this channel partner, or you will receive a 400 Bad Request.
|
|
1484
1484
|
order_id = 'DEMO-0009106820'
|
|
1485
|
-
api_response = channel_partner_api.get_channel_partner_order(order_id, _expand
|
|
1485
|
+
api_response = channel_partner_api.get_channel_partner_order(order_id, {:'_expand' => expansion})
|
|
1486
1486
|
|
|
1487
1487
|
if api_response.error
|
|
1488
1488
|
STDERR.puts api_response.error.developer_message
|
|
@@ -1517,15 +1517,15 @@ reverse_affiliate_transactions = true # for a full refund, the affiliate should
|
|
|
1517
1517
|
issue_store_credit = false # if true, the customer would receive store credit instead of a return on their credit card.
|
|
1518
1518
|
auto_order_cancel_reason = nil
|
|
1519
1519
|
|
|
1520
|
-
api_response = channel_partner_api.refund_channel_partner_order(order_id, order,
|
|
1521
|
-
reject_after_refund
|
|
1522
|
-
skip_customer_notifications
|
|
1523
|
-
auto_order_cancel
|
|
1524
|
-
manual_refund
|
|
1525
|
-
reverse_affiliate_transactions
|
|
1526
|
-
issue_store_credit
|
|
1527
|
-
auto_order_cancel_reason
|
|
1528
|
-
_expand
|
|
1520
|
+
api_response = channel_partner_api.refund_channel_partner_order(order_id, order, {
|
|
1521
|
+
:'reject_after_refund' => reject_after_refund,
|
|
1522
|
+
:'skip_customer_notifications' => skip_customer_notifications,
|
|
1523
|
+
:'auto_order_cancel' => auto_order_cancel,
|
|
1524
|
+
:'manual_refund' => manual_refund,
|
|
1525
|
+
:'reverse_affiliate_transactions' => reverse_affiliate_transactions,
|
|
1526
|
+
:'issue_store_credit' => issue_store_credit,
|
|
1527
|
+
:'auto_order_cancel_reason' => auto_order_cancel_reason,
|
|
1528
|
+
:'_expand' => expansion })
|
|
1529
1529
|
|
|
1530
1530
|
error = api_response.error
|
|
1531
1531
|
updated_order = api_response.order
|
data/docs/CheckoutApi.md
CHANGED
|
@@ -136,7 +136,7 @@ cart_id = cookies[Constants::CART_ID_COOKIE_NAME] if cookies[Constants::CART_ID_
|
|
|
136
136
|
|
|
137
137
|
cart = nil
|
|
138
138
|
if cart_id.nil?
|
|
139
|
-
api_response = checkout_api.get_cart(_expand
|
|
139
|
+
api_response = checkout_api.get_cart({:'_expand' => expansion})
|
|
140
140
|
else
|
|
141
141
|
api_response = checkout_api.get_cart_by_cart_id(cart_id, _expand: expansion)
|
|
142
142
|
end
|
|
@@ -537,7 +537,7 @@ expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"
|
|
|
537
537
|
# summary upsell_after
|
|
538
538
|
|
|
539
539
|
return_code = '1234567890' # usually retrieved from a query parameter
|
|
540
|
-
api_response = checkout_api.get_cart_by_return_code(return_code, _expand
|
|
540
|
+
api_response = checkout_api.get_cart_by_return_code(return_code, {:'_expand' => expansion})
|
|
541
541
|
cart = api_response.cart
|
|
542
542
|
|
|
543
543
|
# TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
|
|
@@ -622,7 +622,7 @@ expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"
|
|
|
622
622
|
# summary upsell_after
|
|
623
623
|
|
|
624
624
|
cart_token = '1234567890' # usually retrieved from a query parameter
|
|
625
|
-
api_response = checkout_api.get_cart_by_return_token(cart_token, _expand
|
|
625
|
+
api_response = checkout_api.get_cart_by_return_token({:'return_token' => cart_token, :'_expand' => expansion})
|
|
626
626
|
cart = api_response.cart
|
|
627
627
|
|
|
628
628
|
# TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
|
|
@@ -1220,9 +1220,9 @@ expansion = 'customer_profile,items,billing,shipping,coupons,checkout,payment,su
|
|
|
1220
1220
|
cart_id = ENV['HTTP_ULTRACARTSHOPPINGCARTID']
|
|
1221
1221
|
|
|
1222
1222
|
cart = if cart_id.nil?
|
|
1223
|
-
checkout_api.get_cart({_expand
|
|
1223
|
+
checkout_api.get_cart({:'_expand' => expansion}).cart
|
|
1224
1224
|
else
|
|
1225
|
-
checkout_api.get_cart_by_cart_id(cart_id, {_expand
|
|
1225
|
+
checkout_api.get_cart_by_cart_id(cart_id, {:'_expand' => expansion}).cart
|
|
1226
1226
|
end
|
|
1227
1227
|
|
|
1228
1228
|
# TODO - add some items to the cart and update.
|
|
@@ -1235,7 +1235,7 @@ items << cart_item
|
|
|
1235
1235
|
cart.items = items
|
|
1236
1236
|
|
|
1237
1237
|
# Update the cart
|
|
1238
|
-
cart = checkout_api.update_cart(cart, { '_expand' => expansion }).cart
|
|
1238
|
+
cart = checkout_api.update_cart(cart, { :'_expand' => expansion }).cart
|
|
1239
1239
|
|
|
1240
1240
|
api_response = checkout_api.related_items_for_cart(cart)
|
|
1241
1241
|
related_items = api_response.items
|
|
@@ -1310,9 +1310,9 @@ expansion = 'customer_profile,items,billing,shipping,coupons,checkout,payment,su
|
|
|
1310
1310
|
cart_id = ENV['HTTP_ULTRACARTSHOPPINGCARTID']
|
|
1311
1311
|
|
|
1312
1312
|
cart = if cart_id.nil?
|
|
1313
|
-
checkout_api.get_cart({_expand
|
|
1313
|
+
checkout_api.get_cart({:'_expand' => expansion}).cart
|
|
1314
1314
|
else
|
|
1315
|
-
checkout_api.get_cart_by_cart_id(cart_id, {_expand
|
|
1315
|
+
checkout_api.get_cart_by_cart_id(cart_id, {:'_expand' => expansion}).cart
|
|
1316
1316
|
end
|
|
1317
1317
|
|
|
1318
1318
|
# TODO - add some items to the cart and update.
|
|
@@ -1325,11 +1325,11 @@ items << cart_item
|
|
|
1325
1325
|
cart.items = items
|
|
1326
1326
|
|
|
1327
1327
|
# Update the cart
|
|
1328
|
-
cart = checkout_api.update_cart(cart, {
|
|
1328
|
+
cart = checkout_api.update_cart(cart, {:'_expand' => expansion }).cart
|
|
1329
1329
|
|
|
1330
1330
|
another_item_id = 'ITEM_ZZZ'
|
|
1331
1331
|
|
|
1332
|
-
api_response = checkout_api.related_items_for_item(another_item_id, cart, {
|
|
1332
|
+
api_response = checkout_api.related_items_for_item(another_item_id, cart, {:'_expand' => expansion })
|
|
1333
1333
|
related_items = api_response.items
|
|
1334
1334
|
|
|
1335
1335
|
puts related_items.inspect
|
|
@@ -1466,11 +1466,11 @@ expansion = 'items' # For this example, we're just getting a cart to insert some
|
|
|
1466
1466
|
|
|
1467
1467
|
cart_id = nil
|
|
1468
1468
|
cart_id = ENV['HTTP_COOKIE'].to_s[/#{Constants::CART_ID_COOKIE_NAME}=([^;]+)/, 1] if ENV['HTTP_COOKIE']
|
|
1469
|
-
|
|
1469
|
+
opts = { :'_expand' => expansion }
|
|
1470
1470
|
cart = if cart_id.nil?
|
|
1471
|
-
checkout_api.get_cart(
|
|
1471
|
+
checkout_api.get_cart(opts).cart
|
|
1472
1472
|
else
|
|
1473
|
-
checkout_api.get_cart_by_cart_id(cart_id,
|
|
1473
|
+
checkout_api.get_cart_by_cart_id(cart_id, opts).cart
|
|
1474
1474
|
end
|
|
1475
1475
|
|
|
1476
1476
|
# Get the items array on the cart, creating it if it doesn't exist.
|
|
@@ -1492,7 +1492,7 @@ items << item
|
|
|
1492
1492
|
cart.items = items
|
|
1493
1493
|
|
|
1494
1494
|
# Push the cart up to save the item
|
|
1495
|
-
cart_response = checkout_api.update_cart(cart,
|
|
1495
|
+
cart_response = checkout_api.update_cart(cart, opts)
|
|
1496
1496
|
|
|
1497
1497
|
# Extract the updated cart from the response
|
|
1498
1498
|
cart = cart_response.cart
|
|
@@ -1565,8 +1565,9 @@ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY
|
|
|
1565
1565
|
cart_id = '123456789123456789123456789123456789' # Usually this would be retrieved from a session variable or cookie.
|
|
1566
1566
|
|
|
1567
1567
|
expansion = 'items,billing,shipping,coupons,checkout,payment,summary,taxes'
|
|
1568
|
+
opts = {:'_expand' => expansion}
|
|
1568
1569
|
|
|
1569
|
-
cart = checkout_api.get_cart_by_cart_id(cart_id,
|
|
1570
|
+
cart = checkout_api.get_cart_by_cart_id(cart_id, opts).cart
|
|
1570
1571
|
|
|
1571
1572
|
validation_request = UltracartClient::CartValidationRequest.new
|
|
1572
1573
|
validation_request.cart = cart
|
|
@@ -1574,7 +1575,7 @@ validation_request.cart = cart
|
|
|
1574
1575
|
# Possible Checks (you can set these as needed, or leave as default):
|
|
1575
1576
|
# validation_request.set_checks(["All", "Item Quantity Valid", "Payment Information Validate"])
|
|
1576
1577
|
|
|
1577
|
-
api_response = checkout_api.validate_cart(validation_request,
|
|
1578
|
+
api_response = checkout_api.validate_cart(validation_request, opts)
|
|
1578
1579
|
cart = api_response.cart
|
|
1579
1580
|
|
|
1580
1581
|
puts "Validation Errors:"
|
data/docs/CouponApi.md
CHANGED
|
@@ -499,7 +499,7 @@ coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
|
|
499
499
|
coupon_oid = 123456789
|
|
500
500
|
|
|
501
501
|
# coupons do not have expansions
|
|
502
|
-
api_response = coupon_api.get_coupon(coupon_oid, {
|
|
502
|
+
api_response = coupon_api.get_coupon(coupon_oid, {})
|
|
503
503
|
|
|
504
504
|
puts api_response.inspect
|
|
505
505
|
```
|
|
@@ -646,19 +646,19 @@ def get_coupons_chunk(coupon_api, offset = 0, limit = 200)
|
|
|
646
646
|
|
|
647
647
|
# getCoupons doesn't have any expansions. full record is always returned.
|
|
648
648
|
opts = {
|
|
649
|
-
merchant_code
|
|
650
|
-
description
|
|
651
|
-
coupon_type
|
|
652
|
-
start_date_begin
|
|
653
|
-
start_date_end
|
|
654
|
-
expiration_date_begin
|
|
655
|
-
expiration_date_end
|
|
656
|
-
affiliate_oid
|
|
657
|
-
exclude_expired
|
|
658
|
-
_limit
|
|
659
|
-
_offset
|
|
660
|
-
_sort
|
|
661
|
-
_expand
|
|
649
|
+
:'merchant_code' => merchant_code,
|
|
650
|
+
:'description' => description,
|
|
651
|
+
:'coupon_type' => coupon_type,
|
|
652
|
+
:'start_date_begin' => start_date_begin,
|
|
653
|
+
:'start_date_end' => start_date_end,
|
|
654
|
+
:'expiration_date_begin' => expiration_date_begin,
|
|
655
|
+
:'expiration_date_end' => expiration_date_end,
|
|
656
|
+
:'affiliate_oid' => affiliate_oid,
|
|
657
|
+
:'exclude_expired' => exclude_expired,
|
|
658
|
+
:'_limit' => limit,
|
|
659
|
+
:'_offset' => offset,
|
|
660
|
+
:'_sort' => nil,
|
|
661
|
+
:'_expand' => nil
|
|
662
662
|
}
|
|
663
663
|
|
|
664
664
|
get_response = coupon_api.get_coupons(opts)
|
|
@@ -834,8 +834,8 @@ def get_coupon_chunk(coupon_api, offset, limit)
|
|
|
834
834
|
# coupons do not have expansions
|
|
835
835
|
# Possible sorts: "coupon_type", "merchant_code", "description", "start_dts", "expiration_dts", "quickbooks_code"
|
|
836
836
|
opts = {
|
|
837
|
-
_expand
|
|
838
|
-
_sort
|
|
837
|
+
:'_expand' => nil,
|
|
838
|
+
:'_sort' => 'merchant_code'
|
|
839
839
|
}
|
|
840
840
|
|
|
841
841
|
api_response = coupon_api.get_coupons_by_query(query, limit, offset, opts)
|
|
@@ -1042,7 +1042,7 @@ coupon.amount_off_subtotal.discount_amount = 11
|
|
|
1042
1042
|
#CouponTierQuantityPercent
|
|
1043
1043
|
|
|
1044
1044
|
# coupons do not have expansions
|
|
1045
|
-
api_response = coupon_api.insert_coupon(coupon, {
|
|
1045
|
+
api_response = coupon_api.insert_coupon(coupon, {})
|
|
1046
1046
|
puts api_response
|
|
1047
1047
|
```
|
|
1048
1048
|
|
|
@@ -1113,7 +1113,7 @@ coupons = []
|
|
|
1113
1113
|
coupons_request.coupons = coupons
|
|
1114
1114
|
|
|
1115
1115
|
# coupons do not have expansions or placeholders
|
|
1116
|
-
api_response = coupon_api.insert_coupons(coupons_request, {
|
|
1116
|
+
api_response = coupon_api.insert_coupons(coupons_request, {})
|
|
1117
1117
|
puts api_response
|
|
1118
1118
|
```
|
|
1119
1119
|
|
|
@@ -1316,13 +1316,13 @@ coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
|
|
1316
1316
|
coupon_oid = 123456789
|
|
1317
1317
|
|
|
1318
1318
|
# coupons do not have expansions
|
|
1319
|
-
api_response = coupon_api.get_coupon(coupon_oid, {
|
|
1319
|
+
api_response = coupon_api.get_coupon(coupon_oid, {})
|
|
1320
1320
|
coupon = api_response.coupon
|
|
1321
1321
|
|
|
1322
1322
|
# update the coupon. this can be difficult given the complexity of coupons. see insertCoupon sample for details.
|
|
1323
1323
|
coupon.expiration_dts = (Date.today + 90).strftime('%Y-%m-%d') + 'T00:00:00+00:00'
|
|
1324
1324
|
|
|
1325
|
-
api_response = coupon_api.update_coupon(coupon_oid, coupon, {
|
|
1325
|
+
api_response = coupon_api.update_coupon(coupon_oid, coupon, {})
|
|
1326
1326
|
updated_coupon = api_response.coupon
|
|
1327
1327
|
puts updated_coupon
|
|
1328
1328
|
```
|
|
@@ -1388,7 +1388,7 @@ coupon_api = UltracartClient::CouponApi.new_using_api_key(Constants::API_KEY)
|
|
|
1388
1388
|
coupon_oid = 123456789
|
|
1389
1389
|
|
|
1390
1390
|
# coupons do not have expansions or placeholders
|
|
1391
|
-
api_response = coupon_api.get_coupon(coupon_oid, {
|
|
1391
|
+
api_response = coupon_api.get_coupon(coupon_oid, {})
|
|
1392
1392
|
coupon = api_response.coupon
|
|
1393
1393
|
|
|
1394
1394
|
# update the coupon. this can be difficult given the complexity of coupons. see insertCoupon sample for details.
|
|
@@ -1398,7 +1398,7 @@ coupon.expiration_dts = (Date.today + 90).strftime('%Y-%m-%d') + 'T00:00:00+00:0
|
|
|
1398
1398
|
coupons_request = UltracartClient::CouponsRequest.new
|
|
1399
1399
|
coupons_request.coupons = [coupon]
|
|
1400
1400
|
|
|
1401
|
-
api_response = coupon_api.update_coupons(coupons_request, {
|
|
1401
|
+
api_response = coupon_api.update_coupons(coupons_request, {})
|
|
1402
1402
|
updated_coupons = api_response.coupons
|
|
1403
1403
|
puts updated_coupons
|
|
1404
1404
|
```
|
data/docs/CustomerApi.md
CHANGED
|
@@ -555,7 +555,7 @@ begin
|
|
|
555
555
|
api_response = customer_api.get_customer(
|
|
556
556
|
customer_oid,
|
|
557
557
|
opts: {
|
|
558
|
-
'_expand' => 'billing,shipping'
|
|
558
|
+
:'_expand' => 'billing,shipping'
|
|
559
559
|
}
|
|
560
560
|
)
|
|
561
561
|
|
|
@@ -653,7 +653,7 @@ begin
|
|
|
653
653
|
api_response = customer_api.get_customer_by_email(
|
|
654
654
|
email,
|
|
655
655
|
opts: {
|
|
656
|
-
'_expand' => 'billing,shipping'
|
|
656
|
+
:'_expand' => 'billing,shipping'
|
|
657
657
|
}
|
|
658
658
|
)
|
|
659
659
|
|
|
@@ -1991,7 +1991,7 @@ customer.billing = [billing] # notice this is an array of one shipping address (
|
|
|
1991
1991
|
# tags
|
|
1992
1992
|
# loyalty
|
|
1993
1993
|
|
|
1994
|
-
opts = {_expand
|
|
1994
|
+
opts = {:'_expand' => 'shipping,billing'}
|
|
1995
1995
|
begin
|
|
1996
1996
|
customer_response = customer_api.insert_customer(customer, opts)
|
|
1997
1997
|
puts customer_response.to_json
|
data/docs/FraudApi.md
CHANGED
|
@@ -23,8 +23,25 @@ Adds one email address to the fraud decline list for this merchant account.
|
|
|
23
23
|
|
|
24
24
|
### Examples
|
|
25
25
|
|
|
26
|
+
```ruby
|
|
27
|
+
# frozen_string_literal: true
|
|
28
|
+
|
|
29
|
+
require 'ultracart_api'
|
|
30
|
+
require_relative '../constants'
|
|
31
|
+
|
|
32
|
+
# decline_email is a shortcut for telling UltraCart to decline orders from a specific email
|
|
33
|
+
# address. It is the quick alternative to building a full "address email" fraud rule by hand.
|
|
34
|
+
|
|
35
|
+
fraud_api = UltracartClient::FraudApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
|
|
36
|
+
|
|
37
|
+
decline_request = UltracartClient::FraudDeclineEmailRequest.new(
|
|
38
|
+
email: 'chargeback-charlie@example.com'
|
|
39
|
+
)
|
|
26
40
|
|
|
27
|
-
(
|
|
41
|
+
fraud_api.decline_email(decline_request)
|
|
42
|
+
|
|
43
|
+
puts "Declined email: #{decline_request.email}"
|
|
44
|
+
```
|
|
28
45
|
|
|
29
46
|
|
|
30
47
|
#### Using the decline_email_with_http_info variant
|
|
@@ -76,8 +93,36 @@ Deletes a fraud rule for this merchant account.
|
|
|
76
93
|
|
|
77
94
|
### Examples
|
|
78
95
|
|
|
79
|
-
|
|
80
|
-
|
|
96
|
+
```ruby
|
|
97
|
+
# frozen_string_literal: true
|
|
98
|
+
|
|
99
|
+
require 'ultracart_api'
|
|
100
|
+
require_relative '../constants'
|
|
101
|
+
|
|
102
|
+
# delete_fraud_rule removes a fraud rule by its oid.
|
|
103
|
+
#
|
|
104
|
+
# To keep this sample self-contained it first inserts a throwaway rule, then deletes it using
|
|
105
|
+
# the oid returned from the insert. In your own code you would already have the oid of the rule
|
|
106
|
+
# you want to remove (for example from search_fraud_rules).
|
|
107
|
+
|
|
108
|
+
fraud_api = UltracartClient::FraudApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
|
|
109
|
+
|
|
110
|
+
# Insert a rule so we have something to delete.
|
|
111
|
+
rule = UltracartClient::FraudRuleInsertRequest.new(
|
|
112
|
+
rule_type: 'credit card single transaction exceeds',
|
|
113
|
+
amount_threshold: 2500.00,
|
|
114
|
+
failure_action: 'Flag For Review',
|
|
115
|
+
auto_note: 'Temporary rule created by the delete_fraud_rule sample'
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
insert_response = fraud_api.insert_fraud_rule(rule)
|
|
119
|
+
fraud_rule_oid = insert_response.fraud_rule.fraud_rule_oid
|
|
120
|
+
puts "Inserted temporary rule, oid = #{fraud_rule_oid}"
|
|
121
|
+
|
|
122
|
+
# Now delete it.
|
|
123
|
+
fraud_api.delete_fraud_rule(fraud_rule_oid)
|
|
124
|
+
puts "Deleted fraud rule oid = #{fraud_rule_oid}"
|
|
125
|
+
```
|
|
81
126
|
|
|
82
127
|
|
|
83
128
|
#### Using the delete_fraud_rule_with_http_info variant
|
|
@@ -129,8 +174,42 @@ Creates one or more fraud rules for this merchant account derived from an existi
|
|
|
129
174
|
|
|
130
175
|
### Examples
|
|
131
176
|
|
|
132
|
-
|
|
133
|
-
|
|
177
|
+
```ruby
|
|
178
|
+
# frozen_string_literal: true
|
|
179
|
+
|
|
180
|
+
require 'ultracart_api'
|
|
181
|
+
require_relative '../constants'
|
|
182
|
+
|
|
183
|
+
# establish_fraud_rules_from_order is a shortcut that derives fraud rules from an existing order.
|
|
184
|
+
# Point it at an order you have identified as fraudulent and tell it which attributes of that
|
|
185
|
+
# order to turn into rules: the email, the credit card, the ip address, and/or the address.
|
|
186
|
+
# It creates the matching rules and returns them. This is the fast way to "block everything
|
|
187
|
+
# associated with this bad order" instead of building each rule by hand.
|
|
188
|
+
#
|
|
189
|
+
# Not every filter produces a rule; the order must actually have that attribute. For example an
|
|
190
|
+
# order with no stored card data will not produce a credit card rule.
|
|
191
|
+
|
|
192
|
+
fraud_api = UltracartClient::FraudApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
|
|
193
|
+
|
|
194
|
+
request = UltracartClient::FraudRuleFromOrderRequest.new(
|
|
195
|
+
order_id: 'DEMO-0009104434',
|
|
196
|
+
establish_email_filter: true,
|
|
197
|
+
establish_card_filter: true,
|
|
198
|
+
establish_ip_filter: true,
|
|
199
|
+
establish_address_filter: true,
|
|
200
|
+
failure_action: 'Flag For Review',
|
|
201
|
+
auto_note: 'Established from fraudulent order DEMO-0009104434'
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
api_response = fraud_api.establish_fraud_rules_from_order(request)
|
|
205
|
+
|
|
206
|
+
fraud_rules = api_response.fraud_rules
|
|
207
|
+
puts "Established #{fraud_rules.length} rule(s) from the order:"
|
|
208
|
+
|
|
209
|
+
fraud_rules.each do |fraud_rule|
|
|
210
|
+
puts " oid #{fraud_rule.fraud_rule_oid} - #{fraud_rule.rule_type} - #{fraud_rule.auto_note}"
|
|
211
|
+
end
|
|
212
|
+
```
|
|
134
213
|
|
|
135
214
|
|
|
136
215
|
#### Using the establish_fraud_rules_from_order_with_http_info variant
|
|
@@ -182,8 +261,34 @@ Returns the dropdown values required to build valid fraud rule insert and search
|
|
|
182
261
|
|
|
183
262
|
### Examples
|
|
184
263
|
|
|
264
|
+
```ruby
|
|
265
|
+
# frozen_string_literal: true
|
|
266
|
+
|
|
267
|
+
require 'ultracart_api'
|
|
268
|
+
require_relative '../constants'
|
|
269
|
+
|
|
270
|
+
# get_fraud_lookup_values returns the lookup values used when building fraud rules:
|
|
271
|
+
# the allowed countries, affiliates, ip range types, rule groups, and rule types.
|
|
272
|
+
# Call this first when constructing a rule so you supply valid values.
|
|
273
|
+
|
|
274
|
+
fraud_api = UltracartClient::FraudApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
|
|
275
|
+
|
|
276
|
+
api_response = fraud_api.get_fraud_lookup_values
|
|
185
277
|
|
|
186
|
-
|
|
278
|
+
lookup_values = api_response.fraud_lookup_values
|
|
279
|
+
|
|
280
|
+
puts 'Rule types:'
|
|
281
|
+
puts lookup_values.rule_types.inspect
|
|
282
|
+
|
|
283
|
+
puts 'Rule groups:'
|
|
284
|
+
puts lookup_values.rule_groups.inspect
|
|
285
|
+
|
|
286
|
+
puts 'IP range types:'
|
|
287
|
+
puts lookup_values.ip_range_types.inspect
|
|
288
|
+
|
|
289
|
+
puts 'Countries:'
|
|
290
|
+
puts lookup_values.countries.inspect
|
|
291
|
+
```
|
|
187
292
|
|
|
188
293
|
|
|
189
294
|
#### Using the get_fraud_lookup_values_with_http_info variant
|
|
@@ -233,8 +338,79 @@ Creates a fraud rule for this merchant account. Field names in the request body
|
|
|
233
338
|
|
|
234
339
|
### Examples
|
|
235
340
|
|
|
236
|
-
|
|
237
|
-
|
|
341
|
+
```ruby
|
|
342
|
+
# frozen_string_literal: true
|
|
343
|
+
|
|
344
|
+
require 'ultracart_api'
|
|
345
|
+
require_relative '../constants'
|
|
346
|
+
|
|
347
|
+
# insert_fraud_rule creates a single fraud rule. Each rule has a rule_type (what it inspects),
|
|
348
|
+
# a failure_action (what happens when it matches), and type-specific fields such as an amount
|
|
349
|
+
# threshold, country code, ip address, or email.
|
|
350
|
+
#
|
|
351
|
+
# This sample has some fun and inserts several rules of different types in one run. Call
|
|
352
|
+
# get_fraud_lookup_values.rb to see every valid rule_type and the other lookup values.
|
|
353
|
+
|
|
354
|
+
fraud_api = UltracartClient::FraudApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
|
|
355
|
+
|
|
356
|
+
rules = []
|
|
357
|
+
|
|
358
|
+
# 1. Decline any order placed with a known-bad email address.
|
|
359
|
+
rules << UltracartClient::FraudRuleInsertRequest.new(
|
|
360
|
+
rule_type: 'address email',
|
|
361
|
+
email: 'chargeback-charlie@example.com',
|
|
362
|
+
failure_action: 'Decline Transaction',
|
|
363
|
+
auto_note: 'Known chargeback email - decline on sight'
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
# 2. Flag large single credit card transactions over $1,000 for manual review.
|
|
367
|
+
rules << UltracartClient::FraudRuleInsertRequest.new(
|
|
368
|
+
rule_type: 'credit card single transaction exceeds',
|
|
369
|
+
amount_threshold: 1000.00,
|
|
370
|
+
failure_action: 'Flag For Review',
|
|
371
|
+
auto_note: 'Large single transaction - review before shipping'
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
# 3. Decline orders that ship outside the United States.
|
|
375
|
+
rules << UltracartClient::FraudRuleInsertRequest.new(
|
|
376
|
+
rule_type: 'address not in country',
|
|
377
|
+
country_code: 'US',
|
|
378
|
+
failure_action: 'Decline Transaction',
|
|
379
|
+
auto_note: 'Domestic shipping only'
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
# 4. Decline transactions originating from a specific bad IP address.
|
|
383
|
+
rules << UltracartClient::FraudRuleInsertRequest.new(
|
|
384
|
+
rule_type: 'ip matches',
|
|
385
|
+
ip_address: '203.0.113.66',
|
|
386
|
+
ip_range_type: 'address',
|
|
387
|
+
failure_action: 'Decline Transaction',
|
|
388
|
+
auto_note: 'Blocked IP address'
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
# 5. Flag prepaid credit cards for review.
|
|
392
|
+
rules << UltracartClient::FraudRuleInsertRequest.new(
|
|
393
|
+
rule_type: 'credit card block prepaid',
|
|
394
|
+
failure_action: 'Flag For Review',
|
|
395
|
+
auto_note: 'Prepaid card - take a closer look'
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
# 6. Flag a customer IP making more than 10 transactions in a single day.
|
|
399
|
+
rules << UltracartClient::FraudRuleInsertRequest.new(
|
|
400
|
+
rule_type: 'ip daily transaction count exceeds',
|
|
401
|
+
count_threshold: 10,
|
|
402
|
+
ip_range_type: 'address',
|
|
403
|
+
user_action: 'Attempted',
|
|
404
|
+
failure_action: 'Flag For Review',
|
|
405
|
+
auto_note: 'IP velocity - more than 10 orders in a day'
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
rules.each do |rule|
|
|
409
|
+
api_response = fraud_api.insert_fraud_rule(rule)
|
|
410
|
+
created = api_response.fraud_rule
|
|
411
|
+
puts "Inserted '#{rule.rule_type}' rule, oid = #{created.fraud_rule_oid}"
|
|
412
|
+
end
|
|
413
|
+
```
|
|
238
414
|
|
|
239
415
|
|
|
240
416
|
#### Using the insert_fraud_rule_with_http_info variant
|
|
@@ -286,8 +462,33 @@ Searches fraud rules for this merchant account using semantic filter fields. Pag
|
|
|
286
462
|
|
|
287
463
|
### Examples
|
|
288
464
|
|
|
465
|
+
```ruby
|
|
466
|
+
# frozen_string_literal: true
|
|
467
|
+
|
|
468
|
+
require 'ultracart_api'
|
|
469
|
+
require_relative '../constants'
|
|
470
|
+
|
|
471
|
+
# search_fraud_rules returns the fraud rules that match the supplied criteria. Every field on the
|
|
472
|
+
# FraudRuleSearchRequest is optional; supply only the ones you want to filter on. Pagination and
|
|
473
|
+
# sort are passed as options (_limit, _offset, _sort).
|
|
474
|
+
#
|
|
475
|
+
# This sample searches for every rule whose action is "Decline Transaction".
|
|
476
|
+
|
|
477
|
+
fraud_api = UltracartClient::FraudApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
|
|
478
|
+
|
|
479
|
+
search_request = UltracartClient::FraudRuleSearchRequest.new(
|
|
480
|
+
failure_action: 'Decline Transaction'
|
|
481
|
+
)
|
|
289
482
|
|
|
290
|
-
(
|
|
483
|
+
api_response = fraud_api.search_fraud_rules(search_request, { _limit: 200, _offset: 0 })
|
|
484
|
+
|
|
485
|
+
fraud_rules = api_response.fraud_rules
|
|
486
|
+
puts "Found #{fraud_rules.length} rule(s) with action 'Decline Transaction'"
|
|
487
|
+
|
|
488
|
+
fraud_rules.each do |fraud_rule|
|
|
489
|
+
puts " oid #{fraud_rule.fraud_rule_oid} - #{fraud_rule.rule_type} - #{fraud_rule.auto_note}"
|
|
490
|
+
end
|
|
491
|
+
```
|
|
291
492
|
|
|
292
493
|
|
|
293
494
|
#### Using the search_fraud_rules_with_http_info variant
|
data/docs/GiftCertificateApi.md
CHANGED
|
@@ -470,10 +470,8 @@ api = UltracartClient::GiftCertificateApi.new_using_api_key(Constants::API_KEY,
|
|
|
470
470
|
def get_gift_certificates_chuck(api, offset, limit)
|
|
471
471
|
expansion = 'ledger'.freeze
|
|
472
472
|
query = UltracartClient::GiftCertificateQuery.new # leaving this empty, so no filtering, and I should get all records returned.
|
|
473
|
-
api_response = api.get_gift_certificates_by_query(query, { _limit
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
[]
|
|
473
|
+
api_response = api.get_gift_certificates_by_query(query, { :'_limit' => limit, :'_offset' => offset, :'_expand' => expansion })
|
|
474
|
+
api_response.gift_certificates unless api_response.gift_certificates.nil? []
|
|
477
475
|
end
|
|
478
476
|
|
|
479
477
|
|
data/docs/OrderApi.md
CHANGED
|
@@ -1300,8 +1300,48 @@ Retrieves the customer activity associated with the email address on this order.
|
|
|
1300
1300
|
|
|
1301
1301
|
### Examples
|
|
1302
1302
|
|
|
1303
|
+
```ruby
|
|
1304
|
+
require 'ultracart_api'
|
|
1305
|
+
require_relative '../constants'
|
|
1303
1306
|
|
|
1304
|
-
|
|
1307
|
+
# getOrderCustomerActivity returns the customer activity associated with the email address on an order.
|
|
1308
|
+
# This includes email engagement history, email list and segment membership, lifetime metrics and email
|
|
1309
|
+
# suppression status.
|
|
1310
|
+
#
|
|
1311
|
+
# A customer profile is NOT required and is not consulted. The activity is keyed off the email address on
|
|
1312
|
+
# the order, so this works for guest orders that have never had a customer profile established. For the
|
|
1313
|
+
# page views captured during the session that placed the order, use get_order_page_view_history instead.
|
|
1314
|
+
#
|
|
1315
|
+
# If the order has no valid email address, email and customer_activity both come back nil. That is a
|
|
1316
|
+
# successful response rather than an error - without an email there is no activity record to find.
|
|
1317
|
+
#
|
|
1318
|
+
# Note: activity.ts is a unix timestamp in milliseconds, not an ISO 8601 string like most dates in this API.
|
|
1319
|
+
#
|
|
1320
|
+
# Possible Errors:
|
|
1321
|
+
# order_id does not start with the merchant id -> "Path parameter 'order_id' does not start with the merchant id. Check your parameter value and call log."
|
|
1322
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
|
1323
|
+
|
|
1324
|
+
order_id = 'DEMO-0009104976'
|
|
1325
|
+
|
|
1326
|
+
begin
|
|
1327
|
+
api_response = order_api.get_order_customer_activity(order_id)
|
|
1328
|
+
customer_activity = api_response.customer_activity
|
|
1329
|
+
|
|
1330
|
+
puts "Customer activity for: #{api_response.email}"
|
|
1331
|
+
|
|
1332
|
+
if customer_activity.nil?
|
|
1333
|
+
puts 'No customer activity found for this order.'
|
|
1334
|
+
else
|
|
1335
|
+
puts "Globally unsubscribed: #{customer_activity.global_unsubscribed}"
|
|
1336
|
+
puts "Spam complaint: #{customer_activity.spam_complaint}"
|
|
1337
|
+
|
|
1338
|
+
# Using inspect instead of var_dump for Ruby-style object representation
|
|
1339
|
+
puts customer_activity.activities.inspect
|
|
1340
|
+
end
|
|
1341
|
+
rescue StandardError => e
|
|
1342
|
+
puts "An error occurred: #{e.message}"
|
|
1343
|
+
end
|
|
1344
|
+
```
|
|
1305
1345
|
|
|
1306
1346
|
|
|
1307
1347
|
#### Using the get_order_customer_activity_with_http_info variant
|
|
@@ -1426,8 +1466,52 @@ Retrieves email delivery records associated with the specified order id.
|
|
|
1426
1466
|
|
|
1427
1467
|
### Examples
|
|
1428
1468
|
|
|
1469
|
+
```ruby
|
|
1470
|
+
require 'ultracart_api'
|
|
1471
|
+
require_relative '../constants'
|
|
1429
1472
|
|
|
1430
|
-
|
|
1473
|
+
# getOrderEmails returns the delivery records for every email UltraCart sent regarding an order, oldest
|
|
1474
|
+
# first. Each record carries the subject and send time plus delivery, open, click and bounce status,
|
|
1475
|
+
# which makes this useful evidence that a customer was notified about their order.
|
|
1476
|
+
#
|
|
1477
|
+
# A customer profile is NOT required. These records are tied to the order id itself.
|
|
1478
|
+
#
|
|
1479
|
+
# An order with no email history, or one whose emails were all suppressed, comes back with an empty emails
|
|
1480
|
+
# array. That is a successful response rather than an error.
|
|
1481
|
+
#
|
|
1482
|
+
# The internal flag marks messages sent to merchant staff rather than to the customer. Filter those out
|
|
1483
|
+
# if you only want what the customer actually received.
|
|
1484
|
+
#
|
|
1485
|
+
# Possible Errors:
|
|
1486
|
+
# order_id does not start with the merchant id -> "Path parameter 'order_id' does not start with the merchant id. Check your parameter value and call log."
|
|
1487
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
|
1488
|
+
|
|
1489
|
+
order_id = 'DEMO-0009104976'
|
|
1490
|
+
|
|
1491
|
+
begin
|
|
1492
|
+
api_response = order_api.get_order_emails(order_id)
|
|
1493
|
+
emails = api_response.emails || []
|
|
1494
|
+
|
|
1495
|
+
if emails.empty?
|
|
1496
|
+
puts 'No emails were sent for this order.'
|
|
1497
|
+
else
|
|
1498
|
+
emails.each do |email|
|
|
1499
|
+
puts "#{email.send_dts} - #{email.email} - #{email.subject}"
|
|
1500
|
+
|
|
1501
|
+
status = []
|
|
1502
|
+
status << "delivered #{email.delivery_dts}" if email.delivered
|
|
1503
|
+
status << "opened #{email.opened_dts}" if email.opened
|
|
1504
|
+
status << "clicked #{email.clicked_dts}" if email.clicked
|
|
1505
|
+
status << "skipped: #{email.skip_reason}" if email.skipped
|
|
1506
|
+
status << "bounced #{email.bounce_type}/#{email.bounce_sub_type}" if email.bounce_type
|
|
1507
|
+
|
|
1508
|
+
puts " #{status.empty? ? 'no delivery events recorded' : status.join(', ')}"
|
|
1509
|
+
end
|
|
1510
|
+
end
|
|
1511
|
+
rescue StandardError => e
|
|
1512
|
+
puts "An error occurred: #{e.message}"
|
|
1513
|
+
end
|
|
1514
|
+
```
|
|
1431
1515
|
|
|
1432
1516
|
|
|
1433
1517
|
#### Using the get_order_emails_with_http_info variant
|
|
@@ -1479,8 +1563,51 @@ Retrieves the page views captured during the session that placed this order.
|
|
|
1479
1563
|
|
|
1480
1564
|
### Examples
|
|
1481
1565
|
|
|
1566
|
+
```ruby
|
|
1567
|
+
require 'ultracart_api'
|
|
1568
|
+
require_relative '../constants'
|
|
1482
1569
|
|
|
1483
|
-
|
|
1570
|
+
# getOrderPageViewHistory returns the page views captured during the session that placed an order, along
|
|
1571
|
+
# with the referrer that started that session.
|
|
1572
|
+
#
|
|
1573
|
+
# A customer profile is NOT required. These page views are keyed off an analytics client id stored on the
|
|
1574
|
+
# order itself, so this works for guest orders. For the email engagement side of customer activity, use
|
|
1575
|
+
# get_order_customer_activity instead.
|
|
1576
|
+
#
|
|
1577
|
+
# An order placed outside the storefront, such as a phone order or an order imported from a channel
|
|
1578
|
+
# partner, will have no analytics session attached. In that case page_views comes back empty. That is a
|
|
1579
|
+
# successful response rather than an error.
|
|
1580
|
+
#
|
|
1581
|
+
# Note: view_dts is an ISO 8601 string here. Be aware that the ts field on get_order_customer_activity is
|
|
1582
|
+
# unix milliseconds instead, so do not assume the two methods format dates the same way.
|
|
1583
|
+
#
|
|
1584
|
+
# Possible Errors:
|
|
1585
|
+
# order_id does not start with the merchant id -> "Path parameter 'order_id' does not start with the merchant id. Check your parameter value and call log."
|
|
1586
|
+
order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
|
1587
|
+
|
|
1588
|
+
order_id = 'DEMO-0009104976'
|
|
1589
|
+
|
|
1590
|
+
begin
|
|
1591
|
+
api_response = order_api.get_order_page_view_history(order_id)
|
|
1592
|
+
page_views = api_response.page_views || []
|
|
1593
|
+
|
|
1594
|
+
puts "Session referrer: #{api_response.referrer || '(none captured)'}"
|
|
1595
|
+
|
|
1596
|
+
if page_views.empty?
|
|
1597
|
+
puts 'No page views were captured for this order.'
|
|
1598
|
+
else
|
|
1599
|
+
page_views.each do |page_view|
|
|
1600
|
+
time_on_page = page_view.time_on_page ? " (#{page_view.time_on_page}s on page)" : ''
|
|
1601
|
+
puts "#{page_view.view_dts} - #{page_view.url}#{time_on_page}"
|
|
1602
|
+
end
|
|
1603
|
+
|
|
1604
|
+
# Using inspect instead of var_dump for Ruby-style object representation
|
|
1605
|
+
puts page_views.inspect
|
|
1606
|
+
end
|
|
1607
|
+
rescue StandardError => e
|
|
1608
|
+
puts "An error occurred: #{e.message}"
|
|
1609
|
+
end
|
|
1610
|
+
```
|
|
1484
1611
|
|
|
1485
1612
|
|
|
1486
1613
|
#### Using the get_order_page_view_history_with_http_info variant
|
|
@@ -2283,7 +2410,7 @@ begin
|
|
|
2283
2410
|
cc_token = 'F893C8CBAE34830177F9EA9D97205400'
|
|
2284
2411
|
cvv_token = '3FA7577E42F7580177F9EAA2FF1F5900'
|
|
2285
2412
|
|
|
2286
|
-
get_response = checkout_api.get_cart(_expand
|
|
2413
|
+
get_response = checkout_api.get_cart({:'_expand' => expansion})
|
|
2287
2414
|
if get_response.errors&.length&.positive?
|
|
2288
2415
|
# handle errors here.
|
|
2289
2416
|
abort('System error. Could not retrieve shopping cart.')
|
|
@@ -2308,7 +2435,7 @@ begin
|
|
|
2308
2435
|
|
|
2309
2436
|
# If the customer already has a customer profile, then load that profile and pull the shipping/billing from there.
|
|
2310
2437
|
# otherwise populate it manually.
|
|
2311
|
-
customer_response = customer_api.get_customer_by_email(email, { _expand
|
|
2438
|
+
customer_response = customer_api.get_customer_by_email(email, { :'_expand' => 'shipping,billing,cards' })
|
|
2312
2439
|
if customer_response&.customer
|
|
2313
2440
|
|
|
2314
2441
|
cp = customer_response.customer # cp is short for 'customer profile'
|
|
@@ -2378,7 +2505,7 @@ begin
|
|
|
2378
2505
|
# the optimal shipping method estimates and ensure that you don't error
|
|
2379
2506
|
# by selecting a shipping method that is somehow excluded from the possible
|
|
2380
2507
|
# list for whatever reason (restrictions, locations, item-level constraints, etc)
|
|
2381
|
-
update_response = checkout_api.update_cart(cart, _expand
|
|
2508
|
+
update_response = checkout_api.update_cart(cart, {:'_expand' => expansion})
|
|
2382
2509
|
cart = update_response.cart
|
|
2383
2510
|
|
|
2384
2511
|
# for shipping, check the estimates and select one. for a completely non-interactive checkout such as this,
|
|
@@ -2392,7 +2519,7 @@ begin
|
|
|
2392
2519
|
end
|
|
2393
2520
|
end
|
|
2394
2521
|
|
|
2395
|
-
update_response = checkout_api.update_cart(cart, _expand
|
|
2522
|
+
update_response = checkout_api.update_cart(cart, {:'_expand' => expansion})
|
|
2396
2523
|
cart = update_response.cart
|
|
2397
2524
|
|
|
2398
2525
|
# validate the cart to ensure everything is in order.
|
|
@@ -2577,7 +2704,7 @@ expansion = "items" # for this example, we're going to change the items after
|
|
|
2577
2704
|
|
|
2578
2705
|
# Step 1. Duplicate the order
|
|
2579
2706
|
order_id_to_duplicate = 'DEMO-0009104436'
|
|
2580
|
-
api_response = order_api.duplicate_order(order_id_to_duplicate, opts = { _expand
|
|
2707
|
+
api_response = order_api.duplicate_order(order_id_to_duplicate, opts = { :'_expand' => expansion })
|
|
2581
2708
|
new_order = api_response.order
|
|
2582
2709
|
|
|
2583
2710
|
# Step 2. Update the items. I will create a new items array and assign it to the order to remove the old ones completely.
|
|
@@ -2600,7 +2727,7 @@ item.weight = weight
|
|
|
2600
2727
|
|
|
2601
2728
|
items << item
|
|
2602
2729
|
new_order.items = items
|
|
2603
|
-
update_response = order_api.update_order(new_order.order_id, new_order, opts = { _expand
|
|
2730
|
+
update_response = order_api.update_order(new_order.order_id, new_order, opts = { :'_expand' => expansion })
|
|
2604
2731
|
|
|
2605
2732
|
updated_order = update_response.order
|
|
2606
2733
|
|
|
@@ -2697,7 +2824,7 @@ expansion = "items"
|
|
|
2697
2824
|
|
|
2698
2825
|
# Step 1. Retrieve the order
|
|
2699
2826
|
order_id = 'DEMO-0009104436'
|
|
2700
|
-
order = order_api.get_order(order_id, opts = { _expand
|
|
2827
|
+
order = order_api.get_order(order_id, opts = { :'_expand' => expansion }).order
|
|
2701
2828
|
|
|
2702
2829
|
order.items.each do |item|
|
|
2703
2830
|
item.quantity_refunded = item.quantity
|
|
@@ -3221,13 +3348,13 @@ order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
|
|
3221
3348
|
expansion = "checkout" # see the get_order sample for expansion discussion
|
|
3222
3349
|
|
|
3223
3350
|
order_id = 'DEMO-0009104976'
|
|
3224
|
-
order = order_api.get_order(order_id, opts = { _expand
|
|
3351
|
+
order = order_api.get_order(order_id, opts = { :'_expand' => expansion }).order
|
|
3225
3352
|
|
|
3226
3353
|
p order
|
|
3227
3354
|
|
|
3228
3355
|
# TODO: do some updates to the order.
|
|
3229
3356
|
|
|
3230
|
-
api_response = order_api.update_order(order_id, order, opts = { _expand
|
|
3357
|
+
api_response = order_api.update_order(order_id, order, opts = { :'_expand' => expansion })
|
|
3231
3358
|
|
|
3232
3359
|
if api_response.error
|
|
3233
3360
|
puts api_response.error.developer_message
|
|
@@ -3330,7 +3457,7 @@ order_api = UltracartClient::OrderApi.new_using_api_key(Constants::API_KEY)
|
|
|
3330
3457
|
expansion = "checkout" # see the get_order sample for expansion discussion
|
|
3331
3458
|
|
|
3332
3459
|
order_id = 'DEMO-0009104976'
|
|
3333
|
-
order = order_api.get_order(order_id, opts = { _expand
|
|
3460
|
+
order = order_api.get_order(order_id, opts = { :'_expand' => expansion }).order
|
|
3334
3461
|
|
|
3335
3462
|
p order
|
|
3336
3463
|
|
data/docs/StorefrontApi.md
CHANGED
|
@@ -1314,8 +1314,9 @@ Delete file manager directory
|
|
|
1314
1314
|
|
|
1315
1315
|
### Examples
|
|
1316
1316
|
|
|
1317
|
+
```ruby
|
|
1317
1318
|
|
|
1318
|
-
|
|
1319
|
+
```
|
|
1319
1320
|
|
|
1320
1321
|
|
|
1321
1322
|
#### Using the delete_fs_file_with_http_info variant
|
|
@@ -9506,8 +9507,9 @@ Update email sending domain
|
|
|
9506
9507
|
|
|
9507
9508
|
### Examples
|
|
9508
9509
|
|
|
9510
|
+
```ruby
|
|
9509
9511
|
|
|
9510
|
-
|
|
9512
|
+
```
|
|
9511
9513
|
|
|
9512
9514
|
|
|
9513
9515
|
#### Using the update_email_sending_domain_with_http_info variant
|