peddler 2.1.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -41
- data/lib/mws.rb +2 -1
- data/lib/mws/easy_ship.rb +3 -0
- data/lib/mws/easy_ship/client.rb +93 -0
- data/lib/mws/fulfillment_outbound_shipment/client.rb +1 -1
- data/lib/mws/orders/client.rb +6 -6
- data/lib/mws/shipment_invoicing.rb +3 -0
- data/lib/mws/shipment_invoicing/client.rb +74 -0
- data/lib/peddler/client.rb +11 -10
- data/lib/peddler/content.rb +2 -2
- data/lib/peddler/errors/builder.rb +7 -2
- data/lib/peddler/errors/class_generator.rb +1 -1
- data/lib/peddler/errors/error.rb +6 -2
- data/lib/peddler/errors/parser.rb +1 -1
- data/lib/peddler/flat_file_parser.rb +5 -3
- data/lib/peddler/marketplace.rb +23 -19
- data/lib/peddler/mws.rb +2 -2
- data/lib/peddler/operation.rb +17 -11
- data/lib/peddler/parser.rb +1 -1
- data/lib/peddler/structured_list.rb +1 -1
- data/lib/peddler/vcr_matcher.rb +7 -7
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler/xml_parser.rb +1 -1
- data/lib/peddler/xml_response_parser.rb +1 -1
- metadata +11 -146
- data/lib/mws/off_amazon_payments/client.rb +0 -362
- data/test/credentials.rb +0 -23
- data/test/helper.rb +0 -15
- data/test/integration/internals/test_errors.rb +0 -17
- data/test/integration/internals/test_multibyte_queries.rb +0 -17
- data/test/integration/internals/test_mws_headers.rb +0 -21
- data/test/integration/internals/test_string_encodings.rb +0 -38
- data/test/integration/test_feeds.rb +0 -37
- data/test/integration/test_fulfillment_inbound_shipment.rb +0 -35
- data/test/integration/test_fulfillment_inventory.rb +0 -20
- data/test/integration/test_fulfillment_outbound_shipment.rb +0 -13
- data/test/integration/test_merchant_fulfillment.rb +0 -69
- data/test/integration/test_off_amazon_payments.rb +0 -13
- data/test/integration/test_orders.rb +0 -30
- data/test/integration/test_products.rb +0 -97
- data/test/integration/test_recommendations.rb +0 -20
- data/test/integration/test_reports.rb +0 -51
- data/test/integration/test_sellers.rb +0 -13
- data/test/integration/test_subscriptions.rb +0 -27
- data/test/integration_helper.rb +0 -53
- data/test/mws.yml +0 -36
- data/test/mws.yml.example +0 -32
- data/test/null_client.rb +0 -25
- data/test/recorder.rb +0 -39
- data/test/unit/mws/test_feeds_client.rb +0 -103
- data/test/unit/mws/test_finances_client.rb +0 -74
- data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +0 -426
- data/test/unit/mws/test_fulfillment_inventory_client.rb +0 -48
- data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +0 -202
- data/test/unit/mws/test_merchant_fulfillment_client.rb +0 -109
- data/test/unit/mws/test_off_amazon_payments_client.rb +0 -286
- data/test/unit/mws/test_orders_client.rb +0 -111
- data/test/unit/mws/test_products_client.rb +0 -248
- data/test/unit/mws/test_recommendations_client.rb +0 -62
- data/test/unit/mws/test_reports_client.rb +0 -209
- data/test/unit/mws/test_sellers_client.rb +0 -47
- data/test/unit/mws/test_subscriptions_client.rb +0 -182
- data/test/unit/peddler/errors/test_builder.rb +0 -65
- data/test/unit/peddler/errors/test_class_generator.rb +0 -18
- data/test/unit/peddler/errors/test_error.rb +0 -33
- data/test/unit/peddler/errors/test_parser.rb +0 -44
- data/test/unit/peddler/test_client.rb +0 -203
- data/test/unit/peddler/test_flat_file_parser.rb +0 -111
- data/test/unit/peddler/test_headers.rb +0 -103
- data/test/unit/peddler/test_marketplace.rb +0 -47
- data/test/unit/peddler/test_operation.rb +0 -87
- data/test/unit/peddler/test_parser.rb +0 -36
- data/test/unit/peddler/test_structured_list.rb +0 -39
- data/test/unit/peddler/test_vcr_matcher.rb +0 -55
- data/test/unit/peddler/test_xml_parser.rb +0 -37
- data/test/unit/peddler/test_xml_response_parser.rb +0 -39
- data/test/unit/test_mws.rb +0 -11
- data/test/vcr_cassettes/CartInformation.yml +0 -433
- data/test/vcr_cassettes/CustomerInformation.yml +0 -433
- data/test/vcr_cassettes/Errors.yml +0 -444
- data/test/vcr_cassettes/Feeds.yml +0 -9957
- data/test/vcr_cassettes/FulfillmentInboundShipment.yml +0 -6166
- data/test/vcr_cassettes/FulfillmentInventory.yml +0 -850
- data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +0 -433
- data/test/vcr_cassettes/MWSHeaders.yml +0 -2964
- data/test/vcr_cassettes/MerchantFulfillment.yml +0 -753
- data/test/vcr_cassettes/MultibyteQueries.yml +0 -437
- data/test/vcr_cassettes/OffAmazonPayments.yml +0 -433
- data/test/vcr_cassettes/Orders.yml +0 -4740
- data/test/vcr_cassettes/PeddlerVCRMatcher.yml +0 -41
- data/test/vcr_cassettes/Products.yml +0 -7139
- data/test/vcr_cassettes/Recommendations.yml +0 -3145
- data/test/vcr_cassettes/Reports.yml +0 -5549
- data/test/vcr_cassettes/Sellers.yml +0 -433
- data/test/vcr_cassettes/Subscriptions.yml +0 -1529
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'helper'
|
4
|
-
require 'mws/fulfillment_inventory/client'
|
5
|
-
|
6
|
-
class TestMWSFulfillmentInventoryClient < MiniTest::Test
|
7
|
-
def setup
|
8
|
-
@client = MWS::FulfillmentInventory::Client.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_listing_inventory_supply
|
12
|
-
operation = {
|
13
|
-
'Action' => 'ListInventorySupply',
|
14
|
-
'SellerSkus.member.1' => '1'
|
15
|
-
}
|
16
|
-
|
17
|
-
@client.stub(:run, nil) do
|
18
|
-
@client.list_inventory_supply(seller_skus: '1')
|
19
|
-
end
|
20
|
-
|
21
|
-
assert_equal operation, @client.operation
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_listing_inventory_supply_by_next_token
|
25
|
-
operation = {
|
26
|
-
'Action' => 'ListInventorySupplyByNextToken',
|
27
|
-
'NextToken' => '1'
|
28
|
-
}
|
29
|
-
|
30
|
-
@client.stub(:run, nil) do
|
31
|
-
@client.list_inventory_supply_by_next_token('1')
|
32
|
-
end
|
33
|
-
|
34
|
-
assert_equal operation, @client.operation
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_getting_service_status
|
38
|
-
operation = {
|
39
|
-
'Action' => 'GetServiceStatus'
|
40
|
-
}
|
41
|
-
|
42
|
-
@client.stub(:run, nil) do
|
43
|
-
@client.get_service_status
|
44
|
-
end
|
45
|
-
|
46
|
-
assert_equal operation, @client.operation
|
47
|
-
end
|
48
|
-
end
|
@@ -1,202 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'helper'
|
4
|
-
require 'mws/fulfillment_outbound_shipment/client'
|
5
|
-
|
6
|
-
class TestMWSFulfillmentOutboundShipmentClient < MiniTest::Test
|
7
|
-
def setup
|
8
|
-
@client = MWS::FulfillmentOutboundShipment::Client.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_getting_fulfillment_preview
|
12
|
-
operation = {
|
13
|
-
'Action' => 'GetFulfillmentPreview',
|
14
|
-
'Address.Foo' => '1',
|
15
|
-
'Items.member.1.Bar' => '2',
|
16
|
-
'ShippingSpeedCategories.1' => '3',
|
17
|
-
'IncludeCODFulfillmentPreview' => true
|
18
|
-
}
|
19
|
-
|
20
|
-
@client.stub(:run, nil) do
|
21
|
-
@client.get_fulfillment_preview(
|
22
|
-
{ 'Foo' => '1' },
|
23
|
-
[{ 'Bar' => '2' }],
|
24
|
-
shipping_speed_categories: ['3'],
|
25
|
-
include_cod_fulfillment_preview: true
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
assert_equal operation, @client.operation
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_creating_fulfillment_order
|
33
|
-
operation = {
|
34
|
-
'Action' => 'CreateFulfillmentOrder',
|
35
|
-
'SellerFulfillmentOrderId' => '1',
|
36
|
-
'DisplayableOrderId' => '2',
|
37
|
-
'DisplayableOrderDateTime' => '3',
|
38
|
-
'DisplayableOrderComment' => '4',
|
39
|
-
'ShippingSpeedCategory' => '5',
|
40
|
-
'DestinationAddress.Foo' => '1',
|
41
|
-
'Items.member.1.Bar' => '2',
|
42
|
-
'CODSettings.Foo' => '1',
|
43
|
-
'NotificationEmailList.member.1' => '1'
|
44
|
-
}
|
45
|
-
|
46
|
-
@client.stub(:run, nil) do
|
47
|
-
@client.create_fulfillment_order(
|
48
|
-
'1', '2', '3', '4', '5',
|
49
|
-
{ 'Foo' => '1' },
|
50
|
-
[{ 'Bar' => '2' }],
|
51
|
-
cod_settings: { 'Foo' => '1' },
|
52
|
-
notification_email_list: ['1']
|
53
|
-
)
|
54
|
-
end
|
55
|
-
|
56
|
-
assert_equal operation, @client.operation
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_updating_fulfillment_order
|
60
|
-
operation = {
|
61
|
-
'Action' => 'UpdateFulfillmentOrder',
|
62
|
-
'SellerFulfillmentOrderId' => '1',
|
63
|
-
'Items.member.1.Bar' => '2',
|
64
|
-
'NotificationEmailList.member.1' => '1'
|
65
|
-
}
|
66
|
-
|
67
|
-
@client.stub(:run, nil) do
|
68
|
-
@client.update_fulfillment_order(
|
69
|
-
'1',
|
70
|
-
items: [{ 'Bar' => '2' }],
|
71
|
-
notification_email_list: ['1']
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
|
-
assert_equal operation, @client.operation
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_getting_fulfillment_order
|
79
|
-
operation = {
|
80
|
-
'Action' => 'GetFulfillmentOrder',
|
81
|
-
'SellerFulfillmentOrderId' => '1'
|
82
|
-
}
|
83
|
-
|
84
|
-
@client.stub(:run, nil) do
|
85
|
-
@client.get_fulfillment_order('1')
|
86
|
-
end
|
87
|
-
|
88
|
-
assert_equal operation, @client.operation
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_listing_all_fulfillment_orders
|
92
|
-
started_at = Time.now
|
93
|
-
|
94
|
-
operation = {
|
95
|
-
'Action' => 'ListAllFulfillmentOrders',
|
96
|
-
'QueryStartDateTime' => started_at.iso8601
|
97
|
-
}
|
98
|
-
|
99
|
-
@client.stub(:run, nil) do
|
100
|
-
@client.list_all_fulfillment_orders(query_start_date_time: started_at)
|
101
|
-
end
|
102
|
-
|
103
|
-
assert_equal operation, @client.operation
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_listing_all_fulfillment_orders_by_next_token
|
107
|
-
operation = {
|
108
|
-
'Action' => 'ListAllFulfillmentOrdersByNextToken',
|
109
|
-
'NextToken' => '1'
|
110
|
-
}
|
111
|
-
|
112
|
-
@client.stub(:run, nil) do
|
113
|
-
@client.list_all_fulfillment_orders_by_next_token('1')
|
114
|
-
end
|
115
|
-
|
116
|
-
assert_equal operation, @client.operation
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_getting_package_tracking_details
|
120
|
-
operation = {
|
121
|
-
'Action' => 'GetPackageTrackingDetails',
|
122
|
-
'PackageNumber' => '1'
|
123
|
-
}
|
124
|
-
|
125
|
-
@client.stub(:run, nil) do
|
126
|
-
@client.get_package_tracking_details('1')
|
127
|
-
end
|
128
|
-
|
129
|
-
assert_equal operation, @client.operation
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_canceling_fulfillment_order
|
133
|
-
operation = {
|
134
|
-
'Action' => 'CancelFulfillmentOrder',
|
135
|
-
'SellerFulfillmentOrderId' => '1'
|
136
|
-
}
|
137
|
-
|
138
|
-
@client.stub(:run, nil) do
|
139
|
-
@client.cancel_fulfillment_order('1')
|
140
|
-
end
|
141
|
-
|
142
|
-
assert_equal operation, @client.operation
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_listing_return_reason_codes
|
146
|
-
seller_sku = 'ABC123'
|
147
|
-
seller_fulfillment_order_id = '123ABC'
|
148
|
-
|
149
|
-
operation = {
|
150
|
-
'Action' => 'ListReturnReasonCodes',
|
151
|
-
'SellerSKU' => seller_sku,
|
152
|
-
'SellerFulfillmentOrderId' => seller_fulfillment_order_id
|
153
|
-
}
|
154
|
-
|
155
|
-
@client.stub(:run, nil) do
|
156
|
-
@client.list_return_reason_codes(
|
157
|
-
seller_sku,
|
158
|
-
seller_fulfillment_order_id: seller_fulfillment_order_id
|
159
|
-
)
|
160
|
-
end
|
161
|
-
|
162
|
-
assert_equal operation, @client.operation
|
163
|
-
end
|
164
|
-
|
165
|
-
def test_creating_fulfillment_return
|
166
|
-
seller_fulfillment_order_id = 'ABC123'
|
167
|
-
|
168
|
-
item = { seller_return_item_id: 'ABC123',
|
169
|
-
seller_fulfillment_order_item_id: 'ABC123',
|
170
|
-
amazon_shipment_id: 'ABC123',
|
171
|
-
return_reason_code: 'VALID_RETURN_REASON_CODE',
|
172
|
-
return_comment: 'RETURN COMMENT FROM CLIENT' }
|
173
|
-
|
174
|
-
operation = {
|
175
|
-
'Action' => 'CreateFulfillmentReturn',
|
176
|
-
'SellerFulfillmentOrderId' => seller_fulfillment_order_id,
|
177
|
-
'Items.member.1.SellerReturnItemId' => item[:seller_return_item_id],
|
178
|
-
'Items.member.1.SellerFulfillmentOrderItemId' => item[:seller_fulfillment_order_item_id],
|
179
|
-
'Items.member.1.AmazonShipmentId' => item[:amazon_shipment_id],
|
180
|
-
'Items.member.1.ReturnReasonCode' => item[:return_reason_code],
|
181
|
-
'Items.member.1.ReturnComment' => item[:return_comment]
|
182
|
-
}
|
183
|
-
|
184
|
-
@client.stub(:run, nil) do
|
185
|
-
@client.create_fulfillment_return(seller_fulfillment_order_id, [item])
|
186
|
-
end
|
187
|
-
|
188
|
-
assert_equal operation, @client.operation
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_getting_service_status
|
192
|
-
operation = {
|
193
|
-
'Action' => 'GetServiceStatus'
|
194
|
-
}
|
195
|
-
|
196
|
-
@client.stub(:run, nil) do
|
197
|
-
@client.get_service_status
|
198
|
-
end
|
199
|
-
|
200
|
-
assert_equal operation, @client.operation
|
201
|
-
end
|
202
|
-
end
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'helper'
|
4
|
-
require 'mws/merchant_fulfillment/client'
|
5
|
-
|
6
|
-
class TestMWSMerchantFulfillmentClient < MiniTest::Test
|
7
|
-
def setup
|
8
|
-
@client = MWS::MerchantFulfillment::Client.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_getting_eligible_shipping_services
|
12
|
-
operation = {
|
13
|
-
'Action' => 'GetEligibleShippingServices',
|
14
|
-
'ShipmentRequestDetails.AmazonOrderId' => '123',
|
15
|
-
'ShipmentRequestDetails.Weight.Value' => '10',
|
16
|
-
'ShipmentRequestDetails.Weight.Unit' => 'ounces',
|
17
|
-
'ShipmentRequestDetails.ItemList.Item.1.OrderItemId' => '123',
|
18
|
-
'ShipmentRequestDetails.ItemList.Item.1.Quantity' => '1'
|
19
|
-
}
|
20
|
-
|
21
|
-
@client.stub(:run, nil) do
|
22
|
-
shipment_request_details = {
|
23
|
-
amazon_order_id: '123',
|
24
|
-
weight: {
|
25
|
-
value: '10',
|
26
|
-
unit: 'ounces'
|
27
|
-
},
|
28
|
-
item_list: [
|
29
|
-
{
|
30
|
-
order_item_id: '123',
|
31
|
-
quantity: '1'
|
32
|
-
}
|
33
|
-
]
|
34
|
-
}
|
35
|
-
@client.get_eligible_shipping_services(shipment_request_details)
|
36
|
-
end
|
37
|
-
|
38
|
-
assert_equal operation, @client.operation
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_creating_shipment
|
42
|
-
operation = {
|
43
|
-
'Action' => 'CreateShipment',
|
44
|
-
'ShipmentRequestDetails.AmazonOrderId' => '123',
|
45
|
-
'ShipmentRequestDetails.Weight.Value' => '10',
|
46
|
-
'ShipmentRequestDetails.Weight.Unit' => 'ounces',
|
47
|
-
'ShipmentRequestDetails.ItemList.Item.1.OrderItemId' => '123',
|
48
|
-
'ShipmentRequestDetails.ItemList.Item.1.Quantity' => '1',
|
49
|
-
'ShippingServiceId' => 'FOO'
|
50
|
-
}
|
51
|
-
|
52
|
-
@client.stub(:run, nil) do
|
53
|
-
shipment_request_details = {
|
54
|
-
amazon_order_id: '123',
|
55
|
-
weight: {
|
56
|
-
value: '10',
|
57
|
-
unit: 'ounces'
|
58
|
-
},
|
59
|
-
item_list: [
|
60
|
-
{
|
61
|
-
order_item_id: '123',
|
62
|
-
quantity: '1'
|
63
|
-
}
|
64
|
-
]
|
65
|
-
}
|
66
|
-
@client.create_shipment(shipment_request_details, 'FOO')
|
67
|
-
end
|
68
|
-
|
69
|
-
assert_equal operation, @client.operation
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_getting_shipment
|
73
|
-
operation = {
|
74
|
-
'Action' => 'GetShipment',
|
75
|
-
'ShipmentId' => '123'
|
76
|
-
}
|
77
|
-
|
78
|
-
@client.stub(:run, nil) do
|
79
|
-
@client.get_shipment('123')
|
80
|
-
end
|
81
|
-
|
82
|
-
assert_equal operation, @client.operation
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_canceling_shipment
|
86
|
-
operation = {
|
87
|
-
'Action' => 'CancelShipment',
|
88
|
-
'ShipmentId' => '123'
|
89
|
-
}
|
90
|
-
|
91
|
-
@client.stub(:run, nil) do
|
92
|
-
@client.cancel_shipment('123')
|
93
|
-
end
|
94
|
-
|
95
|
-
assert_equal operation, @client.operation
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_getting_service_status
|
99
|
-
operation = {
|
100
|
-
'Action' => 'GetServiceStatus'
|
101
|
-
}
|
102
|
-
|
103
|
-
@client.stub(:run, nil) do
|
104
|
-
@client.get_service_status
|
105
|
-
end
|
106
|
-
|
107
|
-
assert_equal operation, @client.operation
|
108
|
-
end
|
109
|
-
end
|
@@ -1,286 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'helper'
|
4
|
-
require 'mws/off_amazon_payments/client'
|
5
|
-
|
6
|
-
class TestMWSOffAmazonPaymentsClient < MiniTest::Test
|
7
|
-
def setup
|
8
|
-
@client = MWS::OffAmazonPayments::Client.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_sandboxes
|
12
|
-
@client.marketplace = 'GB'
|
13
|
-
refute_includes @client.aws_endpoint, 'Sandbox'
|
14
|
-
assert_includes @client.sandbox.aws_endpoint, 'Sandbox'
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_creating_order_reference_for_id
|
18
|
-
operation = {
|
19
|
-
'Action' => 'CreateOrderReferenceForId',
|
20
|
-
'Id' => '1',
|
21
|
-
'IdType' => '2'
|
22
|
-
}
|
23
|
-
|
24
|
-
@client.stub(:run, nil) do
|
25
|
-
@client.create_order_reference_for_id('1', '2')
|
26
|
-
end
|
27
|
-
|
28
|
-
assert_equal operation, @client.operation
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_getting_billing_agreement_details
|
32
|
-
operation = {
|
33
|
-
'Action' => 'GetBillingAgreementDetails',
|
34
|
-
'AmazonBillingAgreementId' => '1'
|
35
|
-
}
|
36
|
-
|
37
|
-
@client.stub(:run, nil) do
|
38
|
-
@client.get_billing_agreement_details('1')
|
39
|
-
end
|
40
|
-
|
41
|
-
assert_equal operation, @client.operation
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_setting_billing_agreement_details
|
45
|
-
operation = {
|
46
|
-
'Action' => 'SetBillingAgreementDetails',
|
47
|
-
'AmazonBillingAgreementId' => '1',
|
48
|
-
'BillingAgreementAttributes.Foo' => '1'
|
49
|
-
}
|
50
|
-
|
51
|
-
@client.stub(:run, nil) do
|
52
|
-
@client.set_billing_agreement_details('1', 'Foo' => '1')
|
53
|
-
end
|
54
|
-
|
55
|
-
assert_equal operation, @client.operation
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_confirming_billing_agreement
|
59
|
-
operation = {
|
60
|
-
'Action' => 'ConfirmBillingAgreement',
|
61
|
-
'AmazonBillingAgreementId' => '1'
|
62
|
-
}
|
63
|
-
|
64
|
-
@client.stub(:run, nil) do
|
65
|
-
@client.confirm_billing_agreement('1')
|
66
|
-
end
|
67
|
-
|
68
|
-
assert_equal operation, @client.operation
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_validating_billing_agreement
|
72
|
-
operation = {
|
73
|
-
'Action' => 'ValidateBillingAgreement',
|
74
|
-
'AmazonBillingAgreementId' => '1'
|
75
|
-
}
|
76
|
-
|
77
|
-
@client.stub(:run, nil) do
|
78
|
-
@client.validate_billing_agreement('1')
|
79
|
-
end
|
80
|
-
|
81
|
-
assert_equal operation, @client.operation
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_authorizing_on_billing_agreement
|
85
|
-
operation = {
|
86
|
-
'Action' => 'AuthorizeOnBillingAgreement',
|
87
|
-
'AmazonBillingAgreementId' => '1',
|
88
|
-
'AuthorizationReferenceId' => '2',
|
89
|
-
'AuthorizationAmount.Foo' => '1'
|
90
|
-
}
|
91
|
-
|
92
|
-
@client.stub(:run, nil) do
|
93
|
-
@client.authorize_on_billing_agreement('1', '2', 'Foo' => '1')
|
94
|
-
end
|
95
|
-
|
96
|
-
assert_equal operation, @client.operation
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_closing_billing_agreement
|
100
|
-
operation = {
|
101
|
-
'Action' => 'CloseBillingAgreement',
|
102
|
-
'AmazonBillingAgreementId' => '1'
|
103
|
-
}
|
104
|
-
|
105
|
-
@client.stub(:run, nil) do
|
106
|
-
@client.close_billing_agreement('1')
|
107
|
-
end
|
108
|
-
|
109
|
-
assert_equal operation, @client.operation
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_setting_order_reference_details
|
113
|
-
operation = {
|
114
|
-
'Action' => 'SetOrderReferenceDetails',
|
115
|
-
'AmazonOrderReferenceId' => '1',
|
116
|
-
'OrderReferenceAttributes.OrderTotal' => '2'
|
117
|
-
}
|
118
|
-
|
119
|
-
@client.stub(:run, nil) do
|
120
|
-
@client.set_order_reference_details('1', '2')
|
121
|
-
end
|
122
|
-
|
123
|
-
assert_equal operation, @client.operation
|
124
|
-
end
|
125
|
-
|
126
|
-
def test_getting_order_reference_details
|
127
|
-
operation = {
|
128
|
-
'Action' => 'GetOrderReferenceDetails',
|
129
|
-
'AmazonOrderReferenceId' => '1'
|
130
|
-
}
|
131
|
-
|
132
|
-
@client.stub(:run, nil) do
|
133
|
-
@client.get_order_reference_details('1')
|
134
|
-
end
|
135
|
-
|
136
|
-
assert_equal operation, @client.operation
|
137
|
-
end
|
138
|
-
|
139
|
-
def test_confirming_order_reference
|
140
|
-
operation = {
|
141
|
-
'Action' => 'ConfirmOrderReference',
|
142
|
-
'AmazonOrderReferenceId' => '1'
|
143
|
-
}
|
144
|
-
|
145
|
-
@client.stub(:run, nil) do
|
146
|
-
@client.confirm_order_reference('1')
|
147
|
-
end
|
148
|
-
|
149
|
-
assert_equal operation, @client.operation
|
150
|
-
end
|
151
|
-
|
152
|
-
def test_canceling_order_reference
|
153
|
-
operation = {
|
154
|
-
'Action' => 'CancelOrderReference',
|
155
|
-
'AmazonOrderReferenceId' => '1'
|
156
|
-
}
|
157
|
-
|
158
|
-
@client.stub(:run, nil) do
|
159
|
-
@client.cancel_order_reference('1')
|
160
|
-
end
|
161
|
-
|
162
|
-
assert_equal operation, @client.operation
|
163
|
-
end
|
164
|
-
|
165
|
-
def test_closing_order_reference
|
166
|
-
operation = {
|
167
|
-
'Action' => 'CloseOrderReference',
|
168
|
-
'AmazonOrderReferenceId' => '1'
|
169
|
-
}
|
170
|
-
|
171
|
-
@client.stub(:run, nil) do
|
172
|
-
@client.close_order_reference('1')
|
173
|
-
end
|
174
|
-
|
175
|
-
assert_equal operation, @client.operation
|
176
|
-
end
|
177
|
-
|
178
|
-
def test_authorizes
|
179
|
-
operation = {
|
180
|
-
'Action' => 'Authorize',
|
181
|
-
'AmazonOrderReferenceId' => '1',
|
182
|
-
'AuthorizationReferenceId' => '2',
|
183
|
-
'AuthorizationAmount' => '3'
|
184
|
-
}
|
185
|
-
|
186
|
-
@client.stub(:run, nil) do
|
187
|
-
@client.authorize('1', '2', '3')
|
188
|
-
end
|
189
|
-
|
190
|
-
assert_equal operation, @client.operation
|
191
|
-
end
|
192
|
-
|
193
|
-
def test_getting_authorization_details
|
194
|
-
operation = {
|
195
|
-
'Action' => 'GetAuthorizationDetails',
|
196
|
-
'AmazonAuthorizationId' => '1'
|
197
|
-
}
|
198
|
-
|
199
|
-
@client.stub(:run, nil) do
|
200
|
-
@client.get_authorization_details('1')
|
201
|
-
end
|
202
|
-
|
203
|
-
assert_equal operation, @client.operation
|
204
|
-
end
|
205
|
-
|
206
|
-
def test_captures
|
207
|
-
operation = {
|
208
|
-
'Action' => 'Capture',
|
209
|
-
'AmazonAuthorizationId' => '1',
|
210
|
-
'CaptureReferenceId' => '2',
|
211
|
-
'CaptureAmount' => '3'
|
212
|
-
}
|
213
|
-
|
214
|
-
@client.stub(:run, nil) do
|
215
|
-
@client.capture('1', '2', '3')
|
216
|
-
end
|
217
|
-
|
218
|
-
assert_equal operation, @client.operation
|
219
|
-
end
|
220
|
-
|
221
|
-
def test_getting_capture_details
|
222
|
-
operation = {
|
223
|
-
'Action' => 'GetCaptureDetails',
|
224
|
-
'AmazonCaptureId' => '1'
|
225
|
-
}
|
226
|
-
|
227
|
-
@client.stub(:run, nil) do
|
228
|
-
@client.get_capture_details('1')
|
229
|
-
end
|
230
|
-
|
231
|
-
assert_equal operation, @client.operation
|
232
|
-
end
|
233
|
-
|
234
|
-
def test_closing_authorization
|
235
|
-
operation = {
|
236
|
-
'Action' => 'CloseAuthorization',
|
237
|
-
'AmazonAuthorizationId' => '1'
|
238
|
-
}
|
239
|
-
|
240
|
-
@client.stub(:run, nil) do
|
241
|
-
@client.close_authorization('1')
|
242
|
-
end
|
243
|
-
|
244
|
-
assert_equal operation, @client.operation
|
245
|
-
end
|
246
|
-
|
247
|
-
def test_refunds
|
248
|
-
operation = {
|
249
|
-
'Action' => 'Refund',
|
250
|
-
'AmazonCaptureId' => '1',
|
251
|
-
'RefundReferenceId' => '2',
|
252
|
-
'RefundAmount' => '3'
|
253
|
-
}
|
254
|
-
|
255
|
-
@client.stub(:run, nil) do
|
256
|
-
@client.refund('1', '2', '3')
|
257
|
-
end
|
258
|
-
|
259
|
-
assert_equal operation, @client.operation
|
260
|
-
end
|
261
|
-
|
262
|
-
def test_getting_refund_details
|
263
|
-
operation = {
|
264
|
-
'Action' => 'GetRefundDetails',
|
265
|
-
'AmazonRefundId' => '1'
|
266
|
-
}
|
267
|
-
|
268
|
-
@client.stub(:run, nil) do
|
269
|
-
@client.get_refund_details('1')
|
270
|
-
end
|
271
|
-
|
272
|
-
assert_equal operation, @client.operation
|
273
|
-
end
|
274
|
-
|
275
|
-
def test_getting_service_status
|
276
|
-
operation = {
|
277
|
-
'Action' => 'GetServiceStatus'
|
278
|
-
}
|
279
|
-
|
280
|
-
@client.stub(:run, nil) do
|
281
|
-
@client.get_service_status
|
282
|
-
end
|
283
|
-
|
284
|
-
assert_equal operation, @client.operation
|
285
|
-
end
|
286
|
-
end
|