rubykassa 0.1.0 → 0.1.1
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 +47 -5
- data/config/routes.rb +5 -3
- data/lib/generators/rubykassa/install_generator.rb +10 -0
- data/lib/generators/rubykassa/templates/rubykassa.rb +9 -0
- data/lib/rubykassa/configuration.rb +1 -1
- data/lib/rubykassa/version.rb +1 -1
- data/lib/rubykassa.rb +1 -1
- data/spec/dummy/config/initializers/rubykassa.rb +3 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b21115e2d037d94d54779b400b762b31cbe79e11
|
4
|
+
data.tar.gz: 483e42685380f113d2c309d911a697570a971ce2
|
5
5
|
!binary "U0hBNTEy":
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ead1b43e4512e9f364c426ad8f3f806643519f0d31dbe11eb369c6a4dc892d4a17dd8177193c0c7c831d6d542a0ef1c73c9e77c414eca66e3094c8fe668114b6
|
7
|
+
data.tar.gz: 8b3784c955556cc99f3c1b7316332679f74052f26d94f14eeda7aee06ae804968916df40f8207f1d83f40023cd24861849cdd36e06f3110924a43366795b855a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,26 +1,68 @@
|
|
1
1
|
## The Rubykassa gem
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rubykassa.png)](http://badge.fury.io/rb/rubykassa)
|
3
4
|
[![Build Status](https://secure.travis-ci.org/ZeroOneStudio/rubykassa.png)](http://travis-ci.org/ZeroOneStudio/rubykassa)
|
4
5
|
|
5
6
|
by [Zero One][]
|
6
7
|
|
7
8
|
[Zero One]: http://zeroone.st
|
8
9
|
|
9
|
-
Yet another Ruby wrapper for Robokassa API.
|
10
|
+
Yet another Ruby wrapper for [Robokassa API][]. Rubykassa took the best from [robokassa gem][] and [Active Merchant Robokassa integration] but easier to use and setup.
|
10
11
|
|
12
|
+
[Robokassa API]: http://robokassa.ru/ru/Doc/Ru/Interface.aspx
|
11
13
|
[robokassa gem]: https://github.com/shaggyone/robokassa
|
12
14
|
[Active Merchant Robokassa integration]: https://github.com/Shopify/active_merchant/tree/master/lib/active_merchant/billing/integrations/robokassa
|
13
15
|
|
14
16
|
## Installation
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
Or put to your `Gemfile`
|
18
|
+
Add to your `Gemfile`:
|
19
19
|
|
20
20
|
gem "rubykassa"
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
+
Run `rails g rubykassa:install`, get an initializer with the following code:
|
25
|
+
|
26
|
+
Rubykassa.configure do |config|
|
27
|
+
config.login = ENV["ROBOKASSA_LOGIN"]
|
28
|
+
config.first_password = ENV["ROBOKASSA_FIRST_PASSWORD"]
|
29
|
+
config.second_password = ENV["ROBOKASSA_SECOND_PASSWORD"]
|
30
|
+
config.mode = :test # or :production
|
31
|
+
config.http_method = :get # or :post
|
32
|
+
config.xml_http_method = :get # or :post
|
33
|
+
end
|
34
|
+
|
35
|
+
and configure it with your credentials.
|
36
|
+
|
37
|
+
Mode is `:test` by default. For production you have to use `:production`.
|
38
|
+
`http_method` and `xml_http_method` are `:get` by default but can be configured as `:post`
|
39
|
+
|
40
|
+
Once you are done, simple use `pay_url` helper in your view:
|
41
|
+
|
42
|
+
<%= pay_url "Pay with Robokassa", ivoice_id, total_sum %>
|
43
|
+
|
44
|
+
Additionally you may want to pass extra options. There is no problem:
|
45
|
+
|
46
|
+
<%= pay_url "Pay with Robokassa", ivoice_id, total_sum, { description: "Invoice description", email: "foo@bar.com", currency: "WMZM", culture: :ru } %>
|
47
|
+
|
48
|
+
If you need to implement Robokassa's XML interface functionality you have to the following:
|
49
|
+
|
50
|
+
xml_interface = Rubykassa::XmlInterface.new do
|
51
|
+
self.invoice_id = your_invioce_id
|
52
|
+
self.total = your_total_sum
|
53
|
+
self.language = :ru # can be :en, :ru is default
|
54
|
+
end
|
55
|
+
|
56
|
+
then call whatever you need
|
57
|
+
|
58
|
+
xml_interface.get_currencies_list
|
59
|
+
xml_interface.get_payment_methods
|
60
|
+
xml_interface.get_rates
|
61
|
+
xml_interface.op_state
|
62
|
+
|
24
63
|
## License
|
25
64
|
|
26
|
-
This project rocks and uses MIT-LICENSE
|
65
|
+
This project rocks and uses MIT-LICENSE
|
66
|
+
Copyright (c) 2013 [Zero One][]
|
67
|
+
|
68
|
+
[ZERO.ONE]: http://www.zeroone.st
|
data/config/routes.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
Rails.application.routes.draw do
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
if Rubykassa::Client.configuration
|
4
|
+
scope '/robokassa' do
|
5
|
+
%w(paid success fail).map do |route|
|
6
|
+
method(Rubykassa.http_method).call "/#{route}" => "robokassa##{route}", as: "robokassa_#{route}".to_sym
|
7
|
+
end
|
6
8
|
end
|
7
9
|
end
|
8
10
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Rubykassa
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path("../templates", __FILE__)
|
6
|
+
def create_initializer_file
|
7
|
+
template 'rubykassa.rb', File.join('config', 'initializers', 'rubykassa.rb')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
Rubykassa.configure do |c|
|
3
|
+
c.login = ENV["ROBOKASSA_LOGIN"]
|
4
|
+
c.first_password = ENV["ROBOKASSA_FIRST_PASSWORD"]
|
5
|
+
c.second_password = ENV["ROBOKASSA_SECOND_PASSWORD"]
|
6
|
+
c.mode = :test # or :production
|
7
|
+
c.http_method = :get # or :post
|
8
|
+
c.xml_http_method = :get # or :post
|
9
|
+
end
|
data/lib/rubykassa/version.rb
CHANGED
data/lib/rubykassa.rb
CHANGED
@@ -3,6 +3,7 @@ Rubykassa.configure do |c|
|
|
3
3
|
c.login = ENV["ROBOKASSA_LOGIN"]
|
4
4
|
c.first_password = ENV["ROBOKASSA_FIRST_PASSWORD"]
|
5
5
|
c.second_password = ENV["ROBOKASSA_SECOND_PASSWORD"]
|
6
|
-
c.mode = :test
|
7
|
-
c.http_method = :get
|
6
|
+
c.mode = :test # or :production
|
7
|
+
c.http_method = :get # or :post
|
8
|
+
c.xml_http_method = :get # or :post
|
8
9
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Kishenin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -127,6 +127,8 @@ files:
|
|
127
127
|
- app/controllers/.gitkeep
|
128
128
|
- app/controllers/robokassa_controller.rb
|
129
129
|
- config/routes.rb
|
130
|
+
- lib/generators/rubykassa/install_generator.rb
|
131
|
+
- lib/generators/rubykassa/templates/rubykassa.rb
|
130
132
|
- lib/rubykassa.rb
|
131
133
|
- lib/rubykassa/action_view_extension.rb
|
132
134
|
- lib/rubykassa/client.rb
|