fintecture 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/fintecture/connect.rb +23 -23
- data/lib/fintecture/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75ca8a2420ebb966cc0587979770691f0c4576d6de33a19f9810eca8e0a3e89e
|
4
|
+
data.tar.gz: 7866554d0e343b0323b7417ce4a928b282de1b43b2b0d0995e0c6a13f44c2c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77e664f94d8fddbd15ce066458a26b761cc3300b02bb5f06deef35defa6a09491c8e73962b885bc5d2d5d9bc247f1bcc62a43201d1c5a2d68f0050363b9698e3
|
7
|
+
data.tar.gz: 1e5e372019e0ca6a95bdb847e398194e53a67927a3d0e5e467657f57110a7cad0c304a731810dcf2e875905d9db841c23fc7b47c18928747571f61ab710dee5b
|
data/Gemfile.lock
CHANGED
data/lib/fintecture/connect.rb
CHANGED
@@ -7,16 +7,16 @@ module Fintecture
|
|
7
7
|
SIGNATURE_TYPE = 'rsa-sha256'.freeze
|
8
8
|
|
9
9
|
def connect_url_pis(payment_attrs = nil)
|
10
|
-
|
10
|
+
connect_url(payment_attrs: payment_attrs, type: 'pis')
|
11
11
|
end
|
12
12
|
|
13
13
|
def connect_url(payment_attrs: nil, type: 'pis')
|
14
|
-
@payment_attrs = payment_attrs
|
14
|
+
@payment_attrs = payment_attrs.as_json
|
15
15
|
@type = type
|
16
16
|
|
17
17
|
validate_payment_integrity
|
18
18
|
|
19
|
-
payment_attrs[
|
19
|
+
@payment_attrs['end_to_end_id'] ||= Fintecture::Utils::Crypto.generate_uuid
|
20
20
|
payload = build_payload
|
21
21
|
state = build_state(payload).to_json.to_s
|
22
22
|
|
@@ -24,14 +24,14 @@ module Fintecture
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def verify_url_parameters(parameters = nil)
|
27
|
-
|
27
|
+
@post_payment_attrs = parameters.as_json
|
28
28
|
|
29
|
-
|
29
|
+
validate_post_payment_integrity
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
decrypted = Fintecture::Utils::Crypto.decrypt_private @post_payment_attrs['s']
|
32
|
+
local_digest = build_local_digest @post_payment_attrs
|
33
33
|
|
34
|
-
|
34
|
+
decrypted == local_digest
|
35
35
|
end
|
36
36
|
|
37
37
|
private
|
@@ -49,32 +49,32 @@ module Fintecture
|
|
49
49
|
|
50
50
|
raise "#{error_msg} type" unless %w[pis ais].include? @type
|
51
51
|
|
52
|
-
%
|
53
|
-
raise "#{error_msg} #{param
|
52
|
+
%w[amount currency order_id customer_id customer_full_name customer_email customer_ip].each do |param|
|
53
|
+
raise "#{error_msg} #{param}" if @payment_attrs[param].nil?
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
def validate_post_payment_integrity
|
58
58
|
raise_if_klass_mismatch @post_payment_attrs, Hash, 'post_payment_attrs'
|
59
59
|
|
60
|
-
%
|
61
|
-
raise "invalid post payment parameter #{param
|
60
|
+
%w[s state status session_id customer_id provider].each do |param|
|
61
|
+
raise "invalid post payment parameter #{param}" if @post_payment_attrs[param].nil?
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
def build_payload
|
66
66
|
attributes = {
|
67
|
-
amount: @payment_attrs[
|
68
|
-
currency: @payment_attrs[
|
69
|
-
communication: @payment_attrs[
|
70
|
-
end_to_end_id: @payment_attrs[
|
67
|
+
amount: @payment_attrs['amount'],
|
68
|
+
currency: @payment_attrs['currency'],
|
69
|
+
communication: @payment_attrs['order_id'].to_s,
|
70
|
+
end_to_end_id: @payment_attrs['end_to_end_id']
|
71
71
|
}
|
72
72
|
|
73
73
|
meta = {
|
74
|
-
psu_local_id: @payment_attrs[
|
75
|
-
psu_name: @payment_attrs[
|
76
|
-
psu_email: @payment_attrs[
|
77
|
-
psu_ip: @payment_attrs[
|
74
|
+
psu_local_id: @payment_attrs['customer_id'],
|
75
|
+
psu_name: @payment_attrs['customer_full_name'],
|
76
|
+
psu_email: @payment_attrs['customer_email'],
|
77
|
+
psu_ip: @payment_attrs['customer_ip']
|
78
78
|
}
|
79
79
|
|
80
80
|
data = {
|
@@ -100,9 +100,9 @@ module Fintecture
|
|
100
100
|
access_token: access_token,
|
101
101
|
signature_type: SIGNATURE_TYPE,
|
102
102
|
signature: build_signature(payload),
|
103
|
-
redirect_uri: @payment_attrs[
|
104
|
-
origin_uri: @payment_attrs[
|
105
|
-
order_id: @payment_attrs[
|
103
|
+
redirect_uri: @payment_attrs['redirect_uri'] || '',
|
104
|
+
origin_uri: @payment_attrs['origin_uri'] || '',
|
105
|
+
order_id: @payment_attrs['order_id'],
|
106
106
|
payload: payload,
|
107
107
|
version: Fintecture::VERSION,
|
108
108
|
}
|
data/lib/fintecture/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fintecture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fintecture
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|