Class: Workers::Reservations::CheckPaymentWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- Workers::Reservations::CheckPaymentWorker
- Defined in:
- app/workers/workers/reservations/check_payment_worker.rb
Overview
Sometimes there are cases where user presses cancel button but the payment still continues, so we need to restore the reservation status back to pending_arrival
Instance Method Summary collapse
Methods inherited from ApplicationWorker
Instance Method Details
#perform(reservation_id) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/workers/workers/reservations/check_payment_worker.rb', line 9 def perform(reservation_id) reservation = Reservation.find(reservation_id) # only process cancelled reservation with paid charges return unless reservation.cancelled? && reservation.paid_charges.present? # skip if already refunded return if reservation.status_as_symbol == :cancelled_with_refund # skip shopee pay refund case return if reservation.shopee_pay_provider? && reservation.refund? update_reservation(reservation) end |