active_shipping 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.gitignore +6 -0
  2. data/CHANGELOG +23 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.markdown +173 -0
  5. data/Rakefile +55 -0
  6. data/VERSION +1 -0
  7. data/init.rb +1 -0
  8. data/lib/active_shipping.rb +50 -0
  9. data/lib/active_shipping/lib/connection.rb +170 -0
  10. data/lib/active_shipping/lib/country.rb +319 -0
  11. data/lib/active_shipping/lib/error.rb +4 -0
  12. data/lib/active_shipping/lib/post_data.rb +22 -0
  13. data/lib/active_shipping/lib/posts_data.rb +47 -0
  14. data/lib/active_shipping/lib/requires_parameters.rb +16 -0
  15. data/lib/active_shipping/lib/utils.rb +18 -0
  16. data/lib/active_shipping/lib/validateable.rb +76 -0
  17. data/lib/active_shipping/shipping/base.rb +15 -0
  18. data/lib/active_shipping/shipping/carrier.rb +75 -0
  19. data/lib/active_shipping/shipping/carriers.rb +17 -0
  20. data/lib/active_shipping/shipping/carriers/bogus_carrier.rb +16 -0
  21. data/lib/active_shipping/shipping/carriers/fedex.rb +315 -0
  22. data/lib/active_shipping/shipping/carriers/shipwire.rb +167 -0
  23. data/lib/active_shipping/shipping/carriers/ups.rb +368 -0
  24. data/lib/active_shipping/shipping/carriers/usps.rb +496 -0
  25. data/lib/active_shipping/shipping/location.rb +100 -0
  26. data/lib/active_shipping/shipping/package.rb +144 -0
  27. data/lib/active_shipping/shipping/rate_estimate.rb +54 -0
  28. data/lib/active_shipping/shipping/rate_response.rb +19 -0
  29. data/lib/active_shipping/shipping/response.rb +49 -0
  30. data/lib/active_shipping/shipping/shipment_event.rb +14 -0
  31. data/lib/active_shipping/shipping/tracking_response.rb +22 -0
  32. data/lib/certs/cacert.pem +7815 -0
  33. data/lib/vendor/quantified/MIT-LICENSE +22 -0
  34. data/lib/vendor/quantified/README.markdown +49 -0
  35. data/lib/vendor/quantified/Rakefile +21 -0
  36. data/lib/vendor/quantified/init.rb +0 -0
  37. data/lib/vendor/quantified/lib/quantified.rb +6 -0
  38. data/lib/vendor/quantified/lib/quantified/attribute.rb +208 -0
  39. data/lib/vendor/quantified/lib/quantified/length.rb +20 -0
  40. data/lib/vendor/quantified/lib/quantified/mass.rb +19 -0
  41. data/lib/vendor/quantified/test/length_test.rb +92 -0
  42. data/lib/vendor/quantified/test/mass_test.rb +88 -0
  43. data/lib/vendor/quantified/test/test_helper.rb +2 -0
  44. data/lib/vendor/test_helper.rb +13 -0
  45. data/lib/vendor/xml_node/README +36 -0
  46. data/lib/vendor/xml_node/Rakefile +21 -0
  47. data/lib/vendor/xml_node/benchmark/bench_generation.rb +32 -0
  48. data/lib/vendor/xml_node/init.rb +1 -0
  49. data/lib/vendor/xml_node/lib/xml_node.rb +222 -0
  50. data/lib/vendor/xml_node/test/test_generating.rb +94 -0
  51. data/lib/vendor/xml_node/test/test_parsing.rb +43 -0
  52. data/test/fixtures.yml +13 -0
  53. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_request.xml +67 -0
  54. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_response.xml +213 -0
  55. data/test/fixtures/xml/fedex/tracking_request.xml +27 -0
  56. data/test/fixtures/xml/fedex/tracking_response.xml +153 -0
  57. data/test/fixtures/xml/shipwire/international_rates_response.xml +17 -0
  58. data/test/fixtures/xml/shipwire/invalid_credentials_response.xml +4 -0
  59. data/test/fixtures/xml/shipwire/new_carrier_rate_response.xml +18 -0
  60. data/test/fixtures/xml/shipwire/no_rates_response.xml +7 -0
  61. data/test/fixtures/xml/shipwire/rates_response.xml +36 -0
  62. data/test/fixtures/xml/ups/example_tracking_response.xml +53 -0
  63. data/test/fixtures/xml/ups/shipment_from_tiger_direct.xml +222 -0
  64. data/test/fixtures/xml/ups/test_real_home_as_residential_destination_response.xml +1 -0
  65. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_book_rate_response.xml +85 -0
  66. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_book_wii_rate_response.xml +168 -0
  67. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_wii_rate_response.xml +85 -0
  68. data/test/remote/fedex_test.rb +140 -0
  69. data/test/remote/shipwire_test.rb +88 -0
  70. data/test/remote/ups_test.rb +187 -0
  71. data/test/remote/usps_test.rb +184 -0
  72. data/test/test_helper.rb +167 -0
  73. data/test/unit/base_test.rb +18 -0
  74. data/test/unit/carriers/fedex_test.rb +78 -0
  75. data/test/unit/carriers/shipwire_test.rb +130 -0
  76. data/test/unit/carriers/ups_test.rb +81 -0
  77. data/test/unit/carriers/usps_test.rb +206 -0
  78. data/test/unit/location_test.rb +46 -0
  79. data/test/unit/package_test.rb +65 -0
  80. data/test/unit/response_test.rb +10 -0
  81. metadata +158 -0
