PciProxy
A simple client library for PCI Proxy's API
Installation
Add this line to your application's Gemfile:
gem 'pci_proxy', '~> 1.0.0'
And then execute:
$ bundle
Or install it yourself as:
$ gem install pci_proxy
Usage
Initially, this gem only covers the Token API, which converts a transactionId from the secure fields mechanism into tokenised card PAN and CVV.
Pull requests are most welcome for coverage of other PCI Proxy APIs :)
Token API - Usage
Create an instance of PciProxy::Token
and call execute
as follows:
client = PciProxy::Token.new(api_username: 'username', api_password: 'password')
And execute a token exchange like so:
client.execute(transaction_id: '1234567890')
In the event of a 200 OK response, an instance of PciProxy::Model::TokenisedCard is returned:
#<PciProxy::Model::TokenisedCard:0x00007fda073453f8 @response={"aliasCC"=>"411111GGCMUJ1111", "aliasCVV"=>"b8XeAbhQQES6OVWTpOCaAscj", "paymentMethod"=>"VIS"}, @pan_token="411111GGCMUJ1111", @cvv_token="b8XeAbhQQES6OVWTpOCaAscj", @type_slug=:visa>
In the event of an error, a subclass of PciProxyAPIError
will be raised.
The most likely error is that the transactionId temporary token has expired, resulting in:
PciProxy::BadRequestError (HTTP status: 400, Response: Tokenization not found)
Changes
See Changelog
Development
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.
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.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/asmallworldsite/pci_proxy. 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.