Class: Edi::CreditMemoEventProcessor
- Inherits:
-
BaseService
- Object
- BaseService
- Edi::CreditMemoEventProcessor
- Defined in:
- app/services/edi/credit_memo_event_processor.rb
Overview
Service object: credit memo event processor.
Instance Attribute Summary
Attributes inherited from BaseService
Instance Method Summary collapse
- #load_orchestrator(customer_id) ⇒ Object
- #process(credit_memo, event, options = {}) ⇒ Object
- #process_creation(credit_memo, _options = {}) ⇒ Object
Methods inherited from BaseService
#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #tagged_logger
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#load_orchestrator(customer_id) ⇒ Object
22 23 24 |
# File 'app/services/edi/credit_memo_event_processor.rb', line 22 def load_orchestrator(customer_id) Edi::BaseOrchestrator.orchestrator_for_customer_id(customer_id) end |
#process(credit_memo, event, options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'app/services/edi/credit_memo_event_processor.rb', line 6 def process(credit_memo, event, = {}) case event when :created process_creation(credit_memo, ) end end |
#process_creation(credit_memo, _options = {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/services/edi/credit_memo_event_processor.rb', line 13 def process_creation(credit_memo, = {}) return unless credit_memo.invoice&.order&.edi_transaction_id # Order doesn't come from EDI return unless (o = load_orchestrator(credit_memo.customer_id)) logger.info "Edi -> Processing creation event for credit_memo id #{credit_memo.id}" # Here we use the invoice 810 message processor for credit memos with strategic negative amounts and reference numbers o..create_credit_memo(credit_memo) if o. end |