rubykassa 0.3.2 → 0.4.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -4
- data/app/controllers/robokassa_controller.rb +5 -5
- data/lib/generators/rubykassa/templates/rubykassa.rb +4 -4
- data/lib/rubykassa.rb +1 -1
- data/lib/rubykassa/configuration.rb +14 -18
- data/lib/rubykassa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bb9879d9d2b86beba88015e506782c4bd57fd4d
|
4
|
+
data.tar.gz: b47aa33a7cad9f81ec111b031b911ab2e9ac41d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3370eb1c5bf9c0923ac17d4795f381d1d2ad120128a5858888ff11c9fc3e8d292addeb77e7cc2362e376ae0141f046dc3aa77e5f7d49d4fb6233518cd5bdf3a5
|
7
|
+
data.tar.gz: 216ff6f6ab2db1479ea5e2108ce7c4a0090a7a4e35d324afc53f770c679733346b736686b0cf143f933127114b71c09f88fedff3881a1653d28ba10aa4fa32e7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -48,12 +48,12 @@ To define custom success/fail callbacks you can also use the initializer:
|
|
48
48
|
|
49
49
|
Rubykassa.configure do |config|
|
50
50
|
...
|
51
|
-
config.success_callback = -> (
|
52
|
-
config.fail_callback
|
53
|
-
config.result_callback
|
51
|
+
config.success_callback = -> (notification) { render text: 'success' }
|
52
|
+
config.fail_callback = -> (notification) { redirect_to root_path }
|
53
|
+
config.result_callback = -> (notification) { render text: notification.success }
|
54
54
|
end
|
55
55
|
|
56
|
-
Lambdas are called in RobokassaController so you can respond with [any kind that is supported by Rails](http://guides.rubyonrails.org/layouts_and_rendering.html#creating-responses)
|
56
|
+
Lambdas are called in RobokassaController so you can respond with [any kind that is supported by Rails](http://guides.rubyonrails.org/layouts_and_rendering.html#creating-responses).
|
57
57
|
|
58
58
|
NOTE: `result_callback` should always return `"OK#{ invoice_id }"` string. So, implement your custom logic above `render text: notification.success` line.
|
59
59
|
|
@@ -4,22 +4,22 @@ class RobokassaController < ApplicationController
|
|
4
4
|
|
5
5
|
def paid
|
6
6
|
if @notification.valid_result_signature?
|
7
|
-
Rubykassa.result_callback
|
7
|
+
instance_exec @notification, &Rubykassa.result_callback
|
8
8
|
else
|
9
|
-
Rubykassa.fail_callback
|
9
|
+
instance_exec @notification, &Rubykassa.fail_callback
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def success
|
14
14
|
if @notification.valid_success_signature?
|
15
|
-
Rubykassa.success_callback
|
15
|
+
instance_exec @notification, &Rubykassa.success_callback
|
16
16
|
else
|
17
|
-
Rubykassa.fail_callback
|
17
|
+
instance_exec @notification, &Rubykassa.fail_callback
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
def fail
|
22
|
-
Rubykassa.fail_callback
|
22
|
+
instance_exec @notification, &Rubykassa.fail_callback
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
@@ -10,12 +10,12 @@ Rubykassa.configure do |config|
|
|
10
10
|
|
11
11
|
# Result callback is called in RobokassaController#paid action if valid signature
|
12
12
|
# was generated. It should always return "OK#{ invoice_id }" string, so implement
|
13
|
-
# your custom logic above `
|
13
|
+
# your custom logic above `render text: notification.success` line
|
14
14
|
|
15
|
-
config.result_callback = -> (
|
15
|
+
config.result_callback = -> (notification) { render text: notification.success }
|
16
16
|
|
17
17
|
# Define success or failure callbacks here like:
|
18
18
|
|
19
|
-
# config.success_callback = -> (
|
20
|
-
# config.fail_callback = -> (
|
19
|
+
# config.success_callback = -> (notification) { render text: 'success' }
|
20
|
+
# config.fail_callback = -> (notification) { redirect_to root_path }
|
21
21
|
end
|
data/lib/rubykassa.rb
CHANGED
@@ -12,7 +12,7 @@ module Rubykassa
|
|
12
12
|
Rubykassa::Client.configure &block
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
Rubykassa::Configuration::ATTRIBUTES.map do |name|
|
16
16
|
define_method name do
|
17
17
|
Rubykassa::Client.configuration.send(name)
|
18
18
|
end
|
@@ -1,27 +1,23 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
module Rubykassa
|
3
3
|
class Configuration
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
ATTRIBUTES = [
|
5
|
+
:login, :first_password, :second_password, :mode, :http_method, :xml_http_method,
|
6
|
+
:success_callback, :fail_callback, :result_callback
|
7
|
+
]
|
8
|
+
|
9
|
+
attr_accessor *ATTRIBUTES
|
8
10
|
|
9
11
|
def initialize
|
10
12
|
self.login = "your_login"
|
11
|
-
self.first_password
|
12
|
-
self.second_password
|
13
|
-
self.mode
|
14
|
-
self.http_method
|
15
|
-
self.xml_http_method
|
16
|
-
self.success_callback =
|
17
|
-
|
18
|
-
|
19
|
-
self.fail_callback = Proc.new do |controller, notification|
|
20
|
-
render text: 'fail'
|
21
|
-
end
|
22
|
-
self.result_callback = Proc.new do |controller, notification|
|
23
|
-
render text: notification.success
|
24
|
-
end
|
13
|
+
self.first_password = "first_password"
|
14
|
+
self.second_password = "second_password"
|
15
|
+
self.mode = :test
|
16
|
+
self.http_method = :get
|
17
|
+
self.xml_http_method = :get
|
18
|
+
self.success_callback = -> (notification) { render text: 'success' }
|
19
|
+
self.fail_callback = -> (notification) { render text: 'fail' }
|
20
|
+
self.result_callback = -> (notification) { render text: notification.success }
|
25
21
|
end
|
26
22
|
end
|
27
23
|
end
|
data/lib/rubykassa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubykassa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Kishenin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|