Class: ActiveMerchant::Billing::KomojuGateway

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

Constant Summary collapse

STANDARD_ERROR_CODE_MAPPING =
{
  "bad_verification_value" => "incorrect_cvc",
  "card_expired" => "expired_card",
  "card_declined" => "card_declined",
  "invalid_number" => "invalid_number"
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, 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, #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 = {}) ⇒ KomojuGateway

Returns a new instance of KomojuGateway


22
23
24
25
# File 'lib/active_merchant/billing/gateways/komoju.rb', line 22

def initialize(options = {})
  requires!(options, :login)
  super
end

Instance Method Details

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


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/active_merchant/billing/gateways/komoju.rb', line 27

def purchase(money, payment, options = {})
  post = {}
  post[:amount] = amount(money)
  post[:description] = options[:description]
  add_payment_details(post, payment, options)
  post[:currency] = options[:currency] || default_currency
  post[:external_order_num] = options[:order_id] if options[:order_id]
  post[:tax] = options[:tax] if options[:tax]
  add_fraud_details(post, options)

  commit("/payments", post)
end

#refund(money, identification, options = {}) ⇒ Object


40
41
42
# File 'lib/active_merchant/billing/gateways/komoju.rb', line 40

def refund(money, identification, options = {})
  commit("/payments/#{identification}/refund", {})
end