Class: ActiveMerchant::Billing::InspireGateway
- Defined in:
- lib/active_merchant/billing/gateways/inspire.rb
Constant Summary collapse
- URL =
'https://secure.inspiregateway.net/api/transact.php'
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#authorize(money, creditcard, options = {}) ⇒ Object
Pass :store => true in the options to store the payment info at Inspire Gateway and get a generated customer_vault_id in the response.
- #capture(money, authorization, options = {}) ⇒ Object
- #delete(vault_id) ⇒ Object (also: #unstore)
-
#initialize(options = {}) ⇒ InspireGateway
constructor
Creates a new InspireGateway .
- #purchase(money, payment_source, options = {}) ⇒ Object
-
#store(creditcard, options = {}) ⇒ Object
To match the other stored-value gateways, like TrustCommerce, store and unstore need to be defined.
-
#update(vault_id, creditcard, options = {}) ⇒ Object
Update the values (such as CC expiration) stored at InspireGateway.
- #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from CreditCardFormatting
Constructor Details
#initialize(options = {}) ⇒ InspireGateway
Creates a new InspireGateway
The gateway requires that a valid login and password be passed in the options
hash.
Options
-
:login
– The Inspire Username. -
:password
– The Inspire Passowrd.
See the Inspire Integration Guide for details. (default: false
)
21 22 23 24 25 |
# File 'lib/active_merchant/billing/gateways/inspire.rb', line 21 def initialize( = {}) requires!(, :login, :password) @options = super end |
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
Pass :store => true in the options to store the payment info at Inspire Gateway and get a generated customer_vault_id in the response.
Pass :store => some_number_or_string to specify the customer_vault_id InspireGateway should use (make sure it’s unique).
33 34 35 36 37 38 39 40 41 |
# File 'lib/active_merchant/billing/gateways/inspire.rb', line 33 def (money, creditcard, = {}) post = {} add_invoice(post, ) add_payment_source(post, creditcard,) add_address(post, creditcard, ) add_customer_data(post, ) commit('auth', money, post) end |
#capture(money, authorization, options = {}) ⇒ Object
53 54 55 56 57 |
# File 'lib/active_merchant/billing/gateways/inspire.rb', line 53 def capture(money, , = {}) post ={} post[:transactionid] = commit('capture', money, post) end |
#delete(vault_id) ⇒ Object Also known as: unstore
79 80 81 82 83 84 |
# File 'lib/active_merchant/billing/gateways/inspire.rb', line 79 def delete(vault_id) post = {} post[:customer_vault] = "delete_customer" add_customer_vault_id(post, vault_id) commit(nil, nil, post) end |
#purchase(money, payment_source, options = {}) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/active_merchant/billing/gateways/inspire.rb', line 43 def purchase(money, payment_source, = {}) post = {} add_invoice(post, ) add_payment_source(post, payment_source, ) add_address(post, payment_source, ) add_customer_data(post, ) commit('sale', money, post) end |
#store(creditcard, options = {}) ⇒ Object
To match the other stored-value gateways, like TrustCommerce, store and unstore need to be defined
88 89 90 91 |
# File 'lib/active_merchant/billing/gateways/inspire.rb', line 88 def store(creditcard, = {}) billing_id = .delete(:billing_id).to_s || true (100, creditcard, .merge(:store => billing_id)) end |
#update(vault_id, creditcard, options = {}) ⇒ Object
Update the values (such as CC expiration) stored at InspireGateway. The CC number must be supplied in the CreditCard object.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/active_merchant/billing/gateways/inspire.rb', line 68 def update(vault_id, creditcard, = {}) post = {} post[:customer_vault] = "update_customer" add_customer_vault_id(post, vault_id) add_creditcard(post, creditcard, ) add_address(post, creditcard, ) add_customer_data(post, ) commit(nil, nil, post) end |
#void(authorization, options = {}) ⇒ Object
59 60 61 62 63 |
# File 'lib/active_merchant/billing/gateways/inspire.rb', line 59 def void(, = {}) post ={} post[:transactionid] = commit('void', nil, post) end |