Class: QuickTravel::Payment
- Defined in:
- lib/quick_travel/payment.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Adapter
all, belongs_to, create, find, has_many, #to_s, update
Methods included from InitFromHash
#define_readers, #initialize, #to_hash
Class Method Details
.charge_account(booking, payment_options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/quick_travel/payment.rb', line 10 def self.charge_account(booking, = {}) payment_type = booking.on_account_payment_type if payment_type.nil? fail ArgumentError, 'Booking not allowed to be paid on account' end agent_booking_reference = [:agent_booking_reference] amount = [:amount].presence = { payment: { payment_type_id: payment_type.id, uid: SecureRandom.hex(16), comment: agent_booking_reference, amount: amount, currency_iso_code: 'AUD' }, pay_balance: amount.nil? } post_and_validate("/api/bookings/#{booking.id}/payments.json", ) end |
Instance Method Details
#payment_type ⇒ Object
6 7 8 |
# File 'lib/quick_travel/payment.rb', line 6 def payment_type QuickTravel::PaymentType.find(@payment_type_id) end |