activemerchant 1.12.1 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +21 -0
- data/README.rdoc +1 -1
- data/lib/active_merchant/billing/gateway.rb +1 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +6 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +26 -4
- data/lib/active_merchant/billing/gateways/data_cash.rb +6 -2
- data/lib/active_merchant/billing/gateways/efsnet.rb +8 -2
- data/lib/active_merchant/billing/gateways/iridium.rb +5 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +8 -5
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +7 -1
- data/lib/active_merchant/billing/gateways/moneris.rb +5 -1
- data/lib/active_merchant/billing/gateways/ogone.rb +8 -2
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +5 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +6 -3
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +24 -4
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +22 -15
- data/lib/active_merchant/billing/gateways/plugnpay.rb +9 -3
- data/lib/active_merchant/billing/gateways/psigate.rb +5 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +5 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/smart_ps.rb +7 -1
- data/lib/active_merchant/billing/gateways/verifi.rb +6 -1
- data/lib/active_merchant/billing/integrations/bogus.rb +1 -1
- data/lib/active_merchant/billing/integrations/chronopay.rb +1 -1
- data/lib/active_merchant/billing/integrations/direc_pay.rb +1 -1
- data/lib/active_merchant/billing/integrations/gestpay.rb +1 -1
- data/lib/active_merchant/billing/integrations/hi_trust.rb +1 -1
- data/lib/active_merchant/billing/integrations/moneybookers.rb +5 -2
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +16 -0
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +54 -26
- data/lib/active_merchant/billing/integrations/nochex.rb +1 -1
- data/lib/active_merchant/billing/integrations/paypal.rb +1 -1
- data/lib/active_merchant/billing/integrations/quickpay.rb +6 -2
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +1 -1
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +1 -1
- data/lib/active_merchant/billing/integrations/two_checkout.rb +1 -1
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +5 -5
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +7 -10
- data/lib/active_merchant/billing/integrations/world_pay.rb +7 -3
- data/lib/active_merchant/common.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- metadata +17 -17
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
= ActiveMerchant CHANGELOG
|
2
2
|
|
3
|
+
== Version 1.13.0 (Apr 19, 2011)
|
4
|
+
|
5
|
+
* Add a Gemfile for optional bundler support [ssoroka]
|
6
|
+
* Stop using has_rdoc= when rubygems version is 1.7.0 or greater, since it's deprecated [ssoroka]
|
7
|
+
* Add tax field to braintree [wisq]
|
8
|
+
* Quickpay: Also add Sweden as supported country [Soleone]
|
9
|
+
* Adding refund method for gateways that are using the credit method for referenced based refunds, added deprecation worning to the credit method [John Duff]
|
10
|
+
* Return the Braintree transaction id in the response for void and refund transaction calls [John Duff]
|
11
|
+
* PayPal Express: Extract phone number from address if no contact phone was sent [Soleone]
|
12
|
+
* Unify all offsite gateways that verify the signature of Returns or Notifications by always using the #acknowledge method and calling the secret :credential2 [Soleone]
|
13
|
+
* Valitor: Change name of credential for Return and Notification from :password to :credential2 in symmetry with the other Integrations [Soleone]
|
14
|
+
* Moneybookers: Add support for tracking token [Soleone]
|
15
|
+
* Moneybookers: Require credential when creating Notifications instead of adding an argument to #acknowledge [Soleone]
|
16
|
+
* Moneybookers: Fix Notification to return correct status [Soleone]
|
17
|
+
* Support default Return class for all Integrations that don't use returns [Soleone]
|
18
|
+
* Add support for passing additional options when creating a Notification to all Integrations [Soleone]
|
19
|
+
* Update BraintreeBlue#refund to have consistent method signature [Jonathan Rudenberg]
|
20
|
+
* Add rails/init.rb for gem campatability in Rails [Rūdolfs Ošiņš]
|
21
|
+
* Fix Paypal Express response parser [Jonathan Rudenberg]
|
22
|
+
* Braintree/Transax: Add tax field [wisq]
|
23
|
+
|
3
24
|
== Version 1.12.1 (Mar 21, 2011)
|
4
25
|
|
5
26
|
* Ogone: Make sure response.params is a real Hash [Soleone]
|
data/README.rdoc
CHANGED
@@ -59,7 +59,7 @@ The {ActiveMerchant Wiki}[http://github.com/Shopify/active_merchant/wikis] conta
|
|
59
59
|
* {PSL Payment Solutions}[http://www.paymentsolutionsltd.com/] - GB
|
60
60
|
* {Quantum}[http://www.quantumgateway.com] - US
|
61
61
|
* {QuickBooks Merchant Services}[http://payments.intuit.com/] - US
|
62
|
-
* {Quickpay}[http://quickpay.dk/] - DK
|
62
|
+
* {Quickpay}[http://quickpay.dk/] - DK, SE
|
63
63
|
* {Rabobank Nederland}[http://www.rabobank.nl/] - NL
|
64
64
|
* {Realex}[http://www.realexpayments.com/] - IE, GB
|
65
65
|
* {Sage Payment Solutions}[http://www.sagepayments.com] - US, CA
|
@@ -63,6 +63,7 @@ module ActiveMerchant #:nodoc:
|
|
63
63
|
|
64
64
|
DEBIT_CARDS = [ :switch, :solo ]
|
65
65
|
CURRENCIES_WITHOUT_FRACTIONS = [ 'JPY' ]
|
66
|
+
CREDIT_DEPRECATION_MESSAGE = "Support for using credit to refund existing transactions is deprecated and will be removed from a future release of ActiveMerchant. Please use the refund method instead."
|
66
67
|
|
67
68
|
cattr_reader :implementations
|
68
69
|
@@implementations = []
|
@@ -64,12 +64,17 @@ module ActiveMerchant #:nodoc:
|
|
64
64
|
# code returned by ePDQ
|
65
65
|
def credit(money, creditcard_or_authorization, options = {})
|
66
66
|
if creditcard_or_authorization.is_a?(String)
|
67
|
-
|
67
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
68
|
+
refund(money, creditcard_or_authorization, options)
|
68
69
|
else
|
69
70
|
credit_new_order(money, creditcard_or_authorization, options)
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
74
|
+
def refund(money, authorization, options = {})
|
75
|
+
credit_existing_order(money, authorization, options)
|
76
|
+
end
|
77
|
+
|
73
78
|
def void(authorization, options = {})
|
74
79
|
document = Document.new(self, @options) do
|
75
80
|
add_order_form(authorization) do
|
@@ -46,10 +46,18 @@ module ActiveMerchant #:nodoc:
|
|
46
46
|
create_transaction(:credit, money, credit_card_or_vault_id, options)
|
47
47
|
end
|
48
48
|
|
49
|
-
def refund(
|
49
|
+
def refund(*args)
|
50
|
+
# legacy signature: #refund(transaction_id, options = {})
|
51
|
+
# new signature: #refund(money, transaction_id, options = {})
|
52
|
+
money, transaction_id, options = extract_refund_args(args)
|
53
|
+
money = amount(money).to_s if money
|
54
|
+
|
50
55
|
commit do
|
51
|
-
result = Braintree::Transaction.
|
52
|
-
Response.new(result.success?, message_from_result(result)
|
56
|
+
result = Braintree::Transaction.refund(transaction_id, money)
|
57
|
+
Response.new(result.success?, message_from_result(result),
|
58
|
+
{:braintree_transaction => (result.transaction if result.success?)},
|
59
|
+
{:authorization => (result.transaction.id if result.success?)}
|
60
|
+
)
|
53
61
|
end
|
54
62
|
end
|
55
63
|
|
@@ -57,7 +65,8 @@ module ActiveMerchant #:nodoc:
|
|
57
65
|
commit do
|
58
66
|
result = Braintree::Transaction.void(authorization)
|
59
67
|
Response.new(result.success?, message_from_result(result),
|
60
|
-
:braintree_transaction => (result.transaction if result.success?)
|
68
|
+
{:braintree_transaction => (result.transaction if result.success?)},
|
69
|
+
{:authorization => (result.transaction.id if result.success?)}
|
61
70
|
)
|
62
71
|
end
|
63
72
|
end
|
@@ -204,6 +213,19 @@ module ActiveMerchant #:nodoc:
|
|
204
213
|
response
|
205
214
|
end
|
206
215
|
end
|
216
|
+
|
217
|
+
def extract_refund_args(args)
|
218
|
+
options = args.extract_options!
|
219
|
+
|
220
|
+
# money, transaction_id, options
|
221
|
+
if args.length == 1 # legacy signature
|
222
|
+
return nil, args[0], options
|
223
|
+
elsif args.length == 2
|
224
|
+
return args[0], args[1], options
|
225
|
+
else
|
226
|
+
raise ArgumentError, "wrong number of arguments (#{args.length} for 2)"
|
227
|
+
end
|
228
|
+
end
|
207
229
|
end
|
208
230
|
end
|
209
231
|
end
|
@@ -139,12 +139,16 @@ module ActiveMerchant
|
|
139
139
|
# * <tt>:address</tt>:: billing address for card
|
140
140
|
def credit(money, reference_or_credit_card, options = {})
|
141
141
|
if reference_or_credit_card.is_a?(String)
|
142
|
-
|
142
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
143
|
+
refund(money, reference_or_credit_card)
|
143
144
|
else
|
144
145
|
request = build_refund_request(money, reference_or_credit_card, options)
|
146
|
+
commit(request)
|
145
147
|
end
|
148
|
+
end
|
146
149
|
|
147
|
-
|
150
|
+
def refund(money, reference, options = {})
|
151
|
+
commit(build_transaction_refund_request(money, reference))
|
148
152
|
end
|
149
153
|
|
150
154
|
# Is the gateway running in test mode?
|
@@ -41,9 +41,9 @@ module ActiveMerchant #:nodoc:
|
|
41
41
|
|
42
42
|
def credit(money, identification_or_credit_card, options = {})
|
43
43
|
if identification_or_credit_card.is_a?(String)
|
44
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
44
45
|
# Perform authorization reversal
|
45
|
-
|
46
|
-
commit(:credit_card_refund, request)
|
46
|
+
refund(money, identification_or_credit_card, options)
|
47
47
|
else
|
48
48
|
# Perform credit
|
49
49
|
request = build_credit_card_request(money, identification_or_credit_card, options)
|
@@ -51,6 +51,12 @@ module ActiveMerchant #:nodoc:
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
def refund(money, reference, options = {})
|
55
|
+
# Perform authorization reversal
|
56
|
+
request = build_refund_or_settle_request(money, reference, options)
|
57
|
+
commit(:credit_card_refund, request)
|
58
|
+
end
|
59
|
+
|
54
60
|
def void(identification, options = {})
|
55
61
|
requires!(options, :order_id)
|
56
62
|
original_transaction_id, original_transaction_amount = identification.split(";")
|
@@ -59,6 +59,11 @@ module ActiveMerchant #:nodoc:
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def credit(money, authorization, options={})
|
62
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
63
|
+
refund(money, authorization, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def refund(money, authorization, options={})
|
62
67
|
commit(build_reference_request('REFUND', money, authorization, options), options)
|
63
68
|
end
|
64
69
|
|
@@ -85,17 +85,20 @@ module ActiveMerchant #:nodoc:
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def credit(money, transaction_id_or_card, options = {})
|
88
|
-
|
89
88
|
if transaction_id_or_card.is_a?(String)
|
90
|
-
|
91
|
-
|
89
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
90
|
+
refund(money, transaction_id_or_card, options)
|
92
91
|
else
|
93
|
-
|
94
|
-
credit_card = transaction_id_or_card
|
92
|
+
commit(money, build_credit_request('CREDIT', money, nil, transaction_id_or_card))
|
95
93
|
end
|
94
|
+
end
|
96
95
|
|
96
|
+
def refund(money, reference, options = {})
|
97
|
+
transaction_id = reference.split(";").first
|
98
|
+
credit_card = options[:credit_card]
|
97
99
|
commit(money, build_credit_request('CREDIT', money, transaction_id, credit_card))
|
98
100
|
end
|
101
|
+
|
99
102
|
|
100
103
|
private
|
101
104
|
|
@@ -98,11 +98,17 @@ module ActiveMerchant #:nodoc:
|
|
98
98
|
# * <tt>:order_id</tt> - A unique reference for this order (required when performing a non-referenced credit)
|
99
99
|
def credit(money, identification, options = {})
|
100
100
|
if identification.is_a?(String)
|
101
|
-
|
101
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
102
|
+
refund(money, identification, options)
|
102
103
|
else
|
103
104
|
perform_credit(money, identification, options)
|
104
105
|
end
|
105
106
|
end
|
107
|
+
|
108
|
+
def refund(money, reference, options = {})
|
109
|
+
perform_reference_credit(money, reference, options)
|
110
|
+
end
|
111
|
+
|
106
112
|
|
107
113
|
private
|
108
114
|
|
@@ -71,9 +71,13 @@ module ActiveMerchant #:nodoc:
|
|
71
71
|
# Moneris interface consistent with other gateways. (See +capture+ for
|
72
72
|
# details.)
|
73
73
|
def credit(money, authorization, options = {})
|
74
|
-
|
74
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
75
|
+
refund(money, authorization, options)
|
75
76
|
end
|
76
77
|
|
78
|
+
def refund(money, authorization, options = {})
|
79
|
+
commit 'refund', crediting_params(authorization, :amount => amount(money))
|
80
|
+
end
|
77
81
|
private # :nodoc: all
|
78
82
|
|
79
83
|
def expdate(creditcard)
|
@@ -126,13 +126,19 @@ module ActiveMerchant #:nodoc:
|
|
126
126
|
# Credit the specified account by a specific amount.
|
127
127
|
def credit(money, identification_or_credit_card, options = {})
|
128
128
|
if reference_transaction?(identification_or_credit_card)
|
129
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
129
130
|
# Referenced credit: refund of a settled transaction
|
130
|
-
|
131
|
+
refund(money, identification_or_credit_card, options)
|
131
132
|
else # must be a credit card or card reference
|
132
133
|
perform_non_referenced_credit(money, identification_or_credit_card, options)
|
133
134
|
end
|
134
135
|
end
|
135
136
|
|
137
|
+
# Refund of a settled transaction
|
138
|
+
def refund(money, reference, options = {})
|
139
|
+
perform_reference_credit(money, reference, options)
|
140
|
+
end
|
141
|
+
|
136
142
|
def test?
|
137
143
|
@options[:test] || super
|
138
144
|
end
|
@@ -283,4 +289,4 @@ module ActiveMerchant #:nodoc:
|
|
283
289
|
end
|
284
290
|
end
|
285
291
|
end
|
286
|
-
end
|
292
|
+
end
|
@@ -99,6 +99,11 @@ module ActiveMerchant #:nodoc:
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def credit(money, identification, options = {})
|
102
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
103
|
+
refund(money, identification, options)
|
104
|
+
end
|
105
|
+
|
106
|
+
def refund(money, identification, options = {})
|
102
107
|
post = {}
|
103
108
|
add_invoice(post, options)
|
104
109
|
add_reference(post, identification)
|
@@ -27,16 +27,19 @@ module ActiveMerchant #:nodoc:
|
|
27
27
|
|
28
28
|
def credit(money, identification_or_credit_card, options = {})
|
29
29
|
if identification_or_credit_card.is_a?(String)
|
30
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
30
31
|
# Perform referenced credit
|
31
|
-
|
32
|
+
refund(money, identification_or_credit_card, options)
|
32
33
|
else
|
33
34
|
# Perform non-referenced credit
|
34
35
|
request = build_credit_card_request(:credit, money, identification_or_credit_card, options)
|
36
|
+
commit(request)
|
35
37
|
end
|
36
|
-
|
37
|
-
commit(request)
|
38
38
|
end
|
39
39
|
|
40
|
+
def refund(money, reference, options = {})
|
41
|
+
commit(build_reference_request(:credit, money, reference, options))
|
42
|
+
end
|
40
43
|
# Adds or modifies a recurring Payflow profile. See the Payflow Pro Recurring Billing Guide for more details:
|
41
44
|
# https://www.paypal.com/en_US/pdf/PayflowPro_RecurringBilling_Guide.pdf
|
42
45
|
#
|
@@ -197,6 +197,26 @@ module ActiveMerchant #:nodoc:
|
|
197
197
|
end
|
198
198
|
|
199
199
|
def parse(action, xml)
|
200
|
+
legacy_hash = legacy_parse(action, xml)
|
201
|
+
xml = strip_attributes(xml)
|
202
|
+
hash = Hash.from_xml(xml)
|
203
|
+
hash = hash.fetch('Envelope').fetch('Body').fetch("#{action}Response")
|
204
|
+
hash = hash["#{action}ResponseDetails"] if hash["#{action}ResponseDetails"]
|
205
|
+
|
206
|
+
legacy_hash.merge(hash)
|
207
|
+
rescue IndexError
|
208
|
+
legacy_hash.merge(hash['Envelope']['Body'])
|
209
|
+
end
|
210
|
+
|
211
|
+
def strip_attributes(xml)
|
212
|
+
xml = REXML::Document.new(xml)
|
213
|
+
REXML::XPath.each(xml, '//SOAP-ENV:Envelope//*[@*]') do |el|
|
214
|
+
el.attributes.each_attribute { |a| a.remove }
|
215
|
+
end
|
216
|
+
xml.to_s
|
217
|
+
end
|
218
|
+
|
219
|
+
def legacy_parse(action, xml)
|
200
220
|
response = {}
|
201
221
|
|
202
222
|
error_messages = []
|
@@ -225,22 +245,22 @@ module ActiveMerchant #:nodoc:
|
|
225
245
|
error_messages << message
|
226
246
|
end
|
227
247
|
else
|
228
|
-
|
248
|
+
legacy_parse_element(response, node)
|
229
249
|
end
|
230
250
|
end
|
231
251
|
response[:message] = error_messages.uniq.join(". ") unless error_messages.empty?
|
232
252
|
response[:error_codes] = error_codes.uniq.join(",") unless error_codes.empty?
|
233
253
|
elsif root = REXML::XPath.first(xml, "//SOAP-ENV:Fault")
|
234
|
-
|
254
|
+
legacy_parse_element(response, root)
|
235
255
|
response[:message] = "#{response[:faultcode]}: #{response[:faultstring]} - #{response[:detail]}"
|
236
256
|
end
|
237
257
|
|
238
258
|
response
|
239
259
|
end
|
240
260
|
|
241
|
-
def
|
261
|
+
def legacy_parse_element(response, node)
|
242
262
|
if node.has_elements?
|
243
|
-
node.elements.each{|e|
|
263
|
+
node.elements.each{|e| legacy_parse_element(response, e) }
|
244
264
|
else
|
245
265
|
response[node.name.underscore.to_sym] = node.text
|
246
266
|
node.attributes.each do |k, v|
|
@@ -2,37 +2,44 @@ module ActiveMerchant #:nodoc:
|
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class PaypalExpressResponse < Response
|
4
4
|
def email
|
5
|
-
@params['
|
5
|
+
@params['PayerInfo']['Payer']
|
6
6
|
end
|
7
7
|
|
8
8
|
def name
|
9
|
-
|
9
|
+
payer = @params['PayerInfo']['PayerName']
|
10
|
+
[payer['FirstName'], payer['MiddleName'], payer['LastName']].compact.join(' ')
|
10
11
|
end
|
11
12
|
|
12
13
|
def token
|
13
|
-
@params['
|
14
|
+
@params['Token']
|
14
15
|
end
|
15
16
|
|
16
17
|
def payer_id
|
17
|
-
@params['
|
18
|
+
@params['PayerInfo']['PayerID']
|
18
19
|
end
|
19
20
|
|
20
21
|
def payer_country
|
21
|
-
@params['
|
22
|
+
@params['PayerInfo']['PayerCountry']
|
23
|
+
end
|
24
|
+
|
25
|
+
# PayPal returns a contact telephone number only if your Merchant account profile settings require that the buyer enter one.
|
26
|
+
def contact_phone
|
27
|
+
@params['ContactPhone']
|
22
28
|
end
|
23
29
|
|
24
30
|
def address
|
25
|
-
|
26
|
-
|
27
|
-
'
|
28
|
-
'
|
29
|
-
'
|
30
|
-
'
|
31
|
-
'
|
32
|
-
'
|
33
|
-
'
|
31
|
+
address = @params['PaymentDetails']['ShipToAddress']
|
32
|
+
{ 'name' => address['Name'],
|
33
|
+
'company' => @params['PayerInfo']['PayerBusiness'],
|
34
|
+
'address1' => address['Street1'],
|
35
|
+
'address2' => address['Street2'],
|
36
|
+
'city' => address['CityName'],
|
37
|
+
'state' => address['StateOrProvince'],
|
38
|
+
'country' => address['Country'],
|
39
|
+
'zip' => address['PostalCode'],
|
40
|
+
'phone' => contact_phone || address['Phone']
|
34
41
|
}
|
35
42
|
end
|
36
43
|
end
|
37
44
|
end
|
38
|
-
end
|
45
|
+
end
|
@@ -156,9 +156,8 @@ module ActiveMerchant
|
|
156
156
|
add_amount(post, money, options)
|
157
157
|
|
158
158
|
if identification_or_creditcard.is_a?(String)
|
159
|
-
|
160
|
-
|
161
|
-
commit(:refund, post)
|
159
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
160
|
+
refund(money, identification_or_creditcard, options)
|
162
161
|
else
|
163
162
|
add_creditcard(post, identification_or_creditcard)
|
164
163
|
add_addresses(post, options)
|
@@ -167,6 +166,13 @@ module ActiveMerchant
|
|
167
166
|
commit(:credit, post)
|
168
167
|
end
|
169
168
|
end
|
169
|
+
|
170
|
+
def refund(money, reference, options = {})
|
171
|
+
post = PlugnpayPostData.new
|
172
|
+
add_amount(post, money, options)
|
173
|
+
post[:orderID] = reference
|
174
|
+
commit(:refund, post)
|
175
|
+
end
|
170
176
|
|
171
177
|
private
|
172
178
|
def commit(action, post)
|
@@ -79,6 +79,11 @@ module ActiveMerchant #:nodoc:
|
|
79
79
|
|
80
80
|
# Psigate Credit
|
81
81
|
def credit(money, authorization, options = {})
|
82
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
83
|
+
refund(money, authorization, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def refund(money, authorization, options = {})
|
82
87
|
options.update({ :CardAction => "3", :order_id => authorization })
|
83
88
|
commit(money, nil, options)
|
84
89
|
end
|
@@ -104,6 +104,11 @@ module ActiveMerchant #:nodoc:
|
|
104
104
|
#
|
105
105
|
#
|
106
106
|
def credit(money, identification, options = {})
|
107
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
108
|
+
refund(money, identification, options = {})
|
109
|
+
end
|
110
|
+
|
111
|
+
def refund(money, identification, options = {})
|
107
112
|
commit(:refund, money, options.merge(:transaction_id => identification))
|
108
113
|
end
|
109
114
|
|
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
|
|
9
9
|
self.default_currency = 'DKK'
|
10
10
|
self.money_format = :cents
|
11
11
|
self.supported_cardtypes = [ :dankort, :forbrugsforeningen, :visa, :master, :american_express, :diners_club, :jcb, :maestro ]
|
12
|
-
self.supported_countries = ['DK']
|
12
|
+
self.supported_countries = ['DK', 'SE']
|
13
13
|
self.homepage_url = 'http://quickpay.dk/'
|
14
14
|
self.display_name = 'Quickpay'
|
15
15
|
|
@@ -27,6 +27,7 @@ module ActiveMerchant #:nodoc:
|
|
27
27
|
add_address(post, options[:shipping_address], "shipping")
|
28
28
|
add_customer_data(post, options)
|
29
29
|
add_currency(post, money, options)
|
30
|
+
add_taxes(post, options)
|
30
31
|
add_processor(post, options)
|
31
32
|
commit('auth', money, post)
|
32
33
|
end
|
@@ -39,6 +40,7 @@ module ActiveMerchant #:nodoc:
|
|
39
40
|
add_address(post, options[:shipping_address], "shipping")
|
40
41
|
add_customer_data(post, options)
|
41
42
|
add_currency(post, money, options)
|
43
|
+
add_taxes(post, options)
|
42
44
|
add_processor(post, options)
|
43
45
|
commit('sale', money, post)
|
44
46
|
end
|
@@ -145,7 +147,11 @@ module ActiveMerchant #:nodoc:
|
|
145
147
|
def add_currency(post, money, options)
|
146
148
|
post[:currency] = options[:currency] || currency(money)
|
147
149
|
end
|
148
|
-
|
150
|
+
|
151
|
+
def add_taxes(post, options)
|
152
|
+
post[:tax] = amount(options[:tax])
|
153
|
+
end
|
154
|
+
|
149
155
|
def add_processor(post, options)
|
150
156
|
post[:processor] = options[:processor] unless options[:processor].nil?
|
151
157
|
end
|
@@ -87,12 +87,17 @@ module ActiveMerchant #:nodoc:
|
|
87
87
|
|
88
88
|
def credit(money, credit_card_or_authorization, options = {})
|
89
89
|
if credit_card_or_authorization.is_a?(String)
|
90
|
-
|
90
|
+
warn CREDIT_DEPRECATION_MESSAGE
|
91
|
+
refund(money, credit_card_or_authorization, options)
|
91
92
|
else
|
92
93
|
sale_authorization_or_credit_template(:credit, money, credit_card_or_authorization, options)
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
97
|
+
def refund(money, reference, options = {})
|
98
|
+
capture_void_or_refund_template(:refund, money, reference, options)
|
99
|
+
end
|
100
|
+
|
96
101
|
private
|
97
102
|
|
98
103
|
def sale_authorization_or_credit_template(trx_type, money, credit_card, options = {})
|
@@ -13,10 +13,13 @@ module ActiveMerchant #:nodoc:
|
|
13
13
|
self.production_url
|
14
14
|
end
|
15
15
|
|
16
|
-
def self.notification(post)
|
17
|
-
Notification.new(post)
|
16
|
+
def self.notification(post, options)
|
17
|
+
Notification.new(post, options)
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.return(post, options = {})
|
21
|
+
Return.new(post, options)
|
22
|
+
end
|
20
23
|
end
|
21
24
|
end
|
22
25
|
end
|
@@ -26,6 +26,22 @@ module ActiveMerchant #:nodoc:
|
|
26
26
|
mapping :return_url, 'return_url'
|
27
27
|
mapping :cancel_return_url, 'cancel_url'
|
28
28
|
mapping :description, 'detail1_text'
|
29
|
+
|
30
|
+
def initialize(order, account, options = {})
|
31
|
+
super
|
32
|
+
add_tracking_token
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def add_tracking_token
|
39
|
+
return if application_id.blank? || application_id == 'ActiveMerchant'
|
40
|
+
|
41
|
+
add_field('merchant_fields', 'platform')
|
42
|
+
add_field('platform', application_id)
|
43
|
+
puts @fields.inspect
|
44
|
+
end
|
29
45
|
end
|
30
46
|
end
|
31
47
|
end
|
@@ -6,27 +6,50 @@ module ActiveMerchant #:nodoc:
|
|
6
6
|
module Integrations #:nodoc:
|
7
7
|
module Moneybookers
|
8
8
|
class Notification < ActiveMerchant::Billing::Integrations::Notification
|
9
|
-
include PostsData
|
10
9
|
|
11
|
-
|
10
|
+
def initialize(data, options)
|
11
|
+
if options[:credential2].nil?
|
12
|
+
raise ArgumentError, "You need to provide the md5 secret as the option :credential2 to verify that the notification originated from Moneybookers"
|
13
|
+
end
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
12
17
|
def complete?
|
13
|
-
status ==
|
18
|
+
status == 'Completed'
|
14
19
|
end
|
15
20
|
|
21
|
+
# ‘2’ Processed – This status is sent when the transaction is processed and the funds have been received on your Moneybookers account.
|
22
|
+
# ‘0’ Pending – This status is sent when the customers pays via the pending bank transfer option. Such transactions will auto-process IF the bank transfer is received by Moneybookers. We strongly recommend that you do NOT process the order/transaction in your system upon receipt of a pending status from Moneybookers.
|
23
|
+
# ‘-1’ Cancelled – Pending transactions can either be cancelled manually by the sender in their online account history or they will auto-cancel after 14 days if still pending.
|
24
|
+
# ‘-2’ Failed – This status is sent when the customer tries to pay via Credit Card or Direct Debit but our provider declines the transaction. If you do not accept Credit Card or Direct Debit payments via Moneybookers (see page 17) then you will never receive the failed status.
|
25
|
+
# ‘-3’ Chargeback – This status could be received only if your account is configured to receive chargebacks. If this is the case, whenever a chargeback is received by Moneybookers, a -3 status will be posted on the status_url for the reversed transaction.
|
16
26
|
def status
|
27
|
+
case status_code
|
28
|
+
when '2'
|
29
|
+
'Completed'
|
30
|
+
when '0'
|
31
|
+
'Pending'
|
32
|
+
when '-1'
|
33
|
+
'Cancelled'
|
34
|
+
when '-2'
|
35
|
+
'Failed'
|
36
|
+
when '-3'
|
37
|
+
'Reversed'
|
38
|
+
else
|
39
|
+
'Error'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def status_code
|
17
44
|
params['status']
|
18
45
|
end
|
19
|
-
|
46
|
+
|
20
47
|
def item_id
|
21
|
-
|
48
|
+
params['transaction_id']
|
22
49
|
end
|
23
50
|
|
24
51
|
def transaction_id
|
25
|
-
|
26
|
-
params['transaction_id']
|
27
|
-
else
|
28
|
-
params['mb_transaction_id']
|
29
|
-
end
|
52
|
+
params['mb_transaction_id']
|
30
53
|
end
|
31
54
|
|
32
55
|
# When was this payment received by the client.
|
@@ -51,47 +74,52 @@ module ActiveMerchant #:nodoc:
|
|
51
74
|
params['merchant_id']
|
52
75
|
end
|
53
76
|
|
54
|
-
# currency of
|
77
|
+
# currency of the payment as posted by the merchant on the entry form
|
55
78
|
def currency
|
56
|
-
params['
|
79
|
+
params['currency']
|
57
80
|
end
|
58
81
|
|
59
|
-
#
|
82
|
+
# amount of the payment as posted by the merchant on the entry form (ex. 39.60/39.6/39)
|
60
83
|
def gross
|
61
|
-
params['
|
84
|
+
params['amount']
|
62
85
|
end
|
63
86
|
|
64
|
-
# currency of the
|
65
|
-
def
|
66
|
-
params['
|
87
|
+
# currency of mb_amount, will always be the same as the currency of the beneficiary's account at Moneybookers.com
|
88
|
+
def merchant_currency
|
89
|
+
params['mb_currency']
|
67
90
|
end
|
68
91
|
|
69
|
-
# amount of the payment
|
70
|
-
def
|
71
|
-
params['
|
92
|
+
# total amount of the payment in Merchants currency (ex 25.46/25.4/25)
|
93
|
+
def merchant_amount
|
94
|
+
params['mb_amount']
|
72
95
|
end
|
73
96
|
|
74
97
|
# Was this a test transaction?
|
75
98
|
def test?
|
76
99
|
false
|
77
100
|
end
|
78
|
-
|
101
|
+
|
102
|
+
def secret
|
103
|
+
@options[:credential2]
|
104
|
+
end
|
105
|
+
|
79
106
|
# Acknowledge the transaction to MoneyBooker. This method has to be called after a new
|
80
107
|
# apc arrives. It will verify that all the information we received is correct and will return a
|
81
|
-
# ok or a fail.
|
108
|
+
# ok or a fail. The secret (second credential) has to be provided in the parameter :credential2
|
109
|
+
# when instantiating the Notification object.
|
82
110
|
#
|
83
111
|
# Example:
|
84
112
|
#
|
85
113
|
# def ipn
|
86
|
-
# notify = Moneybookers
|
114
|
+
# notify = Moneybookers.notification(request.raw_post, :credential2 => 'secret')
|
87
115
|
#
|
88
|
-
# if notify.acknowledge
|
116
|
+
# if notify.acknowledge
|
89
117
|
# ... process order ... if notify.complete?
|
90
118
|
# else
|
91
119
|
# ... log possible hacking attempt ...
|
92
120
|
# end
|
93
|
-
def acknowledge
|
94
|
-
fields = [merchant_id,
|
121
|
+
def acknowledge
|
122
|
+
fields = [merchant_id, item_id, Digest::MD5.hexdigest(secret).upcase, merchant_amount, merchant_currency, status_code].join
|
95
123
|
md5sig == Digest::MD5.hexdigest(fields).upcase
|
96
124
|
end
|
97
125
|
end
|
@@ -75,7 +75,7 @@ module ActiveMerchant #:nodoc:
|
|
75
75
|
|
76
76
|
# Simply a convenience method that returns a new
|
77
77
|
# ActiveMerchant::Billing::Integrations::Nochex::Notification
|
78
|
-
def self.notification(post)
|
78
|
+
def self.notification(post, options = {})
|
79
79
|
Notification.new(post)
|
80
80
|
end
|
81
81
|
|
@@ -8,9 +8,13 @@ module ActiveMerchant #:nodoc:
|
|
8
8
|
mattr_accessor :service_url
|
9
9
|
self.service_url = 'https://secure.quickpay.dk/form/'
|
10
10
|
|
11
|
-
def self.notification(post)
|
11
|
+
def self.notification(post, options = {})
|
12
12
|
Notification.new(post)
|
13
|
-
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.return(post, options = {})
|
16
|
+
Return.new(post, options)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
@@ -87,14 +87,14 @@ module ActiveMerchant #:nodoc:
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
def
|
91
|
-
|
92
|
-
|
93
|
-
Digest::MD5.hexdigest("#{secret}#{params['sid']}#{transaction_id}#{gross}").upcase == security_key.upcase
|
90
|
+
def secret
|
91
|
+
@options[:credential2]
|
94
92
|
end
|
95
93
|
|
96
94
|
def acknowledge
|
97
|
-
|
95
|
+
return false if security_key.blank?
|
96
|
+
|
97
|
+
Digest::MD5.hexdigest("#{secret}#{params['sid']}#{transaction_id}#{gross}").upcase == security_key.upcase
|
98
98
|
end
|
99
99
|
|
100
100
|
private
|
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
|
|
6
6
|
module Valitor
|
7
7
|
module ResponseFields
|
8
8
|
def success?
|
9
|
-
|
9
|
+
acknowledge
|
10
10
|
end
|
11
11
|
alias :complete? :success?
|
12
12
|
|
@@ -74,15 +74,12 @@ module ActiveMerchant #:nodoc:
|
|
74
74
|
params['Athugasemdir']
|
75
75
|
end
|
76
76
|
|
77
|
-
def
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
84
|
-
end
|
85
|
-
@valid
|
77
|
+
def password
|
78
|
+
@options[:credential2]
|
79
|
+
end
|
80
|
+
|
81
|
+
def acknowledge
|
82
|
+
password ? Digest::MD5.hexdigest("#{password}#{order}") == params['RafraenUndirskriftSvar'] : true
|
86
83
|
end
|
87
84
|
end
|
88
85
|
end
|
@@ -25,9 +25,13 @@ module ActiveMerchant #:nodoc:
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.notification(post)
|
29
|
-
Notification.new(post)
|
30
|
-
end
|
28
|
+
def self.notification(post, options = {})
|
29
|
+
Notification.new(post, options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.return(post, options = {})
|
33
|
+
Return.new(post, options)
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 35
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 13
|
9
|
+
- 0
|
10
|
+
version: 1.13.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tobias Luetke
|
@@ -36,13 +36,14 @@ cert_chain:
|
|
36
36
|
hPaSTyVU0yCSnw==
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2011-
|
39
|
+
date: 2011-04-19 00:00:00 -04:00
|
40
40
|
default_executable:
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name: activesupport
|
44
43
|
prerelease: false
|
45
|
-
|
44
|
+
type: :runtime
|
45
|
+
name: activesupport
|
46
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
46
47
|
none: false
|
47
48
|
requirements:
|
48
49
|
- - ">="
|
@@ -53,12 +54,12 @@ dependencies:
|
|
53
54
|
- 3
|
54
55
|
- 8
|
55
56
|
version: 2.3.8
|
56
|
-
|
57
|
-
version_requirements: *id001
|
57
|
+
requirement: *id001
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
|
-
name: builder
|
60
59
|
prerelease: false
|
61
|
-
|
60
|
+
type: :runtime
|
61
|
+
name: builder
|
62
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
62
63
|
none: false
|
63
64
|
requirements:
|
64
65
|
- - ">="
|
@@ -69,12 +70,12 @@ dependencies:
|
|
69
70
|
- 0
|
70
71
|
- 0
|
71
72
|
version: 2.0.0
|
72
|
-
|
73
|
-
version_requirements: *id002
|
73
|
+
requirement: *id002
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
|
-
name: braintree
|
76
75
|
prerelease: false
|
77
|
-
|
76
|
+
type: :runtime
|
77
|
+
name: braintree
|
78
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
78
79
|
none: false
|
79
80
|
requirements:
|
80
81
|
- - ">="
|
@@ -85,8 +86,7 @@ dependencies:
|
|
85
86
|
- 0
|
86
87
|
- 0
|
87
88
|
version: 2.0.0
|
88
|
-
|
89
|
-
version_requirements: *id003
|
89
|
+
requirement: *id003
|
90
90
|
description: Active Merchant is a simple payment abstraction library used in and sponsored by Shopify. It is written by Tobias Luetke, Cody Fauser, and contributors. The aim of the project is to feel natural to Ruby users and to abstract as many parts as possible away from the user to offer a consistent interface across all supported gateways.
|
91
91
|
email: tobi@leetsoft.com
|
92
92
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|