solidus_active_shipping 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/.simplecov +5 -0
- data/.travis.yml +21 -0
- data/Gemfile +18 -0
- data/README.md +192 -0
- data/Rakefile +21 -0
- data/app/assets/javascripts/admin/product_packages/edit.js.coffee +4 -0
- data/app/assets/javascripts/admin/product_packages/index.js.coffee +28 -0
- data/app/assets/javascripts/admin/product_packages/new.js.coffee +7 -0
- data/app/assets/javascripts/spree/backend/solidus_active_shipping.js +0 -0
- data/app/assets/javascripts/spree/frontend/solidus_active_shipping.js +0 -0
- data/app/assets/stylesheets/spree/backend/solidus_active_shipping.css +0 -0
- data/app/assets/stylesheets/spree/frontend/solidus_active_shipping.css +0 -0
- data/app/controllers/spree/admin/active_shipping_settings_controller.rb +27 -0
- data/app/controllers/spree/admin/product_packages_controller.rb +17 -0
- data/app/controllers/spree/admin/products_controller_decorator.rb +12 -0
- data/app/controllers/spree/checkout_controller_decorator.rb +11 -0
- data/app/controllers/spree/orders_controller_decorator.rb +11 -0
- data/app/models/spree/calculator/shipping/active_shipping/base.rb +208 -0
- data/app/models/spree/calculator/shipping/canada_post/base.rb +17 -0
- data/app/models/spree/calculator/shipping/canada_post/expedited.rb +11 -0
- data/app/models/spree/calculator/shipping/canada_post/parcel_surface.rb +11 -0
- data/app/models/spree/calculator/shipping/canada_post/priority_worldwide_intl.rb +12 -0
- data/app/models/spree/calculator/shipping/canada_post/regular.rb +11 -0
- data/app/models/spree/calculator/shipping/canada_post/small_packets_air.rb +11 -0
- data/app/models/spree/calculator/shipping/canada_post/small_packets_surface.rb +11 -0
- data/app/models/spree/calculator/shipping/canada_post/xpresspost.rb +11 -0
- data/app/models/spree/calculator/shipping/canada_post/xpresspost_international.rb +11 -0
- data/app/models/spree/calculator/shipping/fedex/base.rb +21 -0
- data/app/models/spree/calculator/shipping/fedex/express_saver.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/first_overnight.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/ground.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/ground_home_delivery.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/international_economy.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/international_economy_freight.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/international_first.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/international_ground.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/international_priority.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/international_priority_freight.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/international_priority_saturday_delivery.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/one_day_freight.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/one_day_freight_saturday_delivery.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/priority_overnight.rb +13 -0
- data/app/models/spree/calculator/shipping/fedex/priority_overnight_saturday_delivery.rb +11 -0
- data/app/models/spree/calculator/shipping/fedex/saver.rb +11 -0
- data/app/models/spree/calculator/shipping/fedex/standard_overnight.rb +11 -0
- data/app/models/spree/calculator/shipping/fedex/three_day_freight.rb +11 -0
- data/app/models/spree/calculator/shipping/fedex/three_day_freight_saturday_delivery.rb +11 -0
- data/app/models/spree/calculator/shipping/fedex/two_day.rb +11 -0
- data/app/models/spree/calculator/shipping/fedex/two_day_freight.rb +11 -0
- data/app/models/spree/calculator/shipping/fedex/two_day_freight_saturday_delivery.rb +11 -0
- data/app/models/spree/calculator/shipping/fedex/two_day_saturday_delivery.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/base.rb +30 -0
- data/app/models/spree/calculator/shipping/ups/express.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/ground.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/next_day_air.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/next_day_air_early_am.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/next_day_air_saver.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/saver.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/second_day_air.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/standard.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/three_day_select.rb +11 -0
- data/app/models/spree/calculator/shipping/ups/worldwide_expedited.rb +11 -0
- data/app/models/spree/calculator/shipping/usps/base.rb +84 -0
- data/app/models/spree/calculator/shipping/usps/express_mail.rb +19 -0
- data/app/models/spree/calculator/shipping/usps/express_mail_international.rb +46 -0
- data/app/models/spree/calculator/shipping/usps/first_class_mail_international.rb +31 -0
- data/app/models/spree/calculator/shipping/usps/first_class_mail_international_large_envelope.rb +31 -0
- data/app/models/spree/calculator/shipping/usps/first_class_mail_parcel.rb +28 -0
- data/app/models/spree/calculator/shipping/usps/first_class_package_international.rb +49 -0
- data/app/models/spree/calculator/shipping/usps/global_express_guaranteed.rb +48 -0
- data/app/models/spree/calculator/shipping/usps/media_mail.rb +19 -0
- data/app/models/spree/calculator/shipping/usps/priority_mail.rb +19 -0
- data/app/models/spree/calculator/shipping/usps/priority_mail_flat_rate_envelope.rb +19 -0
- data/app/models/spree/calculator/shipping/usps/priority_mail_international.rb +49 -0
- data/app/models/spree/calculator/shipping/usps/priority_mail_international_large_flat_rate_box.rb +43 -0
- data/app/models/spree/calculator/shipping/usps/priority_mail_international_medium_flat_rate_box.rb +43 -0
- data/app/models/spree/calculator/shipping/usps/priority_mail_international_small_flat_rate_box.rb +43 -0
- data/app/models/spree/calculator/shipping/usps/priority_mail_large_flat_rate_box.rb +19 -0
- data/app/models/spree/calculator/shipping/usps/priority_mail_medium_flat_rate_box.rb +19 -0
- data/app/models/spree/calculator/shipping/usps/priority_mail_small_flat_rate_box.rb +19 -0
- data/app/models/spree/calculator/shipping/usps/standard_post.rb +19 -0
- data/app/models/spree/content_item_decorator.rb +7 -0
- data/app/models/spree/line_item_decorator.rb +4 -0
- data/app/models/spree/package_builder.rb +114 -0
- data/app/models/spree/product_decorator.rb +10 -0
- data/app/models/spree/product_package.rb +10 -0
- data/app/models/spree/stock_location_decorator.rb +10 -0
- data/app/models/spree/variant_decorator.rb +3 -0
- data/app/overrides/spree/admin/shared/_configuration_menu/add_active_shipping_settings_tab.html.erb.deface +3 -0
- data/app/overrides/spree/admin/shared/_product_tabs/add_product_packages_tab.html.erb.deface +7 -0
- data/app/views/spree/admin/active_shipping_settings/edit.html.erb +92 -0
- data/app/views/spree/admin/product_packages/_form.html.erb +24 -0
- data/app/views/spree/admin/product_packages/edit.html.erb +15 -0
- data/app/views/spree/admin/product_packages/index.html.erb +46 -0
- data/app/views/spree/admin/product_packages/new.html.erb +15 -0
- data/config/locales/en.yml +93 -0
- data/config/locales/fr.yml +12 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20130107030221_create_product_packages.rb +12 -0
- data/lib/solidus_active_shipping.rb +3 -0
- data/lib/solidus_active_shipping/engine.rb +44 -0
- data/lib/spree/active_shipping_configuration.rb +24 -0
- data/lib/spree/shipping_error.rb +3 -0
- data/solidus_active_shipping.gemspec +33 -0
- data/spec/cassettes/Checkout/with_valid_shipping_address/does_not_break_the_per-item_shipping_method_calculator.yml +134 -0
- data/spec/cassettes/FedEx_calculators/with_Canadian_origin_address/Spree_Calculator_Shipping_Fedex_Ground/1_1_1_1.yml +48 -0
- data/spec/cassettes/FedEx_calculators/with_Canadian_origin_address/Spree_Calculator_Shipping_Fedex_InternationalEconomy/1_1_2_1.yml +48 -0
- data/spec/cassettes/FedEx_calculators/with_Canadian_origin_address/Spree_Calculator_Shipping_Fedex_InternationalFirst/1_1_3_1.yml +48 -0
- data/spec/cassettes/FedEx_calculators/with_Canadian_origin_address/Spree_Calculator_Shipping_Fedex_InternationalPriority/1_1_4_1.yml +48 -0
- data/spec/cassettes/FedEx_calculators/with_US_origin_address/Spree_Calculator_Shipping_Fedex_ExpressSaver/1_2_5_1.yml +48 -0
- data/spec/cassettes/FedEx_calculators/with_US_origin_address/Spree_Calculator_Shipping_Fedex_FirstOvernight/1_2_1_1.yml +48 -0
- data/spec/cassettes/FedEx_calculators/with_US_origin_address/Spree_Calculator_Shipping_Fedex_GroundHomeDelivery/1_2_6_1.yml +48 -0
- data/spec/cassettes/FedEx_calculators/with_US_origin_address/Spree_Calculator_Shipping_Fedex_PriorityOvernight/1_2_2_1.yml +48 -0
- data/spec/cassettes/FedEx_calculators/with_US_origin_address/Spree_Calculator_Shipping_Fedex_StandardOvernight/1_2_3_1.yml +48 -0
- data/spec/cassettes/FedEx_calculators/with_US_origin_address/Spree_Calculator_Shipping_Fedex_TwoDay/1_2_4_1.yml +48 -0
- data/spec/cassettes/UPS_calculators/with_Canadian_origin_address/Spree_Calculator_Shipping_Ups_Express/1_1_1_1.yml +103 -0
- data/spec/cassettes/UPS_calculators/with_Canadian_origin_address/Spree_Calculator_Shipping_Ups_Saver/1_1_3_1.yml +103 -0
- data/spec/cassettes/UPS_calculators/with_Canadian_origin_address/Spree_Calculator_Shipping_Ups_Standard/1_1_4_1.yml +103 -0
- data/spec/cassettes/UPS_calculators/with_Canadian_origin_address/Spree_Calculator_Shipping_Ups_ThreeDaySelect/1_1_5_1.yml +103 -0
- data/spec/cassettes/UPS_calculators/with_Canadian_origin_address/Spree_Calculator_Shipping_Ups_WorldwideExpedited/1_1_2_1.yml +103 -0
- data/spec/cassettes/UPS_calculators/with_US_origin_address/Spree_Calculator_Shipping_Ups_Ground/1_2_1_1.yml +103 -0
- data/spec/cassettes/UPS_calculators/with_US_origin_address/Spree_Calculator_Shipping_Ups_NextDayAir/1_2_2_1.yml +103 -0
- data/spec/cassettes/UPS_calculators/with_US_origin_address/Spree_Calculator_Shipping_Ups_NextDayAirEarlyAm/1_2_3_1.yml +103 -0
- data/spec/cassettes/UPS_calculators/with_US_origin_address/Spree_Calculator_Shipping_Ups_NextDayAirSaver/1_2_4_1.yml +103 -0
- data/spec/cassettes/UPS_calculators/with_US_origin_address/Spree_Calculator_Shipping_Ups_SecondDayAir/1_2_5_1.yml +103 -0
- data/spec/controllers/admin/active_shipping_settings_controller_spec.rb +38 -0
- data/spec/controllers/admin/product_packages_controller_spec.rb +36 -0
- data/spec/factories/order_factory_override.rb +46 -0
- data/spec/factories/product_package_factory.rb +9 -0
- data/spec/factories/state_factory_override.rb +28 -0
- data/spec/features/checkout_spec.rb +37 -0
- data/spec/fixtures/normal_rates_request.xml +2 -0
- data/spec/integrations/calculators/fedex_spec.rb +56 -0
- data/spec/integrations/calculators/ups_spec.rb +56 -0
- data/spec/lib/spree/active_shipping/bogus_carrier.rb +18 -0
- data/spec/lib/spree/calculator/shipping/bogus_calculator.rb +17 -0
- data/spec/models/active_shipping_calculator_spec.rb +182 -0
- data/spec/models/carriers/usps_calculator_spec.rb +72 -0
- data/spec/models/package_builder_spec.rb +173 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +80 -0
- data/spec/support/capybara.rb +24 -0
- data/spec/support/checkout_helper.rb +12 -0
- data/spec/support/feature_helper.rb +7 -0
- data/spec/support/package_helper.rb +9 -0
- data/spec/support/shared_contexts/checkout_setup.rb +12 -0
- data/spec/support/shared_contexts/package_setup.rb +34 -0
- data/spec/support/shared_contexts/shipping_carriers/fedex.rb +15 -0
- data/spec/support/shared_contexts/shipping_carriers/ups.rb +14 -0
- data/spec/support/shared_contexts/stock_location_setup.rb +26 -0
- data/spec/support/web_fixtures.rb +6 -0
- metadata +444 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://wwwcie.ups.com/ups.app/xml/Rate
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0"?>
|
10
|
+
<AccessRequest>
|
11
|
+
<AccessLicenseNumber>9D0B1B1E0A6389A8</AccessLicenseNumber>
|
12
|
+
<UserId>solidusdev</UserId>
|
13
|
+
<Password>S0lidusdev</Password>
|
14
|
+
</AccessRequest>
|
15
|
+
<?xml version="1.0"?>
|
16
|
+
<RatingServiceSelectionRequest>
|
17
|
+
<Request>
|
18
|
+
<RequestAction>Rate</RequestAction>
|
19
|
+
<RequestOption>Shop</RequestOption>
|
20
|
+
</Request>
|
21
|
+
<PickupType>
|
22
|
+
<Code>01</Code>
|
23
|
+
</PickupType>
|
24
|
+
<CustomerClassification>
|
25
|
+
<Code>01</Code>
|
26
|
+
</CustomerClassification>
|
27
|
+
<Shipment>
|
28
|
+
<Shipper>
|
29
|
+
<Address>
|
30
|
+
<City>Washington</City>
|
31
|
+
<StateProvinceCode>DC</StateProvinceCode>
|
32
|
+
<PostalCode>20500</PostalCode>
|
33
|
+
<CountryCode>US</CountryCode>
|
34
|
+
<ResidentialAddressIndicator>true</ResidentialAddressIndicator>
|
35
|
+
</Address>
|
36
|
+
</Shipper>
|
37
|
+
<ShipTo>
|
38
|
+
<Address>
|
39
|
+
<City>Chicago</City>
|
40
|
+
<StateProvinceCode>IL</StateProvinceCode>
|
41
|
+
<PostalCode>60601</PostalCode>
|
42
|
+
<CountryCode>US</CountryCode>
|
43
|
+
<ResidentialAddressIndicator>true</ResidentialAddressIndicator>
|
44
|
+
</Address>
|
45
|
+
</ShipTo>
|
46
|
+
<Package>
|
47
|
+
<PackagingType>
|
48
|
+
<Code>02</Code>
|
49
|
+
</PackagingType>
|
50
|
+
<Dimensions>
|
51
|
+
<UnitOfMeasurement>
|
52
|
+
<Code>IN</Code>
|
53
|
+
</UnitOfMeasurement>
|
54
|
+
<Length>0.1</Length>
|
55
|
+
<Width>0.1</Width>
|
56
|
+
<Height>0.1</Height>
|
57
|
+
</Dimensions>
|
58
|
+
<PackageWeight>
|
59
|
+
<UnitOfMeasurement>
|
60
|
+
<Code>LBS</Code>
|
61
|
+
</UnitOfMeasurement>
|
62
|
+
<Weight>6.0</Weight>
|
63
|
+
</PackageWeight>
|
64
|
+
<PackageServiceOptions/>
|
65
|
+
</Package>
|
66
|
+
</Shipment>
|
67
|
+
</RatingServiceSelectionRequest>
|
68
|
+
headers:
|
69
|
+
Content-Type:
|
70
|
+
- application/x-www-form-urlencoded
|
71
|
+
Accept-Encoding:
|
72
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
73
|
+
Accept:
|
74
|
+
- "*/*"
|
75
|
+
User-Agent:
|
76
|
+
- Ruby
|
77
|
+
response:
|
78
|
+
status:
|
79
|
+
code: 200
|
80
|
+
message: OK
|
81
|
+
headers:
|
82
|
+
Date:
|
83
|
+
- Thu, 02 Jun 2016 03:58:16 GMT
|
84
|
+
Server:
|
85
|
+
- Apache
|
86
|
+
X-Frame-Options:
|
87
|
+
- SAMEORIGIN
|
88
|
+
Pragma:
|
89
|
+
- no-cache
|
90
|
+
Content-Length:
|
91
|
+
- '7196'
|
92
|
+
X-Content-Type-Options:
|
93
|
+
- nosniff
|
94
|
+
Content-Type:
|
95
|
+
- application/xml
|
96
|
+
body:
|
97
|
+
encoding: UTF-8
|
98
|
+
string: |-
|
99
|
+
<?xml version="1.0"?>
|
100
|
+
<RatingServiceSelectionResponse><Response><ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription></Response><RatedShipment><Service><Code>03</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.20</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.20</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery/><ScheduledDeliveryTime/><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.20</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.20</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>12</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.42</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.42</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>3</GuaranteedDaysToDelivery><ScheduledDeliveryTime/><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.42</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.42</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>02</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>27.97</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>27.97</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>2</GuaranteedDaysToDelivery><ScheduledDeliveryTime/><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>27.97</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>27.97</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>13</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>77.46</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>77.46</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime/><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>77.46</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>77.46</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>14</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>110.29</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>110.29</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime>8:00 A.M.</ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>110.29</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>110.29</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>01</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.47</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.47</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime>10:30 A.M.</ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.47</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.47</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment></RatingServiceSelectionResponse>
|
101
|
+
http_version:
|
102
|
+
recorded_at: Thu, 02 Jun 2016 03:58:16 GMT
|
103
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,103 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://wwwcie.ups.com/ups.app/xml/Rate
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0"?>
|
10
|
+
<AccessRequest>
|
11
|
+
<AccessLicenseNumber>9D0B1B1E0A6389A8</AccessLicenseNumber>
|
12
|
+
<UserId>solidusdev</UserId>
|
13
|
+
<Password>S0lidusdev</Password>
|
14
|
+
</AccessRequest>
|
15
|
+
<?xml version="1.0"?>
|
16
|
+
<RatingServiceSelectionRequest>
|
17
|
+
<Request>
|
18
|
+
<RequestAction>Rate</RequestAction>
|
19
|
+
<RequestOption>Shop</RequestOption>
|
20
|
+
</Request>
|
21
|
+
<PickupType>
|
22
|
+
<Code>01</Code>
|
23
|
+
</PickupType>
|
24
|
+
<CustomerClassification>
|
25
|
+
<Code>01</Code>
|
26
|
+
</CustomerClassification>
|
27
|
+
<Shipment>
|
28
|
+
<Shipper>
|
29
|
+
<Address>
|
30
|
+
<City>Washington</City>
|
31
|
+
<StateProvinceCode>DC</StateProvinceCode>
|
32
|
+
<PostalCode>20500</PostalCode>
|
33
|
+
<CountryCode>US</CountryCode>
|
34
|
+
<ResidentialAddressIndicator>true</ResidentialAddressIndicator>
|
35
|
+
</Address>
|
36
|
+
</Shipper>
|
37
|
+
<ShipTo>
|
38
|
+
<Address>
|
39
|
+
<City>Chicago</City>
|
40
|
+
<StateProvinceCode>IL</StateProvinceCode>
|
41
|
+
<PostalCode>60601</PostalCode>
|
42
|
+
<CountryCode>US</CountryCode>
|
43
|
+
<ResidentialAddressIndicator>true</ResidentialAddressIndicator>
|
44
|
+
</Address>
|
45
|
+
</ShipTo>
|
46
|
+
<Package>
|
47
|
+
<PackagingType>
|
48
|
+
<Code>02</Code>
|
49
|
+
</PackagingType>
|
50
|
+
<Dimensions>
|
51
|
+
<UnitOfMeasurement>
|
52
|
+
<Code>IN</Code>
|
53
|
+
</UnitOfMeasurement>
|
54
|
+
<Length>0.1</Length>
|
55
|
+
<Width>0.1</Width>
|
56
|
+
<Height>0.1</Height>
|
57
|
+
</Dimensions>
|
58
|
+
<PackageWeight>
|
59
|
+
<UnitOfMeasurement>
|
60
|
+
<Code>LBS</Code>
|
61
|
+
</UnitOfMeasurement>
|
62
|
+
<Weight>6.0</Weight>
|
63
|
+
</PackageWeight>
|
64
|
+
<PackageServiceOptions/>
|
65
|
+
</Package>
|
66
|
+
</Shipment>
|
67
|
+
</RatingServiceSelectionRequest>
|
68
|
+
headers:
|
69
|
+
Content-Type:
|
70
|
+
- application/x-www-form-urlencoded
|
71
|
+
Accept-Encoding:
|
72
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
73
|
+
Accept:
|
74
|
+
- "*/*"
|
75
|
+
User-Agent:
|
76
|
+
- Ruby
|
77
|
+
response:
|
78
|
+
status:
|
79
|
+
code: 200
|
80
|
+
message: OK
|
81
|
+
headers:
|
82
|
+
Date:
|
83
|
+
- Thu, 02 Jun 2016 03:58:17 GMT
|
84
|
+
Server:
|
85
|
+
- Apache
|
86
|
+
X-Frame-Options:
|
87
|
+
- SAMEORIGIN
|
88
|
+
Pragma:
|
89
|
+
- no-cache
|
90
|
+
Content-Length:
|
91
|
+
- '7196'
|
92
|
+
X-Content-Type-Options:
|
93
|
+
- nosniff
|
94
|
+
Content-Type:
|
95
|
+
- application/xml
|
96
|
+
body:
|
97
|
+
encoding: UTF-8
|
98
|
+
string: |-
|
99
|
+
<?xml version="1.0"?>
|
100
|
+
<RatingServiceSelectionResponse><Response><ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription></Response><RatedShipment><Service><Code>03</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.20</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.20</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery/><ScheduledDeliveryTime/><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.20</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>14.20</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>12</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.42</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.42</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>3</GuaranteedDaysToDelivery><ScheduledDeliveryTime/><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.42</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>21.42</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>02</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>27.97</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>27.97</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>2</GuaranteedDaysToDelivery><ScheduledDeliveryTime/><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>27.97</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>27.97</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>13</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>77.46</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>77.46</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime/><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>77.46</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>77.46</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>14</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>110.29</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>110.29</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime>8:00 A.M.</ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>110.29</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>110.29</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment><RatedShipment><Service><Code>01</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.47</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.47</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery><ScheduledDeliveryTime>10:30 A.M.</ScheduledDeliveryTime><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.47</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>79.47</MonetaryValue></TotalCharges><Weight>6.0</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>6.0</Weight></BillingWeight></RatedPackage></RatedShipment></RatingServiceSelectionResponse>
|
101
|
+
http_version:
|
102
|
+
recorded_at: Thu, 02 Jun 2016 03:58:17 GMT
|
103
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spree::Admin::ActiveShippingSettingsController do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
context '#edit' do
|
7
|
+
it 'should assign a Spree::ActiveShippingConfiguration and render the view' do
|
8
|
+
spree_get :edit
|
9
|
+
expect(assigns(:config)).to be_an_instance_of(Spree::ActiveShippingConfiguration)
|
10
|
+
expect(response).to render_template('edit')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context '#update' do
|
15
|
+
let(:config) { Spree::ActiveShippingConfiguration.new }
|
16
|
+
|
17
|
+
context 'with existing value' do
|
18
|
+
around do |example|
|
19
|
+
default_weight = config.get_preference(:default_weight)
|
20
|
+
example.run
|
21
|
+
config.set_preference(:default_weight, default_weight)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "updates the existing value" do
|
25
|
+
expect(config.has_preference?(:default_weight)).to be(true)
|
26
|
+
spree_post :update, default_weight: 42
|
27
|
+
expect(config.send("preferred_default_weight")).to be(42)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'without existing value' do
|
32
|
+
it "doesn't produce an error" do
|
33
|
+
spree_post :update, 'not_real_parameter_name' => 'not_real'
|
34
|
+
expect(response).to redirect_to(spree.edit_admin_active_shipping_settings_path)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spree::Admin::ProductPackagesController do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
context '#index' do
|
7
|
+
let(:product) { create(:product) }
|
8
|
+
|
9
|
+
it 'should find ProductPackages for the product and render the view' do
|
10
|
+
spree_get :index, product_id: product.slug
|
11
|
+
expect(assigns(:product)).to eq(product)
|
12
|
+
expect(response).to be_ok
|
13
|
+
expect(response).to render_template('index')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context '#update' do
|
18
|
+
let!(:product) { create(:product) }
|
19
|
+
let!(:product_package) { create(:product_package, product: product) }
|
20
|
+
|
21
|
+
it 'should allow us to update the ProductPackage attributes' do
|
22
|
+
new_length = SecureRandom.random_number(19) + 1
|
23
|
+
new_width = SecureRandom.random_number(19) + 1
|
24
|
+
new_height = SecureRandom.random_number(19) + 1
|
25
|
+
new_weight = SecureRandom.random_number(19) + 1
|
26
|
+
spree_post :update, product_id: product.slug, id: product_package.id,
|
27
|
+
product_package: { length: new_length, width: new_width,
|
28
|
+
height: new_height, weight: new_weight }
|
29
|
+
product_package.reload
|
30
|
+
expect(product_package.length).to eq(new_length)
|
31
|
+
expect(product_package.width).to eq(new_width)
|
32
|
+
expect(product_package.height).to eq(new_height)
|
33
|
+
expect(product_package.weight).to eq(new_weight)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spree/testing_support/factories/order_factory'
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
# The order with line items factory was updated in 1.2 to take a stock
|
5
|
+
# location as a transient attribute. This brings that change so we can
|
6
|
+
# specify the stock location which is used for the origin address for packages
|
7
|
+
# and can be removed when we no longer want to support Solidus 1.0 and 1.1.
|
8
|
+
factory :order_with_line_items_and_stock_location, parent: :order do
|
9
|
+
bill_address
|
10
|
+
ship_address
|
11
|
+
|
12
|
+
transient do
|
13
|
+
line_items_count 1
|
14
|
+
line_items_attributes { [{}] * line_items_count }
|
15
|
+
shipment_cost 100
|
16
|
+
shipping_method nil
|
17
|
+
stock_location { create(:stock_location) }
|
18
|
+
end
|
19
|
+
|
20
|
+
after(:create) do |order, evaluator|
|
21
|
+
evaluator.stock_location # must evaluate before creating line items
|
22
|
+
|
23
|
+
evaluator.line_items_attributes.each do |attributes|
|
24
|
+
attributes = {
|
25
|
+
order: order,
|
26
|
+
price: evaluator.line_items_price
|
27
|
+
}.merge(attributes)
|
28
|
+
|
29
|
+
create(:line_item, attributes)
|
30
|
+
end
|
31
|
+
order.line_items.reload
|
32
|
+
|
33
|
+
create(
|
34
|
+
:shipment,
|
35
|
+
order: order,
|
36
|
+
cost: evaluator.shipment_cost,
|
37
|
+
shipping_method: evaluator.shipping_method,
|
38
|
+
stock_location: evaluator.stock_location
|
39
|
+
)
|
40
|
+
|
41
|
+
order.shipments.reload
|
42
|
+
|
43
|
+
order.update!
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :product_package, class: Spree::ProductPackage do
|
3
|
+
length { SecureRandom.random_number(19) + 1 }
|
4
|
+
width { SecureRandom.random_number(19) + 1 }
|
5
|
+
height { SecureRandom.random_number(19) + 1 }
|
6
|
+
weight { SecureRandom.random_number(19) + 1 }
|
7
|
+
product
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'carmen'
|
2
|
+
require 'spree/testing_support/factories/country_factory'
|
3
|
+
|
4
|
+
FactoryGirl.define do
|
5
|
+
# The state factory was changed too drastically in 1.3 to shim
|
6
|
+
# we will need to bring this in until we no longer care about old Solidus
|
7
|
+
factory :state_with_autodiscover, class: Spree::State do
|
8
|
+
transient do
|
9
|
+
country_iso 'US'
|
10
|
+
state_code 'AL'
|
11
|
+
|
12
|
+
carmen_subregion do
|
13
|
+
carmen_country = Carmen::Country.coded(country.iso)
|
14
|
+
carmen_country.subregions.coded(state_code) ||
|
15
|
+
carmen_country.subregions.sort_by(&:name).first ||
|
16
|
+
fail("Country #{country.iso} has no subregions")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
abbr { carmen_subregion.code }
|
21
|
+
name { carmen_subregion.name }
|
22
|
+
|
23
|
+
country do |country|
|
24
|
+
Spree::Country.find_by(iso: country_iso) ||
|
25
|
+
country.association(:country, iso: country_iso)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Checkout", type: :feature do
|
4
|
+
include_context 'US stock location'
|
5
|
+
include_context 'checkout setup'
|
6
|
+
include CheckoutHelper
|
7
|
+
|
8
|
+
include_context 'UPS setup'
|
9
|
+
|
10
|
+
context "with valid shipping address", :vcr do
|
11
|
+
let!(:valid_address) { create :address,
|
12
|
+
firstname: 'John',
|
13
|
+
lastname: 'Doe',
|
14
|
+
company: 'Company',
|
15
|
+
address1: '4157 Lawnview Ave',
|
16
|
+
city: 'Dallas',
|
17
|
+
state: create(:state_with_autodiscover, state_code: 'TX'),
|
18
|
+
zipcode: '75227',
|
19
|
+
phone: "(555) 555-5555"
|
20
|
+
}
|
21
|
+
|
22
|
+
it "does not break the per-item shipping method calculator", js: true do
|
23
|
+
add_to_cart(mug)
|
24
|
+
|
25
|
+
click_button "Checkout"
|
26
|
+
|
27
|
+
fill_in "order_email", with: "test@example.com"
|
28
|
+
click_button "Continue"
|
29
|
+
fill_in_address(valid_address)
|
30
|
+
click_button "Save and Continue"
|
31
|
+
|
32
|
+
# select default shipping
|
33
|
+
click_button "Save and Continue"
|
34
|
+
expect(page).to have_content("Shipping total: $68.81")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<RateV4Response><Package ID="0"><ZipOrigination>16802</ZipOrigination><ZipDestination>20170</ZipDestination><Pounds>0</Pounds><Ounces>2.0</Ounces><Size>REGULAR</Size><Machinable>FALSE</Machinable><Zone>2</Zone><Postage CLASSID="3"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt;</MailService><Rate>14.10</Rate></Postage><Postage CLASSID="2"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Hold For Pickup</MailService><Rate>14.10</Rate></Postage><Postage CLASSID="23"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Sunday/Holiday Delivery</MailService><Rate>26.60</Rate></Postage><Postage CLASSID="55"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Flat Rate Boxes</MailService><Rate>39.95</Rate></Postage><Postage CLASSID="56"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Flat Rate Boxes Hold For Pickup</MailService><Rate>39.95</Rate></Postage><Postage CLASSID="57"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Sunday/Holiday Delivery Flat Rate Boxes</MailService><Rate>52.45</Rate></Postage><Postage CLASSID="13"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Flat Rate Envelope</MailService><Rate>19.95</Rate></Postage><Postage CLASSID="27"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Flat Rate Envelope Hold For Pickup</MailService><Rate>19.95</Rate></Postage><Postage CLASSID="25"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Sunday/Holiday Delivery Flat Rate Envelope</MailService><Rate>32.45</Rate></Postage><Postage CLASSID="30"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Legal Flat Rate Envelope</MailService><Rate>19.95</Rate></Postage><Postage CLASSID="31"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Legal Flat Rate Envelope Hold For Pickup</MailService><Rate>19.95</Rate></Postage><Postage CLASSID="32"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Sunday/Holiday Delivery Legal Flat Rate Envelope</MailService><Rate>32.45</Rate></Postage><Postage CLASSID="62"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Padded Flat Rate Envelope</MailService><Rate>19.95</Rate></Postage><Postage CLASSID="63"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Padded Flat Rate Envelope Hold For Pickup</MailService><Rate>19.95</Rate></Postage><Postage CLASSID="64"><MailService>Express Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Sunday/Holiday Delivery Padded Flat Rate Envelope</MailService><Rate>32.45</Rate></Postage><Postage CLASSID="1"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt;</MailService><Rate>5.60</Rate></Postage><Postage CLASSID="22"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Large Flat Rate Box</MailService><Rate>16.85</Rate></Postage><Postage CLASSID="17"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Medium Flat Rate Box</MailService><Rate>12.35</Rate></Postage><Postage CLASSID="28"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Small Flat Rate Box</MailService><Rate>5.80</Rate></Postage><Postage CLASSID="16"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Flat Rate Envelope</MailService><Rate>5.60</Rate></Postage><Postage CLASSID="44"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Legal Flat Rate Envelope</MailService><Rate>5.75</Rate></Postage><Postage CLASSID="29"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Padded Flat Rate Envelope</MailService><Rate>5.95</Rate></Postage><Postage CLASSID="38"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Gift Card Flat Rate Envelope</MailService><Rate>5.60</Rate></Postage><Postage CLASSID="42"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Small Flat Rate Envelope</MailService><Rate>5.60</Rate></Postage><Postage CLASSID="40"><MailService>Priority Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Window Flat Rate Envelope</MailService><Rate>5.60</Rate></Postage><Postage CLASSID="0"><MailService>First-Class Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Parcel</MailService><Rate>2.07</Rate></Postage><Postage CLASSID="0"><MailService>First-Class Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Letter</MailService><Rate>0.86</Rate></Postage><Postage CLASSID="0"><MailService>First-Class Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Postcards</MailService><Rate>0.33</Rate></Postage><Postage CLASSID="15"><MailService>First-Class Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; Large Postcards</MailService><Rate>0.46</Rate></Postage><Postage CLASSID="4"><MailService>Standard Post&lt;sup&gt;&amp;reg;&lt;/sup&gt;</MailService><Rate>5.60</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt;</MailService><Rate>2.53</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail</MailService><Rate>2.40</Rate></Postage></Package></RateV4Response>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'FedEx calculators', :vcr do
|
4
|
+
include_context 'FedEx setup'
|
5
|
+
include_context 'package setup'
|
6
|
+
|
7
|
+
subject { described_class.new.compute_package(package) }
|
8
|
+
|
9
|
+
context 'with Canadian origin address' do
|
10
|
+
include_context 'Canada stock location'
|
11
|
+
|
12
|
+
describe Spree::Calculator::Shipping::Fedex::Ground do
|
13
|
+
it { is_expected.to eq(28.9) }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe Spree::Calculator::Shipping::Fedex::InternationalEconomy do
|
17
|
+
it { is_expected.to eq(71.54) }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Spree::Calculator::Shipping::Fedex::InternationalFirst do
|
21
|
+
it { is_expected.to eq(168.43) }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe Spree::Calculator::Shipping::Fedex::InternationalPriority do
|
25
|
+
it { is_expected.to eq(105.19) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with US origin address' do
|
30
|
+
include_context 'US stock location'
|
31
|
+
|
32
|
+
describe Spree::Calculator::Shipping::Fedex::FirstOvernight do
|
33
|
+
it { is_expected.to eq(106.13) }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe Spree::Calculator::Shipping::Fedex::PriorityOvernight do
|
37
|
+
it { is_expected.to eq(40.95) }
|
38
|
+
end
|
39
|
+
|
40
|
+
describe Spree::Calculator::Shipping::Fedex::StandardOvernight do
|
41
|
+
it { is_expected.to eq(75.96) }
|
42
|
+
end
|
43
|
+
|
44
|
+
describe Spree::Calculator::Shipping::Fedex::TwoDay do
|
45
|
+
it { is_expected.to eq(27.42) }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe Spree::Calculator::Shipping::Fedex::ExpressSaver do
|
49
|
+
it { is_expected.to eq(25.95) }
|
50
|
+
end
|
51
|
+
|
52
|
+
describe Spree::Calculator::Shipping::Fedex::GroundHomeDelivery do
|
53
|
+
it { is_expected.to eq(14.0) }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|