Sha256: 6b5b087a518ab60aebe344ad891c708b201e7cc16879c3db4cc5faaf1bd60b86
Contents?: true
Size: 969 Bytes
Versions: 17
Compression:
Stored size: 969 Bytes
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.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
17 entries across 17 versions & 1 rubygems