lib/active_merchant/billing/gateways/paypal_express.rb in activemerchant-1.54.0 vs lib/active_merchant/billing/gateways/paypal_express.rb in activemerchant-1.55.0
- old
+ new
@@ -24,10 +24,12 @@
'CN' => 'zh_CN',
'HK' => 'zh_HK',
'TW' => 'zh_TW'
}
+ CURRENCIES_WITHOUT_FRACTIONS = %w(BRL HUF JPY MYR TWD TRY)
+
self.test_redirect_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
self.supported_countries = ['US']
self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=xpt/merchant/ExpressCheckoutIntro-outside'
self.display_name = 'PayPal Express Checkout'
@@ -82,10 +84,14 @@
commit 'DoReferenceTransaction', build_reference_transaction_request('Sale', money, options)
end
private
+ def non_fractional_currency?(currency)
+ CURRENCIES_WITHOUT_FRACTIONS.include?(currency.to_s)
+ end
+
def build_get_details_request(token)
xml = Builder::XmlMarkup.new :indent => 2
xml.tag! 'GetExpressCheckoutDetailsReq', 'xmlns' => PAYPAL_NAMESPACE do
xml.tag! 'GetExpressCheckoutDetailsRequest', 'xmlns:n2' => EBAY_NAMESPACE do
xml.tag! 'n2:Version', API_VERSION
@@ -184,9 +190,11 @@
xml.tag! 'n2:CallbackVersion', options[:callback_version] unless options[:callback_version].blank?
if options.has_key?(:allow_buyer_optin)
xml.tag! 'n2:BuyerEmailOptInEnable', (options[:allow_buyer_optin] ? '1' : '0')
end
+
+ xml.tag! 'n2:TotalType', options[:total_type] unless options[:total_type].blank?
end
end
end
xml.target!