activemerchant 1.31.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +29 -0
- data/CONTRIBUTORS +8 -0
- data/README.md +2 -0
- data/lib/active_merchant/billing/credit_card.rb +1 -1
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +2 -1
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +1 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +1 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +160 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -1
- data/lib/active_merchant/billing/gateways/data_cash.rb +3 -3
- data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +8 -2
- data/lib/active_merchant/billing/gateways/litle.rb +289 -101
- data/lib/active_merchant/billing/gateways/ogone.rb +1 -1
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +26 -16
- data/lib/active_merchant/billing/gateways/orbital.rb +6 -6
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paymill.rb +13 -9
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +14 -9
- data/lib/active_merchant/billing/gateways/pin.rb +13 -5
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +15 -17
- data/lib/active_merchant/billing/gateways/stripe.rb +25 -12
- data/lib/active_merchant/billing/gateways/webpay.rb +8 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +44 -22
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +3 -2
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +1 -0
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +1 -1
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +5 -1
- data/lib/active_merchant/billing/integrations/world_pay.rb +15 -8
- data/lib/active_merchant/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +82 -26
- metadata.gz.sig +0 -0
data/CHANGELOG
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
= ActiveMerchant CHANGELOG
|
|
2
2
|
|
|
3
|
+
== Version 1.32.0 (April 1, 2013)
|
|
4
|
+
|
|
5
|
+
* Optimal: Submit shipping address with requests [jduff]
|
|
6
|
+
* Iridium: Enable reference transactions for authorize [ntalbott]
|
|
7
|
+
* Stripe: Add authorize and capture methods [melari]
|
|
8
|
+
* Pin: Add a default description if none is specified to fix failures [melari]
|
|
9
|
+
* Litle: Add support for passing optional fields in token based transactions [forest]
|
|
10
|
+
* Add Finansbank gateway [scamurcuoglu]
|
|
11
|
+
* Paymill: Use .com instead of .de for save card url [besi]
|
|
12
|
+
* Worldpay integration: Use more robust endpoint urls [nashbridges]
|
|
13
|
+
* Braintree Blue: Return CC token in transaction hash [cyu]
|
|
14
|
+
* Robokassa: Fix signature for empty amount [ukolovda]
|
|
15
|
+
* Worldpay gateway: Fix error messages for some failures [duff]
|
|
16
|
+
* Worldpay gateway: Allow settled payments to be refunded [dougal]
|
|
17
|
+
* Spreedly: Update urls and terminology [duff]
|
|
18
|
+
* Make card brand error more user friendly [oggy]
|
|
19
|
+
* DataCash: Update test Mastercard number [jamesshipton]
|
|
20
|
+
* DataCash: Update test response fixtures [jamesshipton]
|
|
21
|
+
* Pin: Add Pin.js card token support [nagash]
|
|
22
|
+
* PayPal Express gateway: Fix error when no address information is in response [pierre]
|
|
23
|
+
* Ogone: Use BYPSP for ALIASOPERATION [ntalbott]
|
|
24
|
+
* Paymill: Handle error storing card [duff]
|
|
25
|
+
* SagePay integration: Add referrer field [melari]
|
|
26
|
+
* Pin: Add extra headers [duff]
|
|
27
|
+
|
|
28
|
+
== Version 1.31.1 (February 25, 2013)
|
|
29
|
+
|
|
30
|
+
* Cybersource: Bug fixes [natejgreene, jduff]
|
|
31
|
+
|
|
3
32
|
== Version 1.31.0 (February 20, 2013)
|
|
4
33
|
|
|
5
34
|
* Worldpay: XML encoding is required to be ISO-8859-1 [dougal]
|
data/CONTRIBUTORS
CHANGED
|
@@ -346,6 +346,10 @@ Balanced gateway (July 2012)
|
|
|
346
346
|
|
|
347
347
|
* Marshall Jones (mjallday)
|
|
348
348
|
|
|
349
|
+
PayFast integration (October 2012)
|
|
350
|
+
|
|
351
|
+
* Vasiliy Ermolovich (nashby)
|
|
352
|
+
|
|
349
353
|
A1Agregator (November 2012)
|
|
350
354
|
|
|
351
355
|
* Roman Ivanilov (england)
|
|
@@ -384,3 +388,7 @@ Paymill (February 2013)
|
|
|
384
388
|
EVO Canada (February 2013)
|
|
385
389
|
|
|
386
390
|
* Alex Dunae (alexdunae)
|
|
391
|
+
|
|
392
|
+
Finansbank WebPOS (March 2013)
|
|
393
|
+
|
|
394
|
+
* scamurcuoglu
|
data/README.md
CHANGED
|
@@ -100,6 +100,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
|
|
|
100
100
|
* [E-xact](http://www.e-xact.com) - CA, US
|
|
101
101
|
* [Fat Zebra](https://www.fatzebra.com.au) - AU
|
|
102
102
|
* [Federated Canada](http://www.federatedcanada.com/) - CA
|
|
103
|
+
* [Finansbank WebPOS](https://www.fbwebpos.com/) - US, TR
|
|
103
104
|
* [FirstData Global Gateway e4](http://www.firstdata.com) - CA, US
|
|
104
105
|
* [FirstPay](http://www.first-pay.com) - US
|
|
105
106
|
* [Garanti Sanal POS](https://ccpos.garanti.com.tr/ccRaporlar/garanti/ccReports) - US, TR
|
|
@@ -130,6 +131,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
|
|
|
130
131
|
* [Optimal Payments](http://www.optimalpayments.com/) - CA, US, UK
|
|
131
132
|
* [Orbital Paymentech](http://chasepaymentech.com/) - CA, US, UK, GB
|
|
132
133
|
* [PayBox Direct](http://www.paybox.com) - FR
|
|
134
|
+
* [PayFast](https://www.payfast.co.za/) - ZA
|
|
133
135
|
* [PayGate PayXML](http://paygate.co.za/) - US, ZA
|
|
134
136
|
* [PayJunction](http://www.payjunction.com/) - US
|
|
135
137
|
* [PaymentExpress](http://www.paymentexpress.com/) - AU, MY, NZ, SG, ZA, UK, US
|
|
@@ -229,7 +229,7 @@ module ActiveMerchant #:nodoc:
|
|
|
229
229
|
end
|
|
230
230
|
|
|
231
231
|
unless errors.on(:number) || errors.on(:brand)
|
|
232
|
-
errors.add :brand, "
|
|
232
|
+
errors.add :brand, "does not match the card number" unless CreditCard.matching_brand?(number, brand)
|
|
233
233
|
end
|
|
234
234
|
end
|
|
235
235
|
|
|
@@ -338,7 +338,8 @@ module ActiveMerchant #:nodoc:
|
|
|
338
338
|
# * <tt>:type</tt> -- The type of transaction. Can be either <tt>:auth_only</tt>, <tt>:capture_only</tt>, <tt>:auth_capture</tt>, <tt>:prior_auth_capture</tt>, <tt>:refund</tt> or <tt>:void</tt>. (REQUIRED)
|
|
339
339
|
# * <tt>:amount</tt> -- The amount for the tranaction. Formatted with a decimal. For example "4.95" (CONDITIONAL)
|
|
340
340
|
# - :type == :void (NOT USED)
|
|
341
|
-
# - :type ==
|
|
341
|
+
# - :type == :refund (OPTIONAL)
|
|
342
|
+
# - :type == (:auth_only, :capture_only, :auth_capture, :prior_auth_capture) (REQUIRED)
|
|
342
343
|
#
|
|
343
344
|
# * <tt>:customer_profile_id</tt> -- The Customer Profile ID of the customer to use in this transaction. (CONDITIONAL)
|
|
344
345
|
# - :type == (:void, :prior_auth_capture) (OPTIONAL)
|
|
@@ -340,6 +340,7 @@ module ActiveMerchant #:nodoc:
|
|
|
340
340
|
"bin" => transaction.credit_card_details.bin,
|
|
341
341
|
"last_4" => transaction.credit_card_details.last_4,
|
|
342
342
|
"card_type" => transaction.credit_card_details.card_type,
|
|
343
|
+
"token" => transaction.credit_card_details.token
|
|
343
344
|
}
|
|
344
345
|
|
|
345
346
|
{
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
if RUBY_VERSION < '1.9' && $KCODE == "NONE"
|
|
2
|
+
$KCODE = 'u'
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
module ActiveMerchant #:nodoc:
|
|
6
|
+
module Billing #:nodoc:
|
|
7
|
+
# CC5 API is used by many banks in Turkey. Extend this base class to provide
|
|
8
|
+
# concrete implementations.
|
|
9
|
+
class CC5Gateway < Gateway
|
|
10
|
+
self.default_currency = 'TRY'
|
|
11
|
+
|
|
12
|
+
CURRENCY_CODES = {
|
|
13
|
+
'TRY' => 949,
|
|
14
|
+
'YTL' => 949,
|
|
15
|
+
'TRL' => 949,
|
|
16
|
+
'TL' => 949,
|
|
17
|
+
'USD' => 840,
|
|
18
|
+
'EUR' => 978,
|
|
19
|
+
'GBP' => 826,
|
|
20
|
+
'JPY' => 392
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
def initialize(options = {})
|
|
24
|
+
requires!(options, :login, :password, :client_id)
|
|
25
|
+
super
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def purchase(money, creditcard, options = {})
|
|
29
|
+
commit(build_sale_request('Auth', money, creditcard, options))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def authorize(money, creditcard, options = {})
|
|
33
|
+
commit(build_sale_request('PreAuth', money, creditcard, options))
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def capture(money, authorization, options = {})
|
|
37
|
+
commit(build_capture_request(money, authorization, options))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
protected
|
|
41
|
+
|
|
42
|
+
def build_sale_request(type, money, creditcard, options = {})
|
|
43
|
+
requires!(options, :order_id)
|
|
44
|
+
|
|
45
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
|
46
|
+
|
|
47
|
+
xml.tag! 'CC5Request' do
|
|
48
|
+
add_login_tags(xml)
|
|
49
|
+
xml.tag! 'OrderId', options[:order_id]
|
|
50
|
+
xml.tag! 'Type', type
|
|
51
|
+
xml.tag! 'Number', creditcard.number
|
|
52
|
+
xml.tag! 'Expires', [format(creditcard.month, :two_digits), format(creditcard.year, :two_digits)].join('/')
|
|
53
|
+
xml.tag! 'Cvv2Val', creditcard.verification_value
|
|
54
|
+
add_amount_tags(money, options, xml)
|
|
55
|
+
xml.tag! 'Email', options[:email] if options[:email]
|
|
56
|
+
|
|
57
|
+
if(address = (options[:billing_address] || options[:address]))
|
|
58
|
+
xml.tag! 'BillTo' do
|
|
59
|
+
add_address(xml, address)
|
|
60
|
+
end
|
|
61
|
+
xml.tag! 'ShipTo' do
|
|
62
|
+
add_address(xml, address)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
xml.target!
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def build_capture_request(money, authorization, options = {})
|
|
72
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
|
73
|
+
|
|
74
|
+
xml.tag! 'CC5Request' do
|
|
75
|
+
add_login_tags(xml)
|
|
76
|
+
xml.tag! 'OrderId', authorization
|
|
77
|
+
xml.tag! 'Type', 'PostAuth'
|
|
78
|
+
add_amount_tags(money, options, xml)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def add_address(xml, address)
|
|
83
|
+
xml.tag! 'Name', normalize(address[:name])
|
|
84
|
+
xml.tag! 'Street1', normalize(address[:address1])
|
|
85
|
+
xml.tag! 'Street2', normalize(address[:address2]) if address[:address2]
|
|
86
|
+
xml.tag! 'City', normalize(address[:city])
|
|
87
|
+
xml.tag! 'PostalCode', address[:zip]
|
|
88
|
+
xml.tag! 'Country', normalize(address[:country])
|
|
89
|
+
xml.tag! 'Company', normalize(address[:company])
|
|
90
|
+
xml.tag! 'TelVoice', address[:phone].to_s.gsub(/[^0-9]/, '') if address[:phone]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def add_login_tags(xml)
|
|
94
|
+
xml.tag! 'Name', @options[:login]
|
|
95
|
+
xml.tag! 'Password', @options[:password]
|
|
96
|
+
xml.tag! 'ClientId', @options[:client_id]
|
|
97
|
+
xml.tag! 'Mode', (test? ? 'T' : 'P')
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def add_amount_tags(money, options, xml)
|
|
101
|
+
xml.tag! 'Total', amount(money)
|
|
102
|
+
xml.tag! 'Currency', currency_code(options[:currency] || currency(money))
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def currency_code(currency)
|
|
106
|
+
(CURRENCY_CODES[currency] || CURRENCY_CODES[default_currency])
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def commit(request)
|
|
110
|
+
raw_response = ssl_post((test? ? self.test_url : self.live_url), "DATA=" + request)
|
|
111
|
+
|
|
112
|
+
response = parse(raw_response)
|
|
113
|
+
|
|
114
|
+
success = success?(response)
|
|
115
|
+
|
|
116
|
+
Response.new(
|
|
117
|
+
success,
|
|
118
|
+
(success ? 'Approved' : "Declined (Reason: #{response[:proc_return_code]} - #{response[:err_msg]})"),
|
|
119
|
+
response,
|
|
120
|
+
:test => test?,
|
|
121
|
+
:authorization => response[:order_id]
|
|
122
|
+
)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def parse(body)
|
|
126
|
+
xml = REXML::Document.new(body)
|
|
127
|
+
|
|
128
|
+
response = {}
|
|
129
|
+
xml.root.elements.to_a.each do |node|
|
|
130
|
+
parse_element(response, node)
|
|
131
|
+
end
|
|
132
|
+
response
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def parse_element(response, node)
|
|
136
|
+
if node.has_elements?
|
|
137
|
+
node.elements.each{|element| parse_element(response, element) }
|
|
138
|
+
else
|
|
139
|
+
response[node.name.underscore.to_sym] = node.text
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def success?(response)
|
|
144
|
+
(response[:response] == "Approved")
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def normalize(text)
|
|
148
|
+
return unless text
|
|
149
|
+
|
|
150
|
+
if ActiveSupport::Inflector.method(:transliterate).arity == -2
|
|
151
|
+
ActiveSupport::Inflector.transliterate(text,'')
|
|
152
|
+
elsif RUBY_VERSION >= '1.9'
|
|
153
|
+
text.gsub(/[^\x00-\x7F]+/, '')
|
|
154
|
+
else
|
|
155
|
+
ActiveSupport::Inflector.transliterate(text).to_s
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -254,7 +254,7 @@ module ActiveMerchant #:nodoc:
|
|
|
254
254
|
def build_purchase_request(money, payment_method_or_reference, options)
|
|
255
255
|
xml = Builder::XmlMarkup.new :indent => 2
|
|
256
256
|
add_payment_method_or_subscription(xml, money, payment_method_or_reference, options)
|
|
257
|
-
if card_brand(payment_method_or_reference) == 'check'
|
|
257
|
+
if !payment_method_or_reference.is_a?(String) && card_brand(payment_method_or_reference) == 'check'
|
|
258
258
|
add_check_service(xml)
|
|
259
259
|
else
|
|
260
260
|
add_purchase_service(xml, options)
|
|
@@ -65,7 +65,7 @@ module ActiveMerchant
|
|
|
65
65
|
# See http://www.datacash.com/services/recurring/historic.php for more details of historic transactions.
|
|
66
66
|
# * <tt>:address</tt>:: billing address for card
|
|
67
67
|
#
|
|
68
|
-
# The continuous authority reference will be available in response#params['
|
|
68
|
+
# The continuous authority reference will be available in response#params['ca_reference'] if you have requested one
|
|
69
69
|
def purchase(money, authorization_or_credit_card, options = {})
|
|
70
70
|
requires!(options, :order_id)
|
|
71
71
|
|
|
@@ -93,7 +93,7 @@ module ActiveMerchant
|
|
|
93
93
|
# See http://www.datacash.com/services/recurring/historic.php for more details of historic transactions.
|
|
94
94
|
# * <tt>:address</tt>:: billing address for card
|
|
95
95
|
#
|
|
96
|
-
# The continuous authority reference will be available in response#params['
|
|
96
|
+
# The continuous authority reference will be available in response#params['ca_reference'] if you have requested one
|
|
97
97
|
def authorize(money, authorization_or_credit_card, options = {})
|
|
98
98
|
requires!(options, :order_id)
|
|
99
99
|
|
|
@@ -448,7 +448,7 @@ module ActiveMerchant
|
|
|
448
448
|
end
|
|
449
449
|
end
|
|
450
450
|
|
|
451
|
-
# Add credit_card
|
|
451
|
+
# Add credit_card details to the passed XML Builder doc
|
|
452
452
|
#
|
|
453
453
|
# Parameters:
|
|
454
454
|
# -xml: Builder document that is being built up
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/cc5'
|
|
2
|
+
|
|
3
|
+
module ActiveMerchant #:nodoc:
|
|
4
|
+
module Billing #:nodoc:
|
|
5
|
+
class FinansbankGateway < CC5Gateway
|
|
6
|
+
self.live_url = self.test_url = 'https://www.fbwebpos.com/servlet/cc5ApiServer'
|
|
7
|
+
|
|
8
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
|
9
|
+
self.supported_countries = ['US', 'TR']
|
|
10
|
+
|
|
11
|
+
# The card types supported by the payment gateway
|
|
12
|
+
self.supported_cardtypes = [:visa, :master]
|
|
13
|
+
|
|
14
|
+
# The homepage URL of the gateway
|
|
15
|
+
self.homepage_url = 'https://www.fbwebpos.com/'
|
|
16
|
+
|
|
17
|
+
# The name of the gateway
|
|
18
|
+
self.display_name = 'Finansbank WebPOS'
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
@@ -38,8 +38,14 @@ module ActiveMerchant #:nodoc:
|
|
|
38
38
|
super
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
def authorize(money,
|
|
42
|
-
|
|
41
|
+
def authorize(money, payment_source, options = {})
|
|
42
|
+
setup_address_hash(options)
|
|
43
|
+
|
|
44
|
+
if payment_source.respond_to?(:number)
|
|
45
|
+
commit(build_purchase_request('PREAUTH', money, payment_source, options), options)
|
|
46
|
+
else
|
|
47
|
+
commit(build_reference_request('PREAUTH', money, payment_source, options), options)
|
|
48
|
+
end
|
|
43
49
|
end
|
|
44
50
|
|
|
45
51
|
def purchase(money, payment_source, options = {})
|