banklink_lv 0.0.2
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/Gemfile +2 -0
- data/MIT-LICENSE +20 -0
- data/README +70 -0
- data/README.rdoc +70 -0
- data/Rakefile +51 -0
- data/banklink_lv-1.0.1.gem +0 -0
- data/banklink_lv.gemspec +21 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/app/helpers/banklink_helper.rb +26 -0
- data/lib/banklink_lv/banklink.rb +135 -0
- data/lib/banklink_lv/base.rb +9 -0
- data/lib/banklink_lv/core_ext.rb +730 -0
- data/lib/banklink_lv/helper.rb +111 -0
- data/lib/banklink_lv/notification.rb +167 -0
- data/lib/banklink_lv/swedbank.rb +49 -0
- data/lib/banklink_lv/version.rb +3 -0
- data/lib/banklink_lv.rb +31 -0
- data/rails/init.rb +1 -0
- data/test/banklink_common_test.rb +14 -0
- data/test/banklink_helper_test.rb +21 -0
- data/test/banklink_notification_test.rb +41 -0
- data/test/banklink_view_helper_test.rb +17 -0
- data/test/core_ext_test.rb +7 -0
- data/test/database.yml +3 -0
- data/test/debug.log +6 -0
- data/test/schema.rb +2 -0
- data/test/test_helper.rb +81 -0
- data/uninstall.rb +1 -0
- metadata +95 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
module Banklink #:nodoc:
|
2
|
+
class Helper
|
3
|
+
attr_reader :fields
|
4
|
+
include Banklink::Common
|
5
|
+
|
6
|
+
def initialize(order, account, options = {})
|
7
|
+
|
8
|
+
@options = options
|
9
|
+
@fields = {}
|
10
|
+
|
11
|
+
@options['VK_SND_ID'] = account
|
12
|
+
@options['VK_STAMP'] = order
|
13
|
+
@options['VK_AMOUNT'] = options[:amount]
|
14
|
+
@options['VK_CURR'] = options[:currency]
|
15
|
+
@options['VK_RETURN'] = options[:return]
|
16
|
+
@options['VK_REF'] = options[:reference]
|
17
|
+
@options['VK_MSG'] = options[:message]
|
18
|
+
|
19
|
+
if options[:service_msg_number]
|
20
|
+
@service_msg_number = options.delete(:service_msg_number)
|
21
|
+
else
|
22
|
+
@service_msg_number = default_service_msg_number
|
23
|
+
end
|
24
|
+
|
25
|
+
add_required_params
|
26
|
+
add_vk_mac
|
27
|
+
add_charset_field
|
28
|
+
add_return_url_field
|
29
|
+
add_lang_field
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def form_fields
|
34
|
+
@fields
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.mapping(attribute, options = {})
|
38
|
+
self.mappings ||= {}
|
39
|
+
self.mappings[attribute] = options
|
40
|
+
end
|
41
|
+
|
42
|
+
def add_field(name, value)
|
43
|
+
return if name.blank? || value.blank?
|
44
|
+
@fields[name.to_s] = value.to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
def add_vk_mac
|
48
|
+
# Signature used to validate previous parameters
|
49
|
+
add_field('VK_MAC', generate_mac(@service_msg_number, form_fields))
|
50
|
+
end
|
51
|
+
|
52
|
+
def add_return_url_field
|
53
|
+
add_field('VK_RETURN', @options['VK_RETURN'])
|
54
|
+
end
|
55
|
+
|
56
|
+
def add_lang_field
|
57
|
+
add_field vk_lang_param, vk_lang
|
58
|
+
end
|
59
|
+
|
60
|
+
def add_charset_field
|
61
|
+
add_field vk_charset_param, vk_charset
|
62
|
+
end
|
63
|
+
|
64
|
+
def add_required_params
|
65
|
+
required_params = Banklink.required_service_params[@service_msg_number]
|
66
|
+
required_params.each do |param|
|
67
|
+
param_value = (@options.delete(param) || send(param.to_s.downcase)).to_s
|
68
|
+
add_field param, iconv.iconv(param_value)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Default parameters
|
73
|
+
def vk_charset
|
74
|
+
'UTF-8'
|
75
|
+
end
|
76
|
+
|
77
|
+
def vk_charset_param
|
78
|
+
'VK_ENCODING'
|
79
|
+
end
|
80
|
+
|
81
|
+
# Default parameters
|
82
|
+
def vk_lang
|
83
|
+
'LAT'
|
84
|
+
end
|
85
|
+
|
86
|
+
def vk_lang_param
|
87
|
+
'VK_LANG'
|
88
|
+
end
|
89
|
+
|
90
|
+
def vk_service
|
91
|
+
@service_msg_number
|
92
|
+
end
|
93
|
+
|
94
|
+
def vk_version
|
95
|
+
'008'
|
96
|
+
end
|
97
|
+
|
98
|
+
# Default service message number.
|
99
|
+
# Use '1002' because it requires the least amount of parameters.
|
100
|
+
def default_service_msg_number
|
101
|
+
1002
|
102
|
+
end
|
103
|
+
|
104
|
+
private
|
105
|
+
# Iconv converter to convert from utf8 to
|
106
|
+
# the charset the bank api expects.
|
107
|
+
def iconv
|
108
|
+
@iconv ||= Iconv.new(vk_charset, 'UTF-8')
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
module Banklink
|
2
|
+
|
3
|
+
class Notification
|
4
|
+
include Banklink::Common
|
5
|
+
attr_accessor :params
|
6
|
+
attr_accessor :raw
|
7
|
+
|
8
|
+
# set this to an array in the subclass, to specify which IPs are allowed to send requests
|
9
|
+
class_inheritable_accessor :production_ips
|
10
|
+
|
11
|
+
def initialize(post, options = {})
|
12
|
+
@options = options
|
13
|
+
empty!
|
14
|
+
parse(post)
|
15
|
+
end
|
16
|
+
|
17
|
+
def gross_cents
|
18
|
+
(gross.to_f * 100.0).round
|
19
|
+
end
|
20
|
+
|
21
|
+
# This combines the gross and currency and returns a proper Money object.
|
22
|
+
# this requires the money library located at http://dist.leetsoft.com/api/money
|
23
|
+
def amount
|
24
|
+
return gross_cents
|
25
|
+
end
|
26
|
+
|
27
|
+
# reset the notification.
|
28
|
+
def empty!
|
29
|
+
@params = Hash.new
|
30
|
+
@raw = ""
|
31
|
+
end
|
32
|
+
|
33
|
+
# Check if the request comes from an official IP
|
34
|
+
def valid_sender?(ip)
|
35
|
+
return true if Rails.env == :test || production_ips.blank?
|
36
|
+
production_ips.include?(ip)
|
37
|
+
end
|
38
|
+
|
39
|
+
# A helper method to parse the raw post of the request & return
|
40
|
+
# the right Notification subclass based on the sender id.
|
41
|
+
#def self.get_notification(http_raw_data)
|
42
|
+
# params = ActiveMerchant::Billing::Integrations::Notification.new(http_raw_data).params
|
43
|
+
# Banklink.get_class(params)::Notification.new(http_raw_data)
|
44
|
+
#end
|
45
|
+
|
46
|
+
def get_data_string
|
47
|
+
generate_data_string(params['VK_SERVICE'], params)
|
48
|
+
end
|
49
|
+
|
50
|
+
def bank_signature_valid?(bank_signature, service_msg_number, sigparams)
|
51
|
+
SwedbankLv.get_bank_public_key.verify(OpenSSL::Digest::SHA1.new, bank_signature, generate_data_string(service_msg_number, sigparams))
|
52
|
+
end
|
53
|
+
|
54
|
+
def complete?
|
55
|
+
params['VK_SERVICE'] == '1101'
|
56
|
+
end
|
57
|
+
|
58
|
+
def wait?
|
59
|
+
params['VK_SERVICE'] == '1201'
|
60
|
+
end
|
61
|
+
|
62
|
+
def failed?
|
63
|
+
params['VK_SERVICE'] == '1901'
|
64
|
+
end
|
65
|
+
|
66
|
+
def currency
|
67
|
+
params['VK_CURR']
|
68
|
+
end
|
69
|
+
|
70
|
+
# The order id we passed to the form helper.
|
71
|
+
def item_id
|
72
|
+
params['VK_STAMP']
|
73
|
+
end
|
74
|
+
|
75
|
+
def transaction_id
|
76
|
+
params['VK_T_NO']
|
77
|
+
end
|
78
|
+
|
79
|
+
def sender_name
|
80
|
+
params['VK_SND_NAME']
|
81
|
+
end
|
82
|
+
|
83
|
+
def sender_bank_account
|
84
|
+
params['VK_SND_ACC']
|
85
|
+
end
|
86
|
+
|
87
|
+
def reciever_name
|
88
|
+
params['VK_REC_NAME']
|
89
|
+
end
|
90
|
+
|
91
|
+
def reciever_bank_account
|
92
|
+
params['VK_REC_ACC']
|
93
|
+
end
|
94
|
+
|
95
|
+
# When was this payment received by the client.
|
96
|
+
# We're expecting a dd.mm.yyyy format.
|
97
|
+
def received_at
|
98
|
+
date = params['VK_T_DATE']
|
99
|
+
return nil unless date
|
100
|
+
day, month, year = *date.split('.').map(&:to_i)
|
101
|
+
Date.civil(year, month, day)
|
102
|
+
end
|
103
|
+
|
104
|
+
def signature
|
105
|
+
Base64.decode64(params['VK_MAC'])
|
106
|
+
end
|
107
|
+
|
108
|
+
# The money amount we received, string.
|
109
|
+
def gross
|
110
|
+
params['VK_AMOUNT']
|
111
|
+
end
|
112
|
+
|
113
|
+
# Was this a test transaction?
|
114
|
+
def test?
|
115
|
+
params['VK_REC_ID'] == 'testvpos'
|
116
|
+
end
|
117
|
+
|
118
|
+
# TODO what should be here?
|
119
|
+
def status
|
120
|
+
complete? ? 'Completed' : 'Failed'
|
121
|
+
end
|
122
|
+
|
123
|
+
# If our request was sent automatically by the bank (true) or manually
|
124
|
+
# by the user triggering the callback by pressing a "return" button (false).
|
125
|
+
def automatic?
|
126
|
+
params['VK_AUTO'].upcase == 'Y'
|
127
|
+
end
|
128
|
+
|
129
|
+
def success?
|
130
|
+
acknowledge && complete?
|
131
|
+
end
|
132
|
+
|
133
|
+
# We don't actually acknowledge the notification by making another request ourself,
|
134
|
+
# instead, we check the notification by checking the signature that came with the notification.
|
135
|
+
# This method has to be called when handling the notification & deciding whether to process the order.
|
136
|
+
# Example:
|
137
|
+
#
|
138
|
+
# def notify
|
139
|
+
# notify = Notification.new(params)
|
140
|
+
#
|
141
|
+
# if notify.acknowledge
|
142
|
+
# ... process order ... if notify.complete?
|
143
|
+
# else
|
144
|
+
# ... log possible hacking attempt ...
|
145
|
+
# end
|
146
|
+
def acknowledge
|
147
|
+
bank_signature_valid?(signature, params['VK_SERVICE'], params)
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
private
|
152
|
+
|
153
|
+
# Take the posted data and move the relevant data into a hash
|
154
|
+
def parse(post)
|
155
|
+
@raw = post.to_s
|
156
|
+
puts "====== FROM BANK ======"
|
157
|
+
for line in @raw.split('&')
|
158
|
+
key, value = *line.scan( %r{^([A-Za-z0-9_.]+)\=(.*)$} ).flatten
|
159
|
+
params[key] = CGI.unescape(value)
|
160
|
+
|
161
|
+
puts "<#{key}> #{params[key]}"
|
162
|
+
end
|
163
|
+
puts "======================="
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module SwedbankLv
|
2
|
+
|
3
|
+
# Raw X509 certificate of the bank, string format.
|
4
|
+
mattr_accessor :bank_certificate
|
5
|
+
mattr_accessor :test_bank_certificate
|
6
|
+
# RSA public key of the bank, taken from the X509 certificate of the bank. OpenSSL container.
|
7
|
+
def self.get_bank_public_key
|
8
|
+
if Rails.env == 'production'
|
9
|
+
cert = self.bank_certificate
|
10
|
+
else
|
11
|
+
cert = self.test_bank_certificate
|
12
|
+
end
|
13
|
+
OpenSSL::X509::Certificate.new(cert.gsub(/ /, '')).public_key
|
14
|
+
end
|
15
|
+
|
16
|
+
mattr_accessor :private_key
|
17
|
+
mattr_accessor :test_private_key
|
18
|
+
# Our RSA private key. OpenSSL container.
|
19
|
+
def self.get_private_key
|
20
|
+
if Rails.env == 'production'
|
21
|
+
private_key = self.private_key
|
22
|
+
else
|
23
|
+
private_key = self.test_private_key
|
24
|
+
end
|
25
|
+
OpenSSL::PKey::RSA.new(private_key.gsub(/ /, ''))
|
26
|
+
end
|
27
|
+
|
28
|
+
mattr_accessor :test_url
|
29
|
+
mattr_accessor :production_url
|
30
|
+
def self.service_url
|
31
|
+
mode = Rails.env
|
32
|
+
case mode
|
33
|
+
when 'production'
|
34
|
+
self.production_url
|
35
|
+
when 'test'
|
36
|
+
self.test_url
|
37
|
+
when 'development'
|
38
|
+
self.production_url
|
39
|
+
else
|
40
|
+
self.production_url
|
41
|
+
# raise StandardError, "Integration mode set to an invalid value: #{mode}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.notification(post)
|
46
|
+
Notification.new(post)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/lib/banklink_lv.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'banklink_lv/version'
|
2
|
+
|
3
|
+
require 'active_support'
|
4
|
+
|
5
|
+
require 'net/http'
|
6
|
+
require 'net/https'
|
7
|
+
require 'uri'
|
8
|
+
|
9
|
+
require 'digest'
|
10
|
+
require 'md5'
|
11
|
+
require 'openssl'
|
12
|
+
|
13
|
+
require 'iconv'
|
14
|
+
require 'cgi'
|
15
|
+
|
16
|
+
require 'banklink_lv/core_ext'
|
17
|
+
require 'banklink_lv/banklink'
|
18
|
+
require 'banklink_lv/base'
|
19
|
+
require 'banklink_lv/helper'
|
20
|
+
require 'banklink_lv/swedbank'
|
21
|
+
require 'banklink_lv/notification'
|
22
|
+
require 'app/helpers/banklink_helper'
|
23
|
+
|
24
|
+
#include ActiveSupport
|
25
|
+
|
26
|
+
%w{ models controllers helpers }.each do |dir|
|
27
|
+
path = File.join(File.dirname(__FILE__), 'app', dir)
|
28
|
+
$LOAD_PATH << path
|
29
|
+
#ActiveSupport::Dependencies.load_paths << path
|
30
|
+
#ActiveSupport::Dependencies.load_once_paths.delete(path)
|
31
|
+
end
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'banklink_lv'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class BanklinkCommonTest < Test::Unit::TestCase
|
4
|
+
include Banklink::Common
|
5
|
+
|
6
|
+
def test_should_decide_string_lenght
|
7
|
+
assert_equal "007", func_p("ĀĒŪĪĻĶŠ")
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_should_generate_data_string
|
11
|
+
assert_equal "003foo003bar003goo006tooboo00510565003LVL003dsa004test", generate_data_string(1002, PARAMS_1002)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class BanklinkHelperTest < Test::Unit::TestCase
|
4
|
+
include Banklink
|
5
|
+
|
6
|
+
def test_should_create_fields_for_1002
|
7
|
+
options = {}
|
8
|
+
options[:amount] = '1.55'
|
9
|
+
options[:currency] = 'LVL'
|
10
|
+
options[:return] = 'http://default/'
|
11
|
+
options[:reference] = '54'
|
12
|
+
options[:message] = 'Pay for smtx'
|
13
|
+
|
14
|
+
helper = Helper.new(300, '300', options)
|
15
|
+
helper.form_fields.each do |field, value|
|
16
|
+
puts "<#{field}> #{value}"
|
17
|
+
end
|
18
|
+
assert_equal 12, helper.form_fields.size
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class BanklinkNotificationTest < Test::Unit::TestCase
|
4
|
+
include Banklink
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@swedbank = Banklink::Notification.new(http_raw_data)
|
8
|
+
end
|
9
|
+
|
10
|
+
# TODO: fix test
|
11
|
+
def test_acknowledgement
|
12
|
+
assert_equal false, @swedbank.acknowledge
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_accessors
|
16
|
+
assert_equal true, @swedbank.complete?
|
17
|
+
assert_equal 'Completed', @swedbank.status
|
18
|
+
assert_equal "88", @swedbank.item_id
|
19
|
+
assert_equal "2774", @swedbank.transaction_id
|
20
|
+
assert_equal '33', @swedbank.gross
|
21
|
+
assert_equal "EEK", @swedbank.currency
|
22
|
+
assert_equal '26.11.2007', @swedbank.received_at.strftime("%d.%m.%Y")
|
23
|
+
assert_equal true, @swedbank.test?
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_compositions
|
27
|
+
assert_equal 3300, @swedbank.amount
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_acknowledgement_fail_with_params_changed
|
31
|
+
@swedbank = Banklink::Notification.new(http_raw_data.gsub('VK_AMOUNT=33', 'VK_AMOUNT=100'))
|
32
|
+
assert_equal false, @swedbank.acknowledge
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def http_raw_data
|
38
|
+
"VK_SERVICE=1101&VK_VERSION=008&VK_SND_ID=EYP&VK_REC_ID=testvpos&VK_STAMP=88&VK_T_NO=2774&VK_AMOUNT=33&VK_CURR=EEK&VK_REC_ACC=10002050618003&VK_REC_NAME=ALLAS+ALLAR&VK_SND_ACC=10010046155012&VK_SND_NAME=t%C3%B5%C3%B5ger+%2C+Le%C3%B5p%C3%A4%C3%B6ld%C5%BE%C5%BD%C5%A1%C5%A0&VK_REF=123&VK_MSG=Porgandid&VK_T_DATE=26.11.2007&VK_MAC=LyCZRncu%2F%2BOi5nwzOkI6C9UMFohN6tSl3tLFyIJyNp2lGKBrDKZ2H8b%2BadU3XalzS7MwnAj8r%2FRhLpbsGNE5ysNyM4CKkSrsVzxoXbt9%2BB1foH9Rlp9LCeoR2H774f8UcMe9RVsE%2B%2BZfrEZzzXYyR1PXDCVOShQOAxlD9pbh8nk%3D&VK_LANG=EST&VK_RETURN=http%3A%2F%2F90.190.110.154%2Fseb_est%2Fnotify&VK_AUTO=N&VK_CHARSET=UTF-8&keel=EST&appname=UN3MIN&act=UPOSTEST2"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class BanklinkViewHelperTest < Test::Unit::TestCase
|
4
|
+
include Banklink::ActionViewHelper
|
5
|
+
|
6
|
+
def test_should_create_form
|
7
|
+
options = {}
|
8
|
+
options[:amount] = '1.55'
|
9
|
+
options[:currency] = 'LVL'
|
10
|
+
options[:return] = 'http://default/'
|
11
|
+
options[:reference] = '54'
|
12
|
+
options[:message] = 'Pay for smtx'
|
13
|
+
|
14
|
+
# assert_equal "", payment_service_for(300, '300', options)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/test/database.yml
ADDED
data/test/debug.log
ADDED
data/test/schema.rb
ADDED
data/test/test_helper.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
ENV['RAILS_ENV'] = 'test'
|
2
|
+
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
|
6
|
+
|
7
|
+
require File.dirname(__FILE__) + '/../rails/init'
|
8
|
+
|
9
|
+
# default params
|
10
|
+
PARAMS_1002 = {'VK_SERVICE' => 'foo', 'VK_VERSION' => 'bar', 'VK_SND_ID' => 'goo', 'VK_STAMP' => 'tooboo', 'VK_AMOUNT' => '10565', 'VK_CURR' => 'LVL', 'VK_REF' => 'dsa', 'VK_MSG' => 'test'}
|
11
|
+
|
12
|
+
SwedbankLv.test_private_key = <<EOF
|
13
|
+
-----BEGIN RSA PRIVATE KEY-----
|
14
|
+
MIICXAIBAAKBgQC+AROlXiRvi1T7Q9fAh0Lw73szAn26mqfKDqd6Bdplq3v+gVWC
|
15
|
+
3v0+bgtfNakRE/UVYOxEA0z0viqRpKzPuNy8OstTMe8fFKs19NW8lBYik6NzJ4Bk
|
16
|
+
+B6VmovOm0nJLQJytXKiJyuHP9DqPOVmP8S+azzX7Uqzov1nxo9fvH7y2QIDAQAB
|
17
|
+
AoGAFhbD9O6r57fYCloJxB01gBMnTHfWrBH8vbXUbJAvorA7+wuIKG3KHS7n7Yqs
|
18
|
+
fArI7FJXRVTo5m8RPdtaJ9ADAT9rjAi3A17TaEueyJl+B/hjHYhsd8MeFhTb2fh0
|
19
|
+
rY3F6diL8U/YDbiAIegnKO0zcc6ynJrsQZvzb6DlY/CLPe0CQQD3KXJzw1ZfJ1ts
|
20
|
+
c370b/ZC1YrRURw41Q0I8ljYJ8EJw/ngVxrnCIsd43bRnOVp9guJrjTQRkhDC3Gn
|
21
|
+
J2Y0+42LAkEAxMxmh7QY4nItBTS0fe1KCat4VDxhyxYEhZKlGDhxW75vNROrripB
|
22
|
+
1ZfBsq5xkY2MM9R7WKmL7SpStrUPIvEVqwJBAOXA4ISd61cupbytrDEbNscv7Afh
|
23
|
+
pyNpYOGVLmNYqQgj5c7WCcsD1RYmkRgPCe8y6czFZJDLFHdGVxLz+/16bTsCQC9J
|
24
|
+
Ob2TnYMTkhO1JUU4tdh69e+vjoPgp3d80+Rs83fq2wey0UaI6saqryUC21Dw5OYz
|
25
|
+
QOv92RxEVhmGibuIl/8CQCiYrzwlZJDlsKrWPZT0E8rzNmLZkhNHzYJP9S7x+FKk
|
26
|
+
m3gFeXEBgzGn9UOd6xIAp0p7A1XVBN8XzDMa09gSOks=
|
27
|
+
-----END RSA PRIVATE KEY-----
|
28
|
+
EOF
|
29
|
+
|
30
|
+
SwedbankLv.test_bank_certificate = <<EOF
|
31
|
+
-----BEGIN CERTIFICATE-----
|
32
|
+
MIIDRTCCAq6gAwIBAgIBADANBgkqhkiG9w0BAQQFADB7MQswCQYDVQQGEwJFRTEO
|
33
|
+
MAwGA1UECBMFSGFyanUxEDAOBgNVBAcTB1RhbGxpbm4xDDAKBgNVBAoTA0VZUDEL
|
34
|
+
MAkGA1UECxMCSVQxDDAKBgNVBAMTA2EuYTEhMB8GCSqGSIb3DQEJARYSYWxsYXIu
|
35
|
+
YWxsYXNAZXlwLmVlMB4XDTk5MTExNTA4MTAzM1oXDTk5MTIxNTA4MTAzM1owezEL
|
36
|
+
MAkGA1UEBhMCRUUxDjAMBgNVBAgTBUhhcmp1MRAwDgYDVQQHEwdUYWxsaW5uMQww
|
37
|
+
CgYDVQQKEwNFWVAxCzAJBgNVBAsTAklUMQwwCgYDVQQDEwNhLmExITAfBgkqhkiG
|
38
|
+
9w0BCQEWEmFsbGFyLmFsbGFzQGV5cC5lZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
|
39
|
+
gYkCgYEAvgETpV4kb4tU+0PXwIdC8O97MwJ9upqnyg6negXaZat7/oFVgt79Pm4L
|
40
|
+
XzWpERP1FWDsRANM9L4qkaSsz7jcvDrLUzHvHxSrNfTVvJQWIpOjcyeAZPgelZqL
|
41
|
+
zptJyS0CcrVyoicrhz/Q6jzlZj/Evms81+1Ks6L9Z8aPX7x+8tkCAwEAAaOB2DCB
|
42
|
+
1TAdBgNVHQ4EFgQUFivCzZNmegEoOxYtg20YMMRB98gwgaUGA1UdIwSBnTCBmoAU
|
43
|
+
FivCzZNmegEoOxYtg20YMMRB98ihf6R9MHsxCzAJBgNVBAYTAkVFMQ4wDAYDVQQI
|
44
|
+
EwVIYXJqdTEQMA4GA1UEBxMHVGFsbGlubjEMMAoGA1UEChMDRVlQMQswCQYDVQQL
|
45
|
+
EwJJVDEMMAoGA1UEAxMDYS5hMSEwHwYJKoZIhvcNAQkBFhJhbGxhci5hbGxhc0Bl
|
46
|
+
eXAuZWWCAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBfkayuot+e
|
47
|
+
fwW8QmPwpWF5AY3oMT/fTncjCljDBOg39IQv4PjnpTdDfwwl3lUIZHHTLM2i0L/c
|
48
|
+
eD4D1UFM1qdp2VZzhBd1eeMjxYjCP8qL2v2MfLkCYcP30Sl6ISSkFjFc5qbGXZOc
|
49
|
+
C82uR/wUZJDw9kj+R1O46/byG8yA+S9FVw==
|
50
|
+
-----END CERTIFICATE-----
|
51
|
+
EOF
|
52
|
+
|
53
|
+
SwedbankLv.test_url = 'https://banklink.lv'
|
54
|
+
|
55
|
+
def load_schema
|
56
|
+
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
57
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
58
|
+
|
59
|
+
db_adapter = ENV['DB']
|
60
|
+
|
61
|
+
# no db passed, try one of these fine config-free DBs before bombing.
|
62
|
+
db_adapter ||=
|
63
|
+
begin
|
64
|
+
require 'rubygems'
|
65
|
+
require 'sqlite'
|
66
|
+
'sqlite'
|
67
|
+
rescue MissingSourceFile
|
68
|
+
begin
|
69
|
+
require 'sqlite3'
|
70
|
+
'sqlite3'
|
71
|
+
rescue MissingSourceFile
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
if db_adapter.nil?
|
76
|
+
raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
|
77
|
+
end
|
78
|
+
|
79
|
+
ActiveRecord::Base.establish_connection(config[db_adapter])
|
80
|
+
load(File.dirname(__FILE__) + "/schema.rb")
|
81
|
+
end
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: banklink_lv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Arturs Braucs
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-07 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email: arturs.braucs@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README
|
30
|
+
files:
|
31
|
+
- Gemfile
|
32
|
+
- MIT-LICENSE
|
33
|
+
- README
|
34
|
+
- README.rdoc
|
35
|
+
- Rakefile
|
36
|
+
- banklink_lv-1.0.1.gem
|
37
|
+
- banklink_lv.gemspec
|
38
|
+
- init.rb
|
39
|
+
- install.rb
|
40
|
+
- lib/app/helpers/banklink_helper.rb
|
41
|
+
- lib/banklink_lv.rb
|
42
|
+
- lib/banklink_lv/banklink.rb
|
43
|
+
- lib/banklink_lv/base.rb
|
44
|
+
- lib/banklink_lv/core_ext.rb
|
45
|
+
- lib/banklink_lv/helper.rb
|
46
|
+
- lib/banklink_lv/notification.rb
|
47
|
+
- lib/banklink_lv/swedbank.rb
|
48
|
+
- lib/banklink_lv/version.rb
|
49
|
+
- rails/init.rb
|
50
|
+
- test/banklink_common_test.rb
|
51
|
+
- test/banklink_helper_test.rb
|
52
|
+
- test/banklink_notification_test.rb
|
53
|
+
- test/banklink_view_helper_test.rb
|
54
|
+
- test/core_ext_test.rb
|
55
|
+
- test/database.yml
|
56
|
+
- test/debug.log
|
57
|
+
- test/schema.rb
|
58
|
+
- test/test_helper.rb
|
59
|
+
- uninstall.rb
|
60
|
+
has_rdoc: true
|
61
|
+
homepage: https://github.com/CreativeMobile/Banklink-LV
|
62
|
+
licenses: []
|
63
|
+
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
requirements: []
|
88
|
+
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 1.3.7
|
91
|
+
signing_key:
|
92
|
+
specification_version: 3
|
93
|
+
summary: Banklink integration in your website without active merchant (Latvia)
|
94
|
+
test_files: []
|
95
|
+
|