fintecture 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc7cb2f525cc68f62282338bd42ea9192cdec355b8cae741af10c23d8a39707a
4
- data.tar.gz: 996a01131a38654376f643a27a3320fcfdf6cb54a257ed02e5c6827bb03f993d
3
+ metadata.gz: 75ca8a2420ebb966cc0587979770691f0c4576d6de33a19f9810eca8e0a3e89e
4
+ data.tar.gz: 7866554d0e343b0323b7417ce4a928b282de1b43b2b0d0995e0c6a13f44c2c61
5
5
  SHA512:
6
- metadata.gz: 81c99f6a60b75faff2d5b3c7d98d75df3078ad66089dcd2b07e81434291f05cc0abf6690bfbc667c61c9d8be5251afa59b8755552af05aa2304a896e3c4cf34d
7
- data.tar.gz: 9d166f76394978c2baa9f3b3c187740c2b5449263f21a5b3ddc400b6d327b7c2b989a82e110142cdf6134d8680ca38e566f15daa2a898921ec643162bf2504b8
6
+ metadata.gz: 77e664f94d8fddbd15ce066458a26b761cc3300b02bb5f06deef35defa6a09491c8e73962b885bc5d2d5d9bc247f1bcc62a43201d1c5a2d68f0050363b9698e3
7
+ data.tar.gz: 1e5e372019e0ca6a95bdb847e398194e53a67927a3d0e5e467657f57110a7cad0c304a731810dcf2e875905d9db841c23fc7b47c18928747571f61ab710dee5b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fintecture (0.1.1)
4
+ fintecture (0.1.2)
5
5
  faraday
6
6
 
7
7
  GEM
@@ -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
- connect_url(payment_attrs: payment_attrs, type: 'pis')
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[:end_to_end_id] ||= Fintecture::Utils::Crypto.generate_uuid
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
- @post_payment_attrs = parameters
27
+ @post_payment_attrs = parameters.as_json
28
28
 
29
- validate_post_payment_integrity
29
+ validate_post_payment_integrity
30
30
 
31
- decrypted = Fintecture::Utils::Crypto.decrypt_private parameters[:s]
32
- local_digest = build_local_digest parameters
31
+ decrypted = Fintecture::Utils::Crypto.decrypt_private @post_payment_attrs['s']
32
+ local_digest = build_local_digest @post_payment_attrs
33
33
 
34
- decrypted == local_digest
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
- %i[amount currency order_id customer_id customer_full_name customer_email customer_ip].each do |param|
53
- raise "#{error_msg} #{param.to_s}" if @payment_attrs[param].nil?
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
- %i[s state status session_id customer_id provider].each do |param|
61
- raise "invalid post payment parameter #{param.to_s}" if @post_payment_attrs[param].nil?
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[: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]
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[:customer_id],
75
- psu_name: @payment_attrs[:customer_full_name],
76
- psu_email: @payment_attrs[:customer_email],
77
- psu_ip: @payment_attrs[:customer_ip]
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[:redirect_uri] || '',
104
- origin_uri: @payment_attrs[:origin_uri] || '',
105
- order_id: @payment_attrs[:order_id],
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
  }
@@ -1,3 +1,3 @@
1
1
  module Fintecture
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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 00:00:00.000000000 Z
11
+ date: 2019-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler