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, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

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