Sha256: 203f1dc5657d99cfc198bb823b1771a3d5d3a5dd74c2b5665ba0c05b18e034c3
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module Spree class KomojuGateway < Gateway preference :api_key, :string def provider_class ActiveMerchant::Billing::KomojuGateway end def options super.merge(login: preferred_api_key, test: preferred_test_mode) end def auto_capture? false end def payment_profiles_supported? true end def supports?(source) true end # no-op, override where necessary def create_profile(payment) end # We need to change shipping, tax, subtotal and discount from cents to dollar for Komoju gateway. # Because, Komoju gateway supports JPY currency only. # # Spree changes price from dollar to cents. Almost payment gateway supports cents only. # See. https://github.com/spree/spree/blob/master/core/app/models/spree/payment/gateway_options.rb def change_options_to_dollar(options) %i(shipping tax subtotal discount).each { |key| options[key] = options[key] / 100.0 } options end def gateway_type self.class.to_s.split("::Komoju").last.underscore end def method_type "komoju_#{gateway_type}" end def payment_source_class "Spree::#{gateway_type.camelcase}".constantize end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_komoju-0.0.4 | app/models/spree/komoju_gateway.rb |
spree_komoju-0.0.3 | app/models/spree/komoju_gateway.rb |