payture_api 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +101 -9
- data/lib/payture/card.rb +9 -0
- data/lib/payture/parser.rb +14 -0
- data/lib/payture/user.rb +24 -0
- data/lib/payture/version.rb +1 -1
- data/lib/payture/wallet.rb +11 -1
- data/lib/payture.rb +3 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee413a9ff649f0a6d2502ef8a274d5aac82bd516
|
4
|
+
data.tar.gz: 61c5df04be3997c220d82ae34c7949e5ba43ffde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 743dbb834b1152482226f2e03290a9dde49bc92b7313194c1352569a9c6a6777853adc881ca6c64040a840632c050adefef83503ed5fbb1a1fab9d4ae5dfdaf9
|
7
|
+
data.tar.gz: 9996d421a8561a57827f6ef61389cc5f356c65708bef8c44db98c7a390551be564d9046c28bca7d919349fa81578c6a5a408be87f8a4fa6103032908dbed86b1
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Payture for Ruby
|
2
2
|
|
3
|
-
Welcome to
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Welcome to the Payture for Ruby gem! This gem allows you to integrate Payture into your Ruby application (Rails, etc.)
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,13 +20,108 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
In your code you will need to require the gem:
|
24
|
+
```ruby
|
25
|
+
require 'payture'
|
26
|
+
```
|
27
|
+
|
28
|
+
## API
|
29
|
+
|
30
|
+
### Payture::Wallet
|
31
|
+
|
32
|
+
#### Init
|
33
|
+
```ruby
|
34
|
+
HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
|
35
|
+
MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
|
36
|
+
|
37
|
+
payload = {
|
38
|
+
OrderId: 'ABC123',
|
39
|
+
SessionType: 'Block',
|
40
|
+
VWUserLgn: @user.email,
|
41
|
+
VWUserPsw: @user.token,
|
42
|
+
Amount: 100
|
43
|
+
}
|
44
|
+
|
45
|
+
wallet = Payture::Wallet.new(HOST)
|
46
|
+
result = wallet.init(MERCHANT_ADD, payload)
|
47
|
+
```
|
48
|
+
|
49
|
+
#### Pay
|
50
|
+
```ruby
|
51
|
+
HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
|
52
|
+
MERCHANT_PAY = ENV['PAYTURE_PAY'] // VWMerchantExamplePay
|
53
|
+
|
54
|
+
payload = {
|
55
|
+
OrderId: 'DCB312',
|
56
|
+
VWUserLgn: @user.email,
|
57
|
+
VWUserPsw: @user.token,
|
58
|
+
Amount: 100
|
59
|
+
CardId: @order.card_id
|
60
|
+
}
|
61
|
+
|
62
|
+
wallet = Payture::Wallet.new(HOST)
|
63
|
+
result = wallet.pay(MERCHANT_PAY, payload)
|
64
|
+
```
|
65
|
+
|
66
|
+
### Payture::User
|
67
|
+
|
68
|
+
#### Register
|
69
|
+
```ruby
|
70
|
+
HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
|
71
|
+
MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
|
72
|
+
|
73
|
+
payload = {
|
74
|
+
VWUserLgn: @user.email,
|
75
|
+
VWUserPsw: @user.token
|
76
|
+
}
|
26
77
|
|
27
|
-
|
78
|
+
wallet = Payture::User.new(HOST)
|
79
|
+
result = wallet.register(MERCHANT_ADD, payload)
|
80
|
+
```
|
81
|
+
|
82
|
+
#### Update
|
83
|
+
```ruby
|
84
|
+
HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
|
85
|
+
MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
|
86
|
+
|
87
|
+
payload = {
|
88
|
+
VWUserLgn: @user.email,
|
89
|
+
VWUserPsw: @user.token,
|
90
|
+
Phone: @user.phone
|
91
|
+
}
|
28
92
|
|
29
|
-
|
93
|
+
wallet = Payture::User.new(HOST)
|
94
|
+
result = wallet.update(MERCHANT_ADD, payload)
|
95
|
+
```
|
96
|
+
|
97
|
+
#### Check
|
98
|
+
```ruby
|
99
|
+
HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
|
100
|
+
MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
|
30
101
|
|
31
|
-
|
102
|
+
payload = {
|
103
|
+
VWUserLgn: @user.email,
|
104
|
+
VWUserPsw: @user.token
|
105
|
+
}
|
106
|
+
|
107
|
+
wallet = Payture::User.new(HOST)
|
108
|
+
result = wallet.check(MERCHANT_ADD, payload)
|
109
|
+
```
|
110
|
+
|
111
|
+
#### Delete
|
112
|
+
```ruby
|
113
|
+
HOST = ENV['PAYTURE_HOST'] // i.e. sandbox.payture.com
|
114
|
+
MERCHANT_ADD = ENV['PAYTURE_ADD'] // VWMerchantExampleAdd
|
115
|
+
PASSWORD = ENV['PAYTURE_PASSWORD']
|
116
|
+
|
117
|
+
payload = {
|
118
|
+
VWUserLgn: @user.email,
|
119
|
+
password: PASSWORD
|
120
|
+
}
|
121
|
+
|
122
|
+
wallet = Payture::User.new(HOST)
|
123
|
+
result = wallet.delete(MERCHANT_ADD, payload)
|
124
|
+
```
|
32
125
|
|
33
126
|
## Contributing
|
34
127
|
|
@@ -38,4 +131,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
|
|
38
131
|
## License
|
39
132
|
|
40
133
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/lib/payture/card.rb
ADDED
data/lib/payture/user.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
class Payture::User < Payture::Wallet
|
2
|
+
|
3
|
+
PATH_REGISTER = '/vwapi/Register'
|
4
|
+
PATH_UPDATE = '/vwapi/Update'
|
5
|
+
PATH_DELETE = '/vwapi/Delete'
|
6
|
+
PATH_CHECK = '/vwapi/Check'
|
7
|
+
|
8
|
+
def register(vwid, data)
|
9
|
+
self.request(PATH_REGISTER, vwid, data)
|
10
|
+
end
|
11
|
+
|
12
|
+
def update(vwid, data)
|
13
|
+
self.request(PATH_UPDATE, vwid, data)
|
14
|
+
end
|
15
|
+
|
16
|
+
def delete(vwid, data)
|
17
|
+
self.request(PATH_DELETE, vwid, data)
|
18
|
+
end
|
19
|
+
|
20
|
+
def check(vwid, data)
|
21
|
+
self.request(PATH_CHECK, vwid, data)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/payture/version.rb
CHANGED
data/lib/payture/wallet.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
class Payture::Wallet < Payture::API
|
2
2
|
|
3
|
-
PATH_INIT
|
3
|
+
PATH_INIT = '/vwapi/Init'
|
4
|
+
PATH_PAY = '/vwapi/Pay'
|
5
|
+
# PATH_CHARGE = '/vwapi/Charge'
|
4
6
|
|
5
7
|
def init(vwid, data)
|
6
8
|
self.request(PATH_INIT, vwid, data)
|
7
9
|
end
|
8
10
|
|
11
|
+
def pay(vwid, data)
|
12
|
+
self.request(PATH_PAY, vwid, data)
|
13
|
+
end
|
14
|
+
|
15
|
+
# def charge(vwid, data)
|
16
|
+
# self.request(PATH_CHARGE, vwid, data)
|
17
|
+
# end
|
18
|
+
|
9
19
|
end
|
data/lib/payture.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: payture_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,7 +87,10 @@ files:
|
|
87
87
|
- bin/setup
|
88
88
|
- lib/payture.rb
|
89
89
|
- lib/payture/api.rb
|
90
|
+
- lib/payture/card.rb
|
90
91
|
- lib/payture/hash.rb
|
92
|
+
- lib/payture/parser.rb
|
93
|
+
- lib/payture/user.rb
|
91
94
|
- lib/payture/version.rb
|
92
95
|
- lib/payture/wallet.rb
|
93
96
|
- payture_ruby.gemspec
|
@@ -111,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
114
|
version: '0'
|
112
115
|
requirements: []
|
113
116
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.6.11
|
115
118
|
signing_key:
|
116
119
|
specification_version: 4
|
117
120
|
summary: Payture.com API for Ruby
|