Permalink
Browse files

Merge branch 'master' of github.com:optoro/active_shipping

  • Loading branch information...
2 parents 39ca2ba + 5b04010 commit 64cb1405ec9082472232747d10c0b2ebd2f2acd9 @jszmajda jszmajda committed Feb 2, 2013
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/active_shipping/shipping/carriers/endicia.rb
@@ -29,11 +29,13 @@ class Endicia < Carrier
}
INTERNATIONAL_SERVICES = {
- 'FirstClassMailInternational' => 'First-Class Mail International',
+ 'FirstClassPackageInternationalService' => 'First-Class Package International Service',
'PriorityMailInternational' => 'Priority Mail International',
'ExpressMailInternational' => 'Express Mail Internaional'
}
+ FIRST_CLASS_VERIFY_COUNTRIES = ['CA']
+
ENDICIA_EVENT_CODES = {
'-1' => 'NF',
'0' => 'NS',
@@ -207,6 +209,11 @@ def build_label_request(shipment, package, verify=false, opts={})
xml.tag!("CustomsValue#{n}", format_currency(cd.value_cents))
xml.tag!("CustomsCountry#{n}", shipment.origin.country.name)
end
+
+ if (shipment.service == "FirstClassPackageInternationalService") &&
+ (FIRST_CLASS_VERIFY_COUNTRIES.include? shipment.destination.country.code(:alpha2))
+ service_options['DeliveryConfirmation'] = 'ON'
+ end
else
service_options['DeliveryConfirmation'] = 'ON'
end
@@ -432,11 +439,11 @@ def format_currency(value_cents)
end
def supports_epl2?(shipment)
- !shipment.international? || shipment.service == 'FirstClassMailInternational'
+ !shipment.international? || shipment.service == 'FirstClassPackageInternationalService'
end
def supports_international_epl2?(shipment)
- shipment.international? and shipment.service != 'FirstClassMailInternational'
+ shipment.international? and shipment.service != 'FirstClassPackageInternationalService'
end
def calculate_postage_rate

0 comments on commit 64cb140

Please sign in to comment.