fintecture 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b24c5b1997acc13cf4f0921fbf18bfbf1b12a1670f944f275c93656aa8e654e
4
- data.tar.gz: 92be2f3475b55a90824f7beb07174180c62bff3bcf83e8882dac9d62222911b8
3
+ metadata.gz: 9d2e328d5922996c4f88d8bd4931fd0fe10b9e2ded4270918160dbd03a3c9054
4
+ data.tar.gz: c45cc0c0988156002c75f41f09cdb5584973157131f090d532ed1336c86dc156
5
5
  SHA512:
6
- metadata.gz: 501e9cd146fb25f86c872c2a1c412f47adbb78f5a225dcb9b65d63133adee30210b6180686625c0c16d6848e6ae962fe587b1ab66bc30e79bbfc60310a2dfb78
7
- data.tar.gz: 2ad8a2e141344d1a384beff9592fd8a0fc247e2599a4c058ab0a64aa3a7646762b51d543f14784f915974d0ab84565a98c27474d07b5d12331a19699511bbd54
6
+ metadata.gz: 250762c82c3e56553028dfbc16a8c5927204720c685440c87d067eae785682f143abde7a9588093ad426f7bc80d57f0fdbedb36587c64bcd638a8c71923168cb
7
+ data.tar.gz: a8ef6c986acbde371ae675953d0dd26a41d441e661d92097c8bca0d33070fc9f28073ca938c4a7f5d0957f475c1d359b18cc7bec52beb314506c2c0e457468ad
data/README.md CHANGED
@@ -66,17 +66,29 @@ Fintecture::Authentication.access_token
66
66
  payment_attrs = {
67
67
  amount: 123,
68
68
  currency: 'EUR',
69
- order_id: 123,
70
- customer_id: 123,
69
+ communication: 'Thanks Mom!',
71
70
  customer_full_name: 'John Doe',
72
71
  customer_email: 'john.doe@email.com',
73
72
  customer_ip: '127.0.0.1',
74
73
  end_to_end_id: '5f78e902907e4209aa8df63659b05d24', # uuid optional
75
- redirect_uri: '',
76
- origin_uri: ''
74
+ redirect_uri: 'http://example.com/callback',
75
+ origin_uri: '',
76
+ state: 'somestate'
77
77
  }
78
78
  url = Fintecture::Connect.connect_url_pis payment_attrs
79
79
  ```
80
+ Explanation of each field:
81
+
82
+ * amount: **[mandatory]** The amount of the payment initiation request. Min 1.00 and Max is variable based on bank's policy.
83
+ * currency: **[mandatory]** The currency of the payment initiation request. Currently, only EUR and GBP is supported.
84
+ * communication: **[optional]** A message sent to the beneficiary of the payment and visible on his bank statement. In the context of ecommerce payment collection, the order reference is inputted here (with an optional prefer ex: REF#23444)
85
+ * customer_full_name: **[mandatory]** the full name of the payer
86
+ * customer_email: **[mandatory]** the email of the payer
87
+ * customer_ip: **[mandatory]** the ip address of the payer
88
+ * end_to_end_id: **[optional]** unique id of the payment which is sent to the bank but is invisible to the customer. Max 42 character string.
89
+ * redirect_uri: **[mandatory]** the callback URL to which the customer is redirected after authentication with his bank
90
+ * origin_uri: **[optional]** a URL to which the customer will be redirected if he wants to exit Fintecture Connect
91
+ * state: **[optional]** A state parameter which is sent back on callback
80
92
 
81
93
  #### Verify URL parameters
82
94
 
@@ -43,19 +43,27 @@ module Fintecture
43
43
  end
44
44
 
45
45
  def validate_payment_integrity
46
- # raise_if_klass_mismatch @payment_attrs, Hash, 'payment_attrs'
46
+ raise_if_klass_mismatch @payment_attrs, Hash, 'payment_attrs'
47
47
 
48
48
  error_msg = 'invalid payment payload parameter'
49
49
 
50
50
  raise "#{error_msg} type" unless %w[pis ais].include? @type
51
51
 
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?
52
+ raise 'end_to_end_id must be an alphanumeric string' if(@payment_attrs['end_to_end_id'] && !@payment_attrs['end_to_end_id'].match(/^[0-9a-zA-Z]*$/))
53
+
54
+ %w[amount currency customer_full_name customer_email customer_ip redirect_uri].each do |param|
55
+ raise "#{param} is a mandatory field" if @payment_attrs[param].nil?
56
+ end
57
+
58
+ # Check if string
59
+ %w[communication redirect_uri].each do |param|
60
+ raise_if_klass_mismatch(@payment_attrs[param], String, param) if(@payment_attrs[param])
54
61
  end
62
+
55
63
  end
56
64
 
57
65
  def validate_post_payment_integrity
58
- # raise_if_klass_mismatch @post_payment_attrs, Hash, 'post_payment_attrs'
66
+ raise_if_klass_mismatch @post_payment_attrs, Hash, 'post_payment_attrs'
59
67
 
60
68
  %w[s state status session_id customer_id provider].each do |param|
61
69
  raise "invalid post payment parameter #{param}" if @post_payment_attrs[param].nil?
@@ -66,12 +74,11 @@ module Fintecture
66
74
  attributes = {
67
75
  amount: @payment_attrs['amount'],
68
76
  currency: @payment_attrs['currency'],
69
- communication: @payment_attrs['communication'].to_s,
77
+ communication: @payment_attrs['communication'],
70
78
  end_to_end_id: @payment_attrs['end_to_end_id']
71
79
  }
72
80
 
73
81
  meta = {
74
- psu_local_id: @payment_attrs['customer_id'],
75
82
  psu_name: @payment_attrs['customer_full_name'],
76
83
  psu_email: @payment_attrs['customer_email'],
77
84
  psu_ip: @payment_attrs['customer_ip']
@@ -102,7 +109,6 @@ module Fintecture
102
109
  signature: build_signature(payload),
103
110
  redirect_uri: @payment_attrs['redirect_uri'] || '',
104
111
  origin_uri: @payment_attrs['origin_uri'] || '',
105
- order_id: @payment_attrs['order_id'],
106
112
  state: @payment_attrs['state'],
107
113
  payload: payload,
108
114
  version: Fintecture::VERSION,
@@ -130,7 +136,11 @@ module Fintecture
130
136
  def as_json(element)
131
137
  return JSON(element.to_json) if element.is_a? Hash
132
138
 
133
- return element.as_json
139
+ begin
140
+ element.as_json
141
+ rescue NoMethodError
142
+ raise "invalid parameter format, the parameter should be a Hash or an Object Model instead a #{element.class.name}"
143
+ end
134
144
  end
135
145
  end
136
146
  end
@@ -1,3 +1,3 @@
1
1
  module Fintecture
2
- VERSION = "0.1.5"
2
+ VERSION = '0.1.6'
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fintecture
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-16 00:00:00.000000000 Z
11
+ date: 2020-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler