active_fulfillment 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/active_fulfillment.rb +4 -18
  3. data/lib/active_fulfillment/fulfillment/services/amazon_mws.rb +438 -0
  4. data/lib/active_fulfillment/fulfillment/services/shipwire.rb +39 -34
  5. data/lib/active_fulfillment/fulfillment/services/webgistix.rb +5 -1
  6. data/lib/active_fulfillment/fulfillment/version.rb +6 -0
  7. data/test/fixtures/xml/amazon_mws/fulfillment_get_fulfillment_order.xml +114 -0
  8. data/test/fixtures/xml/amazon_mws/fulfillment_get_fulfillment_order_2.xml +90 -0
  9. data/test/fixtures/xml/amazon_mws/fulfillment_get_fullfillment_order_with_multiple_tracking_numbers.xml +121 -0
  10. data/test/fixtures/xml/amazon_mws/fulfillment_list_all_fulfillment_orders.xml +70 -0
  11. data/test/fixtures/xml/amazon_mws/inventory_list_inventory_item_supply.xml +32 -0
  12. data/test/fixtures/xml/amazon_mws/inventory_list_inventory_supply.xml +75 -0
  13. data/test/fixtures/xml/amazon_mws/inventory_list_inventory_supply_by_next_token.xml +38 -0
  14. data/test/fixtures/xml/amazon_mws/tracking_response_error.xml +9 -0
  15. data/test/fixtures/xml/amazon_mws/tracking_response_not_found.xml +9 -0
  16. data/test/fixtures/xml/shipwire/fulfillment_failure_response.xml +7 -0
  17. data/test/fixtures/xml/shipwire/invalid_login_response.xml +7 -0
  18. data/test/fixtures/xml/shipwire/inventory_get_response.xml +44 -0
  19. data/test/fixtures/xml/shipwire/successful_empty_tracking_response.xml +8 -0
  20. data/test/fixtures/xml/shipwire/successful_live_tracking_response.xml +53 -0
  21. data/test/fixtures/xml/shipwire/successful_tracking_response.xml +16 -0
  22. data/test/fixtures/xml/shipwire/successful_tracking_response_with_tracking_urls.xml +31 -0
  23. data/test/fixtures/xml/webgistix/multiple_tracking_response.xml +21 -0
  24. data/test/remote/amazon_mws_test.rb +114 -0
  25. data/test/unit/services/amazon_mws_test.rb +357 -0
  26. data/test/unit/services/shipwire_test.rb +20 -95
  27. data/test/unit/services/webgistix_test.rb +12 -1
  28. metadata +57 -11
  29. data/Rakefile +0 -36
  30. data/VERSION +0 -1
  31. data/active_fulfillment.gemspec +0 -70
  32. data/init.rb +0 -1
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0"?>
2
+ <ListAllFulfillmentOrdersResponse
3
+ xmlns="http://mws.amazonaws.com/FulfillmentOutboundShipment/2010-10-01/">
4
+ <ListAllFulfillmentOrdersResult>
5
+ <NextToken>H4sIAAAAAAAAAC2MwQqDMBBEfyXsPXU3ITUEEyjFQ6FWUNt7sbEI
6
+ alH7/3SVwjLLG3iTzeLjoe6n9xAv3ziWyysuIFoPCjGVqCWmDaZOWYckkRNB9B4MgZj
7
+ 4MY0euuewRhBxswhZkaQbUk5pZ+iA1nK1m+u+ayXxlmnwyCXffzdkXTiXt/pe5FWWdB
8
+ tWeVE+Ttedkjn8AF4nvJquAAAA</NextToken>
9
+ <FulfillmentOrders>
10
+ <member>
11
+ <ShippingSpeedCategory>Standard</ShippingSpeedCategory>
12
+ <StatusUpdatedDateTime>2011-01-28T23:48:48Z
13
+ </StatusUpdatedDateTime>
14
+ <NotificationEmailList>
15
+ <member>o8c2EXAMPLsfr7o@marketplace.amazon.com</member>
16
+ </NotificationEmailList>
17
+ <SellerFulfillmentOrderId>extern_id_1154539615776
18
+ </SellerFulfillmentOrderId>
19
+ <DestinationAddress>
20
+ <PostalCode>98101</PostalCode>
21
+ <PhoneNumber>321-098-7654</PhoneNumber>
22
+ <Name>Jane Adams</Name>
23
+ <CountryCode>US</CountryCode>
24
+ <Line1>123 Oak St.</Line1>
25
+ <StateOrProvinceCode>WA</StateOrProvinceCode>
26
+ <City>Seattle</City>
27
+ <Line2>Apt. 321</Line2>
28
+ </DestinationAddress>
29
+ <FulfillmentMethod>Consumer</FulfillmentMethod>
30
+ <DisplayableOrderDateTime>2011-02-05T17:26:56Z
31
+ </DisplayableOrderDateTime>
32
+ <FulfillmentPolicy>FillOrKill</FulfillmentPolicy>
33
+ <ReceivedDateTime>2011-02-06T17:26:56Z</ReceivedDateTime>
34
+ <DisplayableOrderId>test_displayable_id</DisplayableOrderId>
35
+ <DisplayableOrderComment>Sample comment text.
36
+ </DisplayableOrderComment>
37
+ <FulfillmentOrderStatus>PROCESSING</FulfillmentOrderStatus>
38
+ </member>
39
+ <member>
40
+ <ShippingSpeedCategory>Standard</ShippingSpeedCategory>
41
+ <StatusUpdatedDateTime>2011-03-05T18:48:53Z
42
+ </StatusUpdatedDateTime>
43
+ <SellerFulfillmentOrderId>external-order-ebaytime1154557376014
44
+ </SellerFulfillmentOrderId>
45
+ <DestinationAddress>
46
+ <PostalCode>98104</PostalCode>
47
+ <PhoneNumber>123-123-4567</PhoneNumber>
48
+ <Name>George Jones</Name>
49
+ <CountryCode>US</CountryCode>
50
+ <Line1>2345 5th Ave</Line1>
51
+ <StateOrProvinceCode>WA</StateOrProvinceCode>
52
+ <City>Seattle</City>
53
+ </DestinationAddress>
54
+ <FulfillmentMethod>Consumer</FulfillmentMethod>
55
+ <DisplayableOrderDateTime>2011-03-11T18:48:52Z
56
+ </DisplayableOrderDateTime>
57
+ <FulfillmentPolicy>FillAllAvailable</FulfillmentPolicy>
58
+ <ReceivedDateTime>2011-03-03T18:48:53Z</ReceivedDateTime>
59
+ <DisplayableOrderId>test-order-test-1159210132812
60
+ </DisplayableOrderId>
61
+ <DisplayableOrderComment>Sample order comment.
62
+ </DisplayableOrderComment>
63
+ <FulfillmentOrderStatus>PLANNING</FulfillmentOrderStatus>
64
+ </member>
65
+ </FulfillmentOrders>
66
+ </ListAllFulfillmentOrdersResult>
67
+ <ResponseMetadata>
68
+ <RequestId>7e9c8d48-8e79-11df-929f-87c80302f8f6</RequestId>
69
+ </ResponseMetadata>
70
+ </ListAllFulfillmentOrdersResponse>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0"?>
2
+ <ListInventorySupplyResponse
3
+ xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01">
4
+ <ListInventorySupplyResult>
5
+ <InventorySupplyList>
6
+ <member>
7
+ <SellerSKU>SampleSKU1</SellerSKU>
8
+ <ASIN>B00000K3CQ</ASIN>
9
+ <TotalSupplyQuantity>20</TotalSupplyQuantity>
10
+ <FNSKU>X0000000FM</FNSKU>
11
+ <Condition>NewItem</Condition>
12
+ <SupplyDetail/>
13
+ <InStockSupplyQuantity>15</InStockSupplyQuantity>
14
+ <EarliestAvailability>
15
+ <TimepointType>Immediately</TimepointType>
16
+ </EarliestAvailability>
17
+ </member>
18
+ <member>
19
+ <SellerSKU>SampleSKU2</SellerSKU>
20
+ <ASIN>B00004RWQR</ASIN>
21
+ <TotalSupplyQuantity>0</TotalSupplyQuantity>
22
+ <FNSKU>X00008FZR1</FNSKU>
23
+ <Condition>UsedLikeNew</Condition>
24
+ <SupplyDetail/>
25
+ <InStockSupplyQuantity>0</InStockSupplyQuantity>
26
+ </member>
27
+ </InventorySupplyList>
28
+ </ListInventorySupplyResult>
29
+ <ResponseMetadata>
30
+ <RequestId>e8698ffa-8e59-11df-9acb-230ae7a8b736</RequestId>
31
+ </ResponseMetadata>
32
+ </ListInventorySupplyResponse>
@@ -0,0 +1,75 @@
1
+ <?xml version="1.0"?>
2
+ <ListInventorySupplyResponse
3
+ xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">
4
+ <ListInventorySupplyResult>
5
+ <InventorySupplyList>
6
+ <member>
7
+ <SellerSKU>GN-00-01A</SellerSKU>
8
+ <ASIN>B000021Y68</ASIN>
9
+ <TotalSupplyQuantity>202</TotalSupplyQuantity>
10
+ <FNSKU>X00002YKJ1</FNSKU>
11
+ <Condition>NewItem</Condition>
12
+ <SupplyDetail>
13
+ <member>
14
+ <EarliestAvailableToPick>
15
+ <TimepointType>Immediately</TimepointType>
16
+ </EarliestAvailableToPick>
17
+ <Quantity>5</Quantity>
18
+ <LatestAvailableToPick>
19
+ <TimepointType>Immediately</TimepointType>
20
+ </LatestAvailableToPick>
21
+ <SupplyType>InStock</SupplyType>
22
+ </member>
23
+ <member>
24
+ <EarliestAvailableToPick>
25
+ <TimepointType>DateTime</TimepointType>
26
+ <DateTime>2011-05-04T23:00:00Z</DateTime>
27
+ </EarliestAvailableToPick>
28
+ <Quantity>13</Quantity>
29
+ <LatestAvailableToPick>
30
+ <TimepointType>DateTime</TimepointType>
31
+ <DateTime>2011-05-04T23:00:00Z</DateTime>
32
+ </LatestAvailableToPick>
33
+ <SupplyType>InStock</SupplyType>
34
+ </member>
35
+ </SupplyDetail>
36
+ <InStockSupplyQuantity>202</InStockSupplyQuantity>
37
+ </member>
38
+ <member>
39
+ <SellerSKU>GN-00-02A</SellerSKU>
40
+ <ASIN>B111121Y68</ASIN>
41
+ <TotalSupplyQuantity>240</TotalSupplyQuantity>
42
+ <FNSKU>X11112YKJ2</FNSKU>
43
+ <Condition>NewItem</Condition>
44
+ <SupplyDetail>
45
+ <member>
46
+ <EarliestAvailableToPick>
47
+ <TimepointType>Immediately</TimepointType>
48
+ </EarliestAvailableToPick>
49
+ <Quantity>5</Quantity>
50
+ <LatestAvailableToPick>
51
+ <TimepointType>Immediately</TimepointType>
52
+ </LatestAvailableToPick>
53
+ <SupplyType>InStock</SupplyType>
54
+ </member>
55
+ <member>
56
+ <EarliestAvailableToPick>
57
+ <TimepointType>DateTime</TimepointType>
58
+ <DateTime>2011-05-04T23:00:00Z</DateTime>
59
+ </EarliestAvailableToPick>
60
+ <Quantity>13</Quantity>
61
+ <LatestAvailableToPick>
62
+ <TimepointType>DateTime</TimepointType>
63
+ <DateTime>2011-05-04T23:00:00Z</DateTime>
64
+ </LatestAvailableToPick>
65
+ <SupplyType>InStock</SupplyType>
66
+ </member>
67
+ </SupplyDetail>
68
+ <InStockSupplyQuantity>199</InStockSupplyQuantity>
69
+ </member>
70
+ </InventorySupplyList>
71
+ </ListInventorySupplyResult>
72
+ <ResponseMetadata>
73
+ <RequestId>e26d8d21-8e5c-11df-9acb-230ae7a8b736</RequestId>
74
+ </ResponseMetadata>
75
+ </ListInventorySupplyResponse>
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0"?>
2
+ <ListInventorySupplyByNextTokenResponse
3
+ xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">
4
+ <ListInventorySupplyByNextTokenResult>
5
+ <NextToken>H4sIAAAAAAAAADXQQXKCMAAAwK90uPaA0oAyUzsjaKgYDIgieiMEQowG
6
+ FUwsr28v3SfsJ++IeNP0MTPq4tJVxtu1nxnfoFvN/wUW3iVPP/H8wJy2mlrjICebC/2BBU/
7
+ SSWclSjfeMgt7bvfK+TYcDQlTfxmmzzJ2yy4XZfw1WbylcZY+SocmwrfvXqrD/rZheFq/eA
8
+ B49VGHdFA60QiybuoeLDfOSFKxHqnqoWKfHPnH3MOUROAyLU6APlvW+jZbpNxfb0K4T9GCZ
9
+ NbRwjR2tdDekGDMMv5oiiOwkWS5WuArle0w9891GIp0e5PlfWIqAFMA+TASoqjVuDKXgaNI
10
+ m4dIRiiJvL+BmWF+/QKCLcvmKQEAAA==</NextToken>
11
+ <InventorySupplyList>
12
+ <member>
13
+ <SellerSKU>GN-01-01A</SellerSKU>
14
+ <ASIN>B00008UI0R</ASIN>
15
+ <TotalSupplyQuantity>123</TotalSupplyQuantity>
16
+ <FNSKU>B00008UI0R</FNSKU>
17
+ <Condition/>
18
+ <SupplyDetail/>
19
+ <InStockSupplyQuantity>0</InStockSupplyQuantity>
20
+ </member>
21
+ <member>
22
+ <SellerSKU>GN-01-02A</SellerSKU>
23
+ <ASIN>B00000K3CQ</ASIN>
24
+ <TotalSupplyQuantity>321</TotalSupplyQuantity>
25
+ <FNSKU>X0000000FM</FNSKU>
26
+ <Condition>NewItem</Condition>
27
+ <SupplyDetail/>
28
+ <InStockSupplyQuantity>5259</InStockSupplyQuantity>
29
+ <EarliestAvailability>
30
+ <TimepointType>Immediately</TimepointType>
31
+ </EarliestAvailability>
32
+ </member>
33
+ </InventorySupplyList>
34
+ </ListInventorySupplyByNextTokenResult>
35
+ <ResponseMetadata>
36
+ <RequestId>b3a020ac-8e5e-11df-9acb-230ae7a8b736</RequestId>
37
+ </ResponseMetadata>
38
+ </ListInventorySupplyByNextTokenResponse>
@@ -0,0 +1,9 @@
1
+ <ErrorResponse
2
+ xmlns="http://mws.amazonaws.com/FulfillmentOutboundShipment/2010-10-01/">
3
+ <Error>
4
+ <Type>Sender</Type>
5
+ <Code>UnknownError</Code>
6
+ <Message>Something has gone terribly wrong!</Message>
7
+ </Error>
8
+ <RequestId>2d51bcf0-9237-49a6-a778-62195564575f</RequestId>
9
+ </ErrorResponse>
@@ -0,0 +1,9 @@
1
+ <ErrorResponse
2
+ xmlns="http://mws.amazonaws.com/FulfillmentOutboundShipment/2010-10-01/">
3
+ <Error>
4
+ <Type>Sender</Type>
5
+ <Code>InvalidRequestException</Code>
6
+ <Message>Requested order 'dafdfafsdafdafasdfa' not found</Message>
7
+ </Error>
8
+ <RequestId>2d51bcf0-9237-49a6-a778-62195564575f</RequestId>
9
+ </ErrorResponse>
@@ -0,0 +1,7 @@
1
+ <!DOCTYPE SubmitOrderResponse SYSTEM "http://www.shipwire.com/exec/download/SubmitOrderResponse.dtd">
2
+ <SubmitOrderResponse>
3
+ <Status>Error</Status>
4
+ <ErrorMessage>
5
+ <![CDATA[Could not verify Username/EmailAddress and Password combination]]>
6
+ </ErrorMessage>
7
+ </SubmitOrderResponse>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <TrackingUpdateResponse><Status>Error</Status>
3
+ <ErrorMessage>
4
+ Error with Valid Username/EmailAddress and Password Required.
5
+ There is an error in XML document.
6
+ </ErrorMessage>
7
+ </TrackingUpdateResponse>
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <InventoryUpdateResponse>
3
+ <Status>Test</Status>
4
+ <Product code="BlackDog"
5
+ quantity="926"
6
+ pending="0"
7
+ good="793"
8
+ backordered="480"
9
+ reserved="573"
10
+ shipping="155"
11
+ shipped="620"
12
+ consuming="503"
13
+ creating="588"
14
+ consumed="677"
15
+ created="914"
16
+ />
17
+ <Product code="MoustacheCat"
18
+ quantity="-1"
19
+ pending="806"
20
+ good="368"
21
+ backordered="640"
22
+ reserved="520"
23
+ shipping="420"
24
+ shipped="658"
25
+ consuming="672"
26
+ creating="677"
27
+ consumed="254"
28
+ created="901"
29
+ />
30
+ <Product code="KingMonkey"
31
+ quantity="677"
32
+ pending="244"
33
+ good="336"
34
+ backordered="462"
35
+ reserved="202"
36
+ shipping="860"
37
+ shipped="956"
38
+ consuming="521"
39
+ creating="598"
40
+ consumed="387"
41
+ created="543"
42
+ />
43
+ <TotalProducts>3</TotalProducts>
44
+ </InventoryUpdateResponse>
@@ -0,0 +1,8 @@
1
+ "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
2
+ <TrackingUpdateResponse>
3
+ <Status>Test</Status>
4
+ <TotalOrders></TotalOrders>
5
+ <TotalShippedOrders></TotalShippedOrders>
6
+ <TotalProducts></TotalProducts>
7
+ <Bookmark></Bookmark>
8
+ </TrackingUpdateResponse>"
@@ -0,0 +1,53 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <TrackingUpdateResponse>
3
+ <Status>0</Status>
4
+ <Order id="21" shipped="YES" shipper="5" handling="0.00" shipping="6.58" total="6.58">
5
+ <TrackingNumber>1Z6296VW0398500001</TrackingNumber>
6
+ </Order>
7
+ <Order id="22" shipped="YES" shipper="5" handling="0.00" shipping="8.13" total="8.13">
8
+ <TrackingNumber>1Z6296VW0390790002</TrackingNumber>
9
+ </Order>
10
+ <Order id="23" shipped="YES" shipper="5" handling="0.00" shipping="7.63" total="7.63">
11
+ <TrackingNumber>1Z6296VW0396490003</TrackingNumber>
12
+ </Order>
13
+ <Order id="24" shipped="YES" shipper="5" handling="0.00" shipping="8.97" total="8.97">
14
+ <TrackingNumber>1Z6296VW0390200004</TrackingNumber>
15
+ </Order>
16
+ <Order id="25" shipped="YES" shipper="5" handling="0.00" shipping="8.42" total="8.42">
17
+ <TrackingNumber>1Z6296VW0393240005</TrackingNumber>
18
+ </Order>
19
+ <Order id="26" shipped="YES" shipper="5" handling="0.00" shipping="8.42" total="8.42">
20
+ <TrackingNumber>1Z6296VW0396400006</TrackingNumber>
21
+ </Order>
22
+ <Order id="2581" shipped="YES" shipper="5" handling="0.00" shipping="8.21" total="8.21">
23
+ <TrackingNumber>1Z6296VW0391160007</TrackingNumber>
24
+ </Order>
25
+ <Order id="2576" shipped="YES" shipper="43" handling="0.00" shipping="18.60" total="18.60">
26
+ <TrackingNumber>CJ3026000018US</TrackingNumber>
27
+ </Order>
28
+ <Order id="2593" shipped="YES" shipper="5" handling="0.00" shipping="7.63" total="7.63">
29
+ <TrackingNumber>1Z6296VW0398660008</TrackingNumber>
30
+ </Order>
31
+ <Order id="2598" shipped="YES" shipper="5" handling="0.00" shipping="9.84" total="9.84">
32
+ <TrackingNumber>1Z6296VW0391610009</TrackingNumber>
33
+ </Order>
34
+ <Order id="2610" shipped="YES" shipper="5" handling="0.00" shipping="7.63" total="7.63">
35
+ <TrackingNumber>1Z6296VW0395650010</TrackingNumber>
36
+ </Order>
37
+ <Order id="2611" shipped="YES" shipper="5" handling="0.00" shipping="7.13" total="7.13">
38
+ <TrackingNumber>1Z6296VW0397050011</TrackingNumber>
39
+ </Order>
40
+ <Order id="2613" shipped="YES" shipper="5" handling="0.00" shipping="8.97" total="8.97">
41
+ <TrackingNumber>1Z6296VW0398970012</TrackingNumber>
42
+ </Order>
43
+ <Order id="2616" shipped="NO" shipper="5" handling="0.00" shipping="9.84" total="9.84">
44
+ <TrackingNumber></TrackingNumber>
45
+ </Order>
46
+ <Order id="2631" shipped="NO" shipper="" handling="" shipping="" total="">
47
+ <TrackingNumber></TrackingNumber>
48
+ </Order>
49
+ <TotalOrders>15</TotalOrders>
50
+ <TotalShippedOrders>13</TotalShippedOrders>
51
+ <TotalProducts/>
52
+ <Bookmark/>
53
+ </TrackingUpdateResponse>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0"?>
2
+ <TrackingUpdateResponse>
3
+ <Status>Test</Status>
4
+ <Order id="2986" shipped="YES" shipper="UPS GD" handling="1.00" shipping="13.66" total="14.66">
5
+ <TrackingNumber>1ZW682E90326614239</TrackingNumber>
6
+ </Order>
7
+ <Order id="2987" shipped="YES" shipper="UPS GD" handling="1.50" shipping="9.37" total="10.87">
8
+ <TrackingNumber>1ZW682E90326795080</TrackingNumber>
9
+ </Order>
10
+ <Order id="2988" shipped="NO" shipper="UPS GD" handling="" shipping="" total="">
11
+ <TrackingNumber></TrackingNumber>
12
+ </Order>
13
+ <TotalOrders>3</TotalOrders>
14
+ <TotalShippedOrders>2</TotalShippedOrders>
15
+ <Bookmark>2006-04-28 20:35:45</Bookmark>
16
+ </TrackingUpdateResponse>
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <TrackingUpdateResponse>
3
+ <Status>Test</Status>
4
+ <Order id="40298"
5
+ shipwireId="1234567890-1234569-1"
6
+ warehouse="Chicago"
7
+ shipped="YES"
8
+ shipper="USPS FC"
9
+ shipperFullName="USPS First-Class Mail Parcel + Delivery Confirmation"
10
+ shipDate="2011-04-08 09:33:10"
11
+ delivered="NO"
12
+ expectedDeliveryDate="2011-04-15 00:00:00"
13
+ handling="0.00"
14
+ shipping="4.47"
15
+ packaging="0.00"
16
+ total="4.47"
17
+ returned="NO"
18
+ href="https://app.shipwire.com/c/t/xxx1:yyy3"
19
+ affiliateStatus="shipwireFulfilled"
20
+ manuallyEdited="NO">
21
+ <TrackingNumber carrier="USPS"
22
+ delivered="NO"
23
+ href="http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum=9400110200793596422990">
24
+ 9400110200793596422990</TrackingNumber>
25
+ </Order>
26
+ <TotalOrders>1</TotalOrders>
27
+ <TotalShippedOrders>1</TotalShippedOrders>
28
+ <TotalProducts>8</TotalProducts>
29
+ <Bookmark>2011-10-22 14:13:16</Bookmark>
30
+ <ProcessingTime units="ms">1192</ProcessingTime>
31
+ </TrackingUpdateResponse>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Orders>
3
+ <Shipment>
4
+ <InvoiceNumber>#8305090.1</InvoiceNumber>
5
+ <WebgistixOrderNumber>1234512</WebgistixOrderNumber>
6
+ <Method>FedEx Home Delivery</Method>
7
+ <DateShipped>2012-12-10 04:55:00 PM</DateShipped>
8
+ <ShipmentTrackingNumber>345678070437428</ShipmentTrackingNumber>
9
+ <ShippingCost>12.5000</ShippingCost>
10
+ <WeightInPounds>7.1</WeightInPounds>
11
+ </Shipment>
12
+ <Shipment>
13
+ <InvoiceNumber>#8305090.1</InvoiceNumber>
14
+ <WebgistixOrderNumber>1234513</WebgistixOrderNumber>
15
+ <Method>FedEx 2Day</Method>
16
+ <DateShipped>2012-12-11 10:12:00 AM</DateShipped>
17
+ <ShipmentTrackingNumber>546932544227</ShipmentTrackingNumber>
18
+ <ShippingCost>23.2800</ShippingCost>
19
+ <WeightInPounds>0.71</WeightInPounds>
20
+ </Shipment>
21
+ </Orders>
@@ -0,0 +1,114 @@
1
+ require 'test_helper'
2
+
3
+ class RemoteAmazonMarketplaceWebservicesTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @service = AmazonMarketplaceWebService.new( fixtures(:amazon_mws) )
7
+
8
+ @options = {
9
+ :shipping_method => 'Standard',
10
+ :order_date => Time.now.utc.yesterday,
11
+ :comment => "Delayed due to tornadoes"
12
+ }
13
+
14
+ @address = {
15
+ :name => 'Johnny Chase',
16
+ :address1 => '100 Information Super Highway',
17
+ :address2 => 'Suite 66',
18
+ :city => 'Beverly Hills',
19
+ :state => 'CA',
20
+ :country => 'US',
21
+ :zip => '90210'
22
+ }
23
+
24
+ @line_items = [
25
+ { :sku => 'SETTLERS',
26
+ :quantity => 1 #,
27
+ #:comment => 'Awesome'
28
+ }
29
+ ]
30
+ end
31
+
32
+ def test_successful_order_submission
33
+ response = @service.fulfill(ActiveMerchant::Utils.generate_unique_id, @address, @line_items, @options)
34
+ assert response.success?
35
+ assert !response.test?
36
+ end
37
+
38
+ def test_order_multiple_line_items
39
+ @line_items.push({
40
+ :sku => 'CARCASSONNE',
41
+ :quantity => 2
42
+ })
43
+
44
+ response = @service.fulfill(ActiveMerchant::Utils.generate_unique_id, @address, @line_items, @options)
45
+ assert response.success?
46
+ end
47
+
48
+ def test_invalid_credentials_during_fulfillment
49
+ service = AmazonMarketplaceWebService.new(
50
+ :login => 'y',
51
+ :password => 'p',
52
+ :seller_id => 'o')
53
+
54
+ response = service.fulfill(ActiveMerchant::Utils.generate_unique_id, @address, @line_items, @options)
55
+ assert !response.success?
56
+
57
+ assert_equal "InvalidAccessKeyId: The AWS Access Key Id you provided does not exist in our records.", response.response_comment
58
+ end
59
+
60
+ def test_list_orders
61
+ response = @service.fetch_current_orders
62
+ assert response.success?
63
+ end
64
+
65
+ def test_get_inventory
66
+ response = @service.fetch_stock_levels(:sku => '2R-JAXZ-P0IB')
67
+ assert response.success?
68
+ assert_equal 0, response.stock_levels['2R-JAXZ-P0IB']
69
+ end
70
+
71
+ def test_list_inventory
72
+ response = @service.fetch_stock_levels(:start_time => Time.parse('2010-01-01'))
73
+ assert response.success?
74
+ assert_equal 0, response.stock_levels['SETTLERS']
75
+ end
76
+
77
+ def test_fetch_tracking_numbers
78
+ response = @service.fetch_tracking_numbers(['123456']) # an actual order
79
+ assert response.success?
80
+ assert_equal Hash.new, response.tracking_numbers # no tracking numbers in testing
81
+ end
82
+
83
+ def test_fetch_tracking_numbers_ignores_not_found
84
+ response = @service.fetch_tracking_numbers(['1337-1'])
85
+ assert response.success?
86
+ assert_equal Hash.new, response.tracking_numbers
87
+ end
88
+
89
+ def test_valid_credentials
90
+ assert @service.valid_credentials?
91
+ end
92
+
93
+ def test_invalid_credentials
94
+ service = AmazonMarketplaceWebService.new(
95
+ :login => 'your@email.com',
96
+ :password => 'password',
97
+ :seller_id => 'SellerNumber1')
98
+ assert !service.valid_credentials?
99
+ end
100
+
101
+ def test_get_status_does_not_require_valid_credentials
102
+ service = AmazonMarketplaceWebService.new(
103
+ :login => 'your@email.com',
104
+ :password => 'password')
105
+ response = service.status
106
+ assert response.success?
107
+ end
108
+
109
+ def test_get_status
110
+ service = AmazonMarketplaceWebService.new(fixtures(:amazon))
111
+ response = service.status
112
+ assert response.success?
113
+ end
114
+ end