8000 GitHub - OnlinetoursGit/qiwi-kassa
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

OnlinetoursGit/qiwi-kassa

Repository files navigation

Qiwi::Kassa

Ruby wrapper to interact with QIWI Kassa API v1.21.

To experiment with that code, run bin/console for an interactive prompt.

Installation

Add this line to your application's Gemfile:

gem 'qiwi-kassa'

And then execute:

$ bundle

Or install it yourself as:

$ gem install qiwi-kassa

Usage

Interact with API

Initialize api object:

api = Qiwi::Kassa::Api.new(secret_key: "xxx-yyy-zzz", provider: :pay2me)

Valid values for the provider parameter - qiwi | pay2me. The default value is qiwi.

Optional param host

api = Qiwi::Kassa::Api.new(secret_key: "xxx-yyy-zzz", provider: :pay2me, host: "https://alternative.api.host")

In case host does not passed default hosts used:

Create invoice (api doc):

api.resources.bills.create(id: "invoice_id", site_id: "site_id", params: { amount: { currency: "RUB", value: "10.00" }, expirationDateTime: "2024-04-29T14:12:45+03:00" })

Invoice status (api doc):

api.resources.bills.status(id: "invoice_id", site_id: "site_id")

Invoice payments (api doc):

api.resources.bills.payments(id: "invoice_id", site_id: "site_id")

Capture create (api doc):

api.resources.captures.create(payment_id: "payment_id", capture_id: "capture_id", site_id: "site_id")

Capture status (api doc):

api.resources.captures.status(payment_id: "payment_id", capture_id: "capture_id", site_id: "site_id")

Refund create (api doc):

api.resources.refunds.create(payment_id: "payment_id", refund_id: "refund_id", site_id: "site_id")

Refund status (api doc):

api.resources.refunds.status(payment_id: "payment_id", refund_id: "refund_id", site_id: "site_id")

Refunds statuses (api doc):

api.resources.refunds.statuses(payment_id: "payment_id", site_id: "site_id")

Server notification (api doc)

Build notification inside your callback controller:

notification = Qiwi::Kassa::Notification.new(data: notification_params)

Check is notification valid:

notification.valid?(secret_key: notification_secret_key, signature: request.headers["Signature"])

Build WPF invoice url (doc)

params = {
           publicKey: 'Fnzr1yTebUiQaBLDnebLMMxL8nc6FF5zfmGQnypc*******',
           amount: 100,
           billId: '893794793973',
           successUrl: 'https://test.ru',
           email: 'test@test.ru'
         }

Qiwi::Kassa::PaymentForm.build(params: params)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

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.

Run tests

bundle exec rake spec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/qiwi-kassa. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Qiwi::Kassa project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 5

0