channeladvisor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/.yardopts +8 -0
- data/Gemfile +31 -0
- data/Guardfile +28 -0
- data/LICENSE +19 -0
- data/README.md +40 -0
- data/Rakefile +69 -0
- data/channeladvisor.gemspec +29 -0
- data/lib/channeladvisor.rb +27 -0
- data/lib/channeladvisor/account_authorization.rb +14 -0
- data/lib/channeladvisor/address.rb +39 -0
- data/lib/channeladvisor/admin.rb +75 -0
- data/lib/channeladvisor/base.rb +34 -0
- data/lib/channeladvisor/client.rb +3 -0
- data/lib/channeladvisor/configuration.rb +11 -0
- data/lib/channeladvisor/error.rb +30 -0
- data/lib/channeladvisor/line_item.rb +38 -0
- data/lib/channeladvisor/order.rb +179 -0
- data/lib/channeladvisor/order_status.rb +14 -0
- data/lib/channeladvisor/payment.rb +15 -0
- data/lib/channeladvisor/services.rb +11 -0
- data/lib/channeladvisor/services/admin_service.rb +47 -0
- data/lib/channeladvisor/services/base_service.rb +26 -0
- data/lib/channeladvisor/services/inventory_service.rb +90 -0
- data/lib/channeladvisor/services/order_service.rb +117 -0
- data/lib/channeladvisor/services/shipping_service.rb +164 -0
- data/lib/channeladvisor/shipment.rb +71 -0
- data/lib/channeladvisor/shopping_cart.rb +26 -0
- data/lib/channeladvisor/version.rb +3 -0
- data/spec/fixtures/requests/admin_service/get_authorization_list.xml +1 -0
- data/spec/fixtures/requests/admin_service/get_authorization_list_with_local_id.xml +1 -0
- data/spec/fixtures/requests/admin_service/ping.xml +1 -0
- data/spec/fixtures/requests/admin_service/request_access.xml +1 -0
- data/spec/fixtures/requests/inventory_service/ping.xml +1 -0
- data/spec/fixtures/requests/inventory_service/update_inventory_item_quantity_and_price_list/with_one_item/price_only.xml +1 -0
- data/spec/fixtures/requests/inventory_service/update_inventory_item_quantity_and_price_list/with_one_item/quantity_and_price.xml +1 -0
- data/spec/fixtures/requests/inventory_service/update_inventory_item_quantity_and_price_list/with_one_item/quantity_only.xml +1 -0
- data/spec/fixtures/requests/inventory_service/update_inventory_item_quantity_and_price_list/with_two_items/price_only.xml +1 -0
- data/spec/fixtures/requests/inventory_service/update_inventory_item_quantity_and_price_list/with_two_items/quantity_and_price.xml +1 -0
- data/spec/fixtures/requests/inventory_service/update_inventory_item_quantity_and_price_list/with_two_items/quantity_only.xml +1 -0
- data/spec/fixtures/requests/inventory_service/update_item_price.xml +1 -0
- data/spec/fixtures/requests/inventory_service/update_item_quantity.xml +1 -0
- data/spec/fixtures/requests/inventory_service/update_item_quantity_and_price.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_checkout_status_filter.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_created_from_date.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_created_to_date.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_detail_level.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_distribution_center_code.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_export_state.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_join_dates.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_one_client_order_id.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_one_order_id.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_order_state_filter.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_page_number_filter.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_page_size.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_payment_status_filter.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_refund_status_filter.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_shipping_status_filter.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_two_client_order_ids.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_two_order_ids.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_updated_from_date.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/with_updated_to_date.xml +1 -0
- data/spec/fixtures/requests/order_service/get_order_list/without_order_criteria.xml +1 -0
- data/spec/fixtures/requests/order_service/ping.xml +1 -0
- data/spec/fixtures/requests/order_service/set_orders_export_status/with_one_client_order_id.xml +1 -0
- data/spec/fixtures/requests/order_service/set_orders_export_status/with_two_client_order_ids.xml +1 -0
- data/spec/fixtures/requests/shipping_service/get_shipping_carrier_list.xml +1 -0
- data/spec/fixtures/requests/shipping_service/ping.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/full_shipment/with_one_shipment.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/full_shipment/with_two_shipments.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/full_shipment/without_carrier_code.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/full_shipment/without_class_code.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/full_shipment/without_client_order_id.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/full_shipment/without_seller_id.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/full_shipment/without_tracking_number.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/partial_shipment/with_one_line_item.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/partial_shipment/with_two_line_items.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/partial_shipment/with_two_shipments.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/partial_shipment/without_carrier_code.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/partial_shipment/without_class_code.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/partial_shipment/without_seller_id.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/partial_shipment/without_tracking_number.xml +1 -0
- data/spec/fixtures/requests/shipping_service/submit_order_shipment_list/with_partial_and_full_shipments.xml +1 -0
- data/spec/fixtures/responses/admin/get_authorization_list/failure.yml +50 -0
- data/spec/fixtures/responses/admin/get_authorization_list/no_authorizations.yml +49 -0
- data/spec/fixtures/responses/admin/get_authorization_list/one_authorization.yml +49 -0
- data/spec/fixtures/responses/admin/get_authorization_list/success.yml +49 -0
- data/spec/fixtures/responses/admin/get_authorization_list/two_authorizations.yml +49 -0
- data/spec/fixtures/responses/admin/ping/failure.yml +50 -0
- data/spec/fixtures/responses/admin/ping/success.yml +218 -0
- data/spec/fixtures/responses/admin/request_access/failure.yml +50 -0
- data/spec/fixtures/responses/admin/request_access/success.yml +49 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/with_invalid_local_id.yml +219 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/with_local_id/success.yml +218 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/with_valid_local_id/multiple_authorizations.yml +49 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/with_valid_local_id/no_authorizations.yml +49 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/with_valid_local_id/one_authorization.yml +49 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/with_valid_local_id/success.yml +218 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/without_local_id/multiple_authorizations.yml +49 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/without_local_id/no_authorizations.yml +49 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/without_local_id/one_authorization.yml +49 -0
- data/spec/fixtures/responses/admin_service/get_authorization_list/without_local_id/success.yml +218 -0
- data/spec/fixtures/responses/admin_service/ping/failure.yml +222 -0
- data/spec/fixtures/responses/admin_service/ping/success.yml +218 -0
- data/spec/fixtures/responses/admin_service/request_access/failure.yml +219 -0
- data/spec/fixtures/responses/admin_service/request_access/success.yml +218 -0
- data/spec/fixtures/responses/http_error.yml +48 -0
- data/spec/fixtures/responses/inventory_service/ping.yml +1356 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price.yml +1356 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price/price_only.yml +144 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price/quantity_and_price.yml +191 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price/quantity_only.yml +1403 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price_list.yml +243 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price_list/with_one_item/price_only.yml +97 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price_list/with_one_item/quantity_and_price.yml +144 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price_list/with_one_item/quantity_only.yml +51 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price_list/with_two_items/price_only.yml +238 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price_list/with_two_items/quantity_and_price.yml +285 -0
- data/spec/fixtures/responses/inventory_service/update_inventory_item_quantity_and_price_list/with_two_items/quantity_only.yml +191 -0
- data/spec/fixtures/responses/order/instance_set_export_status.yml +51 -0
- data/spec/fixtures/responses/order/instance_set_export_status/failure.yml +51 -0
- data/spec/fixtures/responses/order/instance_set_export_status/success/result_false.yml +51 -0
- data/spec/fixtures/responses/order/instance_set_export_status/success/result_true.yml +51 -0
- data/spec/fixtures/responses/order/list.yml +58 -0
- data/spec/fixtures/responses/order/list/failure.yml +56 -0
- data/spec/fixtures/responses/order/list/no_matching_orders.yml +56 -0
- data/spec/fixtures/responses/order/list/one_matching_order.yml +57 -0
- data/spec/fixtures/responses/order/list/two_matching_orders.yml +59 -0
- data/spec/fixtures/responses/order/list/with_criteria.yml +52 -0
- data/spec/fixtures/responses/order/list/with_no_criteria.yml +58 -0
- data/spec/fixtures/responses/order/ping.yml +868 -0
- data/spec/fixtures/responses/order/ping/failure.yml +50 -0
- data/spec/fixtures/responses/order/ping/success.yml +867 -0
- data/spec/fixtures/responses/order/set_export_status/failure.yml +51 -0
- data/spec/fixtures/responses/order/set_export_status/success/with_one_client_order_id.yml +51 -0
- data/spec/fixtures/responses/order/set_export_status/success/with_two_client_order_ids.yml +51 -0
- data/spec/fixtures/responses/order_service/get_order_list/.gitkeep +0 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_checkout_status_filter.yml +875 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_created_from_date.yml +874 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_created_to_date.yml +874 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_detail_level.yml +875 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_distribution_center_code.yml +872 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_export_state.yml +875 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_join_dates.yml +869 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_one_client_order_id.yml +872 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_one_order_id.yml +873 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_order_state_filter.yml +875 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_page_number_filter.yml +875 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_page_size.yml +874 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_payment_status_filter.yml +875 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_refund_status_filter.yml +875 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_shipping_status_filter.yml +875 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_two_client_order_ids.yml +872 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_two_order_ids.yml +875 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_updated_from_date.yml +874 -0
- data/spec/fixtures/responses/order_service/get_order_list/with_updated_to_date.yml +874 -0
- data/spec/fixtures/responses/order_service/get_order_list/without_order_criteria.yml +871 -0
- data/spec/fixtures/responses/order_service/get_order_refund_history/.gitkeep +0 -0
- data/spec/fixtures/responses/order_service/order_merge/.gitkeep +0 -0
- data/spec/fixtures/responses/order_service/order_split/.gitkeep +0 -0
- data/spec/fixtures/responses/order_service/ping/.gitkeep +0 -0
- data/spec/fixtures/responses/order_service/ping/failure.yml +871 -0
- data/spec/fixtures/responses/order_service/ping/success.yml +868 -0
- data/spec/fixtures/responses/order_service/set_orders_export_status/with_one_client_order_id.yml +867 -0
- data/spec/fixtures/responses/order_service/set_orders_export_status/with_two_client_order_id.yml +867 -0
- data/spec/fixtures/responses/order_service/set_seller_order_id/.gitkeep +0 -0
- data/spec/fixtures/responses/order_service/set_seller_order_item_id_list/.gitkeep +0 -0
- data/spec/fixtures/responses/order_service/submit_order/.gitkeep +0 -0
- data/spec/fixtures/responses/order_service/submit_order_refund/.gitkeep +0 -0
- data/spec/fixtures/responses/order_service/update_order_list/.gitkeep +0 -0
- data/spec/fixtures/responses/shipment/get_carriers.yml +53 -0
- data/spec/fixtures/responses/shipment/get_carriers/failure.yml +52 -0
- data/spec/fixtures/responses/shipment/submit.yml +464 -0
- data/spec/fixtures/responses/shipment/submit/failure.yml +462 -0
- data/spec/fixtures/responses/shipment/submit/one_shipment.yml +464 -0
- data/spec/fixtures/responses/shipment/submit/two_shipments.yml +56 -0
- data/spec/fixtures/responses/shipping_service/get_shipping_carrier_list.yml +953 -0
- data/spec/fixtures/responses/shipping_service/ping/failure.yml +55 -0
- data/spec/fixtures/responses/shipping_service/ping/success.yml +460 -0
- data/spec/fixtures/responses/shipping_service/submit_order_shipment_list.yml +55 -0
- data/spec/fixtures/responses/soap_fault.yml +53 -0
- data/spec/lib/channeladvisor/address_spec.rb +107 -0
- data/spec/lib/channeladvisor/admin_spec.rb +216 -0
- data/spec/lib/channeladvisor/line_item_spec.rb +147 -0
- data/spec/lib/channeladvisor/order_spec.rb +623 -0
- data/spec/lib/channeladvisor/order_status_spec.rb +36 -0
- data/spec/lib/channeladvisor/payment_spec.rb +38 -0
- data/spec/lib/channeladvisor/services/admin_service_spec.rb +65 -0
- data/spec/lib/channeladvisor/services/base_service_spec.rb +11 -0
- data/spec/lib/channeladvisor/services/inventory_service_spec.rb +214 -0
- data/spec/lib/channeladvisor/services/order_service_spec.rb +267 -0
- data/spec/lib/channeladvisor/services/shipping_service_spec.rb +288 -0
- data/spec/lib/channeladvisor/shipment_spec.rb +257 -0
- data/spec/lib/channeladvisor/shopping_cart_spec.rb +173 -0
- data/spec/lib/channeladvisor_spec.rb +18 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/support/credentials.rb +15 -0
- data/spec/support/matchers/boolean.rb +17 -0
- data/spec/support/matchers/markup.rb +50 -0
- data/spec/support/rr.rb +38 -0
- data/spec/support/shared_examples.rb +4 -0
- data/spec/support/vcr.rb +38 -0
- metadata +501 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module ChannelAdvisor
|
|
4
|
+
describe OrderStatus do
|
|
5
|
+
describe ".new" do
|
|
6
|
+
before(:each) do
|
|
7
|
+
@attrs = {
|
|
8
|
+
:checkout_status => "Completed",
|
|
9
|
+
:checkout_date_gmt => DateTime.new(2012,05,17),
|
|
10
|
+
:payment_status => "Cleared",
|
|
11
|
+
:payment_date_gmt => DateTime.new(2012,05,17),
|
|
12
|
+
:shipping_status => "Shipped",
|
|
13
|
+
:shipping_date_gmt => DateTime.new(2012,05,21),
|
|
14
|
+
:order_refund_status => "NoRefunds"
|
|
15
|
+
}
|
|
16
|
+
@order_status = OrderStatus.new(@attrs)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "sets @checkout to an array of status and date" do
|
|
20
|
+
@order_status.checkout.should == [@attrs[:checkout_status], @attrs[:checkout_date_gmt]]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "sets @payment to an array of status and date" do
|
|
24
|
+
@order_status.payment.should == [@attrs[:payment], @attrs[:payment_date_gmt]]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "sets @shipping to an array of status and date" do
|
|
28
|
+
@order_status.shipping.should == [@attrs[:shipping], @attrs[:shipping_date_gmt]]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "sets @refund to the refund status" do
|
|
32
|
+
@order_status.refund.should == @attrs[:order_refund_status]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module ChannelAdvisor
|
|
4
|
+
describe Payment do
|
|
5
|
+
describe ".new" do
|
|
6
|
+
before(:each) do
|
|
7
|
+
@attrs = {
|
|
8
|
+
:payment_type => "Credit Card",
|
|
9
|
+
:credit_card_last4 => "1234",
|
|
10
|
+
:pay_pal_id => "ABCDEFG123456",
|
|
11
|
+
:merchant_reference_number => "99999",
|
|
12
|
+
:payment_transaction_id => "XYZ999999999"
|
|
13
|
+
}
|
|
14
|
+
@payment = Payment.new(@attrs)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "sets @type" do
|
|
18
|
+
@payment.type.should == @attrs[:payment_type]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "sets @credit_card_last4" do
|
|
22
|
+
@payment.credit_card_number.should == @attrs[:credit_card_last4]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "sets @paypal_id" do
|
|
26
|
+
@payment.paypal_id.should == @attrs[:pay_pal_id]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "sets @merchant_reference_number" do
|
|
30
|
+
@payment.merchant_reference_number.should == @attrs[:merchant_reference_number]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "sets @payment_transaction_id" do
|
|
34
|
+
@payment.transaction_id.should == @attrs[:payment_transaction_id]
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module ChannelAdvisor
|
|
4
|
+
module Services
|
|
5
|
+
describe AdminService do
|
|
6
|
+
subject { AdminService }
|
|
7
|
+
let(:local_id) { sensitive_data["local_ids"].first }
|
|
8
|
+
|
|
9
|
+
describe "#ping" do
|
|
10
|
+
context "when successful" do
|
|
11
|
+
use_vcr_cassette "responses/admin_service/ping/success"
|
|
12
|
+
before(:each) { AdminService.ping }
|
|
13
|
+
|
|
14
|
+
its(:last_request) { should match_valid_xml_body_for :ping }
|
|
15
|
+
its(:last_request) { should be_an HTTPI::Request }
|
|
16
|
+
its(:last_response) { should be_a Savon::SOAP::Response }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
context "when unsuccessful" do
|
|
20
|
+
use_vcr_cassette "responses/admin_service/ping/failure"
|
|
21
|
+
before(:each) do
|
|
22
|
+
ChannelAdvisor.configure { |config| config.password = "wrong password" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should raise a SOAP Fault error" do
|
|
26
|
+
expect { AdminService.ping }.to raise_error Savon::SOAP::Fault
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end # ping
|
|
30
|
+
|
|
31
|
+
describe "#request_access" do
|
|
32
|
+
context "when successful" do
|
|
33
|
+
use_vcr_cassette "responses/admin_service/request_access/success"
|
|
34
|
+
before(:each) { AdminService.request_access(local_id) }
|
|
35
|
+
|
|
36
|
+
its(:last_request) { should match_valid_xml_body_for :request_access }
|
|
37
|
+
its(:last_request) { should be_an HTTPI::Request }
|
|
38
|
+
its(:last_response) { should be_a Savon::SOAP::Response }
|
|
39
|
+
end
|
|
40
|
+
end # request_access
|
|
41
|
+
|
|
42
|
+
describe "#get_authorization_list" do
|
|
43
|
+
context "without Local ID" do
|
|
44
|
+
use_vcr_cassette "responses/admin_service/get_authorization_list/without_local_id/success"
|
|
45
|
+
before(:each) { AdminService.get_authorization_list }
|
|
46
|
+
|
|
47
|
+
its(:last_request) { should match_valid_xml_body_for :get_authorization_list }
|
|
48
|
+
its(:last_request) { should be_an HTTPI::Request }
|
|
49
|
+
its(:last_response) { should be_a Savon::SOAP::Response }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
context "with Local ID" do
|
|
53
|
+
context "when successful" do
|
|
54
|
+
use_vcr_cassette "responses/admin_service/get_authorization_list/with_local_id/success"
|
|
55
|
+
before(:each) { AdminService.get_authorization_list(local_id) }
|
|
56
|
+
|
|
57
|
+
its(:last_request) { should match_valid_xml_body_for :get_authorization_list_with_local_id }
|
|
58
|
+
its(:last_request) { should be_an HTTPI::Request }
|
|
59
|
+
its(:last_response) { should be_a Savon::SOAP::Response }
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end # get_authorization_list
|
|
63
|
+
end # AdminService
|
|
64
|
+
end # Services
|
|
65
|
+
end # ChannelAdvisor
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module ChannelAdvisor
|
|
4
|
+
module Services
|
|
5
|
+
describe InventoryService do
|
|
6
|
+
describe ".ping" do
|
|
7
|
+
use_vcr_cassette "responses/inventory_service/ping", :allow_playback_repeats => true
|
|
8
|
+
|
|
9
|
+
before(:each) do
|
|
10
|
+
@last_request, @last_response = nil
|
|
11
|
+
|
|
12
|
+
InventoryService.client.config.hooks.define(:ping, :soap_request) do |callback, request|
|
|
13
|
+
@last_request = request.http
|
|
14
|
+
@last_response = callback.call
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "sends a valid SOAP request" do
|
|
19
|
+
InventoryService.ping
|
|
20
|
+
@last_request.should match_valid_xml_body_for :ping
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "returns a SOAP response" do
|
|
24
|
+
soap_response = InventoryService.ping
|
|
25
|
+
soap_response.should be_a Savon::SOAP::Response
|
|
26
|
+
end
|
|
27
|
+
end # .ping
|
|
28
|
+
|
|
29
|
+
describe ".update_inventory_item_quantity_and_price" do
|
|
30
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price", :allow_playback_repeats => true
|
|
31
|
+
|
|
32
|
+
let(:quantity_info) do
|
|
33
|
+
{
|
|
34
|
+
:update_type => "Absolute",
|
|
35
|
+
:total => 5000
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
let(:price_info) do
|
|
40
|
+
{
|
|
41
|
+
:cost => 2.99,
|
|
42
|
+
:retail_price => 11.99,
|
|
43
|
+
:starting_price => 5.99,
|
|
44
|
+
:reserve_price => 7.99,
|
|
45
|
+
:take_it_price => 9.99,
|
|
46
|
+
:second_chance_offer_price => 8.99,
|
|
47
|
+
:store_price => 9.49
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
before(:each) do
|
|
52
|
+
@last_request, @last_response = nil
|
|
53
|
+
|
|
54
|
+
InventoryService.client.config.hooks.define(:update_inventory_item_quantity_and_price, :soap_request) do |callback, request|
|
|
55
|
+
@last_request = request.http
|
|
56
|
+
@last_response = callback.call
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "returns a SOAP response" do
|
|
61
|
+
soap_response = InventoryService.update_inventory_item_quantity_and_price("FAKE001", :quantity_info => quantity_info, :price_info => price_info)
|
|
62
|
+
soap_response.should be_a Savon::SOAP::Response
|
|
63
|
+
end # returns a SOAP response
|
|
64
|
+
|
|
65
|
+
context "with only quantity info" do
|
|
66
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price/quantity_only"
|
|
67
|
+
|
|
68
|
+
it "sends a valid SOAP request with only quantity info" do
|
|
69
|
+
InventoryService.update_inventory_item_quantity_and_price("FAKE001", :quantity_info => quantity_info)
|
|
70
|
+
@last_request.should match_valid_xml_body_for :update_item_quantity
|
|
71
|
+
end
|
|
72
|
+
end # with only quantity info
|
|
73
|
+
|
|
74
|
+
context "with only price info" do
|
|
75
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price/price_only"
|
|
76
|
+
|
|
77
|
+
it "sends a valid SOAP request with only price info" do
|
|
78
|
+
InventoryService.update_inventory_item_quantity_and_price("FAKE001", :price_info => price_info)
|
|
79
|
+
@last_request.should match_valid_xml_body_for :update_item_price
|
|
80
|
+
end
|
|
81
|
+
end # with only price info
|
|
82
|
+
|
|
83
|
+
context "with both quantity and price info" do
|
|
84
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price/quantity_and_price"
|
|
85
|
+
|
|
86
|
+
it "sends a valid SOAP request with both quantity and price info" do
|
|
87
|
+
InventoryService.update_inventory_item_quantity_and_price("FAKE001", :quantity_info => quantity_info, :price_info => price_info)
|
|
88
|
+
@last_request.should match_valid_xml_body_for :update_item_quantity_and_price
|
|
89
|
+
end
|
|
90
|
+
end # with both quantity and price info
|
|
91
|
+
end # .update_inventory_item_quantity_and_price
|
|
92
|
+
|
|
93
|
+
describe ".update_inventory_item_quantity_and_price_list" do
|
|
94
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price_list", :allow_playback_repeats => true
|
|
95
|
+
|
|
96
|
+
let(:item1) do
|
|
97
|
+
{
|
|
98
|
+
:sku => "FAKE001",
|
|
99
|
+
:quantity_info => {
|
|
100
|
+
:update_type => "Absolute",
|
|
101
|
+
:total => 5000
|
|
102
|
+
},
|
|
103
|
+
:price_info => {
|
|
104
|
+
:cost => 2.99,
|
|
105
|
+
:retail_price => 11.99,
|
|
106
|
+
:starting_price => 5.99,
|
|
107
|
+
:reserve_price => 7.99,
|
|
108
|
+
:take_it_price => 9.99,
|
|
109
|
+
:second_chance_offer_price => 8.99,
|
|
110
|
+
:store_price => 9.49
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
let(:item2) do
|
|
116
|
+
{
|
|
117
|
+
:sku => "FAKE002",
|
|
118
|
+
:quantity_info => {
|
|
119
|
+
:update_type => "Absolute",
|
|
120
|
+
:total => 7500
|
|
121
|
+
},
|
|
122
|
+
:price_info => {
|
|
123
|
+
:cost => 3.99,
|
|
124
|
+
:retail_price => 10.99,
|
|
125
|
+
:starting_price => 4.99,
|
|
126
|
+
:reserve_price => 7.99,
|
|
127
|
+
:take_it_price => 8.99,
|
|
128
|
+
:second_chance_offer_price => 6.99,
|
|
129
|
+
:store_price => 8.49
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
before(:each) do
|
|
135
|
+
@last_request, @last_response = nil
|
|
136
|
+
|
|
137
|
+
InventoryService.client.config.hooks.define(:update_inventory_item_quantity_and_price_list, :soap_request) do |callback, request|
|
|
138
|
+
@last_request = request.http
|
|
139
|
+
@last_response = callback.call
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it "returns a SOAP response" do
|
|
144
|
+
soap_response = InventoryService.update_inventory_item_quantity_and_price_list([item1])
|
|
145
|
+
soap_response.should be_a Savon::SOAP::Response
|
|
146
|
+
end # returns a SOAP response
|
|
147
|
+
|
|
148
|
+
context "with one item" do
|
|
149
|
+
context "with only quantity info" do
|
|
150
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price_list/with_one_item/quantity_only"
|
|
151
|
+
|
|
152
|
+
it "sends a valid SOAP request with only quantity info" do
|
|
153
|
+
item1.delete(:price_info)
|
|
154
|
+
InventoryService.update_inventory_item_quantity_and_price_list([item1])
|
|
155
|
+
@last_request.should match_valid_xml_body_for "update_inventory_item_quantity_and_price_list/with_one_item/quantity_only"
|
|
156
|
+
end
|
|
157
|
+
end # with only quantity info
|
|
158
|
+
|
|
159
|
+
context "with only price info" do
|
|
160
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price_list/with_one_item/price_only"
|
|
161
|
+
|
|
162
|
+
it "sends a valid SOAP request with only price info" do
|
|
163
|
+
item1.delete(:quantity_info)
|
|
164
|
+
InventoryService.update_inventory_item_quantity_and_price_list([item1])
|
|
165
|
+
@last_request.should match_valid_xml_body_for "update_inventory_item_quantity_and_price_list/with_one_item/price_only"
|
|
166
|
+
end
|
|
167
|
+
end # with only price info
|
|
168
|
+
|
|
169
|
+
context "with both quantity and price info" do
|
|
170
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price_list/with_one_item/quantity_and_price"
|
|
171
|
+
|
|
172
|
+
it "sends a valid SOAP request with both quantity and price info" do
|
|
173
|
+
InventoryService.update_inventory_item_quantity_and_price_list([item1])
|
|
174
|
+
@last_request.should match_valid_xml_body_for "update_inventory_item_quantity_and_price_list/with_one_item/quantity_and_price"
|
|
175
|
+
end
|
|
176
|
+
end # with both quantity and price info
|
|
177
|
+
end # with one item
|
|
178
|
+
|
|
179
|
+
context "with two items" do
|
|
180
|
+
context "with only quantity info" do
|
|
181
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price_list/with_two_items/quantity_only"
|
|
182
|
+
|
|
183
|
+
it "sends a valid SOAP request with only quantity info" do
|
|
184
|
+
item1.delete(:price_info)
|
|
185
|
+
item2.delete(:price_info)
|
|
186
|
+
InventoryService.update_inventory_item_quantity_and_price_list([item1, item2])
|
|
187
|
+
@last_request.should match_valid_xml_body_for "update_inventory_item_quantity_and_price_list/with_two_items/quantity_only"
|
|
188
|
+
end
|
|
189
|
+
end # with only quantity info
|
|
190
|
+
|
|
191
|
+
context "with only price info" do
|
|
192
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price_list/with_two_items/price_only"
|
|
193
|
+
|
|
194
|
+
it "sends a valid SOAP request with only price info" do
|
|
195
|
+
item1.delete(:quantity_info)
|
|
196
|
+
item2.delete(:quantity_info)
|
|
197
|
+
InventoryService.update_inventory_item_quantity_and_price_list([item1, item2])
|
|
198
|
+
@last_request.should match_valid_xml_body_for "update_inventory_item_quantity_and_price_list/with_two_items/price_only"
|
|
199
|
+
end
|
|
200
|
+
end # with only price info
|
|
201
|
+
|
|
202
|
+
context "with both quantity and price info" do
|
|
203
|
+
use_vcr_cassette "responses/inventory_service/update_inventory_item_quantity_and_price_list/with_two_items/quantity_and_price"
|
|
204
|
+
|
|
205
|
+
it "sends a valid SOAP request with both quantity and price info" do
|
|
206
|
+
InventoryService.update_inventory_item_quantity_and_price_list([item1, item2])
|
|
207
|
+
@last_request.should match_valid_xml_body_for "update_inventory_item_quantity_and_price_list/with_two_items/quantity_and_price"
|
|
208
|
+
end
|
|
209
|
+
end # with both quantity and price info
|
|
210
|
+
end # with two items
|
|
211
|
+
end # .update_inventory_item_quantity_and_price_list
|
|
212
|
+
end # InventoryService
|
|
213
|
+
end # Services
|
|
214
|
+
end # ChannelAdvisor
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module ChannelAdvisor
|
|
4
|
+
module Services
|
|
5
|
+
describe OrderService do
|
|
6
|
+
subject { OrderService }
|
|
7
|
+
|
|
8
|
+
describe "#ping" do
|
|
9
|
+
context "when successful" do
|
|
10
|
+
use_vcr_cassette "responses/order_service/ping/success"
|
|
11
|
+
before(:each) { OrderService.ping }
|
|
12
|
+
|
|
13
|
+
its(:last_request) { should match_valid_xml_body_for :ping }
|
|
14
|
+
its(:last_request) { should be_an HTTPI::Request }
|
|
15
|
+
its(:last_response) { should be_a Savon::SOAP::Response }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
context "when unsuccessful" do
|
|
19
|
+
use_vcr_cassette "responses/order_service/ping/failure"
|
|
20
|
+
|
|
21
|
+
it "should raise a SOAP Fault error" do
|
|
22
|
+
ChannelAdvisor.configure { |config| config.password = "wrong password" }
|
|
23
|
+
expect { OrderService.ping }.to raise_error Savon::SOAP::Fault
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end # ping
|
|
27
|
+
|
|
28
|
+
describe "#get_order_list" do
|
|
29
|
+
context "without order criteria" do
|
|
30
|
+
use_vcr_cassette "responses/order_service/get_order_list/without_order_criteria"
|
|
31
|
+
before(:each) { OrderService.get_order_list }
|
|
32
|
+
|
|
33
|
+
its(:last_request) { should be_an HTTPI::Request }
|
|
34
|
+
its(:last_response) { should be_a Savon::SOAP::Response }
|
|
35
|
+
|
|
36
|
+
it "sends a valid SOAP request with no order criteria" do
|
|
37
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/without_order_criteria'
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context "with created from date criteria" do
|
|
42
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_created_from_date"
|
|
43
|
+
|
|
44
|
+
it "sends a valid SOAP request with the created from date" do
|
|
45
|
+
order_criteria = {:created_from => DateTime.new(2012,05,14)}
|
|
46
|
+
OrderService.get_order_list(order_criteria)
|
|
47
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_created_from_date'
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context "with created to date criteria" do
|
|
52
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_created_to_date"
|
|
53
|
+
|
|
54
|
+
it "sends a valid SOAP request with the created to date" do
|
|
55
|
+
order_criteria = {:created_to => DateTime.new(2012,05,15)}
|
|
56
|
+
OrderService.get_order_list(order_criteria)
|
|
57
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_created_to_date'
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context "with updated from date criteria" do
|
|
62
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_updated_from_date"
|
|
63
|
+
|
|
64
|
+
it "sends a valid SOAP request with the updated from date" do
|
|
65
|
+
order_criteria = {:updated_from => DateTime.new(2012,05,14)}
|
|
66
|
+
OrderService.get_order_list(order_criteria)
|
|
67
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_updated_from_date'
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
context "with updated to date criteria" do
|
|
72
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_updated_to_date"
|
|
73
|
+
|
|
74
|
+
it "sends a valid SOAP request with the updated to date" do
|
|
75
|
+
order_criteria = {:updated_to => DateTime.new(2012,05,15)}
|
|
76
|
+
OrderService.get_order_list(order_criteria)
|
|
77
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_updated_to_date'
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
context "with join dates criteria" do
|
|
82
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_join dates"
|
|
83
|
+
|
|
84
|
+
it "sends a valid SOAP request with the join dates" do
|
|
85
|
+
order_criteria = {
|
|
86
|
+
:created_from => DateTime.new(2012,05,14),
|
|
87
|
+
:created_to => DateTime.new(2012,05,15),
|
|
88
|
+
:updated_from => DateTime.new(2012,05,14),
|
|
89
|
+
:updated_to => DateTime.new(2012,05,15),
|
|
90
|
+
:join_dates => true
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
OrderService.get_order_list(order_criteria)
|
|
94
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_join_dates'
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
context "with detail level criteria" do
|
|
99
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_detail_level"
|
|
100
|
+
|
|
101
|
+
it "sends a valid SOAP request with a detail level" do
|
|
102
|
+
order_criteria = {:detail_level => "Low"}
|
|
103
|
+
OrderService.get_order_list(order_criteria)
|
|
104
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_detail_level'
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
context "with export state criteria" do
|
|
109
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_export_state"
|
|
110
|
+
|
|
111
|
+
it "sends a valid SOAP request with an export state" do
|
|
112
|
+
order_criteria = {:export_state => "NotExported"}
|
|
113
|
+
OrderService.get_order_list(order_criteria)
|
|
114
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_export_state'
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
context "with one Order ID" do
|
|
119
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_one_order_id"
|
|
120
|
+
|
|
121
|
+
it "sends a valid SOAP request with one Order ID" do
|
|
122
|
+
order_criteria = {:order_ids => [14162751]}
|
|
123
|
+
OrderService.get_order_list(order_criteria)
|
|
124
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_one_order_id'
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
context "with two Order IDs" do
|
|
129
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_two_order_ids"
|
|
130
|
+
|
|
131
|
+
it "sends a valid SOAP request with two Order IDs" do
|
|
132
|
+
order_criteria = {:order_ids => [14162751, 14161613]}
|
|
133
|
+
OrderService.get_order_list(order_criteria)
|
|
134
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_two_order_ids'
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
context "with one Client ID" do
|
|
139
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_one_client_order_id"
|
|
140
|
+
|
|
141
|
+
it "sends a valid SOAP request with one Client ID" do
|
|
142
|
+
order_criteria = {:client_order_ids => ['ABCD1234']}
|
|
143
|
+
OrderService.get_order_list(order_criteria)
|
|
144
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_one_client_order_id'
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
context "with two Client IDs" do
|
|
149
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_two_client_order_ids"
|
|
150
|
+
|
|
151
|
+
it "sends a valid SOAP request with one Client ID" do
|
|
152
|
+
order_criteria = {:client_order_ids => ['ABCD1234', 'EFGH5678']}
|
|
153
|
+
OrderService.get_order_list(order_criteria)
|
|
154
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_two_client_order_ids'
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
context "with order state criteria" do
|
|
159
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_order_state_filter"
|
|
160
|
+
|
|
161
|
+
it "sends a valid SOAP request with an order state" do
|
|
162
|
+
order_criteria = {:state => "Active"}
|
|
163
|
+
OrderService.get_order_list(order_criteria)
|
|
164
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_order_state_filter'
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
context "with payment status criteria" do
|
|
169
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_payment_status_filter"
|
|
170
|
+
|
|
171
|
+
it "sends a valid SOAP request with a payment status" do
|
|
172
|
+
order_criteria = {:payment_status => "NoChange"}
|
|
173
|
+
OrderService.get_order_list(order_criteria)
|
|
174
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_payment_status_filter'
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
context "with checkout status criteria" do
|
|
179
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_checkout_status_filter"
|
|
180
|
+
|
|
181
|
+
it "sends a valid SOAP request with an checkout status" do
|
|
182
|
+
order_criteria = {:checkout_status => "NoChange"}
|
|
183
|
+
OrderService.get_order_list(order_criteria)
|
|
184
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_checkout_status_filter'
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
context "with shipping status criteria" do
|
|
189
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_shipping_status_filter"
|
|
190
|
+
|
|
191
|
+
it "sends a valid SOAP request with a shipping status" do
|
|
192
|
+
order_criteria = {:shipping_status => "NoChange"}
|
|
193
|
+
OrderService.get_order_list(order_criteria)
|
|
194
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_shipping_status_filter'
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
context "with refund status criteria" do
|
|
199
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_refund_status_filter"
|
|
200
|
+
|
|
201
|
+
it "sends a valid SOAP request with an refund status" do
|
|
202
|
+
order_criteria = {:refund_status => "NoChange"}
|
|
203
|
+
OrderService.get_order_list(order_criteria)
|
|
204
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_refund_status_filter'
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
context "with distribution center criteria" do
|
|
209
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_distribution_center_code"
|
|
210
|
+
|
|
211
|
+
it "sends a valid SOAP request with a distribution center code" do
|
|
212
|
+
order_criteria = {:distribution_center => "ABC"}
|
|
213
|
+
OrderService.get_order_list(order_criteria)
|
|
214
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_distribution_center_code'
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
context "with page number criteria" do
|
|
219
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_page_number_filter"
|
|
220
|
+
|
|
221
|
+
it "sends a valid SOAP request with a page number" do
|
|
222
|
+
order_criteria = {:page_number => 1}
|
|
223
|
+
OrderService.get_order_list(order_criteria)
|
|
224
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_page_number_filter'
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
context "with page size criteria" do
|
|
229
|
+
use_vcr_cassette "responses/order_service/get_order_list/with_page_size"
|
|
230
|
+
|
|
231
|
+
it "sends a valid SOAP request with a page size" do
|
|
232
|
+
order_criteria = {:page_size => 20}
|
|
233
|
+
OrderService.get_order_list(order_criteria)
|
|
234
|
+
OrderService.last_request.should match_valid_xml_body_for 'get_order_list/with_page_size'
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end # get_order_list
|
|
238
|
+
|
|
239
|
+
describe "#set_orders_export_status" do
|
|
240
|
+
context "with one Client Order ID" do
|
|
241
|
+
use_vcr_cassette "responses/order_service/set_orders_export_status/with_one_client_order_id"
|
|
242
|
+
before(:each) do
|
|
243
|
+
client_order_ids = ["ABCD1234"]
|
|
244
|
+
OrderService.set_orders_export_status(client_order_ids, true)
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
its(:last_request) { should be_an HTTPI::Request }
|
|
248
|
+
its(:last_response) { should be_an Savon::SOAP::Response }
|
|
249
|
+
|
|
250
|
+
it "sends a valid SOAP request with one Client Order ID" do
|
|
251
|
+
OrderService.last_request.should match_valid_xml_body_for "set_orders_export_status/with_one_client_order_id"
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
context "with two Client Order IDs" do
|
|
256
|
+
use_vcr_cassette "responses/order_service/set_orders_export_status/with_two_client_order_id"
|
|
257
|
+
|
|
258
|
+
it "sends a valid SOAP request with two Client Order IDs" do
|
|
259
|
+
client_order_ids = ["ABCD1234", "EFGH5678"]
|
|
260
|
+
OrderService.set_orders_export_status(client_order_ids, true)
|
|
261
|
+
OrderService.last_request.should match_valid_xml_body_for "set_orders_export_status/with_two_client_order_ids"
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end # set_orders_export_status
|
|
265
|
+
end # OrderService
|
|
266
|
+
end # Services
|
|
267
|
+
end # ChannelAdvisor
|