Skip to content

Latest commit

 

History

History
79 lines (50 loc) · 2.25 KB

README.md

File metadata and controls

79 lines (50 loc) · 2.25 KB

Authipay Rails Example Application

Integrated example application using Authipay's Connect API.

Requirements

In order to run this application you will need the following:

  • ruby (version 2.2+)

    • We recommend you use rvm to manage your ruby versions
    • If you are using windows you can find a ruby installer here
  • node.js (latest LTS)

Setup

Firstly pull down the repo.

$ git clone https://github.com/testingpays/authipay_rails.git

Next enter the directory and install the applications dependencies using bundler

$ gem install bundler
$ bundle install

You also need to have an Authipay account setup. And from that you need to set the following credentials into environment variables:

AUTHIPAY_STORE_ID=1234567890
AUTHIPAY_USER_ID=1234567890
AUTHIPAY_SHARED_SECRET=t1p%0gBao
CALLBACK_BASE="http://localhost:3001"

Running the application

Now that we have the application installed and our api keys setup we can start using the application. firstly lets run the tests to make everything is in order.

$ rails test

Your tests should have ran successfully. now to run the application use the following command.

$ rails server

Your application should now be running locally.

API Keys

Developing with Testing Pays

In order to work with Testing Pays you need to provide your API Key. You can find that in the instructions or in your team page.

When you point at Testing Pays, set the following environment variables:

AUTHIPAY_SHARED_SECRET=SharedSecret
AUTHIPAY_URL="https://api.testingpays.com/YOUR_KEY_HERE/authipay/v1/connect/checkout"

And you should be ready to go

Unit Testing with Testing Pays

Testing Pays makes testing many types of responses easy. In order to get a particular response simply pass in the associated response mapping. E.g.

amount: 0   # => success

For a full list of response mappings see the Test tab of your sim.