Class: ActiveMerchant::Billing::ElavonGateway
- Inherits:
-
ViaklixGateway
- Object
- Gateway
- ViaklixGateway
- ActiveMerchant::Billing::ElavonGateway
- Defined in:
- lib/active_merchant/billing/gateways/elavon.rb
Overview
Elavon Virtual Merchant Gateway
Example use:
gateway = ActiveMerchant::Billing::ElavonGateway.new(
:login => "my_virtual_merchant_id",
:password => "my_virtual_merchant_pin",
:user => "my_virtual_merchant_user_id" # optional
)
# set up credit card obj as in main ActiveMerchant example
creditcard = ActiveMerchant::Billing::CreditCard.new(
:type => 'visa',
:number => '41111111111111111',
:month => 10,
:year => 2011,
:first_name => 'Bob',
:last_name => 'Bobsen'
)
# run request
response = gateway.purchase(1000, creditcard) # authorize and capture 10 USD
puts response.success? # Check whether the transaction was successful
puts response. # Retrieve the message returned by Elavon
puts response. # Retrieve the unique transaction ID returned by Elavon
Constant Summary
Constants inherited from ViaklixGateway
Constants inherited from Gateway
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#authorize(money, creditcard, options = {}) ⇒ Object
Authorize a credit card for a given amount.
-
#capture(money, authorization, options = {}) ⇒ Object
Capture authorized funds from a credit card.
Methods inherited from ViaklixGateway
#credit, #initialize, #purchase
Methods inherited from Gateway
#card_brand, card_brand, inherited, #initialize, supports?, #test?
Methods included from Utils
Methods included from CreditCardFormatting
Methods included from RequiresParameters
Methods included from PostsData
Constructor Details
This class inherits a constructor from ActiveMerchant::Billing::ViaklixGateway
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
Authorize a credit card for a given amount.
Parameters
-
money
- The amount to be authorized. Either an Integer value in cents or a Money object. -
credit_card
- The CreditCard details for the transaction. -
options
-
:billing_address
- The billing address for the cardholder.
-
55 56 57 58 59 60 61 62 |
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 55 def (money, creditcard, = {}) form = {} add_invoice(form, ) add_creditcard(form, creditcard) add_address(form, ) add_customer_data(form, ) commit(:authorize, money, form) end |
#capture(money, authorization, options = {}) ⇒ Object
Capture authorized funds from a credit card.
Parameters
-
money
- The amount to be captured. Either an Integer value in cents or a Money object. -
authorization
- The approval code returned from the initial authorization. -
options
-
:credit_card
- The CreditCard details from the initial transaction (required).
-
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 71 def capture(money, , = {}) requires!(, :credit_card) form = {} add_reference(form, ) add_invoice(form, ) add_creditcard(form, [:credit_card]) add_customer_data(form, ) commit(:capture, money, form) end |