activemerchant 1.21.0 → 1.22.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.tar.gz.sig +0 -0
- data/CHANGELOG +63 -0
- data/CONTRIBUTORS +29 -0
- data/README.md +195 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +2 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +2 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +492 -11
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +46 -19
- data/lib/active_merchant/billing/gateways/certo_direct.rb +1 -1
- data/lib/active_merchant/billing/gateways/cyber_source.rb +342 -106
- data/lib/active_merchant/billing/gateways/elavon.rb +2 -0
- data/lib/active_merchant/billing/gateways/epay.rb +3 -1
- data/lib/active_merchant/billing/gateways/itransact.rb +450 -0
- data/lib/active_merchant/billing/gateways/migs.rb +259 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
- data/lib/active_merchant/billing/gateways/moneris_us.rb +211 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +104 -12
- data/lib/active_merchant/billing/gateways/orbital.rb +15 -6
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +1 -4
- data/lib/active_merchant/billing/gateways/payflow.rb +8 -3
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +4 -1
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal.rb +3 -18
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +287 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +245 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +14 -66
- data/lib/active_merchant/billing/gateways/realex.rb +5 -7
- data/lib/active_merchant/billing/gateways/stripe.rb +1 -9
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +2 -2
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +1 -5
- data/lib/active_merchant/billing/gateways/viaklix.rb +7 -2
- data/lib/active_merchant/billing/gateways/vindicia.rb +359 -0
- data/lib/active_merchant/billing/integrations/dotpay.rb +22 -0
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +77 -0
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +86 -0
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +11 -0
- data/lib/active_merchant/billing/integrations/epay.rb +21 -0
- data/lib/active_merchant/billing/integrations/epay/helper.rb +55 -0
- data/lib/active_merchant/billing/integrations/epay/notification.rb +110 -0
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +2 -1
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +2 -3
- data/lib/active_merchant/billing/integrations/robokassa.rb +49 -0
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +19 -0
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +50 -0
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +55 -0
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +17 -0
- data/lib/active_merchant/billing/integrations/two_checkout.rb +25 -3
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +15 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +20 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +87 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +59 -0
- data/lib/active_merchant/version.rb +1 -1
- metadata +59 -26
- metadata.gz.sig +0 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
module Integrations #:nodoc:
|
6
|
+
module Dotpay
|
7
|
+
class Notification < ActiveMerchant::Billing::Integrations::Notification
|
8
|
+
def complete?
|
9
|
+
status == 'OK' && %w(2 4 5).include?(t_status)
|
10
|
+
end
|
11
|
+
|
12
|
+
def currency
|
13
|
+
orginal_amount.split(' ')[1]
|
14
|
+
end
|
15
|
+
|
16
|
+
# the money amount we received in X.2 decimal.
|
17
|
+
def gross
|
18
|
+
params['amount']
|
19
|
+
end
|
20
|
+
|
21
|
+
def pin=(value)
|
22
|
+
@options[:pin] = value
|
23
|
+
end
|
24
|
+
|
25
|
+
def status
|
26
|
+
params['status']
|
27
|
+
end
|
28
|
+
|
29
|
+
def test?
|
30
|
+
params['t_id'].match('.*-TST\d+') ? true : false
|
31
|
+
end
|
32
|
+
|
33
|
+
PAYMENT_HOOK_FIELDS = [
|
34
|
+
:id,
|
35
|
+
:control,
|
36
|
+
:t_id,
|
37
|
+
:orginal_amount,
|
38
|
+
:email,
|
39
|
+
:service,
|
40
|
+
:code,
|
41
|
+
:username,
|
42
|
+
:password,
|
43
|
+
:t_status,
|
44
|
+
:description,
|
45
|
+
:md5,
|
46
|
+
:p_info,
|
47
|
+
:p_email,
|
48
|
+
:t_date
|
49
|
+
]
|
50
|
+
|
51
|
+
PAYMENT_HOOK_SIGNATURE_FIELDS = [
|
52
|
+
:id,
|
53
|
+
:control,
|
54
|
+
:t_id,
|
55
|
+
:amount,
|
56
|
+
:email,
|
57
|
+
:service,
|
58
|
+
:code,
|
59
|
+
:username,
|
60
|
+
:password,
|
61
|
+
:t_status
|
62
|
+
]
|
63
|
+
|
64
|
+
# Provide access to raw fields
|
65
|
+
PAYMENT_HOOK_FIELDS.each do |key|
|
66
|
+
define_method(key.to_s) do
|
67
|
+
params[key.to_s]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def generate_signature_string
|
72
|
+
"#{@options[:pin]}:" + PAYMENT_HOOK_SIGNATURE_FIELDS.map {|key| params[key.to_s]} * ":"
|
73
|
+
end
|
74
|
+
|
75
|
+
def generate_signature
|
76
|
+
Digest::MD5.hexdigest(generate_signature_string)
|
77
|
+
end
|
78
|
+
|
79
|
+
def acknowledge
|
80
|
+
generate_signature.to_s == md5.to_s
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module Epay
|
5
|
+
autoload :Helper, File.dirname(__FILE__) + '/epay/helper.rb'
|
6
|
+
autoload :Notification, File.dirname(__FILE__) + '/epay/notification.rb'
|
7
|
+
|
8
|
+
mattr_accessor :service_url
|
9
|
+
self.service_url = 'https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/Default.aspx'
|
10
|
+
|
11
|
+
def self.notification(post, options = {})
|
12
|
+
Notification.new(post)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.return(post, options = {})
|
16
|
+
Return.new(post, options)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module Epay
|
5
|
+
class Helper < ActiveMerchant::Billing::Integrations::Helper
|
6
|
+
|
7
|
+
def initialize(order, merchantnumber, options = {})
|
8
|
+
super
|
9
|
+
add_field('windowstate', 3)
|
10
|
+
add_field('language', '0')
|
11
|
+
add_field('orderid', format_order_number(order))
|
12
|
+
@fields = Hash[@fields.sort]
|
13
|
+
end
|
14
|
+
|
15
|
+
def md5secret(value)
|
16
|
+
@md5secret = value
|
17
|
+
end
|
18
|
+
|
19
|
+
def form_fields
|
20
|
+
@fields.merge('hash' => generate_md5hash)
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_md5string
|
24
|
+
@fields.sort.each.map { |key, value| key != 'hash' ? value.to_s : ''} * "" + @md5secret
|
25
|
+
end
|
26
|
+
|
27
|
+
def generate_md5hash
|
28
|
+
Digest::MD5.hexdigest(generate_md5string)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Limited to 20 digits max
|
32
|
+
def format_order_number(number)
|
33
|
+
number.to_s.gsub(/[^\w_]/, '').rjust(4, "0")[0...20]
|
34
|
+
end
|
35
|
+
|
36
|
+
mapping :account, 'merchantnumber'
|
37
|
+
mapping :language, 'language'
|
38
|
+
mapping :amount, 'amount'
|
39
|
+
mapping :currency, 'currency'
|
40
|
+
mapping :return_url, 'accepturl'
|
41
|
+
mapping :cancel_return_url, 'cancelurl'
|
42
|
+
mapping :notify_url, 'callbackurl'
|
43
|
+
mapping :autocapture, 'instantcapture'
|
44
|
+
mapping :description, 'description'
|
45
|
+
mapping :credential3, 'md5secret'
|
46
|
+
mapping :customer, ''
|
47
|
+
mapping :billing_address, {}
|
48
|
+
mapping :tax, ''
|
49
|
+
mapping :shipping, ''
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
module Integrations #:nodoc:
|
6
|
+
module Epay
|
7
|
+
class Notification < ActiveMerchant::Billing::Integrations::Notification
|
8
|
+
|
9
|
+
CURRENCY_CODES = {
|
10
|
+
:ADP => '020', :AED => '784', :AFA => '004', :ALL => '008', :AMD => '051',
|
11
|
+
:ANG => '532', :AOA => '973', :ARS => '032', :AUD => '036', :AWG => '533',
|
12
|
+
:AZM => '031', :BAM => '977', :BBD => '052', :BDT => '050', :BGL => '100',
|
13
|
+
:BGN => '975', :BHD => '048', :BIF => '108', :BMD => '060', :BND => '096',
|
14
|
+
:BOB => '068', :BOV => '984', :BRL => '986', :BSD => '044', :BTN => '064',
|
15
|
+
:BWP => '072', :BYR => '974', :BZD => '084', :CAD => '124', :CDF => '976',
|
16
|
+
:CHF => '756', :CLF => '990', :CLP => '152', :CNY => '156', :COP => '170',
|
17
|
+
:CRC => '188', :CUP => '192', :CVE => '132', :CYP => '196', :CZK => '203',
|
18
|
+
:DJF => '262', :DKK => '208', :DOP => '214', :DZD => '012', :ECS => '218',
|
19
|
+
:ECV => '983', :EEK => '233', :EGP => '818', :ERN => '232', :ETB => '230',
|
20
|
+
:EUR => '978', :FJD => '242', :FKP => '238', :GBP => '826', :GEL => '981',
|
21
|
+
:GHC => '288', :GIP => '292', :GMD => '270', :GNF => '324', :GTQ => '320',
|
22
|
+
:GWP => '624', :GYD => '328', :HKD => '344', :HNL => '340', :HRK => '191',
|
23
|
+
:HTG => '332', :HUF => '348', :IDR => '360', :ILS => '376', :INR => '356',
|
24
|
+
:IQD => '368', :IRR => '364', :ISK => '352', :JMD => '388', :JOD => '400',
|
25
|
+
:JPY => '392', :KES => '404', :KGS => '417', :KHR => '116', :KMF => '174',
|
26
|
+
:KPW => '408', :KRW => '410', :KWD => '414', :KYD => '136', :KZT => '398',
|
27
|
+
:LAK => '418', :LBP => '422', :LKR => '144', :LRD => '430', :LSL => '426',
|
28
|
+
:LTL => '440', :LVL => '428', :LYD => '434', :MAD => '504', :MDL => '498',
|
29
|
+
:MGF => '450', :MKD => '807', :MMK => '104', :MNT => '496', :MOP => '446',
|
30
|
+
:MRO => '478', :MTL => '470', :MUR => '480', :MVR => '462', :MWK => '454',
|
31
|
+
:MXN => '484', :MXV => '979', :MYR => '458', :MZM => '508', :NAD => '516',
|
32
|
+
:NGN => '566', :NIO => '558', :NOK => '578', :NPR => '524', :NZD => '554',
|
33
|
+
:OMR => '512', :PAB => '590', :PEN => '604', :PGK => '598', :PHP => '608',
|
34
|
+
:PKR => '586', :PLN => '985', :PYG => '600', :QAR => '634', :ROL => '642',
|
35
|
+
:RUB => '643', :RUR => '810', :RWF => '646', :SAR => '682', :SBD => '090',
|
36
|
+
:SCR => '690', :SDD => '736', :SEK => '752', :SGD => '702', :SHP => '654',
|
37
|
+
:SIT => '705', :SKK => '703', :SLL => '694', :SOS => '706', :SRG => '740',
|
38
|
+
:STD => '678', :SVC => '222', :SYP => '760', :SZL => '748', :THB => '764',
|
39
|
+
:TJS => '972', :TMM => '795', :TND => '788', :TOP => '776', :TPE => '626',
|
40
|
+
:TRL => '792', :TRY => '949', :TTD => '780', :TWD => '901', :TZS => '834',
|
41
|
+
:UAH => '980', :UGX => '800', :USD => '840', :UYU => '858', :UZS => '860',
|
42
|
+
:VEB => '862', :VND => '704', :VUV => '548', :XAF => '950', :XCD => '951',
|
43
|
+
:XOF => '952', :XPF => '953', :YER => '886', :YUM => '891', :ZAR => '710',
|
44
|
+
:ZMK => '894', :ZWD => '716'
|
45
|
+
}
|
46
|
+
|
47
|
+
def complete?
|
48
|
+
Integer(transaction_id) > 0
|
49
|
+
end
|
50
|
+
|
51
|
+
def item_id
|
52
|
+
params['orderid']
|
53
|
+
end
|
54
|
+
|
55
|
+
def transaction_id
|
56
|
+
params['txnid']
|
57
|
+
end
|
58
|
+
|
59
|
+
def received_at
|
60
|
+
Time.mktime(params['date'][0..3], params['date'][4..5], params['date'][6..7], params['time'][0..1], params['time'][2..3])
|
61
|
+
end
|
62
|
+
|
63
|
+
def gross
|
64
|
+
"%.2f" % (gross_cents / 100.0)
|
65
|
+
end
|
66
|
+
|
67
|
+
def gross_cents
|
68
|
+
params['amount'].to_i
|
69
|
+
end
|
70
|
+
|
71
|
+
def test?
|
72
|
+
return false
|
73
|
+
end
|
74
|
+
|
75
|
+
%w(txnid orderid amount currency date time hash fraud payercountry issuercountry txnfee subscriptionid paymenttype cardno).each do |attr|
|
76
|
+
define_method(attr) do
|
77
|
+
params[attr]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def currency
|
82
|
+
CURRENCY_CODES.invert[params['currency']].to_s
|
83
|
+
end
|
84
|
+
|
85
|
+
def amount
|
86
|
+
Money.new(params['amount'].to_i, currency)
|
87
|
+
end
|
88
|
+
|
89
|
+
def generate_md5string
|
90
|
+
md5string = String.new
|
91
|
+
for line in @raw.split('&')
|
92
|
+
key, value = *line.scan( %r{^([A-Za-z0-9_.]+)\=(.*)$} ).flatten
|
93
|
+
md5string += params[key] if key != 'hash'
|
94
|
+
end
|
95
|
+
return md5string + @options[:credential3]
|
96
|
+
end
|
97
|
+
|
98
|
+
def generate_md5hash
|
99
|
+
Digest::MD5.hexdigest(generate_md5string)
|
100
|
+
end
|
101
|
+
|
102
|
+
def acknowledge
|
103
|
+
generate_md5hash == params['hash']
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -54,7 +54,8 @@ module ActiveMerchant #:nodoc:
|
|
54
54
|
# One possible scenario is that our web application was down. In this case paypal tries several
|
55
55
|
# times an hour to inform us about the notification
|
56
56
|
def received_at
|
57
|
-
|
57
|
+
parsed_time_fields = DateTime._strptime(params['payment_date'], "%H:%M:%S %b %d, %Y %z")
|
58
|
+
Time.mktime(*parsed_time_fields.values_at(:year, :mon, :mday, :hour, :min, :sec, :zone))
|
58
59
|
end
|
59
60
|
|
60
61
|
# Status of transaction. List of possible values:
|
@@ -5,12 +5,13 @@ module ActiveMerchant #:nodoc:
|
|
5
5
|
class Helper < ActiveMerchant::Billing::Integrations::Helper
|
6
6
|
|
7
7
|
def initialize(order, account, options = {})
|
8
|
+
md5secret options.delete(:credential2)
|
8
9
|
super
|
9
10
|
add_field('protocol', '3')
|
10
11
|
add_field('msgtype', 'authorize')
|
11
12
|
add_field('language', 'da')
|
12
13
|
add_field('autocapture', 0)
|
13
|
-
add_field('testmode', 0)
|
14
|
+
add_field('testmode', test? ? 1 : 0)
|
14
15
|
add_field('ordernumber', format_order_number(order))
|
15
16
|
end
|
16
17
|
|
@@ -59,8 +60,6 @@ module ActiveMerchant #:nodoc:
|
|
59
60
|
mapping :ipaddress, 'ipaddress'
|
60
61
|
mapping :testmode, 'testmode'
|
61
62
|
|
62
|
-
mapping :credential2, 'md5secret'
|
63
|
-
|
64
63
|
mapping :customer, ''
|
65
64
|
mapping :billing_address, {}
|
66
65
|
mapping :tax, ''
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
|
5
|
+
# Documentation: http://robokassa.ru/Doc/En/Interface.aspx
|
6
|
+
module Robokassa
|
7
|
+
autoload :Helper, File.dirname(__FILE__) + '/robokassa/helper.rb'
|
8
|
+
autoload :Notification, File.dirname(__FILE__) + '/robokassa/notification.rb'
|
9
|
+
autoload :Return, File.dirname(__FILE__) + '/robokassa/return.rb'
|
10
|
+
autoload :Common, File.dirname(__FILE__) + '/robokassa/common.rb'
|
11
|
+
|
12
|
+
# Overwrite this if you want to change the Robokassa test url
|
13
|
+
mattr_accessor :test_url
|
14
|
+
self.test_url = 'http://test.robokassa.ru/Index.aspx'
|
15
|
+
|
16
|
+
# Overwrite this if you want to change the Robokassa production url
|
17
|
+
mattr_accessor :production_url
|
18
|
+
self.production_url = 'https://merchant.roboxchange.com/Index.aspx'
|
19
|
+
|
20
|
+
mattr_accessor :signature_parameter_name
|
21
|
+
self.signature_parameter_name = 'SignatureValue'
|
22
|
+
|
23
|
+
def self.service_url
|
24
|
+
mode = ActiveMerchant::Billing::Base.integration_mode
|
25
|
+
case mode
|
26
|
+
when :production
|
27
|
+
self.production_url
|
28
|
+
when :test
|
29
|
+
self.test_url
|
30
|
+
else
|
31
|
+
raise StandardError, "Integration mode set to an invalid value: #{mode}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.helper(order, account, options = {})
|
36
|
+
Helper.new(order, account, options)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.notification(query_string, options = {})
|
40
|
+
Notification.new(query_string, options)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.return(query_string)
|
44
|
+
Return.new(query_string)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module Robokassa
|
5
|
+
module Common
|
6
|
+
def generate_signature_string
|
7
|
+
custom_param_keys = params.keys.select {|key| key =~ /^shp/}.sort
|
8
|
+
custom_params = custom_param_keys.map {|key| "#{key}=#{params[key]}"}
|
9
|
+
[main_params, secret, custom_params].flatten.compact.join(':')
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate_signature
|
13
|
+
Digest::MD5.hexdigest(generate_signature_string)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module Robokassa
|
5
|
+
class Helper < ActiveMerchant::Billing::Integrations::Helper
|
6
|
+
include Common
|
7
|
+
|
8
|
+
def initialize(order, account, options = {})
|
9
|
+
@md5secret = options.delete(:secret)
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def form_fields
|
14
|
+
@fields.merge(ActiveMerchant::Billing::Integrations::Robokassa.signature_parameter_name => generate_signature)
|
15
|
+
end
|
16
|
+
|
17
|
+
def main_params
|
18
|
+
[:account, :amount, :order].map {|key| @fields[mappings[key]]}
|
19
|
+
end
|
20
|
+
|
21
|
+
def params
|
22
|
+
@fields
|
23
|
+
end
|
24
|
+
|
25
|
+
def secret
|
26
|
+
@md5secret
|
27
|
+
end
|
28
|
+
|
29
|
+
def method_missing(method_id, *args)
|
30
|
+
method_id = method_id.to_s.gsub(/=$/, '')
|
31
|
+
|
32
|
+
# support for robokassa custom parameters
|
33
|
+
if method_id =~ /^shp/
|
34
|
+
add_field method_id, args.last
|
35
|
+
end
|
36
|
+
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
mapping :account, 'MrchLogin'
|
41
|
+
mapping :amount, 'OutSum'
|
42
|
+
mapping :currency, 'IncCurrLabel'
|
43
|
+
mapping :order, 'InvId'
|
44
|
+
mapping :description, 'Desc'
|
45
|
+
mapping :email, 'Email'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module Robokassa
|
5
|
+
class Notification < ActiveMerchant::Billing::Integrations::Notification
|
6
|
+
include Common
|
7
|
+
|
8
|
+
def self.recognizes?(params)
|
9
|
+
params.has_key?('InvId') && params.has_key?('OutSum')
|
10
|
+
end
|
11
|
+
|
12
|
+
def complete?
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
def amount
|
17
|
+
BigDecimal.new(gross)
|
18
|
+
end
|
19
|
+
|
20
|
+
def item_id
|
21
|
+
params['InvId']
|
22
|
+
end
|
23
|
+
|
24
|
+
def security_key
|
25
|
+
params[ActiveMerchant::Billing::Integrations::Robokassa.signature_parameter_name].to_s.downcase
|
26
|
+
end
|
27
|
+
|
28
|
+
def gross
|
29
|
+
params['OutSum']
|
30
|
+
end
|
31
|
+
|
32
|
+
def status
|
33
|
+
'success'
|
34
|
+
end
|
35
|
+
|
36
|
+
def secret
|
37
|
+
@options[:secret]
|
38
|
+
end
|
39
|
+
|
40
|
+
def main_params
|
41
|
+
[gross, item_id]
|
42
|
+
end
|
43
|
+
|
44
|
+
def acknowledge
|
45
|
+
security_key == generate_signature
|
46
|
+
end
|
47
|
+
|
48
|
+
def success_response(*args)
|
49
|
+
"OK#{item_id}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|