yandex_kassa 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2c5872b0fc57adaa8f6b273950ed6f0f9837b11
4
- data.tar.gz: 7ce2bb60893d904effefc4a673108370536f65e9
3
+ metadata.gz: 84eae94c84cc69dfd7c6c90b6e1b890d121b121d
4
+ data.tar.gz: a4cbab230b48851807ce9c4146622b53c585b9bd
5
5
  SHA512:
6
- metadata.gz: f08aa27c79ce4b471f432276fa4cf95a6317abddaa65258be74d2e4ddc56d24639b3fe5e74490296707cd033654af7a2a15f80709195bd09879cd20eacfa0116
7
- data.tar.gz: 79e20be1746ae5d40e482e5b41d9d850412cc19698977ef299db7be3534059b7ac6bb554373fe5594a787647e9179e14a18ac84f4417ac2932dbb25454c66a8d
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yandex_kassa`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Write usage instructions here
27
-
28
- ## Development
29
-
30
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31
-
32
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
33
-
34
- ## Contributing
35
-
36
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yandex_kassa. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
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
- @payment_params
63
+ @payment_params_body || set_payment_params
64
64
  end
65
65
 
66
- def set_payment_params(params={})
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
- @payment_params = "\n<paymentParams>\n#{params}</paymentParams>"
72
+ @payment_params_body = "\n<paymentParams>\n#{params}</paymentParams>"
69
73
  end
70
74
  end
71
75
  end
@@ -1,3 +1,3 @@
1
1
  module YandexKassa
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex_kassa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Burdaev