From 44e70191cfdc82cbbce0eaae21b6764ad2f95b07 Mon Sep 17 00:00:00 2001 From: Ian Date: Thu, 20 Oct 2016 11:53:14 -0400 Subject: [PATCH] Add support for Electronic Trade Documents generation --- lib/fedex/request/shipment.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/fedex/request/shipment.rb b/lib/fedex/request/shipment.rb index 9b54f752..cb5b3619 100644 --- a/lib/fedex/request/shipment.rb +++ b/lib/fedex/request/shipment.rb @@ -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{ @@ -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