Skip to content

ualibraries/ual-payments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

layout title
default
README

University of Arizona Libraries - Payments

CircleCI Scrutinizer license

Requirements

  • 💻
  • PHP >= 7.4
  • Composer
  • NodeJs

Getting started

  • NOTE: For MacOS Mojave users, visit here and here first.
  • Clone the repository using git clone ssh://git@github.com/ualibraries/ual-payments.git.
  • Run composer install
  • Copy .env to .env.local and open it in a text editor.
  • Create an empty database.
  • Replace the DB_* with the correct credentials for your database connection.
  • Run bin/console doctrine:migrations:migrate to get the database structure in place.
  • Run npm install
  • Run npm run build
  • Generate an Alma API key with read/write access to the Users API in the appropriate environment (sandbox or prod) and add the correct API_URL and API_KEY values.
  • Update the PAYFLOW_* properties with correct credentials for your Payflow Link account.
  • Log in to your Payflow Link account and navigate to Service Settings > Configuration. Under "Form Configuration", set "Return URL" to be the root of your application (e.g. http://www.example.com) and set the "Silent POST URL" value to the /result endpoint of the application (e.g. http://www.example.com/result). In order for Payflow to successfully post success and failure messages to your application, your server must be publicly available. For local development, a tool like ngrok or localtunnel can provide public URLs for Payflow.
  • (Optional) Set TEST_ID and TEST_PASS to the credentials for a test user in your Alma system. These credentials will be used while running automated tests.
  • (Optional) Install Zombie.js globally: npm install -g zombie. This is necessary for running automated tests due to a quirk in the Mink ZombieDriver.
  • (Optional) Enable emergency logging in Slack for production environments by creating a new Slack incoming webhook and copying the webhook url to the SLACK_LOGGING parameter in .env. Update SLACK_CHANNEL with the name of the channel you want the emergency logs to go to. Make sure SLACK_CHANNEL doesn't start with a #, otherwise the .env file will interpret the line as a comment!

Deploying

This project uses Deployer for its deployments. Deployment commands are scripted in composer.json. To deploy, use the following commands:

  • Production: composer deploy:prd
  • Staging: composer deploy:stg

Environments

  • Production - pay-prd
  • Staging - pay-stg

Authentication

  • If you don't already have an SSH key on your development machine, generate one and add it to the ssh-agent.
  • Add your SSH key to the server environment for the deploy user. You can do this using ssh-copy-id:
ssh-copy-id deploy@pay-prd

If you don't have the password for the deploy account, you can ask someone who already has server access to add your key. Send them your public key (e.g. ~/.ssh/id_rsa.pub) and have them append it to the authorized_keys file for the deploy user:

deploy@pay-prd:~$ cat your_id_rsa.pub >> /home/deploy/.ssh/authorized_keys

Rollback

To rollback to the previous release, run composer deploy:rollback. See Deployer documentation for more.

Documentation

Additional documentation can be found in the docs directory.

Documentation related to the UAL Payments API (namespaces, classes, etc) is automatically generated by phpDox.

Build the phpDox documentation by running composer docs:build.

The phpDox documentation is automatically built and deployed by CircleCI whenever changes are pushed to master. If for some reason you want to manually deploy a change to the documentation, you can do it by running composer docs:deploy. You may need to specify your AWS profile: composer docs:deploy -- --profile=ual.

View the phpDox documentation at UAL Payments Documentation (http://ualibr-payments-documentation.s3-website-us-west-2.amazonaws.com).

License

Licensed under the MIT license.