Class: ActiveMerchant::Billing::App55Gateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/app55.rb

Constant Summary

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?, #test?

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ App55Gateway

Create gateway

options:

:api_key - merchants App55 API Key
:api_secret - merchants App55 Secret Key


19
20
21
22
23
24
# File 'lib/active_merchant/billing/gateways/app55.rb', line 19

def initialize(options = {})
  requires!(options, :api_key, :api_secret)
  @api_key = options[:api_key]
  @api_secret = options[:api_secret]
  super
end

Instance Method Details

#authorize(money, payment_method, options = {}) ⇒ Object

Authorize a transaction.

money - The monetary amount of the transaction in cents. payment_method - The CreditCard or the App55 card token. options - A standard ActiveMerchant options hash



40
41
42
43
44
45
46
# File 'lib/active_merchant/billing/gateways/app55.rb', line 40

def authorize(money, payment_method, options = {})
  post = {}
  add_creditcard(post, payment_method, options)
  add_transaction(post, money, options)

  commit(:post, 'transaction', post)
end

#capture(money, authorization, options = {}) ⇒ Object

Commit a pre-authorized transaction.

money - The monetary amount of the transaction in cents. authorization - The App55 transaction id string. options - A standard ActiveMerchant options hash



53
54
55
# File 'lib/active_merchant/billing/gateways/app55.rb', line 53

def capture(money, authorization, options = {})
  commit(:post, "transaction/#{authorization}")
end

#purchase(money, payment_method, options = {}) ⇒ Object

Make a purchase (authorize and commit)

money - The monetary amount of the transaction in cents. payment_method - The CreditCard or the App55 card token. options - A standard ActiveMerchant options hash



31
32
33
# File 'lib/active_merchant/billing/gateways/app55.rb', line 31

def purchase(money, payment_method, options = {})
  authorize(money, payment_method, options.merge(commit: true))
end