Class: Returns::SendSecondReminder

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

Overview

Second advance-replacement reminder — 20 days after an unpaid invoice, and
only once the 10-day reminder has actually gone out.

Also opens an RMAOUT follow-up activity for the rep, so a customer who has
ignored two notices gets a human chasing them before the 30-day charge.

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.

20

Instance Method Summary collapse

Instance Method Details

#process(_options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/services/returns/send_second_reminder.rb', line 20

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

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

  Result.new(rmas: outcome.delivered)
end