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

Add support for Electronic Trade Documents generation #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 20 additions & 1 deletion lib/fedex/request/shipment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,30 @@ def add_requested_shipment(xml)
add_origin(xml) if @origin
add_recipient(xml)
add_shipping_charges_payment(xml)
add_special_services(xml) if @shipping_options[:return_reason] || @shipping_options[:cod] || @shipping_options[:saturday_delivery]
if @shipping_options[:return_reason] || @shipping_options[:cod] || @shipping_options[:saturday_delivery] || @shipping_options[:electronic_trade_documents]
add_special_services(xml)
end
add_customs_clearance(xml) if @customs_clearance_detail
add_custom_components(xml)
add_commercial_invoice_specification(xml) if @shipping_options[:electronic_trade_documents]
xml.RateRequestTypes "ACCOUNT"
add_packages(xml)
}
end

def add_commercial_invoice_specification(xml)
xml.ShippingDocumentSpecification {
xml.ShippingDocumentTypes 'COMMERCIAL_INVOICE'
xml.CommercialInvoiceDetail {
xml.Format {
xml.ImageType 'PDF'
xml.StockType 'PAPER_LETTER'
xml.ProvideInstructions '1'
}
}
}
end

def add_total_weight(xml)
if @mps.has_key? :total_weight
xml.TotalWeight{
Expand Down Expand Up @@ -122,6 +138,9 @@ def add_special_services(xml)
if @shipping_options[:saturday_delivery]
xml.SpecialServiceTypes "SATURDAY_DELIVERY"
end
if @shipping_options[:electronic_trade_documents]
xml.SpecialServiceTypes 'ELECTRONIC_TRADE_DOCUMENTS'
end
}
end

Expand Down