Class: RefundGuarantee::ExpireRefundStatusWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- RefundGuarantee::ExpireRefundStatusWorker
- Defined in:
- app/workers/refund_guarantee/expire_refund_status_worker.rb
Instance Method Summary collapse
-
#perform(reservation_id) ⇒ void
Expires refund guarantees that have passed their refundable_until deadline.
Methods inherited from ApplicationWorker
Instance Method Details
#perform(reservation_id) ⇒ void
This method returns an undefined value.
Expires refund guarantees that have passed their refundable_until deadline
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/workers/refund_guarantee/expire_refund_status_worker.rb', line 15 def perform(reservation_id) return if reservation_id.blank? set_business_context(reservation_id) reservation = find_reservation(reservation_id) refund_guarantee = reservation.refund_guarantee if refund_guarantee.blank? BUSINESS_LOGGER.info( 'No refund guarantee found for reservation, skipping expiration', { reservation_id: reservation.id }, ) return end return unless should_expire_refund_guarantee?(reservation, refund_guarantee) expire_refund_guarantee(reservation, refund_guarantee) rescue ActiveRecord::RecordNotFound handle_record_not_found(reservation_id) rescue StandardError => e handle_error(e, reservation_id) end |