Class: Returns::SendChargeNotice

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/returns/send_charge_notice.rb

Overview

Final advance-replacement notice — 30 days after an unpaid invoice, and only
once the 20-day reminder has actually gone out. Tells the customer we are
charging for the replacement they kept.

See ReminderLadder for why this matches a date RANGE rather than
an exact day.

Defined Under Namespace

Classes: Result

Constant Summary collapse

AFTER_DAYS =

Days after the invoice date this stage fires.

30

Instance Method Summary collapse

Instance Method Details

#process(_options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/services/returns/send_charge_notice.rb', line 18

def process(_options = {})
  ladder = Returns::ReminderLadder.new(
    days: AFTER_DAYS,
    sent_column: :charge_notice_sent_at,
    requires: :reminder_2_sent_at,
    system_code: 'RMA_CHARGE'
  )

  outcome = ladder.deliver_all(logger:)
  logger.warn "[RMA_CHARGE] #{outcome.failed.size} RMA(s) failed: #{outcome.failed.join(', ')}" unless outcome.complete?

  Result.new(rmas: outcome.delivered)
end