yandex_kassa 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +47 -15
- data/lib/yandex_kassa/requests.rb +7 -3
- data/lib/yandex_kassa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84eae94c84cc69dfd7c6c90b6e1b890d121b121d
|
4
|
+
data.tar.gz: a4cbab230b48851807ce9c4146622b53c585b9bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed9d3793c756080bfadf3c47d0c7b399e2897a5e3c58f6d33a77b24382f7e45fb4267aa364c9814f0ec5acf0b1185d39b7fb5cc785421fd706290ec5efb46a88
|
7
|
+
data.tar.gz: 8cda826e6b111dd795fefee27f6979fbf3301382e3ac0237ed2f8adcb2117a9b960a25aac778fb534f3909d7e1f9a052acd2023f355fcfe00d8b16438f30da5c
|
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
[![Code Climate](https://codeclimate.com/github/creepycheese/yandex-kassa-api/badges/gpa.svg)](https://codeclimate.com/github/creepycheese/yandex-kassa-api)
|
2
2
|
# YandexKassa
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Simple API wrapper for [YandexKassa] (https://kassa.yandex.ru).
|
4
|
+
Official API documentaton [here](https://tech.yandex.ru/money/doc/payment-solution/payout/intro-docpage/)
|
7
5
|
|
8
6
|
## Installation
|
9
7
|
|
@@ -23,18 +21,52 @@ Or install it yourself as:
|
|
23
21
|
|
24
22
|
## Usage
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
24
|
+
First of all configure gem.
|
25
|
+
```ruby
|
26
|
+
require "yandex_kassa"
|
27
|
+
|
28
|
+
YandexKassa.configure do |config|
|
29
|
+
# API end url given by Yandex
|
30
|
+
config.url = "https://bo-demo02.yamoney.ru:9094/webservice/deposition/api"
|
31
|
+
#path to you *.cer generated by Yandex on your request
|
32
|
+
config.cert = "123123.cer"
|
33
|
+
#path to your private key
|
34
|
+
config.key = "private.key"
|
35
|
+
#path to deposit *.cer generated by Yandex
|
36
|
+
config.deposit = "deposit.cer"
|
37
|
+
#passphare for *.key file, omit if you don't need
|
38
|
+
config.passphrase = "passphrase"
|
39
|
+
end
|
40
|
+
```
|
37
41
|
|
42
|
+
```ruby
|
43
|
+
#enable std loggin for Rest client
|
44
|
+
RestClient.log = 'stdout'
|
45
|
+
|
46
|
+
#create api instance
|
47
|
+
api = YandexKassa.create
|
48
|
+
|
49
|
+
#send test deposition request
|
50
|
+
test_deposition_params = {
|
51
|
+
dst_account: "410011234567", amount: "10.00", currency: 10643,
|
52
|
+
agent_id: "123123", contract: "Fun stuff", client_order_id: 1, request_dt: Time.now.iso8601
|
53
|
+
}
|
54
|
+
|
55
|
+
data = api.test_deposition(test_deposition_params)
|
56
|
+
# => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<testDepositionResponse clientOrderId=\"1\" status=\"3\" error=\"41\" processedDT=\"2016-03-23T12:52:53.087+03:00\" identification=\"anonymous\" />\r\n"
|
57
|
+
|
58
|
+
#or equally
|
59
|
+
data = api.test_deposition do |request|
|
60
|
+
request.dst_account = 410011234567
|
61
|
+
request.amount = 10.00
|
62
|
+
request.currency = 10643
|
63
|
+
request.contract = "Fun stuff"
|
64
|
+
request.dst_account = 410011234567
|
65
|
+
request.client_order_id = 1
|
66
|
+
request.request_dt = Time.now.iso8601
|
67
|
+
end
|
68
|
+
# => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<testDepositionResponse clientOrderId=\"1\" status=\"3\" error=\"41\" processedDT=\"2016-03-23T12:52:53.087+03:00\" identification=\"anonymous\" />\r\n"
|
69
|
+
```
|
38
70
|
|
39
71
|
## License
|
40
72
|
|
@@ -60,12 +60,16 @@ XML
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def extra_params
|
63
|
-
@
|
63
|
+
@payment_params_body || set_payment_params
|
64
64
|
end
|
65
65
|
|
66
|
-
def
|
66
|
+
def payment_params
|
67
|
+
@payment_params ||= {}
|
68
|
+
end
|
69
|
+
|
70
|
+
def set_payment_params(params = payment_params)
|
67
71
|
params = params.inject("") { |str, hash| str += "<#{hash[0]}>#{hash[1]}</#{hash[0]}>\n"}
|
68
|
-
@
|
72
|
+
@payment_params_body = "\n<paymentParams>\n#{params}</paymentParams>"
|
69
73
|
end
|
70
74
|
end
|
71
75
|
end
|
data/lib/yandex_kassa/version.rb
CHANGED