liqpay 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +11 -11
- data/lib/liqpay/liqpay_helper.rb +5 -7
- data/lib/liqpay/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a1dbccbf4ed75ad7d2bee9a85462ce68832c711
|
4
|
+
data.tar.gz: 337b981afc82d4b6210f5a3e7a7efcf61f1628bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a39d8ec9301bdcddc1762c4fecfbff3bb6486a9221b18703e20e88cd7594f09d7bf7019687e1c9ac2f19c7c031dd9002d4be3877b151f6084b13d75feb74cf55
|
7
|
+
data.tar.gz: 4ebde391c58b7538e7db5b456cd9a73287c010336c0545fbfd378898a8caf74288a80df9b96d6a275f9a34377b244dfb60d8a788f3b842f2f58e9ec349546d00
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This Ruby gem implements the [LiqPAY](https://www.liqpay.com) billing system API, as described in [the LiqPAY documentation](https://www.liqpay.com/doc).
|
4
4
|
|
5
|
-
**Users of version 0.1.2 and earlier:** your version of the gem uses the older, deprecated LiqPAY API; you should migrate to v1
|
5
|
+
**Users of version 0.1.2 and earlier:** your version of the gem uses the older, deprecated LiqPAY API; you should migrate to >v1, but it requires you to change configuration and set up a server callback endpoint, so it's not a trivial upgrade.
|
6
6
|
|
7
7
|
## Demo
|
8
8
|
|
@@ -54,15 +54,15 @@ Liqpay.default_options = {
|
|
54
54
|
|
55
55
|
The most recent version of the LiqPAY API *requires* you to have a serverside endpoint, which makes it impossible to test it with a local address.
|
56
56
|
|
57
|
-
### Implementation in Rails
|
57
|
+
### Implementation in Rails
|
58
58
|
|
59
59
|
0. Configure Liqpay
|
60
60
|
|
61
61
|
1. Create a `Liqpay::Request` object
|
62
62
|
|
63
63
|
The required options are: the amount and currency of the payment, and an
|
64
|
-
"order ID".
|
65
|
-
|
64
|
+
"order ID".
|
65
|
+
|
66
66
|
The "order ID" is just a random string that you will use to
|
67
67
|
identify the payment after it has been completed. If you have an `Order`
|
68
68
|
model (I suggest that you should), pass its ID. If not, it can be a random
|
@@ -70,9 +70,9 @@ The most recent version of the LiqPAY API *requires* you to have a serverside en
|
|
70
70
|
|
71
71
|
```ruby
|
72
72
|
@liqpay_request = Liqpay::Request.new(
|
73
|
-
amount: '999.99',
|
74
|
-
currency: 'UAH',
|
75
|
-
order_id: '123',
|
73
|
+
amount: '999.99',
|
74
|
+
currency: 'UAH',
|
75
|
+
order_id: '123',
|
76
76
|
description: 'Some Product',
|
77
77
|
result_url: order_url(@order),
|
78
78
|
server_url: liqpay_payment_url
|
@@ -81,10 +81,10 @@ The most recent version of the LiqPAY API *requires* you to have a serverside en
|
|
81
81
|
|
82
82
|
**Note that this does not do anything permanent.** No saves to the database, no
|
83
83
|
requests to LiqPAY.
|
84
|
-
|
84
|
+
|
85
85
|
2. Put a payment button somewhere
|
86
86
|
|
87
|
-
As you need to make a POST request, there is definitely going to be a form somewhere.
|
87
|
+
As you need to make a POST request, there is definitely going to be a form somewhere.
|
88
88
|
|
89
89
|
To output a form consisting of a single "Pay with LiqPAY" button, do
|
90
90
|
|
@@ -108,7 +108,7 @@ The most recent version of the LiqPAY API *requires* you to have a serverside en
|
|
108
108
|
|
109
109
|
3. Set up a receiving endpoint.
|
110
110
|
|
111
|
-
```ruby
|
111
|
+
```ruby
|
112
112
|
# config/routes.rb
|
113
113
|
post '/liqpay_payment' => 'payments#liqpay_payment'
|
114
114
|
|
@@ -139,7 +139,7 @@ That's about it.
|
|
139
139
|
|
140
140
|
* Check that amount from response matches the expected amount;
|
141
141
|
* check that the order id is valid;
|
142
|
-
* check that the order isn't completed yet (to avoid replay attacks);
|
142
|
+
* check that the order isn't completed yet (to avoid replay attacks);
|
143
143
|
|
144
144
|
- - -
|
145
145
|
|
data/lib/liqpay/liqpay_helper.rb
CHANGED
@@ -13,16 +13,14 @@ module Liqpay
|
|
13
13
|
id = options.fetch(:id, 'liqpay_form')
|
14
14
|
title = options.fetch(:title, 'Pay with LiqPAY')
|
15
15
|
content_tag(:form, :id => id, :action => Liqpay::LIQPAY_ENDPOINT_URL, :method => :post) do
|
16
|
-
|
17
|
-
hidden_field_tag(name, value)
|
18
|
-
|
19
|
-
|
16
|
+
liqpay_request.form_fields.each do |name, value|
|
17
|
+
concat hidden_field_tag(name, value)
|
18
|
+
end
|
20
19
|
if block_given?
|
21
|
-
|
20
|
+
yield
|
22
21
|
else
|
23
|
-
|
22
|
+
concat submit_tag(title, :name => nil)
|
24
23
|
end
|
25
|
-
result
|
26
24
|
end
|
27
25
|
end
|
28
26
|
end
|
data/lib/liqpay/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liqpay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Shevtsov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
description: LiqPAY billing API implementation in Ruby
|
@@ -31,7 +31,7 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- .gitignore
|
34
|
+
- ".gitignore"
|
35
35
|
- CHANGELOG.md
|
36
36
|
- Gemfile
|
37
37
|
- README.md
|
@@ -53,17 +53,17 @@ require_paths:
|
|
53
53
|
- lib
|
54
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
65
|
rubyforge_project:
|
66
|
-
rubygems_version: 2.
|
66
|
+
rubygems_version: 2.3.0
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: LiqPAY billing API implementation in Ruby
|