Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Commit

Permalink
Merge pull request #44 from rramsden/fix-locale
Browse files Browse the repository at this point in the history
Add localized e-mail support
  • Loading branch information
k2nr committed Mar 3, 2016
2 parents f850771 + 38a2c16 commit d6a2e8f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/models/spree/komoju_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def provider_class
end

def options
super.merge(login: preferred_api_key, test: preferred_test_mode)
super.merge(login: preferred_api_key, test: preferred_test_mode, locale: locale)
end

def auto_capture?
Expand Down Expand Up @@ -43,5 +43,11 @@ def method_type
def payment_source_class
"Spree::#{gateway_type.camelcase}".constantize
end

private

def locale
I18n.locale == :ja ? "ja" : "en"
end
end
end
1 change: 1 addition & 0 deletions lib/active_merchant/billing/gateways/komoju.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def continue(uuid, payment_details)
def purchase(money, payment, options = {})
post = {}
post[:amount] = amount(money)
post[:locale] = @options[:locale] if @options[:locale]
post[:description] = options[:description]
add_payment_details(post, payment, options)
post[:currency] = options[:currency] || default_currency
Expand Down
2 changes: 1 addition & 1 deletion spec/models/spree/komoju_gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
allow(subject).to receive(:preferred_api_key) { api_key }
allow(subject).to receive(:preferred_test) { true }

expect(subject.options).to eq ({ api_key: nil, test: true, server: "test", test_mode: true, login: api_key })
expect(subject.options).to eq ({ api_key: nil, test: true, server: "test", test_mode: true, login: api_key, locale: "en" })
end
end

Expand Down

0 comments on commit d6a2e8f

Please sign in to comment.