lib/omniship/carriers/ups.rb in omniship-0.4.0 vs lib/omniship/carriers/ups.rb in omniship-0.4.1

- old
+ new

@@ -223,10 +223,18 @@ xml.BillShipper { xml.AccountNumber options[:origin_account] } } } + if options[:return_service_code].present? + xml.ReturnService { + xml.Code options[:return_service_code] + # if options[:return_service_description].present? + # xml.Description options[:return_service_description] + # end + } + end xml.Service { xml.Code options[:service] } xml.ShipmentServiceOptions { xml.SaturdayDelivery if options[:saturday] == true @@ -234,18 +242,10 @@ xml.DeliveryConfirmation { xml.DCISType options[:delivery_confirmation_type] } end } - if options[:return_service_code].present? - xml.ReturnService { - xml.Code options[:return_service_code] - if options[:return_service_description].present? - xml.Description options[:return_service_description] - end - } - end packages.each do |package| imperial = ['US', 'LR', 'MM'].include?(origin.country_code(:alpha2)) xml.Package { xml.PackagingType { xml.Code package.options[:package_type] @@ -502,11 +502,12 @@ service_code = rated_shipment.xpath('Service/Code').text.to_s days_to_delivery = rated_shipment.xpath('GuaranteedDaysToDelivery').text.to_s.to_i delivery_date = days_to_delivery >= 1 ? days_to_delivery.days.from_now.strftime("%Y-%m-%d") : nil rate_estimates << RateEstimate.new(origin, destination, @@name, - service_name_for(origin, service_code), + :service_code => service_code, + :service_name => service_name_for(origin, service_code), :total_price => rated_shipment.xpath('TotalCharges/MonetaryValue').text.to_s.to_f, :currency => rated_shipment.xpath('TotalCharges/CurrencyCode').text.to_s, :service_code => service_code, :packages => packages, :delivery_range => [delivery_date]) @@ -625,9 +626,10 @@ return @response_text end def parse_ship_accept_response(response, options={}) xml = Nokogiri::XML(response) + puts xml success = response_success?(xml) @response_text = {} if success tracking_number = []