lib/active_merchant/billing/gateways/card_stream.rb in activemerchant-1.103.0 vs lib/active_merchant/billing/gateways/card_stream.rb in activemerchant-1.104.0
- old
+ new
@@ -1,14 +1,14 @@
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class CardStreamGateway < Gateway
-
THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE = 'Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead.'
self.test_url = self.live_url = 'https://gateway.cardstream.com/direct/'
self.money_format = :cents
self.default_currency = 'GBP'
+ self.currencies_without_fractions = %w(CVE ISK JPY UGX)
self.supported_countries = ['GB', 'US', 'CH', 'SE', 'SG', 'NO', 'JP', 'IS', 'HK', 'NL', 'CZ', 'CA', 'AU']
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro]
self.homepage_url = 'http://www.cardstream.com/'
self.display_name = 'CardStream'
@@ -171,11 +171,11 @@
end
def capture(money, authorization, options = {})
post = {}
add_pair(post, :xref, authorization)
- add_pair(post, :amount, amount(money), :required => true)
+ add_pair(post, :amount, localized_amount(money, options[:currency] || currency(money)), :required => true)
add_remote_address(post, options)
commit('CAPTURE', post)
end
@@ -222,12 +222,13 @@
end
private
def add_amount(post, money, options)
- add_pair(post, :amount, amount(money), :required => true)
- add_pair(post, :currencyCode, currency_code(options[:currency] || currency(money)))
+ currency = options[:currency] || currency(money)
+ add_pair(post, :amount, localized_amount(money, currency), :required => true)
+ add_pair(post, :currencyCode, currency_code(currency))
end
def add_customer_data(post, options)
add_pair(post, :customerEmail, options[:email])
if (address = options[:billing_address] || options[:address])
@@ -247,11 +248,11 @@
add_pair(post, :statementNarrative2, options[:dynamic_descriptor]) if options[:dynamic_descriptor]
if credit_card_or_reference.respond_to?(:number)
if ['american_express', 'diners_club'].include?(card_brand(credit_card_or_reference).to_s)
add_pair(post, :item1Quantity, 1)
add_pair(post, :item1Description, (options[:description] || options[:order_id]).slice(0, 15))
- add_pair(post, :item1GrossValue, amount(money))
+ add_pair(post, :item1GrossValue, localized_amount(money, options[:currency] || currency(money)))
end
end
add_pair(post, :type, options[:type] || '1')
add_threeds_required(post, options)
@@ -359,9 +360,8 @@
end
def add_pair(post, key, value, options = {})
post[key] = value if !value.blank? || options[:required]
end
-
end
end
end