Skip to content

lxkuz/trampampam-ruby-client

Repository files navigation

Contactpay

Ruby client for Contactpay API

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add contactpay

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install contactpay

Usage

Configure

When you get your Site approved you can use it's secret key for making API requests.

  require 'contactpay'

  contactpay_config = Contactpay::Config.new(
    base_url: "<BASE API URL>", # "https://api.contactpay.com.com"
    account_secret_key: "<YOUR ACCOUNT SECRET KEY>",
    shop_id: <YOUR ACCOUNT SHOP ID>,
    faraday_block: # if needed
  )

Now you can make API calls

Balance

To get yoour account balance:

  Contactpay::Shop.new(contactpay_config).balance

See API method reference

Invoice

To get invoice prelim calculation result:

  data = { ... }
  Contactpay::Invoice.new(contactpay_config).prelim_calc(data)

See API method reference

To create invoice:

  data = { ... }
  Contactpay::Invoice.new(contactpay_config).create(data)

See API method reference

To get invoice status:

  data = { ... }
  Contactpay::Invoice.new(contactpay_config).status(data)

See API method reference

To charge hold funds:

  data = { ... }
  Contactpay::Invoice.new(contactpay_config).hold_funds(data)

See API method reference

To charge invoice funds:

  data = { ... }
  Contactpay::Invoice.new(contactpay_config).charge(data)

See API method reference

To charge unhold funds:

  data = { ... }
  Contactpay::Invoice.new(contactpay_config).unhold_funds(data)

See API method reference

To get payment methods for input

  Contactpay::Invoice.new(contactpay_config).payment_methods

See API method reference

Withdraw

To get withdraw prelim calculation result:

  data = { ... }
  Contactpay::Withdraw.new(contactpay_config).prelim_calc(data)

See API method reference

To check the account for the possibility of replenishment:

  data = { ... }
  Contactpay::Withdraw.new(contactpay_config).check_account(data)

See API method reference

To create withdraw:

  data = { ... }
  Contactpay::Withdraw.new(contactpay_config).create(data)

See API method reference

To get withdraw status by ID:

  data = { ... }
  Contactpay::Withdraw.new(contactpay_config).status_by_id(data)

See API method reference

To get withdraw status by shop payout number:

  data = { ... }
  Contactpay::Withdraw.new(contactpay_config).status_by_shop_number(data)

To get possible payout methods

  Contactpay::Withdraw.new(contactpay_config).payment_methods

See API method reference

Refund

Invoice refund

  data = { ... }
  Contactpay::Refund.new(contactpay_config).create(data)

See API method reference

Invoice refund status

  data = { ... }
  Contactpay::Refund.new(contactpay_config).status(data)

See API method reference

Recurrent invoice

Payment token issue

  data = { ... }
  Contactpay::PaymentToken.new(contactpay_config).create(data)

See API method reference

Payment token issue confirmation

  data = { ... }
  Contactpay::PaymentToken.new(contactpay_config).complete(data)

See API method reference

Payment token issue status

  data = { ... }
  Contactpay::PaymentToken.new(contactpay_config).status(data)

See API method reference

Payment token deletion

  data = { ... }
  Contactpay::PaymentToken.new(contactpay_config).delete(data)

See API method reference

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 the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/contactpay. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the 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 Contactpay project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Ruby client for contactpay.com API

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors