Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SmartPost Labels & Tracking Bugfix #1

Merged
merged 2 commits into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/fedex/label.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def initialize(label_details = {}, associated_shipments = false)
@response_details = label_details[:process_shipment_reply]
package_details = label_details[:process_shipment_reply][:completed_shipment_detail][:completed_package_details]
@options = package_details[:label]
@options[:tracking_number] = package_details[:tracking_ids][:tracking_number]
@options[:tracking_number] = [package_details[:tracking_ids]].flatten.first[:tracking_number]
end
@options[:format] = label_details[:format]
@options[:file_name] = label_details[:file_name]
Expand Down Expand Up @@ -68,4 +68,4 @@ def associated_shipments
end
end
end
end
end
7 changes: 6 additions & 1 deletion lib/fedex/request/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ class Base
def initialize(credentials, options={})
requires!(options, :shipper, :recipient, :packages)
@credentials = credentials
@shipper, @recipient, @packages, @service_type, @customs_clearance_detail, @debug = options[:shipper], options[:recipient], options[:packages], options[:service_type], options[:customs_clearance_detail], options[:debug]
@shipper = options[:shipper]
@recipient = options[:recipient]
@packages = options[:packages]
@service_type = options[:service_type]
@customs_clearance = options[:customs_clearance]
@smartpost_details = options[:smartpost_details]
@origin = options[:origin]
@debug = ENV['DEBUG'] == 'true'
@shipping_options = options[:shipping_options] ||={}
Expand Down
9 changes: 9 additions & 0 deletions lib/fedex/request/shipment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,21 @@ def add_requested_shipment(xml)
add_shipping_charges_payment(xml)
add_special_services(xml) if @shipping_options[:return_reason] || @shipping_options[:cod] || @shipping_options[:saturday_delivery]
add_customs_clearance(xml) if @customs_clearance_detail
add_smartpost_details(xml) if @smartpost_details
add_custom_components(xml)
xml.RateRequestTypes "ACCOUNT"
add_packages(xml)
}
end

def add_smartpost_details(xml)
xml.SmartPostDetail {
xml.Indicia @smartpost_details[:indicia]
xml.AncillaryEndorsement @smartpost_details[:ancillary_endorsement]
xml.HubId @smartpost_details[:hub_id]
}
end

def add_total_weight(xml)
if @mps.has_key? :total_weight
xml.TotalWeight{
Expand Down
2 changes: 1 addition & 1 deletion lib/fedex/request/tracking_information.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def process_request
if success?(response)
options = response[:track_reply][:track_details]

if response[:track_reply][:duplicate_waybill].downcase == 'true'
if response[:track_reply][:duplicate_waybill] && response[:track_reply][:duplicate_waybill].downcase == 'true'
shipments = []
[options].flatten.map do |details|
options = {:tracking_number => @package_id, :uuid => details[:tracking_number_unique_identifier]}
Expand Down