2019-04-25 15:09:37 +02:00
|
|
|
# frozen_string_literal: true
|
2018-12-11 15:07:21 +01:00
|
|
|
|
2019-04-25 15:09:37 +02:00
|
|
|
# Provides helper methods for Reservation actions
|
|
|
|
class Reservations::Reserve
|
2019-06-12 12:22:38 +02:00
|
|
|
attr_accessor :user_id, :operator_profile_id
|
2019-04-25 15:09:37 +02:00
|
|
|
|
2019-06-12 12:22:38 +02:00
|
|
|
def initialize(user_id, operator_profile_id)
|
2019-04-25 15:09:37 +02:00
|
|
|
@user_id = user_id
|
2019-06-12 12:22:38 +02:00
|
|
|
@operator_profile_id = operator_profile_id
|
2019-04-25 15:09:37 +02:00
|
|
|
end
|
2018-12-11 15:07:21 +01:00
|
|
|
|
2019-09-10 11:46:14 +02:00
|
|
|
def pay_and_save(reservation, coupon)
|
2019-06-06 16:34:53 +02:00
|
|
|
reservation.statistic_profile_id = StatisticProfile.find_by(user_id: user_id).id
|
2019-09-10 11:46:14 +02:00
|
|
|
reservation.save_with_payment(operator_profile_id, coupon)
|
2018-12-11 15:07:21 +01:00
|
|
|
end
|
2019-03-18 11:11:09 +01:00
|
|
|
end
|