Class: Edi::MiraklSeller::ConfirmMessageProcessor
- Inherits:
-
BaseEdiService
- Object
- BaseService
- BaseEdiService
- Edi::MiraklSeller::ConfirmMessageProcessor
- Defined in:
- app/services/edi/mirakl_seller/confirm_message_processor.rb
Overview
Service object: confirm message processor.
Constant Summary
Constants included from AddressAbbreviator
AddressAbbreviator::MAX_LENGTH
Instance Attribute Summary
Attributes inherited from BaseEdiService
Attributes inherited from BaseService
Instance Method Summary collapse
- #acknowledge_order(order, options = {}) ⇒ Object
- #build_confirm_message_from_invoice(invoice) ⇒ Object
- #cancel_order(order) ⇒ Object
- #confirm_invoice(invoice) ⇒ Object
-
#process(confirm_message, category, order = nil) ⇒ Object
Picks up the edi communication log in the queue ready to process, generate acknowledgements/shipments.
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, #tagged_logger
Constructor Details
This class inherits a constructor from Edi::BaseEdiService
Instance Method Details
#acknowledge_order(order, options = {}) ⇒ Object
6 7 8 |
# File 'app/services/edi/mirakl_seller/confirm_message_processor.rb', line 6 def acknowledge_order(order, = {}) # do nothing for Mirakl. end |
#build_confirm_message_from_invoice(invoice) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/services/edi/mirakl_seller/confirm_message_processor.rb', line 19 def (invoice) invoice.order delivery = invoice.delivery delivery.line_items.where.not(edi_reference: nil).order(:edi_line_number) partner_namespace = (orchestrator.try(:namespace) || orchestrator.partner).to_sym carrier_code = partner_namespace == :bricodepot_es ? 'courier_gls' : 'gls' { # Talk to Ramie about this # "carrier_name": "gls", carrier_code: carrier_code, # "carrier_standard_code": "dpd", tracking_number: delivery&.master_tracking_number || delivery&.carrier_bol } end |
#cancel_order(order) ⇒ Object
10 11 12 |
# File 'app/services/edi/mirakl_seller/confirm_message_processor.rb', line 10 def cancel_order(order) # do nothing for Mirakl end |
#confirm_invoice(invoice) ⇒ Object
14 15 16 17 |
# File 'app/services/edi/mirakl_seller/confirm_message_processor.rb', line 14 def confirm_invoice(invoice) m = (invoice) process(m, :order_confirm, invoice.order) end |
#process(confirm_message, category, order = nil) ⇒ Object
Picks up the edi communication log in the queue ready to process, generate acknowledgements/shipments
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/services/edi/mirakl_seller/confirm_message_processor.rb', line 37 def process(, category, order = nil) edi_log = nil EdiCommunicationLog.transaction do edi_log = EdiCommunicationLog.create! partner: orchestrator.partner, category: category, data: .to_json, data_type: 'json', transmit_datetime: Time.current end edi_log.edi_documents.create!(order: order) if order.present? edi_log end |