Class: Edi::Commercehub::FaMessageProcessor
- Inherits:
-
BaseEdiService
- Object
- BaseService
- BaseEdiService
- Edi::Commercehub::FaMessageProcessor
- Defined in:
- app/services/edi/commercehub/fa_message_processor.rb
Constant Summary
Constants included from AddressAbbreviator
AddressAbbreviator::MAX_LENGTH
Instance Attribute Summary
Attributes inherited from BaseEdiService
Instance Method Summary collapse
-
#process(batch_process_result) ⇒ Object
BatchProcessResult.
Methods inherited from BaseEdiService
#duplicate_po_already_notified?, #initialize, #mark_duplicate_po_as_notified, #report_order_creation_issues, #safe_process_edi_communication_log
Methods included from AddressAbbreviator
#abbreviate_street, #collect_street_originals, #record_address_abbreviation_notes
Methods inherited from BaseService
#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #options, #tagged_logger
Constructor Details
This class inherits a constructor from Edi::BaseEdiService
Instance Method Details
#process(batch_process_result) ⇒ Object
BatchProcessResult
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/services/edi/commercehub/fa_message_processor.rb', line 7 def process(batch_process_result) b = Nokogiri::XML::Builder.new do |xml| xml.send(:FAMessageBatch, type: '', batchNumber: batch_process_result.batch_number) do xml.send(:partnerID, orchestrator.ch_partner_id) xml.send(:hubFA) do xml.send(:messageBatchLink) batch_process_result.orders_created.each do |order| xml.send(:messageAck, type: 'order') do xml.send(:trxID, order.edi_transaction_id) xml.send(:messageDisposition, status: 'A') end end xml.send(:messageBatchDisposition, status: 'A') do xml.send(:trxReceivedCount, batch_process_result.orders_created.size) xml.send(:trxAcceptedCount, batch_process_result.orders_created.size) end end xml.send(:messageCount, 1) end end EdiCommunicationLog.create_outbound_file_from_data(data: b.to_xml, file_extension: 'fa', partner: orchestrator.partner, category: 'order_fa', data_type: 'xml', resources: batch_process_result.orders_created, file_info: { orders_acknowledged: batch_process_result.orders_created.size }) end |