@@ -0,0 +1,168 @@
1
+ <?xml version="1.0"?>
2
+ <IntlRateResponse><Package ID="0"><Prohibitions>An issue of a publication in which more than 5 percent of its total advertising space is primarily directed to a Canadian market and which indicates:
3
+ (a) specifically where goods or services may be obtained in Canada, or
4
+ (b) specific items or conditions relating to the sale or provision of goods or services in Canada.
5
+ All alcoholic beverages including wines, etc.
6
+ An issue of a publication that contains an advertisement primarily directed to a Canadian market is a prohibited import if that advertisement does not appear in identical form in all editions of the issue distributed in the country of origin.
7
+ Articles so marked as to create the false impression that they were made in Canada, Great Britain or any other British country.
8
+ Butane gas lighters and refill cartridges.
9
+ Commercial tags of metal.
10
+ Firearms, including prohibited and restricted weapons, may not be mailed to Canadian addressees from outside Canada.
11
+ Oleomargarine and other butter substitutes, including altered or renovated butter.
12
+ Shipments bearing caution labels indicating the contents are flammable.
13
+ Perishable infectious biological substances.
14
+ Perishable noninfectious biological substances.
15
+ Plumage and skins of wild birds.
16
+ Prison-made goods being sold or intended for sale by a person or firm.
17
+ Radioactive materials.
18
+ Reprints of Canadian or British works copyrighted in Canada.
19
+ Reproductions of Canadian postage stamps unless printed in publications in black and white only and with a defacing line drawn across each reproduction.
20
+ Smoke-making devices for motor vehicles and boats.
21
+ Used or secondhand hives or bee supplies.</Prohibitions><Restrictions>Coins; banknotes; currency notes; securities payable to bearer; traveler's checks; gold, silver, platinum, manufactured or not; jewelry; and other valuable articles may be sent only in registered letter-post items.
22
+ Exceptions:
23
+ Coins sent to or from collectors or dealers may be mailed in ordinary (uninsured) parcel post packages. Jewelry and precious stones may be sent via GPL Air Courier (Premium) service to Canada subject to indemnity limits indicated in section 626.31.
24
+ Drugs and medicines must comply with Canadian law.
25
+ Eggs for hatching must be packed in new, clean containers and accompanied by a certificate issued by a veterinarian of the U.S. Department of Agriculture, or one issued by a State veterinarian and endorsed by a veterinarian of that Bureau, stating that to the best of his or her knowledge the eggs come from a flock that is free from Newcastle disease, fowl pest, or fowl typhoid. See 135.3 for method of packing.
26
+ Meat and meat food products must be accompanied by an export certificate issued by the U.S. Department of Agriculture and labeled in accordance with Canadian regulations. Exception to these requirements are:
27
+ (1) bona fide sample shipments weighing less than 10 kg;
28
+ (2) meat products addressed to a government department or agency;
29
+ (3) meat products intended for personal consumption when they enter Canada in the possession of the importer.
30
+ Precious stones, set or not set; all items used as dress ornaments and coming under the term "jewelry" including articles of gold or other precious metal for personal use such as cigarette holders, cases, powder cases, card cases, opera glasses, fountain pens, watches, etc., are permitted in insured parcel post packages provided the articles have value not over $5 U.S. A parcel post package containing a number of such articles valued at $5 or less may be insured for the total value of the contents up to a maximum of $200.
31
+ Senders are advised to communicate with prospective addressees to assure themselves before mailing that such articles will be admitted.
32
+ Veterinary biological products including serums and vaccines must be accompanied by a permit issued by the Veterinary Director General, Ministry of Agriculture of Canada.</Restrictions><Observations>1. Banknotes valued at $100 or more must be put up in a compact package and securely tied with strong twine before wrapping. The wrapper must be linen or other strong, woven material, linen lined paper, or two thicknesses of strong kraft paper. After wrapping, the package must be again securely tied or stitched and sealed at the points of closing.
33
+ 2. The name of the Canadian province in which the office of destination is located must appear as part of the address.
34
+ 3. The following must not be accepted for insurance:
35
+ Bees, postage stamps (canceled and uncanceled) and albums in which they are mounted, and parcel post packages addressed to CFPOs.
36
+ 4. Canadian Forces Mail (CFPO) is processed through Canadian military post offices and must be addressed in the following manner:
37
+ NUMBER, RANK, NAME UNIT
38
+ CFPO (NUMBER)
39
+ BELLEVILLE, ONT CANADA K0K 3R0
40
+ Maximum weight limits for mail addressed to members of the Canadian Forces based outside of Canada (CFPO) is: 22 pounds. Parcel post packages for CFPO addresses may not be insured. Direct sacks of printed matter (M Bags) are not permitted for CFPO addresses.
41
+ 5. Advertising matter specially prepared to promote the sale of goods or services by Canadian persons or firms is charged with customs duty in Canada when the total weight of articles mailed at one time exceeds one pound. Duty is charged on each individually addressed article. To avoid detention of such mail by Canadian customs, senders may arrange to pay the duty, which can be done by means of Canadian customs duty stamps affixed to the back of each piece of mail. Senders may inquire as to rates of duty and may purchase the duty stamps from the Department of National Revenue, Customs and Excise, Ottawa, Ont., Canada.
42
+ 6. A letter fully prepaid and bearing the same address as that of the parcel post package may be tied or otherwise securely attached to the outside of the parcel. Stamps to cover postage on the parcel post package must be affixed to the wrapper of the parcel. Stamps to pay postage on the letter must be affixed to the envelope thereof.
43
+ 7. Certain types of merchandise must be marked to show country of origin in the manner prescribed by the Canadian customs regulations.
44
+ 8. Goods valued under 20 Canadian dollars are duty and excise tax exempt. Goods over 20 Canadian dollars will be subject to the applicable duties and excise taxes. Gift shipments received by mail that are valued under 60 Canadian dollars are duty and excise tax exempt.
45
+ 9. For all casual and commercial items valued under 1,200 Canadian dollars, Canada Post will collect the assessed duties and excise taxes and a handling fee of 5 Canadian dollars from the addressee. For EMS items, the handling fee is 8 Canadian dollars. All commercial mail items over 1,200 Canadian dollars will be held by Canada Customs and Excise until proper invoice and accounting documentation is provided by the addressee.
46
+ 10. The Canada Customs Invoice can be obtained from stationery, office supply, or printing companies. If mailers are unable to obtain the Canada Customs Invoice locally, they should write to the following office that will apply specific names and addresses from which the invoice may be obtained:
47
+ REVENUE CANADA, CUSTOMS AND EXCISE
48
+ CONNAUGHT BUILDING
49
+ OTTAWA ON K1A 0L5
50
+ CANADA
51
+ Attn: Release and Documentation Systems
52
+ Data Control Programmes.
53
+ 11. Information on Canadian customs regulations may be obtained from the Office of International Marketing/223, Bureau of International Commerce, Department of Commerce, Washington, DC 20230, or any field office of that Department.
54
+ 12. (a) Information on Canadian post code directories can be obtained from:
55
+ NATIONAL PHILATELIC CENTER
56
+ CANADA POST CORPORATION
57
+ STATION 1
58
+ ANTIGONISH NS B2G 2R8
59
+ Telephone: 1-800-565-4362
60
+ Fax: 1-902-863-6796
61
+ (b) To obtain Canadian post codes for specific addresses, call the General Information line at 1-416-0979-8822 or access the Canada Post Corporation web site on the Internet at http://www.canadapost.ca
62
+ 13. Registered mail to Canada has an indemnity limit of $1,000, with the exception of cash that has an indemnity limit of $200.</Observations><CustomsForms>Letter-post: PS Form 2976 or 2976-A (see 123.61)
63
+ Parcel Post: PS Form 2976-A inside 2976-E (envelope)
64
+ (Customs Form Information -- http://ircalc.usps.gov/custforms.htm)</CustomsForms><ExpressMail>Country Code:
65
+ CA
66
+
67
+ Reciprocal Service Name:
68
+ There is no reciprocal service.
69
+
70
+ Required Customs Form/Endorsement
71
+ 1. Business papers and commercial documents.
72
+ PS Form 2976, Customs - CN 22 (Old C 1) and Sender's Declaration (green label).
73
+
74
+ 2. Merchandise samples and gift shipments (non-commercial parcels).
75
+ PS Form 2976-A, Customs Declaration and Dispatch Note CP 72, inside a PS Form 2976-E, Customs Declaration Envelope CP 91.
76
+
77
+ 3. Merchandise (commercial shipments) and all articles subject to customs duty.
78
+ PS Form 2976-A, Customs Declaration and Dispatch Note CP 72, inside a PS Form 2976-E, Customs Declaration Envelope CP 91.
79
+
80
+ Notes:
81
+ 1. Gift shipments (non-commercial parcels) require a sales receipt, invoice or other documentation to support the declared value.
82
+ 2. Coins; banknotes; currency notes (paper money); securities of any kind payable to bearer; traveler's checks; platinum, gold, and silver (manufactured or not); precious stones; jewelry; and other valuable articles are prohibited in EMS shipments to Canada.
83
+ 3. Express Mail shipments may have a street address or a post office box address. A local telephone number for the addressee MUST be provided for shipments addressed to a post office box address. A local telephone number for the addressee should be provided if possible for shipments to a street address.
84
+
85
+ Areas Served: All</ExpressMail><AreasServed>Please reference Express Mail for Areas Served.</AreasServed><Service ID="4"><Pounds>0</Pounds><Ounces>9</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>41</Postage><SvcCommitments>1 - 3 Days</SvcCommitments><SvcDescription>Global Express Guaranteed</SvcDescription><MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth 108"</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="6"><Pounds>0</Pounds><Ounces>9</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>41</Postage><SvcCommitments>1 - 3 Days</SvcCommitments><SvcDescription>Global Express Guaranteed Non-Document Rectangular</SvcDescription><MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth 108"</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="7"><Pounds>0</Pounds><Ounces>9</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>41</Postage><SvcCommitments>1 - 3 Days</SvcCommitments><SvcDescription>Global Express Guaranteed Non-Document Non-Rectangular</SvcDescription><MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth 108"</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="1"><Pounds>0</Pounds><Ounces>9</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>23.25</Postage><SvcCommitments>5 Days</SvcCommitments><SvcDescription>Express Mail International (EMS)</SvcDescription><MaxDimensions>Max.length 42", max. length plus girth 79"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="10"><Pounds>0</Pounds><Ounces>9</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>22</Postage><SvcCommitments>5 Days</SvcCommitments><SvcDescription>Express Mail International (EMS) Flat Rate Envelope</SvcDescription><MaxDimensions>9 1/2" X 12 1/2"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="2"><Pounds>0</Pounds><Ounces>9</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>16</Postage><SvcCommitments>6 - 10 Days</SvcCommitments><SvcDescription>Priority Mail International</SvcDescription><MaxDimensions>Maximum length and girth combined 108"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="8"><Pounds>0</Pounds><Ounces>9</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>9</Postage><SvcCommitments>6 - 10 Days</SvcCommitments><SvcDescription>Priority Mail International Flat Rate Envelope</SvcDescription><MaxDimensions>USPS-supplied Priority Mail flat-rate envelope 9 1/2" x 12 1/2." Maximum weight 4 pounds.</MaxDimensions><MaxWeight>4</MaxWeight></Service><Service ID="9"><Pounds>0</Pounds><Ounces>9</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>23</Postage><SvcCommitments>6 - 10 Days</SvcCommitments><SvcDescription>Priority Mail International Flat Rate Box</SvcDescription><MaxDimensions>USPS-supplied Priority Mail flat-rate box. Maximum weight 20 pounds.</MaxDimensions><MaxWeight>20</MaxWeight></Service><Service ID="3"><Pounds>0</Pounds><Ounces>9</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>3.76</Postage><SvcCommitments>Varies</SvcCommitments><SvcDescription>First-Class Mail International</SvcDescription><MaxDimensions>Max. length 24", Max. length, height, depth combined 36"</MaxDimensions><MaxWeight>64</MaxWeight></Service></Package><Package ID="1"><Prohibitions>An issue of a publication in which more than 5 percent of its total advertising space is primarily directed to a Canadian market and which indicates:
86
+ (a) specifically where goods or services may be obtained in Canada, or
87
+ (b) specific items or conditions relating to the sale or provision of goods or services in Canada.
88
+ All alcoholic beverages including wines, etc.
89
+ An issue of a publication that contains an advertisement primarily directed to a Canadian market is a prohibited import if that advertisement does not appear in identical form in all editions of the issue distributed in the country of origin.
90
+ Articles so marked as to create the false impression that they were made in Canada, Great Britain or any other British country.
91
+ Butane gas lighters and refill cartridges.
92
+ Commercial tags of metal.
93
+ Firearms, including prohibited and restricted weapons, may not be mailed to Canadian addressees from outside Canada.
94
+ Oleomargarine and other butter substitutes, including altered or renovated butter.
95
+ Shipments bearing caution labels indicating the contents are flammable.
96
+ Perishable infectious biological substances.
97
+ Perishable noninfectious biological substances.
98
+ Plumage and skins of wild birds.
99
+ Prison-made goods being sold or intended for sale by a person or firm.
100
+ Radioactive materials.
101
+ Reprints of Canadian or British works copyrighted in Canada.
102
+ Reproductions of Canadian postage stamps unless printed in publications in black and white only and with a defacing line drawn across each reproduction.
103
+ Smoke-making devices for motor vehicles and boats.
104
+ Used or secondhand hives or bee supplies.</Prohibitions><Restrictions>Coins; banknotes; currency notes; securities payable to bearer; traveler's checks; gold, silver, platinum, manufactured or not; jewelry; and other valuable articles may be sent only in registered letter-post items.
105
+ Exceptions:
106
+ Coins sent to or from collectors or dealers may be mailed in ordinary (uninsured) parcel post packages. Jewelry and precious stones may be sent via GPL Air Courier (Premium) service to Canada subject to indemnity limits indicated in section 626.31.
107
+ Drugs and medicines must comply with Canadian law.
108
+ Eggs for hatching must be packed in new, clean containers and accompanied by a certificate issued by a veterinarian of the U.S. Department of Agriculture, or one issued by a State veterinarian and endorsed by a veterinarian of that Bureau, stating that to the best of his or her knowledge the eggs come from a flock that is free from Newcastle disease, fowl pest, or fowl typhoid. See 135.3 for method of packing.
109
+ Meat and meat food products must be accompanied by an export certificate issued by the U.S. Department of Agriculture and labeled in accordance with Canadian regulations. Exception to these requirements are:
110
+ (1) bona fide sample shipments weighing less than 10 kg;
111
+ (2) meat products addressed to a government department or agency;
112
+ (3) meat products intended for personal consumption when they enter Canada in the possession of the importer.
113
+ Precious stones, set or not set; all items used as dress ornaments and coming under the term "jewelry" including articles of gold or other precious metal for personal use such as cigarette holders, cases, powder cases, card cases, opera glasses, fountain pens, watches, etc., are permitted in insured parcel post packages provided the articles have value not over $5 U.S. A parcel post package containing a number of such articles valued at $5 or less may be insured for the total value of the contents up to a maximum of $200.
114
+ Senders are advised to communicate with prospective addressees to assure themselves before mailing that such articles will be admitted.
115
+ Veterinary biological products including serums and vaccines must be accompanied by a permit issued by the Veterinary Director General, Ministry of Agriculture of Canada.</Restrictions><Observations>1. Banknotes valued at $100 or more must be put up in a compact package and securely tied with strong twine before wrapping. The wrapper must be linen or other strong, woven material, linen lined paper, or two thicknesses of strong kraft paper. After wrapping, the package must be again securely tied or stitched and sealed at the points of closing.
116
+ 2. The name of the Canadian province in which the office of destination is located must appear as part of the address.
117
+ 3. The following must not be accepted for insurance:
118
+ Bees, postage stamps (canceled and uncanceled) and albums in which they are mounted, and parcel post packages addressed to CFPOs.
119
+ 4. Canadian Forces Mail (CFPO) is processed through Canadian military post offices and must be addressed in the following manner:
120
+ NUMBER, RANK, NAME UNIT
121
+ CFPO (NUMBER)
122
+ BELLEVILLE, ONT CANADA K0K 3R0
123
+ Maximum weight limits for mail addressed to members of the Canadian Forces based outside of Canada (CFPO) is: 22 pounds. Parcel post packages for CFPO addresses may not be insured. Direct sacks of printed matter (M Bags) are not permitted for CFPO addresses.
124
+ 5. Advertising matter specially prepared to promote the sale of goods or services by Canadian persons or firms is charged with customs duty in Canada when the total weight of articles mailed at one time exceeds one pound. Duty is charged on each individually addressed article. To avoid detention of such mail by Canadian customs, senders may arrange to pay the duty, which can be done by means of Canadian customs duty stamps affixed to the back of each piece of mail. Senders may inquire as to rates of duty and may purchase the duty stamps from the Department of National Revenue, Customs and Excise, Ottawa, Ont., Canada.
125
+ 6. A letter fully prepaid and bearing the same address as that of the parcel post package may be tied or otherwise securely attached to the outside of the parcel. Stamps to cover postage on the parcel post package must be affixed to the wrapper of the parcel. Stamps to pay postage on the letter must be affixed to the envelope thereof.
126
+ 7. Certain types of merchandise must be marked to show country of origin in the manner prescribed by the Canadian customs regulations.
127
+ 8. Goods valued under 20 Canadian dollars are duty and excise tax exempt. Goods over 20 Canadian dollars will be subject to the applicable duties and excise taxes. Gift shipments received by mail that are valued under 60 Canadian dollars are duty and excise tax exempt.
128
+ 9. For all casual and commercial items valued under 1,200 Canadian dollars, Canada Post will collect the assessed duties and excise taxes and a handling fee of 5 Canadian dollars from the addressee. For EMS items, the handling fee is 8 Canadian dollars. All commercial mail items over 1,200 Canadian dollars will be held by Canada Customs and Excise until proper invoice and accounting documentation is provided by the addressee.
129
+ 10. The Canada Customs Invoice can be obtained from stationery, office supply, or printing companies. If mailers are unable to obtain the Canada Customs Invoice locally, they should write to the following office that will apply specific names and addresses from which the invoice may be obtained:
130
+ REVENUE CANADA, CUSTOMS AND EXCISE
131
+ CONNAUGHT BUILDING
132
+ OTTAWA ON K1A 0L5
133
+ CANADA
134
+ Attn: Release and Documentation Systems
135
+ Data Control Programmes.
136
+ 11. Information on Canadian customs regulations may be obtained from the Office of International Marketing/223, Bureau of International Commerce, Department of Commerce, Washington, DC 20230, or any field office of that Department.
137
+ 12. (a) Information on Canadian post code directories can be obtained from:
138
+ NATIONAL PHILATELIC CENTER
139
+ CANADA POST CORPORATION
140
+ STATION 1
141
+ ANTIGONISH NS B2G 2R8
142
+ Telephone: 1-800-565-4362
143
+ Fax: 1-902-863-6796
144
+ (b) To obtain Canadian post codes for specific addresses, call the General Information line at 1-416-0979-8822 or access the Canada Post Corporation web site on the Internet at http://www.canadapost.ca
145
+ 13. Registered mail to Canada has an indemnity limit of $1,000, with the exception of cash that has an indemnity limit of $200.</Observations><CustomsForms>Letter-post: PS Form 2976 or 2976-A (see 123.61)
146
+ Parcel Post: PS Form 2976-A inside 2976-E (envelope)
147
+ (Customs Form Information -- http://ircalc.usps.gov/custforms.htm)</CustomsForms><ExpressMail>Country Code:
148
+ CA
149
+
150
+ Reciprocal Service Name:
151
+ There is no reciprocal service.
152
+
153
+ Required Customs Form/Endorsement
154
+ 1. Business papers and commercial documents.
155
+ PS Form 2976, Customs - CN 22 (Old C 1) and Sender's Declaration (green label).
156
+
157
+ 2. Merchandise samples and gift shipments (non-commercial parcels).
158
+ PS Form 2976-A, Customs Declaration and Dispatch Note CP 72, inside a PS Form 2976-E, Customs Declaration Envelope CP 91.
159
+
160
+ 3. Merchandise (commercial shipments) and all articles subject to customs duty.
161
+ PS Form 2976-A, Customs Declaration and Dispatch Note CP 72, inside a PS Form 2976-E, Customs Declaration Envelope CP 91.
162
+
163
+ Notes:
164
+ 1. Gift shipments (non-commercial parcels) require a sales receipt, invoice or other documentation to support the declared value.
165
+ 2. Coins; banknotes; currency notes (paper money); securities of any kind payable to bearer; traveler's checks; platinum, gold, and silver (manufactured or not); precious stones; jewelry; and other valuable articles are prohibited in EMS shipments to Canada.
166
+ 3. Express Mail shipments may have a street address or a post office box address. A local telephone number for the addressee MUST be provided for shipments addressed to a post office box address. A local telephone number for the addressee should be provided if possible for shipments to a street address.
167
+
168
+ Areas Served: All</ExpressMail><AreasServed>Please reference Express Mail for Areas Served.</AreasServed><Service ID="4"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>65.5</Postage><SvcCommitments>1 - 3 Days</SvcCommitments><SvcDescription>Global Express Guaranteed</SvcDescription><MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth 108"</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="6"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>65.5</Postage><SvcCommitments>1 - 3 Days</SvcCommitments><SvcDescription>Global Express Guaranteed Non-Document Rectangular</SvcDescription><MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth 108"</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="7"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>65.5</Postage><SvcCommitments>1 - 3 Days</SvcCommitments><SvcDescription>Global Express Guaranteed Non-Document Non-Rectangular</SvcDescription><MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth 108"</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="1"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>35.5</Postage><SvcCommitments>5 Days</SvcCommitments><SvcDescription>Express Mail International (EMS)</SvcDescription><MaxDimensions>Max.length 42", max. length plus girth 79"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="10"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>22</Postage><SvcCommitments>5 Days</SvcCommitments><SvcDescription>Express Mail International (EMS) Flat Rate Envelope</SvcDescription><MaxDimensions>9 1/2" X 12 1/2"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="2"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>25.1</Postage><SvcCommitments>6 - 10 Days</SvcCommitments><SvcDescription>Priority Mail International</SvcDescription><MaxDimensions>Maximum length and girth combined 108"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="9"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>23</Postage><SvcCommitments>6 - 10 Days</SvcCommitments><SvcDescription>Priority Mail International Flat Rate Box</SvcDescription><MaxDimensions>USPS-supplied Priority Mail flat-rate box. Maximum weight 20 pounds.</MaxDimensions><MaxWeight>20</MaxWeight></Service></Package></IntlRateResponse>
@@ -0,0 +1,85 @@
1
+ <?xml version="1.0"?>
2
+ <IntlRateResponse><Package ID="0"><Prohibitions>An issue of a publication in which more than 5 percent of its total advertising space is primarily directed to a Canadian market and which indicates:
3
+ (a) specifically where goods or services may be obtained in Canada, or
4
+ (b) specific items or conditions relating to the sale or provision of goods or services in Canada.
5
+ All alcoholic beverages including wines, etc.
6
+ An issue of a publication that contains an advertisement primarily directed to a Canadian market is a prohibited import if that advertisement does not appear in identical form in all editions of the issue distributed in the country of origin.
7
+ Articles so marked as to create the false impression that they were made in Canada, Great Britain or any other British country.
8
+ Butane gas lighters and refill cartridges.
9
+ Commercial tags of metal.
10
+ Firearms, including prohibited and restricted weapons, may not be mailed to Canadian addressees from outside Canada.
11
+ Oleomargarine and other butter substitutes, including altered or renovated butter.
12
+ Shipments bearing caution labels indicating the contents are flammable.
13
+ Perishable infectious biological substances.
14
+ Perishable noninfectious biological substances.
15
+ Plumage and skins of wild birds.
16
+ Prison-made goods being sold or intended for sale by a person or firm.
17
+ Radioactive materials.
18
+ Reprints of Canadian or British works copyrighted in Canada.
19
+ Reproductions of Canadian postage stamps unless printed in publications in black and white only and with a defacing line drawn across each reproduction.
20
+ Smoke-making devices for motor vehicles and boats.
21
+ Used or secondhand hives or bee supplies.</Prohibitions><Restrictions>Coins; banknotes; currency notes; securities payable to bearer; traveler's checks; gold, silver, platinum, manufactured or not; jewelry; and other valuable articles may be sent only in registered letter-post items.
22
+ Exceptions:
23
+ Coins sent to or from collectors or dealers may be mailed in ordinary (uninsured) parcel post packages. Jewelry and precious stones may be sent via GPL Air Courier (Premium) service to Canada subject to indemnity limits indicated in section 626.31.
24
+ Drugs and medicines must comply with Canadian law.
25
+ Eggs for hatching must be packed in new, clean containers and accompanied by a certificate issued by a veterinarian of the U.S. Department of Agriculture, or one issued by a State veterinarian and endorsed by a veterinarian of that Bureau, stating that to the best of his or her knowledge the eggs come from a flock that is free from Newcastle disease, fowl pest, or fowl typhoid. See 135.3 for method of packing.
26
+ Meat and meat food products must be accompanied by an export certificate issued by the U.S. Department of Agriculture and labeled in accordance with Canadian regulations. Exception to these requirements are:
27
+ (1) bona fide sample shipments weighing less than 10 kg;
28
+ (2) meat products addressed to a government department or agency;
29
+ (3) meat products intended for personal consumption when they enter Canada in the possession of the importer.
30
+ Precious stones, set or not set; all items used as dress ornaments and coming under the term "jewelry" including articles of gold or other precious metal for personal use such as cigarette holders, cases, powder cases, card cases, opera glasses, fountain pens, watches, etc., are permitted in insured parcel post packages provided the articles have value not over $5 U.S. A parcel post package containing a number of such articles valued at $5 or less may be insured for the total value of the contents up to a maximum of $200.
31
+ Senders are advised to communicate with prospective addressees to assure themselves before mailing that such articles will be admitted.
32
+ Veterinary biological products including serums and vaccines must be accompanied by a permit issued by the Veterinary Director General, Ministry of Agriculture of Canada.</Restrictions><Observations>1. Banknotes valued at $100 or more must be put up in a compact package and securely tied with strong twine before wrapping. The wrapper must be linen or other strong, woven material, linen lined paper, or two thicknesses of strong kraft paper. After wrapping, the package must be again securely tied or stitched and sealed at the points of closing.
33
+ 2. The name of the Canadian province in which the office of destination is located must appear as part of the address.
34
+ 3. The following must not be accepted for insurance:
35
+ Bees, postage stamps (canceled and uncanceled) and albums in which they are mounted, and parcel post packages addressed to CFPOs.
36
+ 4. Canadian Forces Mail (CFPO) is processed through Canadian military post offices and must be addressed in the following manner:
37
+ NUMBER, RANK, NAME UNIT
38
+ CFPO (NUMBER)
39
+ BELLEVILLE, ONT CANADA K0K 3R0
40
+ Maximum weight limits for mail addressed to members of the Canadian Forces based outside of Canada (CFPO) is: 22 pounds. Parcel post packages for CFPO addresses may not be insured. Direct sacks of printed matter (M Bags) are not permitted for CFPO addresses.
41
+ 5. Advertising matter specially prepared to promote the sale of goods or services by Canadian persons or firms is charged with customs duty in Canada when the total weight of articles mailed at one time exceeds one pound. Duty is charged on each individually addressed article. To avoid detention of such mail by Canadian customs, senders may arrange to pay the duty, which can be done by means of Canadian customs duty stamps affixed to the back of each piece of mail. Senders may inquire as to rates of duty and may purchase the duty stamps from the Department of National Revenue, Customs and Excise, Ottawa, Ont., Canada.
42
+ 6. A letter fully prepaid and bearing the same address as that of the parcel post package may be tied or otherwise securely attached to the outside of the parcel. Stamps to cover postage on the parcel post package must be affixed to the wrapper of the parcel. Stamps to pay postage on the letter must be affixed to the envelope thereof.
43
+ 7. Certain types of merchandise must be marked to show country of origin in the manner prescribed by the Canadian customs regulations.
44
+ 8. Goods valued under 20 Canadian dollars are duty and excise tax exempt. Goods over 20 Canadian dollars will be subject to the applicable duties and excise taxes. Gift shipments received by mail that are valued under 60 Canadian dollars are duty and excise tax exempt.
45
+ 9. For all casual and commercial items valued under 1,200 Canadian dollars, Canada Post will collect the assessed duties and excise taxes and a handling fee of 5 Canadian dollars from the addressee. For EMS items, the handling fee is 8 Canadian dollars. All commercial mail items over 1,200 Canadian dollars will be held by Canada Customs and Excise until proper invoice and accounting documentation is provided by the addressee.
46
+ 10. The Canada Customs Invoice can be obtained from stationery, office supply, or printing companies. If mailers are unable to obtain the Canada Customs Invoice locally, they should write to the following office that will apply specific names and addresses from which the invoice may be obtained:
47
+ REVENUE CANADA, CUSTOMS AND EXCISE
48
+ CONNAUGHT BUILDING
49
+ OTTAWA ON K1A 0L5
50
+ CANADA
51
+ Attn: Release and Documentation Systems
52
+ Data Control Programmes.
53
+ 11. Information on Canadian customs regulations may be obtained from the Office of International Marketing/223, Bureau of International Commerce, Department of Commerce, Washington, DC 20230, or any field office of that Department.
54
+ 12. (a) Information on Canadian post code directories can be obtained from:
55
+ NATIONAL PHILATELIC CENTER
56
+ CANADA POST CORPORATION
57
+ STATION 1
58
+ ANTIGONISH NS B2G 2R8
59
+ Telephone: 1-800-565-4362
60
+ Fax: 1-902-863-6796
61
+ (b) To obtain Canadian post codes for specific addresses, call the General Information line at 1-416-0979-8822 or access the Canada Post Corporation web site on the Internet at http://www.canadapost.ca
62
+ 13. Registered mail to Canada has an indemnity limit of $1,000, with the exception of cash that has an indemnity limit of $200.</Observations><CustomsForms>Letter-post: PS Form 2976 or 2976-A (see 123.61)
63
+ Parcel Post: PS Form 2976-A inside 2976-E (envelope)
64
+ (Customs Form Information -- http://ircalc.usps.gov/custforms.htm)</CustomsForms><ExpressMail>Country Code:
65
+ CA
66
+
67
+ Reciprocal Service Name:
68
+ There is no reciprocal service.
69
+
70
+ Required Customs Form/Endorsement
71
+ 1. Business papers and commercial documents.
72
+ PS Form 2976, Customs - CN 22 (Old C 1) and Sender's Declaration (green label).
73
+
74
+ 2. Merchandise samples and gift shipments (non-commercial parcels).
75
+ PS Form 2976-A, Customs Declaration and Dispatch Note CP 72, inside a PS Form 2976-E, Customs Declaration Envelope CP 91.
76
+
77
+ 3. Merchandise (commercial shipments) and all articles subject to customs duty.
78
+ PS Form 2976-A, Customs Declaration and Dispatch Note CP 72, inside a PS Form 2976-E, Customs Declaration Envelope CP 91.
79
+
80
+ Notes:
81
+ 1. Gift shipments (non-commercial parcels) require a sales receipt, invoice or other documentation to support the declared value.
82
+ 2. Coins; banknotes; currency notes (paper money); securities of any kind payable to bearer; traveler's checks; platinum, gold, and silver (manufactured or not); precious stones; jewelry; and other valuable articles are prohibited in EMS shipments to Canada.
83
+ 3. Express Mail shipments may have a street address or a post office box address. A local telephone number for the addressee MUST be provided for shipments addressed to a post office box address. A local telephone number for the addressee should be provided if possible for shipments to a street address.
84
+
85
+ Areas Served: All</ExpressMail><AreasServed>Please reference Express Mail for Areas Served.</AreasServed><Service ID="4"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>65.5</Postage><SvcCommitments>1 - 3 Days</SvcCommitments><SvcDescription>Global Express Guaranteed</SvcDescription><MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth 108"</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="6"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>65.5</Postage><SvcCommitments>1 - 3 Days</SvcCommitments><SvcDescription>Global Express Guaranteed Non-Document Rectangular</SvcDescription><MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth 108"</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="7"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>65.5</Postage><SvcCommitments>1 - 3 Days</SvcCommitments><SvcDescription>Global Express Guaranteed Non-Document Non-Rectangular</SvcDescription><MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth 108"</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="1"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>35.5</Postage><SvcCommitments>5 Days</SvcCommitments><SvcDescription>Express Mail International (EMS)</SvcDescription><MaxDimensions>Max.length 42", max. length plus girth 79"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="10"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>22</Postage><SvcCommitments>5 Days</SvcCommitments><SvcDescription>Express Mail International (EMS) Flat Rate Envelope</SvcDescription><MaxDimensions>9 1/2" X 12 1/2"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="2"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>25.1</Postage><SvcCommitments>6 - 10 Days</SvcCommitments><SvcDescription>Priority Mail International</SvcDescription><MaxDimensions>Maximum length and girth combined 108"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="9"><Pounds>7</Pounds><Ounces>8</Ounces><MailType>Package</MailType><Country>CANADA</Country><Postage>23</Postage><SvcCommitments>6 - 10 Days</SvcCommitments><SvcDescription>Priority Mail International Flat Rate Box</SvcDescription><MaxDimensions>USPS-supplied Priority Mail flat-rate box. Maximum weight 20 pounds.</MaxDimensions><MaxWeight>20</MaxWeight></Service></Package></IntlRateResponse>
@@ -0,0 +1,140 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class FedExTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @packages = TestFixtures.packages
7
+ @locations = TestFixtures.locations
8
+ @carrier = FedEx.new(fixtures(:fedex))
9
+ FedEx.logger = Logger.new('/Users/james/.active_merchant/fedex.log')
10
+ end
11
+
12
+ def test_us_to_canada
13
+ response = nil
14
+ assert_nothing_raised do
15
+ response = @carrier.find_rates(
16
+ @locations[:beverly_hills],
17
+ @locations[:ottawa],
18
+ @packages.values_at(:wii),
19
+ :test => true
20
+ )
21
+ assert !response.rates.blank?
22
+ response.rates.each do |rate|
23
+ assert_instance_of String, rate.service_name
24
+ assert_instance_of Fixnum, rate.price
25
+ end
26
+ end
27
+ end
28
+
29
+ def test_zip_to_zip_fails
30
+ begin
31
+ @carrier.find_rates(
32
+ Location.new(:zip => 40524),
33
+ Location.new(:zip => 40515),
34
+ @packages[:wii],
35
+ :test => true
36
+ )
37
+ rescue ResponseError => e
38
+ assert_match /country\s?code/i, e.message
39
+ assert_match /(missing|invalid)/, e.message
40
+ end
41
+ end
42
+
43
+ # FedEx requires a valid origin and destination postal code
44
+ def test_rates_for_locations_with_only_zip_and_country
45
+ response = @carrier.find_rates(
46
+ @locations[:bare_beverly_hills],
47
+ @locations[:bare_ottawa],
48
+ @packages.values_at(:wii),
49
+ :test => true
50
+ )
51
+
52
+ assert response.rates.size > 0
53
+ end
54
+
55
+ def test_rates_for_location_with_only_country_code
56
+ begin
57
+ response = @carrier.find_rates(
58
+ @locations[:bare_beverly_hills],
59
+ Location.new(:country => 'CA'),
60
+ @packages.values_at(:wii),
61
+ :test => true
62
+ )
63
+ rescue ResponseError => e
64
+ assert_match /postal code/i, e.message
65
+ assert_match /(missing|invalid)/i, e.message
66
+ end
67
+ end
68
+
69
+ def test_invalid_recipient_country
70
+ begin
71
+ response = @carrier.find_rates(
72
+ @locations[:bare_beverly_hills],
73
+ Location.new(:country => 'JP', :zip => '108-8361'),
74
+ @packages.values_at(:wii),
75
+ :test => true
76
+ )
77
+ rescue ResponseError => e
78
+ assert_match /postal code/i, e.message
79
+ assert_match /(missing|invalid)/i, e.message
80
+ end
81
+ end
82
+
83
+ def test_ottawa_to_beverly_hills
84
+ response = nil
85
+ assert_nothing_raised do
86
+ response = @carrier.find_rates(
87
+ @locations[:ottawa],
88
+ @locations[:beverly_hills],
89
+ @packages.values_at(:book, :wii),
90
+ :test => true
91
+ )
92
+ assert !response.rates.blank?
93
+ response.rates.each do |rate|
94
+ assert_instance_of String, rate.service_name
95
+ assert_instance_of Fixnum, rate.price
96
+ end
97
+ end
98
+ end
99
+
100
+ def test_ottawa_to_london
101
+ response = nil
102
+ assert_nothing_raised do
103
+ response = @carrier.find_rates(
104
+ @locations[:ottawa],
105
+ @locations[:london],
106
+ @packages.values_at(:book, :wii),
107
+ :test => true
108
+ )
109
+ assert !response.rates.blank?
110
+ response.rates.each do |rate|
111
+ assert_instance_of String, rate.service_name
112
+ assert_instance_of Fixnum, rate.price
113
+ end
114
+ end
115
+ end
116
+
117
+ def test_beverly_hills_to_london
118
+ response = nil
119
+ assert_nothing_raised do
120
+ response = @carrier.find_rates(
121
+ @locations[:beverly_hills],
122
+ @locations[:london],
123
+ @packages.values_at(:book, :wii),
124
+ :test => true
125
+ )
126
+ assert !response.rates.blank?
127
+ response.rates.each do |rate|
128
+ assert_instance_of String, rate.service_name
129
+ assert_instance_of Fixnum, rate.price
130
+ end
131
+ end
132
+ end
133
+
134
+ def test_tracking
135
+ assert_nothing_raised do
136
+ @carrier.find_tracking_info('077973360403984', :test => true)
137
+ end
138
+ end
139
+
140
+ end
@@ -0,0 +1,88 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class RemoteShipwireTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @packages = TestFixtures.packages
7
+ @locations = TestFixtures.locations
8
+ @carrier = Shipwire.new(fixtures(:shipwire))
9
+ @item1 = { :sku => 'AF0001', :quantity => 2 }
10
+ @item2 = { :sku => 'AF0002', :quantity => 1 }
11
+ @items = [@item1, @item2]
12
+ end
13
+
14
+ def test_successful_domestic_rates_request_for_single_line_item
15
+ response = @carrier.find_rates(
16
+ @locations[:ottawa],
17
+ @locations[:beverly_hills],
18
+ @packages.values_at(:book, :wii),
19
+ :items => [@item1],
20
+ :order_id => '#1000'
21
+ )
22
+
23
+ assert response.success?
24
+ assert_equal 3, response.rates.size
25
+ assert_equal ['1D', '2D', 'GD'], response.rates.collect(&:service_code).sort
26
+ end
27
+
28
+ def test_successful_domestic_rates_request_for_multiple_line_items
29
+ response = @carrier.find_rates(
30
+ @locations[:ottawa],
31
+ @locations[:beverly_hills],
32
+ @packages.values_at(:book, :wii),
33
+ :items => @items,
34
+ :order_id => '#1000'
35
+ )
36
+
37
+ assert response.success?
38
+ assert_equal 3, response.rates.size
39
+ assert_equal ['1D', '2D', 'GD'], response.rates.collect(&:service_code).sort
40
+ end
41
+
42
+ def test_successful_international_rates_request_for_single_line_item
43
+ response = @carrier.find_rates(
44
+ @locations[:ottawa],
45
+ @locations[:london],
46
+ @packages.values_at(:book, :wii),
47
+ :items => [@item1],
48
+ :order_id => '#1000'
49
+ )
50
+
51
+ assert response.success?
52
+ assert_equal 1, response.rates.size
53
+ assert_equal ['INTL'], response.rates.collect(&:service_code)
54
+ end
55
+
56
+ def test_invalid_credentials
57
+ shipwire = Shipwire.new(
58
+ :login => 'your@email.com',
59
+ :password => 'password'
60
+ )
61
+
62
+ begin
63
+ assert_raises(ActiveMerchant::Shipping::ResponseError) do
64
+ shipwire.find_rates(
65
+ @locations[:ottawa],
66
+ @locations[:beverly_hills],
67
+ @packages.values_at(:book, :wii),
68
+ :items => @items,
69
+ :order_id => '#1000'
70
+ )
71
+ end
72
+ rescue ResponseError => e
73
+ assert_equal "Could not verify e-mail/password combination", response.message
74
+ end
75
+ end
76
+
77
+ def test_validate_credentials_with_valid_credentials
78
+ assert @carrier.valid_credentials?
79
+ end
80
+
81
+ def test_validate_credentials_with_invalid_credentials
82
+ shipwire = Shipwire.new(
83
+ :login => 'your@email.com',
84
+ :password => 'password'
85
+ )
86
+ assert !shipwire.valid_credentials?
87
+ end
88
+ end