active_shipping 0.1.4 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/CHANGELOG +2 -0
  2. data/README.markdown +0 -3
  3. data/lib/active_merchant/common.rb +14 -0
  4. data/lib/{active_shipping/lib → active_merchant/common}/connection.rb +2 -0
  5. data/lib/{active_shipping/lib → active_merchant/common}/country.rb +0 -0
  6. data/lib/active_merchant/common/error.rb +26 -0
  7. data/lib/active_merchant/common/post_data.rb +24 -0
  8. data/lib/{active_shipping/lib → active_merchant/common}/posts_data.rb +0 -0
  9. data/lib/{active_shipping/lib → active_merchant/common}/requires_parameters.rb +0 -0
  10. data/lib/{active_shipping/lib → active_merchant/common}/utils.rb +0 -0
  11. data/lib/{active_shipping/lib → active_merchant/common}/validateable.rb +0 -0
  12. data/lib/active_shipping.rb +10 -22
  13. data/lib/active_shipping/shipping/base.rb +2 -1
  14. data/lib/active_shipping/shipping/carrier.rb +0 -5
  15. data/lib/active_shipping/shipping/carriers.rb +2 -1
  16. data/lib/active_shipping/shipping/carriers/fedex.rb +7 -191
  17. data/lib/active_shipping/shipping/carriers/kunaki.rb +165 -0
  18. data/lib/active_shipping/shipping/carriers/ups.rb +2 -1
  19. data/lib/active_shipping/shipping/carriers/usps.rb +0 -85
  20. data/lib/active_shipping/shipping/location.rb +1 -4
  21. data/lib/active_shipping/shipping/response.rb +1 -4
  22. data/lib/active_shipping/version.rb +3 -0
  23. data/lib/vendor/quantified/lib/quantified.rb +5 -3
  24. metadata +68 -102
  25. data/.gitignore +0 -8
  26. data/Rakefile +0 -51
  27. data/VERSION +0 -1
  28. data/active_shipping.gemspec +0 -152
  29. data/init.rb +0 -1
  30. data/lib/active_shipping/lib/error.rb +0 -4
  31. data/lib/active_shipping/lib/post_data.rb +0 -22
  32. data/lib/active_shipping/shipping/contact.rb +0 -18
  33. data/lib/active_shipping/shipping/label.rb +0 -31
  34. data/lib/active_shipping/shipping/location_response.rb +0 -14
  35. data/lib/active_shipping/shipping/party.rb +0 -15
  36. data/lib/active_shipping/shipping/return_label_response.rb +0 -14
  37. data/lib/active_shipping/shipping/return_shipment.rb +0 -14
  38. data/lib/active_shipping/shipping/shipment.rb +0 -73
  39. data/test/fixtures.example.yml +0 -13
  40. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_request.xml +0 -67
  41. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_response.xml +0 -213
  42. data/test/fixtures/xml/fedex/tracking_request.xml +0 -27
  43. data/test/fixtures/xml/fedex/tracking_response.xml +0 -153
  44. data/test/fixtures/xml/shipwire/international_rates_response.xml +0 -17
  45. data/test/fixtures/xml/shipwire/invalid_credentials_response.xml +0 -4
  46. data/test/fixtures/xml/shipwire/new_carrier_rate_response.xml +0 -18
  47. data/test/fixtures/xml/shipwire/no_rates_response.xml +0 -7
  48. data/test/fixtures/xml/shipwire/rates_response.xml +0 -36
  49. data/test/fixtures/xml/ups/example_tracking_response.xml +0 -53
  50. data/test/fixtures/xml/ups/shipment_from_tiger_direct.xml +0 -222
  51. data/test/fixtures/xml/ups/test_real_home_as_residential_destination_response.xml +0 -1
  52. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_book_rate_response.xml +0 -85
  53. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_book_wii_rate_response.xml +0 -168
  54. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_wii_rate_response.xml +0 -85
  55. data/test/fixtures/xml/usps/example_tracking_response.xml +0 -104
  56. data/test/fixtures/xml/usps/multi_tracking_example.xml +0 -105
  57. data/test/party_factory.rb +0 -29
  58. data/test/remote/fedex_test.rb +0 -160
  59. data/test/remote/shipwire_test.rb +0 -88
  60. data/test/remote/ups_test.rb +0 -207
  61. data/test/remote/usps_test.rb +0 -184
  62. data/test/shipment_factory.rb +0 -27
  63. data/test/test_helper.rb +0 -171
  64. data/test/unit/base_test.rb +0 -18
  65. data/test/unit/carriers/fedex_test.rb +0 -78
  66. data/test/unit/carriers/shipwire_test.rb +0 -130
  67. data/test/unit/carriers/ups_test.rb +0 -81
  68. data/test/unit/carriers/usps_test.rb +0 -206
  69. data/test/unit/location_test.rb +0 -46
  70. data/test/unit/package_test.rb +0 -65
  71. data/test/unit/party_test.rb +0 -20
  72. data/test/unit/response_test.rb +0 -10
  73. data/test/unit/shipment_test.rb +0 -43
