Class: ActiveMerchant::Billing::KomojuGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::KomojuGateway
- 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
- #continue(uuid, payment_details) ⇒ Object
-
#initialize(options = {}) ⇒ KomojuGateway
constructor
A new instance of KomojuGateway.
- #purchase(money, payment, options = {}) ⇒ Object
- #refund(amount, identification, options = {}) ⇒ Object
- #store(payment, options = {}) ⇒ Object
- #void(identification, options = {}) ⇒ Object
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( = {}) requires!(, :login) super end |
Instance Method Details
#continue(uuid, payment_details) ⇒ Object
27 28 29 30 |
# File 'lib/active_merchant/billing/gateways/komoju.rb', line 27 def continue(uuid, payment_details) details = {payment_details: payment_details} commit("/payments/#{uuid}", details, :patch) end |
#purchase(money, payment, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/active_merchant/billing/gateways/komoju.rb', line 32 def purchase(money, payment, = {}) post = {} post[:amount] = amount(money) post[:locale] = @options[:locale] if @options[:locale] post[:description] = [:description] add_payment_details(post, payment, ) post[:currency] = [:currency] || default_currency post[:external_order_num] = [:order_id] if [:order_id] post[:tax] = [:tax] if [:tax] add_fraud_details(post, ) commit("/payments", post) end |
#refund(amount, identification, options = {}) ⇒ Object
46 47 48 49 |
# File 'lib/active_merchant/billing/gateways/komoju.rb', line 46 def refund(amount, identification, = {}) params = { :amount => amount } commit("/payments/#{identification}/refund", params) end |
#store(payment, options = {}) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/active_merchant/billing/gateways/komoju.rb', line 55 def store(payment, = {}) post = {} add_payment_details(post, payment, ) if [:customer_profile] post[:email] = [:email] commit("/customers", post) else commit("/tokens", post) end end |
#void(identification, options = {}) ⇒ Object
51 52 53 |
# File 'lib/active_merchant/billing/gateways/komoju.rb', line 51 def void(identification, = {}) commit("/payments/#{identification}/refund", {}) end |