lolita-bank-link 1.0.2 → 1.0.3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a692e64cc9e5773bc38865d2ac516ff0592e3d6f
|
4
|
+
data.tar.gz: b4941495e06c5ade39bf4038acaadfba9bd18b81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d65e3d8802ab780ea76f1eb9ed2d967f242e054cea5d2b304f65ed739d5e8c33bd8d3ae39d7880860567a459e810ed13c4ca611e2eacb3753cb5ad1cb36344c
|
7
|
+
data.tar.gz: 4db446892acaf63ae7ed3f81c370e0232efbbd814dc5f8c4d67625a0f029fdd32325f7488915ce46b2b875c9222762e1aca56c332099069a3181c56398c82a24
|
@@ -18,19 +18,13 @@ module LolitaBankLink
|
|
18
18
|
# - bank sends another confirmation and add's VK_AUTO=Y to params
|
19
19
|
def answer
|
20
20
|
response = LolitaBankLink::Response.new(response_params)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
21
|
+
response.update_transaction
|
22
|
+
if response.success_redirect?
|
23
|
+
redirect_to response.return_path
|
24
|
+
elsif response.success_response?
|
25
|
+
render nothing: true
|
27
26
|
else
|
28
|
-
|
29
|
-
redirect_to response.return_path
|
30
|
-
else
|
31
|
-
LolitaBankLink.logger.error("[#{session_id}][#{response.paymentable_id}][answer] #{response.error}")
|
32
|
-
render text: I18n.t("bank_link.wrong_request"), status: 400
|
33
|
-
end
|
27
|
+
render text: I18n.t("bank_link.wrong_request"), status: 400
|
34
28
|
end
|
35
29
|
ensure
|
36
30
|
if response
|
@@ -40,10 +34,6 @@ module LolitaBankLink
|
|
40
34
|
|
41
35
|
private
|
42
36
|
|
43
|
-
def bank_auto_response?
|
44
|
-
params["VK_AUTO"] == "Y"
|
45
|
-
end
|
46
|
-
|
47
37
|
# returns current payment instance from session
|
48
38
|
def set_active_payment
|
49
39
|
if session && session[:payment_data]
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module LolitaBankLink
|
2
2
|
class Response
|
3
|
-
attr_reader :params, :required_params, :crypt, :signature
|
3
|
+
attr_reader :params, :required_params, :crypt, :signature, :bank_auto_response
|
4
4
|
attr_accessor :error
|
5
5
|
|
6
6
|
def initialize params
|
7
|
+
@bank_auto_response = params["VK_AUTO"] == "Y"
|
7
8
|
@params = read_required_params(params)
|
8
9
|
@signature = read_signature(params)
|
9
10
|
@crypt = LolitaBankLink::Crypt.new
|
@@ -47,6 +48,14 @@ module LolitaBankLink
|
|
47
48
|
transaction && transaction.completed?
|
48
49
|
end
|
49
50
|
|
51
|
+
def success_redirect?
|
52
|
+
!bank_auto_response && transaction_completed?
|
53
|
+
end
|
54
|
+
|
55
|
+
def success_response?
|
56
|
+
bank_auto_response && transaction_completed?
|
57
|
+
end
|
58
|
+
|
50
59
|
private
|
51
60
|
|
52
61
|
def read_signature(params)
|