activemerchant 1.28.0 → 1.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data.tar.gz.sig +3 -3
  2. data/CHANGELOG +36 -0
  3. data/CONTRIBUTORS +8 -0
  4. data/README.md +5 -0
  5. data/lib/active_merchant/billing/gateway.rb +2 -1
  6. data/lib/active_merchant/billing/gateways.rb +6 -7
  7. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
  8. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +77 -78
  9. data/lib/active_merchant/billing/gateways/balanced.rb +0 -1
  10. data/lib/active_merchant/billing/gateways/banwire.rb +1 -2
  11. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +19 -20
  12. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +35 -36
  13. data/lib/active_merchant/billing/gateways/blue_pay.rb +135 -140
  14. data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -4
  15. data/lib/active_merchant/billing/gateways/card_stream.rb +54 -59
  16. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -1
  17. data/lib/active_merchant/billing/gateways/cyber_source.rb +19 -14
  18. data/lib/active_merchant/billing/gateways/data_cash.rb +106 -112
  19. data/lib/active_merchant/billing/gateways/efsnet.rb +29 -34
  20. data/lib/active_merchant/billing/gateways/elavon.rb +7 -1
  21. data/lib/active_merchant/billing/gateways/epay.rb +0 -1
  22. data/lib/active_merchant/billing/gateways/eway.rb +88 -93
  23. data/lib/active_merchant/billing/gateways/eway_managed.rb +47 -51
  24. data/lib/active_merchant/billing/gateways/exact.rb +45 -54
  25. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -4
  26. data/lib/active_merchant/billing/gateways/first_pay.rb +37 -38
  27. data/lib/active_merchant/billing/gateways/garanti.rb +1 -2
  28. data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
  29. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +5 -8
  30. data/lib/active_merchant/billing/gateways/inspire.rb +52 -52
  31. data/lib/active_merchant/billing/gateways/instapay.rb +10 -11
  32. data/lib/active_merchant/billing/gateways/iridium.rb +38 -39
  33. data/lib/active_merchant/billing/gateways/itransact.rb +7 -9
  34. data/lib/active_merchant/billing/gateways/jetpay.rb +45 -46
  35. data/lib/active_merchant/billing/gateways/linkpoint.rb +104 -108
  36. data/lib/active_merchant/billing/gateways/litle.rb +1 -5
  37. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +153 -155
  38. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -50
  39. data/lib/active_merchant/billing/gateways/mercury.rb +272 -0
  40. data/lib/active_merchant/billing/gateways/metrics_global.rb +9 -10
  41. data/lib/active_merchant/billing/gateways/migs.rb +5 -3
  42. data/lib/active_merchant/billing/gateways/modern_payments.rb +6 -7
  43. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +40 -41
  44. data/lib/active_merchant/billing/gateways/moneris.rb +46 -50
  45. data/lib/active_merchant/billing/gateways/moneris_us.rb +52 -55
  46. data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -5
  47. data/lib/active_merchant/billing/gateways/net_registry.rb +20 -21
  48. data/lib/active_merchant/billing/gateways/netaxept.rb +30 -36
  49. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  50. data/lib/active_merchant/billing/gateways/ogone.rb +0 -5
  51. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -6
  52. data/lib/active_merchant/billing/gateways/orbital.rb +25 -21
  53. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
  54. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -6
  55. data/lib/active_merchant/billing/gateways/pay_junction.rb +62 -63
  56. data/lib/active_merchant/billing/gateways/pay_secure.rb +29 -30
  57. data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -5
  58. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +33 -38
  59. data/lib/active_merchant/billing/gateways/payment_express.rb +48 -51
  60. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +7 -11
  61. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +7 -0
  62. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +3 -0
  63. data/lib/active_merchant/billing/gateways/paystation.rb +62 -64
  64. data/lib/active_merchant/billing/gateways/payway.rb +2 -9
  65. data/lib/active_merchant/billing/gateways/plugnpay.rb +0 -1
  66. data/lib/active_merchant/billing/gateways/psigate.rb +102 -94
  67. data/lib/active_merchant/billing/gateways/psl_card.rb +66 -67
  68. data/lib/active_merchant/billing/gateways/qbms.rb +0 -6
  69. data/lib/active_merchant/billing/gateways/quantum.rb +2 -8
  70. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -3
  71. data/lib/active_merchant/billing/gateways/realex.rb +6 -16
  72. data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
  73. data/lib/active_merchant/billing/gateways/sage.rb +15 -16
  74. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
  75. data/lib/active_merchant/billing/gateways/sage_pay.rb +51 -56
  76. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  77. data/lib/active_merchant/billing/gateways/samurai.rb +1 -4
  78. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
  79. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -8
  80. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -5
  81. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +17 -18
  82. data/lib/active_merchant/billing/gateways/skip_jack.rb +29 -34
  83. data/lib/active_merchant/billing/gateways/smart_ps.rb +55 -56
  84. data/lib/active_merchant/billing/gateways/stripe.rb +8 -3
  85. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -29
  86. data/lib/active_merchant/billing/gateways/trust_commerce.rb +85 -87
  87. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +27 -28
  88. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -5
  89. data/lib/active_merchant/billing/gateways/verifi.rb +86 -87
  90. data/lib/active_merchant/billing/gateways/viaklix.rb +42 -47
  91. data/lib/active_merchant/billing/gateways/vindicia.rb +30 -28
  92. data/lib/active_merchant/billing/gateways/webpay.rb +45 -0
  93. data/lib/active_merchant/billing/gateways/wirecard.rb +0 -6
  94. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -9
  95. data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
  96. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
  97. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
  98. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
  99. data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
  100. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
  101. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
  102. data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
  103. data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +17 -1
  104. data/lib/active_merchant/billing/integrations/notification.rb +4 -0
  105. data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
  106. data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
  107. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
  108. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
  109. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
  110. data/lib/active_merchant/billing/integrations/paypal/notification.rb +64 -0
  111. data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +10 -7
  112. data/lib/active_merchant/billing/integrations/webmoney/notification.rb +12 -0
  113. data/lib/active_merchant/billing/response.rb +19 -4
  114. data/lib/active_merchant/version.rb +1 -1
  115. metadata +45 -27
  116. metadata.gz.sig +0 -0
