Sha256: ddc62fad79ac81a2497322344d6016474462db5c87d4e7da3fe670b802de41f3
Contents?: true
Size: 1.36 KB
Versions: 7
Compression:
Stored size: 1.36 KB
Contents
require 'quick_travel/adapter' require 'quick_travel/credit_card' module QuickTravel class Payment < Adapter def payment_type QuickTravel::PaymentType.find(@payment_type_id) end def self.create(options = {}) post_and_validate("/front_office/bookings/#{options[:booking_id]}/payments.json", options) end def self.get_redirect_url(options) response = get_and_validate("/api/checkouts/migs_redirect_url.json", options) response[:redirect_url] end def self.handle_redirected_payment(options) get_and_validate('/api/redirected_payments', options) end def self.charge_account(booking, payment_options = {}) 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 = payment_options[:agent_booking_reference] amount = payment_options[:amount].presence options = { 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", options) end end end
Version data entries
7 entries across 7 versions & 1 rubygems