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"
}

Instance Method Summary collapse

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

#store(payment, options = {}) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/active_merchant/billing/gateways/komoju.rb', line 44

def store(payment, options = {})
  post = {}
  add_payment_details(post, payment, options)

  if options[:customer_profile]
    post[:email] = options[:email]
    commit("/customers", post)
  else
    commit("/tokens", post)
  end
end