@@ -0,0 +1,26 @@
1
+ require File.dirname(__FILE__) + '/a1agregator/helper.rb'
2
+ require File.dirname(__FILE__) + '/a1agregator/notification.rb'
3
+ require File.dirname(__FILE__) + '/a1agregator/status.rb'
4
+
5
+ module ActiveMerchant #:nodoc:
6
+ module Billing #:nodoc:
7
+ module Integrations #:nodoc:
8
+ module A1agregator
9
+
10
+ mattr_accessor :service_url
11
+ self.service_url = 'https://partner.a1agregator.ru/a1lite/input/'
12
+
13
+ mattr_accessor :signature_parameter_name
14
+ self.signature_parameter_name = 'check'
15
+
16
+ def self.notification(*args)
17
+ Notification.new(*args)
18
+ end
19
+
20
+ def self.status(login, password)
21
+ Status.new(login, password)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,31 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module A1agregator
5
+ class Helper < ActiveMerchant::Billing::Integrations::Helper
6
+
7
+ # public key
8
+ mapping :account, 'key'
9
+
10
+ mapping :amount, 'cost'
11
+
12
+ mapping :order, 'order_id'
13
+
14
+ mapping :customer, :email => 'email',
15
+ :phone => 'phone_number'
16
+
17
+ # payment description
18
+ mapping :credential2, 'name'
19
+
20
+ mapping :credential3, 'comment'
21
+
22
+ # on error
23
+ # 1 - raise error
24
+ # 0 - redirect
25
+ mapping :credential4, 'verbose'
26
+
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,186 @@
1
+ require 'net/http'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ module Integrations #:nodoc:
6
+ module A1agregator
7
+ class Notification < ActiveMerchant::Billing::Integrations::Notification
8
+
9
+ self.production_ips = [
10
+ '78.108.178.206',
11
+ '79.137.235.129',
12
+ '95.163.96.79',
13
+ '212.24.38.100'
14
+ ]
15
+
16
+ def initialize(*args)
17
+ super
18
+ guess_notification_type
19
+ end
20
+
21
+ # Simple notification request params:
22
+ # tid
23
+ # name
24
+ # comment
25
+ # partner_id
26
+ # service_id
27
+ # order_id
28
+ # type
29
+ # partner_income
30
+ # system_income
31
+
32
+ def complete?
33
+ true
34
+ end
35
+
36
+ def transaction_id
37
+ params['tid']
38
+ end
39
+
40
+ def title
41
+ params['name']
42
+ end
43
+
44
+ def comment
45
+ params['comment']
46
+ end
47
+
48
+ def partner_id
49
+ params['partner_id']
50
+ end
51
+
52
+ def service_id
53
+ params['service_id']
54
+ end
55
+
56
+ def item_id
57
+ params['order_id']
58
+ end
59
+
60
+ def type
61
+ params['type']
62
+ end
63
+
64
+ def partner_income
65
+ params['partner_income']
66
+ end
67
+
68
+ def system_income
69
+ params['system_income']
70
+ end
71
+
72
+ # Additional notification request params:
73
+ # tid
74
+ # name
75
+ # comment
76
+ # partner_id
77
+ # service_id
78
+ # order_id
79
+ # type
80
+ # cost
81
+ # income_total
82
+ # income
83
+ # partner_income
84
+ # system_income
85
+ # command
86
+ # phone_number
87
+ # email
88
+ # resultStr
89
+ # date_created
90
+ # version
91
+ # check
92
+
93
+ def inclome_total
94
+ params['income_total']
95
+ end
96
+
97
+ def income
98
+ params['income']
99
+ end
100
+
101
+ def partner_income
102
+ params['partner_income']
103
+ end
104
+
105
+ def system_income
106
+ params['system_income']
107
+ end
108
+
109
+ def command
110
+ params['command']
111
+ end
112
+
113
+ def phone_number
114
+ params['phone_number']
115
+ end
116
+
117
+ def payer_email
118
+ params['email']
119
+ end
120
+
121
+ def result_string
122
+ params['resultStr']
123
+ end
124
+
125
+ def received_at
126
+ params['date_created']
127
+ end
128
+
129
+ def version
130
+ params['version']
131
+ end
132
+
133
+ def security_key
134
+ params[A1agregator.signature_parameter_name].to_s.downcase
135
+ end
136
+
137
+ # the money amount we received in X.2 decimal.
138
+ alias_method :gross, :system_income
139
+
140
+ def currency
141
+ 'RUB'
142
+ end
143
+
144
+ # Was this a test transaction?
145
+ def test?
146
+ params['test'] == '1'
147
+ end
148
+
149
+ def simple_notification?
150
+ @notification_type == :simple
151
+ end
152
+
153
+ def additional_notification?
154
+ @notification_type == :additional
155
+ end
156
+
157
+ def acknowledge
158
+ security_key == signature
159
+ end
160
+
161
+ private
162
+
163
+ def signature
164
+ data = "#{params['tid']}\
165
+ #{params['name']}\
166
+ #{params['comment']}\
167
+ #{params['partner_id']}\
168
+ #{params['service_id']}\
169
+ #{params['order_id']}\
170
+ #{params['type']}\
171
+ #{params['partner_income']}\
172
+ #{params['system_income']}\
173
+ #{params['test']}\
174
+ #{@options[:secret]}"
175
+ Digest::MD5.hexdigest(data)
176
+ end
177
+
178
+ def guess_notification_type
179
+ @notification_type = params['version'] ? :additional : :simple
180
+ end
181
+
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,38 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module A1agregator
5
+
6
+ class Status
7
+ include PostsData
8
+
9
+ STATUS_TEST_URL = 'https://partner.a1pay.ru/a1lite/info/'
10
+
11
+ attr_accessor :login, :password
12
+
13
+ def initialize(login, password)
14
+ @login, @password = login, password
15
+ end
16
+
17
+ # agregator provides two methods:
18
+ # by tid - transaction id
19
+ # by order_id & service_id
20
+ def update(options = {})
21
+ data = PostData.new
22
+ data[:user] = @login
23
+ data[:pass] = @password
24
+ if options[:tid]
25
+ data[:tid] = options[:tid]
26
+ else
27
+ data[:ord_id] = options[:ord_id]
28
+ data[:service_id] = options[:service_id]
29
+ end
30
+
31
+ ssl_post(STATUS_TEST_URL, data.to_post_data)
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,30 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ # Documentation: https://www.liqpay.com/?do=pages&p=cnb10
5
+ module Liqpay
6
+ autoload :Helper, File.dirname(__FILE__) + '/liqpay/helper.rb'
7
+ autoload :Notification, File.dirname(__FILE__) + '/liqpay/notification.rb'
8
+ autoload :Return, File.dirname(__FILE__) + '/liqpay/return.rb'
9
+
10
+ mattr_accessor :service_url
11
+ self.service_url = 'https://liqpay.com/?do=clickNbuy'
12
+
13
+ mattr_accessor :signature_parameter_name
14
+ self.signature_parameter_name = 'signature'
15
+
16
+ def self.helper(order, account, options = {})
17
+ Helper.new(order, account, options)
18
+ end
19
+
20
+ def self.notification(query_string, options = {})
21
+ Notification.new(query_string, options)
22
+ end
23
+
24
+ def self.return(query_string)
25
+ Return.new(query_string)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,43 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module Liqpay
5
+ class Helper < ActiveMerchant::Billing::Integrations::Helper
6
+ def initialize(order, account, options = {})
7
+ @secret = options.delete(:secret)
8
+ super
9
+
10
+ add_field 'version', '1.2'
11
+ end
12
+
13
+ def form_fields
14
+ xml = "<request>
15
+ <version>1.2</version>
16
+ <result_url>#{@fields["result_url"]}</result_url>
17
+ <server_url>#{@fields["server_url"]}</server_url>
18
+ <merchant_id>#{@fields["merchant_id"]}</merchant_id>
19
+ <order_id>#{@fields["order_id"]}</order_id>
20
+ <amount>#{@fields["amount"]}</amount>
21
+ <currency>#{@fields["currency"]}</currency>
22
+ <description>#{@fields["description"]}</description>
23
+ <default_phone>#{@fields["default_phone"]}</default_phone>
24
+ <pay_way>card</pay_way>
25
+ </request>".strip
26
+ sign = Base64.encode64(Digest::SHA1.digest("#{@secret}#{xml}#{@secret}")).strip
27
+ {"operation_xml" => Base64.encode64(xml), "signature" => sign}
28
+ end
29
+
30
+ mapping :account, 'merchant_id'
31
+ mapping :amount, 'amount'
32
+ mapping :currency, 'currency'
33
+ mapping :order, 'order_id'
34
+ mapping :description, 'description'
35
+ mapping :phone, 'default_phone'
36
+
37
+ mapping :notify_url, 'server_url'
38
+ mapping :return_url, 'result_url'
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,89 @@
1
+ require 'net/http'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ module Integrations #:nodoc:
6
+ module Liqpay
7
+ class Notification < ActiveMerchant::Billing::Integrations::Notification
8
+ def self.recognizes?(params)
9
+ params.has_key?('amount') && params.has_key?('order_id')
10
+ end
11
+
12
+ def initialize(post, options = {})
13
+ raise ArgumentError if post.blank?
14
+ super
15
+ @params.merge!(Hash.from_xml(Base64.decode64(xml))["response"])
16
+ end
17
+
18
+ def xml
19
+ @params["operation_xml"]
20
+ end
21
+
22
+ def complete?
23
+ status == 'success'
24
+ end
25
+
26
+ def account
27
+ params['merchant_id']
28
+ end
29
+
30
+ def amount
31
+ BigDecimal.new(gross)
32
+ end
33
+
34
+ def item_id
35
+ params['order_id']
36
+ end
37
+
38
+ def transaction_id
39
+ params['transaction_id']
40
+ end
41
+
42
+ def action_name
43
+ params['action_name'] # either 'result_url' or 'server_url'
44
+ end
45
+
46
+ def version
47
+ params['version']
48
+ end
49
+
50
+ def sender_phone
51
+ params['sender_phone']
52
+ end
53
+
54
+ def security_key
55
+ params[ActiveMerchant::Billing::Integrations::Liqpay.signature_parameter_name]
56
+ end
57
+
58
+ def gross
59
+ params['amount']
60
+ end
61
+
62
+ def currency
63
+ params['currency']
64
+ end
65
+
66
+ def status
67
+ params['status'] # 'success', 'failure' or 'wait_secure'
68
+ end
69
+
70
+ def code
71
+ params['code']
72
+ end
73
+
74
+ def generate_signature_string
75
+ "#{@options[:secret]}#{Base64.decode64(xml)}#{@options[:secret]}"
76
+ end
77
+
78
+ def generate_signature
79
+ Base64.encode64(Digest::SHA1.digest(generate_signature_string)).strip
80
+ end
81
+
82
+ def acknowledge
83
+ security_key == generate_signature
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end