Method: ActiveMerchant::Billing::PayexGateway#authorize
- Defined in:
- lib/active_merchant/billing/gateways/payex.rb
#authorize(amount, payment_method, options = {}) ⇒ Object
Public: Send an authorize Payex request
amount - The monetary amount of the transaction in cents.
payment_method - The Active Merchant payment method or the store authorization for stored transactions.
options - A standard ActiveMerchant options hash:
:currency - Three letter currency code for the transaction (default: "EUR")
:order_id - The unique order ID for this transaction (required).
:product_number - The merchant product number (default: '1').
:description - The merchant description for this product (default: The :order_id).
:ip - The client IP address (default: '127.0.0.1').
:vat - The vat amount (optional).
Returns an ActiveMerchant::Billing::Response object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/active_merchant/billing/gateways/payex.rb', line 60 def (amount, payment_method, = {}) requires!(, :order_id) amount = amount(amount) if payment_method.respond_to?(:number) # credit card authorization MultiResponse.new.tap do |r| r.process { send_initialize(amount, true, ) } r.process { send_purchasecc(payment_method, r.params['orderref']) } end else # stored authorization send_autopay(amount, payment_method, true, ) end end |