Class: Edi::MiraklSeller::FaMessageProcessor
- Inherits:
-
BaseEdiService
- Object
- BaseService
- BaseEdiService
- Edi::MiraklSeller::FaMessageProcessor
- Defined in:
- app/services/edi/mirakl_seller/fa_message_processor.rb
Constant Summary
Constants included from AddressAbbreviator
AddressAbbreviator::MAX_LENGTH
Instance Attribute Summary
Attributes inherited from BaseEdiService
Instance Method Summary collapse
- #accept_order_lines_hash(order) ⇒ Object
-
#process(order) ⇒ 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
#accept_order_lines_hash(order) ⇒ Object
26 27 28 |
# File 'app/services/edi/mirakl_seller/fa_message_processor.rb', line 26 def accept_order_lines_hash(order) order.line_items.non_shipping.map { |a| { accepted: true, id: a.edi_reference } } end |
#process(order) ⇒ Object
BatchProcessResult
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/edi/mirakl_seller/fa_message_processor.rb', line 7 def process(order) edi_log = nil h = { order_lines: accept_order_lines_hash(order) } EdiCommunicationLog.transaction do edi_log = EdiCommunicationLog.new partner: orchestrator.partner, category: 'order_fa', data: h.to_json, data_type: 'json', transmit_datetime: Time.current end edi_log.save! edi_log.edi_documents.create!(order: order) edi_log end |