lib/active_merchant/billing/gateways/komoju.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/komoju.rb in activemerchant-1.80.0
- old
+ new
@@ -1,24 +1,24 @@
require 'json'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class KomojuGateway < Gateway
- self.test_url = "https://sandbox.komoju.com/api/v1"
- self.live_url = "https://komoju.com/api/v1"
+ self.test_url = 'https://sandbox.komoju.com/api/v1'
+ self.live_url = 'https://komoju.com/api/v1'
self.supported_countries = ['JP']
self.default_currency = 'JPY'
self.money_format = :cents
self.homepage_url = 'https://www.komoju.com/'
self.display_name = 'Komoju'
self.supported_cardtypes = [:visa, :master, :american_express, :jcb]
STANDARD_ERROR_CODE_MAPPING = {
- "bad_verification_value" => "incorrect_cvc",
- "card_expired" => "expired_card",
- "card_declined" => "card_declined",
- "invalid_number" => "invalid_number"
+ 'bad_verification_value' => 'incorrect_cvc',
+ 'card_expired' => 'expired_card',
+ 'card_declined' => 'card_declined',
+ 'invalid_number' => 'invalid_number'
}
def initialize(options = {})
requires!(options, :login)
super
@@ -32,11 +32,11 @@
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)
+ commit('/payments', post)
end
def refund(money, identification, options = {})
commit("/payments/#{identification}/refund", {})
end
@@ -80,19 +80,19 @@
JSON.parse(raw_response)
end
def commit(path, params)
response = api_request(path, params.to_json)
- success = !response.key?("error")
- message = (success ? "Transaction succeeded" : response["error"]["message"])
+ success = !response.key?('error')
+ message = (success ? 'Transaction succeeded' : response['error']['message'])
Response.new(
success,
message,
response,
test: test?,
- error_code: (success ? nil : error_code(response["error"]["code"])),
- authorization: (success ? response["id"] : nil)
+ error_code: (success ? nil : error_code(response['error']['code'])),
+ authorization: (success ? response['id'] : nil)
)
end
def error_code(code)
STANDARD_ERROR_CODE_MAPPING[code] || code
@@ -102,13 +102,13 @@
test? ? self.test_url : self.live_url
end
def headers
{
- "Authorization" => "Basic " + Base64.encode64(@options[:login].to_s + ":").strip,
- "Accept" => "application/json",
- "Content-Type" => "application/json",
- "User-Agent" => "Komoju/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
+ 'Authorization' => 'Basic ' + Base64.encode64(@options[:login].to_s + ':').strip,
+ 'Accept' => 'application/json',
+ 'Content-Type' => 'application/json',
+ 'User-Agent' => "Komoju/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
}
end
end
end
end