seb_elink 0.9.2 → 0.9.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/README.md +3 -3
- data/lib/seb_elink/message_specs.rb +2 -6
- data/lib/seb_elink/response.rb +5 -5
- data/lib/seb_elink/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5283ed18506553638a681afb5b1bb1ed0799c38b
|
4
|
+
data.tar.gz: 6582c3b9bcf74f6f9ac177046a77c4981c2f6834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3fae22ac25e64cf39f0722e8a0275daa42af6e0fb5a25f4d3630b233e14cc756754c8f5693572607ebe23731b9522cf7a56da775ea98ecc57d47c2124384dc7
|
7
|
+
data.tar.gz: a0d9d2b9faecccf621ea2d6a34f88aab0d5766d3b5730228b98c7fd5e0a8eb5947ec81b6ee721cc9b9e176bff3e496c5d8cd8bd2785775c66371d3225a281630
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Please note that for consistency in this gem all hash keys are constant-case __s
|
|
18
18
|
|
19
19
|
The gem has three elements represented as Ruby classes:
|
20
20
|
|
21
|
-
|
21
|
+
### 1. SebElink::Gateway
|
22
22
|
Think of this as the communication adapter. Initialize it with a base64-encoded private key string (the human-readable .pem format). You can store the instance in a constant to reduce processing overhead.
|
23
23
|
|
24
24
|
You can pass an optional options hash as the second argument that will specify default values for communications processed by that gateway instance. Useful for setting company-related data just once.
|
@@ -49,7 +49,7 @@ Instances of `SebElink::Gateway` have one method for public use:
|
|
49
49
|
gateway.ibank_api_uri #=> uri for POSTing intial message to.
|
50
50
|
```
|
51
51
|
|
52
|
-
|
52
|
+
### 2. SebElink::Message
|
53
53
|
Instances represent requests to i-bank, generally for payment.
|
54
54
|
|
55
55
|
Initialize these with `SebElink::Message.new(gateway_instance, message_code, data_hash)`
|
@@ -71,7 +71,7 @@ message_instance.digital_signature
|
|
71
71
|
#=> outputs the value of :IB_CRC key, the base64-encoded digital signature of the message
|
72
72
|
```
|
73
73
|
|
74
|
-
|
74
|
+
### 3. SebElink::Response
|
75
75
|
Instances represent responses from SEB.lv i-bank server.
|
76
76
|
Well-formedness is not validated since if digital signature is OK, one would think that the bank adheres to it's own spec.
|
77
77
|
|
@@ -86,13 +86,9 @@ module SebElink
|
|
86
86
|
IB_REC_ID: {no: 4, in_signature: true},
|
87
87
|
IB_PAYMENT_ID: {no: 5, in_signature: true},
|
88
88
|
IB_PAYMENT_DESC: {no: 6, in_signature: true},
|
89
|
-
|
90
|
-
IB_STATUS: {no:
|
89
|
+
IB_FROM_SERVER: {no: 7, in_signature: true},
|
90
|
+
IB_STATUS: {no: 8, in_signature: true},
|
91
91
|
}.freeze
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
93
|
end
|
98
94
|
end
|
data/lib/seb_elink/response.rb
CHANGED
@@ -26,8 +26,8 @@ class SebElink::Response
|
|
26
26
|
|
27
27
|
@valid = gateway_instance.verify({
|
28
28
|
version: version,
|
29
|
-
|
30
|
-
|
29
|
+
message: footprint,
|
30
|
+
base64_signature: body_hash[:IB_CRC]
|
31
31
|
})
|
32
32
|
end
|
33
33
|
|
@@ -41,9 +41,9 @@ class SebElink::Response
|
|
41
41
|
|
42
42
|
private
|
43
43
|
def body_hash
|
44
|
-
@body_hash ||= body.split("&").each_with_object({}) do |q_pair, hash|
|
45
|
-
|
46
|
-
split_index =
|
44
|
+
# @body_hash ||= body.split("&").each_with_object({}) do |q_pair, hash|
|
45
|
+
@body_hash ||= CGI.unescape(body).split("&").each_with_object({}) do |pair, hash|
|
46
|
+
split_index = pair.index("=")
|
47
47
|
key, value = pair[0..(split_index - 1)], pair[split_index.next..-1]
|
48
48
|
hash[key.to_sym] = value.to_s
|
49
49
|
end
|
data/lib/seb_elink/version.rb
CHANGED