@@ -1,85 +0,0 @@
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>
@@ -1,104 +0,0 @@
1
- <?xml version="1.0"?>
2
- <TrackResponse>
3
-
4
- <TrackInfo ID="EJ958083578US">
5
-
6
- <TrackSummary>
7
-
8
- <EventTime>8:10 am</EventTime>
9
-
10
- <EventDate>June 1, 2001</EventDate>
11
-
12
- <Event>DELIVERED</Event>
13
-
14
- <EventCity>WILMINGTON</EventCity>
15
-
16
- <EventState>DE</EventState>
17
-
18
- <EventZIPCode>19801</EventZIPCode>
19
-
20
- <EventCountry/>
21
-
22
- <FirmName></FirmName>
23
-
24
- <Name></Name>
25
-
26
- <AuthorizedAgent></AuthorizedAgent>
27
-
28
- </TrackSummary>
29
-
30
- <TrackDetail>
31
-
32
- <EventTime>11:07 am</EventTime>
33
-
34
- <EventDate>May 30, 2001</EventDate>
35
-
36
- <Event>NOTICE LEFT</Event>
37
-
38
- <EventCity>WILMINGTON</EventCity>
39
-
40
- <EventState>DE</EventState>
41
-
42
- <EventZIPCode>19801</EventZIPCode>
43
-
44
- <EventCountry/>
45
-
46
- <FirmName/>
47
-
48
- <Name/>
49
-
50
- <AuthorizedAgent/>
51
-
52
- </TrackDetail>
53
-
54
- <TrackDetail>
55
-
56
- <EventTime>10:08 am</EventTime>
57
-
58
- <EventDate>May 30, 2001</EventDate>
59
-
60
- <Event>ARRIVAL AT UNIT</Event>
61
-
62
- <EventCity>WILMINGTON</EventCity>
63
-
64
- <EventState>DE</EventState>
65
-
66
- <EventZIPCode>19850</EventZIPCode>
67
-
68
- <EventCountry/>
69
-
70
- <FirmName/>
71
-
72
- <Name/>
73
-
74
- <AuthorizedAgent/>
75
-
76
- </TrackDetail>
77
-
78
- <TrackDetail>
79
-
80
- <EventTime>9:55 pm</EventTime>
81
-
82
- <EventDate>May 29, 2001</EventDate>
83
-
84
- <Event>ACCEPTANCE</Event>
85
-
86
- <EventCity>EDGEWATER</EventCity>
87
-
88
- <EventState>NJ</EventState>
89
-
90
- <EventZIPCode>07020</EventZIPCode>
91
-
92
- <EventCountry/>
93
-
94
- <FirmName/>
95
-
96
- <Name/>
97
-
98
- <AuthorizedAgent/>
99
-
100
- </TrackDetail>
101
-
102
- </TrackInfo>
103
-
104
- </TrackResponse>
@@ -1,105 +0,0 @@
1
- <?xml version="1.0"?>
2
- <TrackResponse>
3
-
4
- <TrackInfo ID="EJ958083578US">
5
-
6
- <TrackSummary>
7
-
8
- <EventTime>8:10 am</EventTime>
9
-
10
- <EventDate>June 1, 2001</EventDate>
11
-
12
- <Event>DELIVERED</Event>
13
-
14
- <EventCity>WILMINGTON</EventCity>
15
-
16
- <EventState>DE</EventState>
17
-
18
- <EventZIPCode>19801</EventZIPCode>
19
-
20
- <EventCountry/>
21
-
22
- <FirmName></FirmName>
23
-
24
- <Name></Name>
25
-
26
- <AuthorizedAgent></AuthorizedAgent>
27
-
28
- </TrackSummary>
29
-
30
- <TrackDetail>
31
-
32
- <EventTime>11:07 am</EventTime>
33
-
34
- <EventDate>May 30, 2001</EventDate>
35
-
36
- <Event>NOTICE LEFT</Event>
37
-
38
- <EventCity>WILMINGTON</EventCity>
39
-
40
- <EventState>DE</EventState>
41
-
42
- <EventZIPCode>19801</EventZIPCode>
43
-
44
- <EventCountry/>
45
-
46
- <FirmName/>
47
-
48
- <Name/>
49
-
50
- <AuthorizedAgent/>
51
-
52
- </TrackDetail>
53
-
54
- <TrackDetail>
55
-
56
- <EventTime>10:08 am</EventTime>
57
-
58
- <EventDate>May 30, 2001</EventDate>
59
-
60
- <Event>ARRIVAL AT UNIT</Event>
61
-
62
- <EventCity>WILMINGTON</EventCity>
63
-
64
- <EventState>DE</EventState>
65
-
66
- <EventZIPCode>19850</EventZIPCode>
67
-
68
- <EventCountry/>
69
-
70
- <FirmName/>
71
-
72
- <Name/>
73
-
74
- <AuthorizedAgent/>
75
-
76
- </TrackDetail>
77
-
78
- <TrackDetail>
79
-
80
- <EventTime>9:55 pm</EventTime>
81
-
82
- <EventDate>May 29, 2001</EventDate>
83
-
84
- <Event>ACCEPTANCE</Event>
85
-
86
- <EventCity>EDGEWATER</EventCity>
87
-
88
- <EventState>NJ</EventState>
89
-
90
- <EventZIPCode>07020</EventZIPCode>
91
-
92
- <EventCountry/>
93
-
94
- <FirmName/>
95
-
96
- <Name/>
97
-
98
- <AuthorizedAgent/>
99
-
100
- </TrackDetail>
101
-
102
- </TrackInfo>
103
-
104
- <TrackInfo ID="EJ958088694US"><TrackSummary><EventTime>1:39 pm</EventTime><EventDate>June 1, 2001</EventDate><Event>DELIVERED</Event><EventCity>WOBURN</EventCity><EventState>MA</EventState><EventZIPCode>01815</EventZIPCode><EventCountry/><FirmName></FirmName><Name></Name><AuthorizedAgent></AuthorizedAgent></TrackSummary><TrackDetail><EventTime>7:44 am</EventTime><EventDate>May 30, 2001</EventDate><Event>NOTICE LEFT</Event><EventCity>WOBURN</EventCity><EventState>MA</EventState><EventZIPCode>01815</EventZIPCode><EventCountry/><FirmName/><Name/><AuthorizedAgent/></TrackDetail><TrackDetail><EventTime>7:36 am</EventTime><EventDate>May 30, 2001</EventDate><Event>ARRIVAL AT UNIT</Event><EventCity>NORTH READING</EventCity><EventState>MA</EventState><EventZIPCode>01889</EventZIPCode><EventCountry/><FirmName/><Name/><AuthorizedAgent/></TrackDetail><TrackDetail><EventTime>6:00 pm</EventTime><EventDate>May 29, 2001</EventDate><Event>ACCEPTANCE</Event><EventCity>PORTSMOUTH</EventCity><EventState>NH</EventState><EventZIPCode>03801</EventZIPCode><EventCountry/><FirmName/><Name/><AuthorizedAgent/></TrackDetail></TrackInfo>
105
- </TrackResponse>
@@ -1,29 +0,0 @@
1
- class PartyFactory
2
- include ActiveMerchant::Shipping
3
- def self.build(carrier = :fedex, attrs = {})
4
- default_location = Location.new(
5
- :country => 'US',
6
- :state => 'MA',
7
- :address1 => '4 Yawkey Way',
8
- :city => 'Boston',
9
- :state => 'MA',
10
- :zip => '02215'
11
- )
12
-
13
- default_contact = Contact.new(
14
- :name => 'John Smith',
15
- :company => 'Red Sox',
16
- :phone_number => '1-555-867-5309',
17
- :fax_number => '1-555-867-5310',
18
- :email_address => 'user@example.com'
19
- )
20
-
21
- default_attrs = {
22
- :location => default_location,
23
- :contact => default_contact,
24
- :account_number => '5555555'
25
- }
26
-
27
- Party.new(default_attrs.merge(attrs))
28
- end
29
- end
@@ -1,160 +0,0 @@
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).merge(:test => true))
9
- #FedEx.logger = Logger.new('/Users/james/.active_merchant/fedex.log')
10
- end
11
-
12
- def test_valid_credentials
13
- assert @carrier.valid_credentials?
14
- end
15
-
16
- def test_us_to_canada
17
- response = nil
18
- assert_nothing_raised do
19
- response = @carrier.find_rates(
20
- @locations[:beverly_hills],
21
- @locations[:ottawa],
22
- @packages.values_at(:wii)
23
- )
24
- assert !response.rates.blank?
25
- response.rates.each do |rate|
26
- assert_instance_of String, rate.service_name
27
- assert_instance_of Fixnum, rate.price
28
- end
29
- end
30
- end
31
-
32
- def test_zip_to_zip_fails
33
- begin
34
- @carrier.find_rates(
35
- Location.new(:zip => 40524),
36
- Location.new(:zip => 40515),
37
- @packages[:wii]
38
- )
39
- rescue ResponseError => e
40
- assert_match /country\s?code/i, e.message
41
- assert_match /(missing|invalid)/, e.message
42
- end
43
- end
44
-
45
- # FedEx requires a valid origin and destination postal code
46
- def test_rates_for_locations_with_only_zip_and_country
47
- response = @carrier.find_rates(
48
- @locations[:bare_beverly_hills],
49
- @locations[:bare_ottawa],
50
- @packages.values_at(:wii)
51
- )
52
-
53
- assert response.rates.size > 0
54
- end
55
-
56
- def test_rates_for_location_with_only_country_code
57
- begin
58
- response = @carrier.find_rates(
59
- @locations[:bare_beverly_hills],
60
- Location.new(:country => 'CA'),
61
- @packages.values_at(:wii)
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
- )
76
- rescue ResponseError => e
77
- assert_match /postal code/i, e.message
78
- assert_match /(missing|invalid)/i, e.message
79
- end
80
- end
81
-
82
- def test_ottawa_to_beverly_hills
83
- response = nil
84
- assert_nothing_raised do
85
- response = @carrier.find_rates(
86
- @locations[:ottawa],
87
- @locations[:beverly_hills],
88
- @packages.values_at(:book, :wii)
89
- )
90
- assert !response.rates.blank?
91
- response.rates.each do |rate|
92
- assert_instance_of String, rate.service_name
93
- assert_instance_of Fixnum, rate.price
94
- end
95
- end
96
- end
97
-
98
- def test_ottawa_to_london
99
- response = nil
100
- assert_nothing_raised do
101
- response = @carrier.find_rates(
102
- @locations[:ottawa],
103
- @locations[:london],
104
- @packages.values_at(:book, :wii)
105
- )
106
- assert !response.rates.blank?
107
- response.rates.each do |rate|
108
- assert_instance_of String, rate.service_name
109
- assert_instance_of Fixnum, rate.price
110
- end
111
- end
112
- end
113
-
114
- def test_beverly_hills_to_london
115
- response = nil
116
- assert_nothing_raised do
117
- response = @carrier.find_rates(
118
- @locations[:beverly_hills],
119
- @locations[:london],
120
- @packages.values_at(:book, :wii)
121
- )
122
- assert !response.rates.blank?
123
- response.rates.each do |rate|
124
- assert_instance_of String, rate.service_name
125
- assert_instance_of Fixnum, rate.price
126
- end
127
- end
128
- end
129
-
130
- def test_tracking
131
- assert_nothing_raised do
132
- @carrier.find_tracking_info('077973360403984', :test => true)
133
- end
134
- end
135
-
136
- def test_return_label
137
- shipment = ShipmentFactory.build
138
- shipment.shipper.account_number = fixtures(:fedex)[:account]
139
- shipment.payor_account_number = fixtures(:fedex)[:account]
140
- shipment.payor_account_country = 'US'
141
- shipment.label.image_type = 'PDF'
142
- @carrier.get_return_label(shipment, :test => true)
143
- assert_not_nil shipment.label.image
144
- assert_not_nil shipment.tracking_number
145
- end
146
-
147
- def test_address_validation
148
- party = PartyFactory.build
149
- @carrier.validate_location(party.location, :test => true)
150
- assert party.location.valid
151
- assert_equal 100, party.location.score
152
- end
153
-
154
- def test_address_validation_with_bunk_address
155
- party = PartyFactory.build
156
- party.location.stubs(:address1).returns('44 Foeawrfsadfasd Street')
157
- @carrier.validate_location(party.location, :test => true)
158
- assert !party.location.valid
159
- end
160
- end