rubykassa 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +8 -4
- data/app/controllers/robokassa_controller.rb +1 -1
- data/lib/generators/rubykassa/templates/rubykassa.rb +16 -9
- data/lib/rubykassa/configuration.rb +5 -1
- data/lib/rubykassa/version.rb +1 -1
- data/lib/rubykassa.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: dd92e78dd2880fad505c7e4bcf561a011c0ebabd
|
4
|
+
data.tar.gz: 7075c5b4b5a8b7d5852f2de6e985bba652e23455
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1800cc9729f3a985d9aabf204b3199c251f5b2bdfc6bbe7425256a5e797fb54c148b16f9f3d71ccbcf81bc6b5cf1606588501690b7863b3f21e7a609994f5c3
|
7
|
+
data.tar.gz: 71a029822a6eaf978bd1cd0b950ca9c1ae3a231f556d177188795bdb823f61b7b8b837873ef3e7169ba065b56f9779906307f8e88e87e8ec5f29b16c243666ed
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/ZeroOneStudio/rubykassa/badge.png)](https://coveralls.io/r/ZeroOneStudio/rubykassa)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/ZeroOneStudio/rubykassa.png)](https://codeclimate.com/github/ZeroOneStudio/rubykassa)
|
7
7
|
[![Dependency Status](https://gemnasium.com/ZeroOneStudio/rubykassa.png)](https://gemnasium.com/ZeroOneStudio/rubykassa)
|
8
|
+
[![Inline docs](http://inch-ci.org/github/ZeroOneStudio/rubykassa.svg?branch=master)](http://inch-ci.org/github/ZeroOneStudio/rubykassa)
|
8
9
|
|
9
10
|
by [Zero One][]
|
10
11
|
|
@@ -47,11 +48,14 @@ To define custom success/fail callbacks you can also use the initializer:
|
|
47
48
|
|
48
49
|
Rubykassa.configure do |config|
|
49
50
|
...
|
50
|
-
config.success_callback = -> (controller, notification){ render text: 'success' }
|
51
|
-
config.fail_callback = -> (controller, notification){ redirect_to root_path }
|
51
|
+
config.success_callback = -> (controller, notification) { controller.render text: 'success' }
|
52
|
+
config.fail_callback = -> (controller, notification) { controller.redirect_to controller.root_path }
|
53
|
+
config.result_callback = -> (controller, notification) { controller.render text: notification.success }
|
52
54
|
end
|
53
55
|
|
54
|
-
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) calling it on the `controller` variable.
|
57
|
+
|
58
|
+
NOTE: `result_callback` should always return `"OK#{ invoice_id }"` string. So, implement your custom logic above `render text: notification.success` line.
|
55
59
|
|
56
60
|
Mode is `:test` by default. For production you have to use `:production`.
|
57
61
|
`http_method` and `xml_http_method` are `:get` by default but can be configured as `:post`
|
@@ -103,4 +107,4 @@ Copyright (c) 2013-2014 [Zero One][]
|
|
103
107
|
[ZERO.ONE]: http://www.zeroone.st
|
104
108
|
|
105
109
|
|
106
|
-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ZeroOneStudio/rubykassa/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
110
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ZeroOneStudio/rubykassa/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
@@ -1,14 +1,21 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
|
-
Rubykassa.configure do |
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
Rubykassa.configure do |config|
|
3
|
+
config.login = ENV["ROBOKASSA_LOGIN"]
|
4
|
+
config.first_password = ENV["ROBOKASSA_FIRST_PASSWORD"]
|
5
|
+
config.second_password = ENV["ROBOKASSA_SECOND_PASSWORD"]
|
6
|
+
config.mode = :test # or :production
|
7
|
+
config.http_method = :get # or :post
|
8
|
+
config.xml_http_method = :get # or :post
|
9
|
+
|
10
|
+
|
11
|
+
# Result callback is called in RobokassaController#paid action if valid signature
|
12
|
+
# was generated. It should always return "OK#{ invoice_id }" string, so implement
|
13
|
+
# your custom logic above `controller.render text: notification.success` line
|
14
|
+
|
15
|
+
config.result_callback = -> (controller, notification) { controller.render text: notification.success }
|
9
16
|
|
10
17
|
# Define success or failure callbacks here like:
|
11
18
|
|
12
|
-
# config.success_callback = -> (controller, notification){ render text: 'success' }
|
13
|
-
# config.fail_callback = -> (controller, notification){ redirect_to root_path }
|
19
|
+
# config.success_callback = -> (controller, notification) { controller.render text: 'success' }
|
20
|
+
# config.fail_callback = -> (controller, notification) { controller.redirect_to controller.root_path }
|
14
21
|
end
|
@@ -4,6 +4,7 @@ module Rubykassa
|
|
4
4
|
attr_accessor :login, :first_password, :second_password, :mode, :http_method, :xml_http_method
|
5
5
|
attr_accessor :success_callback
|
6
6
|
attr_accessor :fail_callback
|
7
|
+
attr_accessor :result_callback
|
7
8
|
|
8
9
|
def initialize
|
9
10
|
self.login = "your_login"
|
@@ -18,6 +19,9 @@ module Rubykassa
|
|
18
19
|
self.fail_callback = Proc.new do |controller, notification|
|
19
20
|
render text: 'fail'
|
20
21
|
end
|
22
|
+
self.result_callback = Proc.new do |controller, notification|
|
23
|
+
render text: notification.success
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
23
|
-
end
|
27
|
+
end
|
data/lib/rubykassa/version.rb
CHANGED
data/lib/rubykassa.rb
CHANGED
@@ -12,7 +12,7 @@ module Rubykassa
|
|
12
12
|
Rubykassa::Client.configure &block
|
13
13
|
end
|
14
14
|
|
15
|
-
%w(login first_password second_password mode http_method xml_http_method success_callback fail_callback).map do |name|
|
15
|
+
%w(login first_password second_password mode http_method xml_http_method success_callback fail_callback result_callback).map do |name|
|
16
16
|
define_method name do
|
17
17
|
Rubykassa::Client.configuration.send(name)
|
18
18
|
end
|
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.3.
|
4
|
+
version: 0.3.2
|
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-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|