1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-05 16:24:21 +01:00
fab-manager/app/services/reservations/reserve.rb

17 lines
527 B
Ruby
Raw Normal View History

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