Skip to content

oswaldquek/payments-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

payment-api

Requirements

  1. Java 8
  2. maven

How to start the payment-api application

  1. Run mvn clean install to build your application
  2. Start application with java -jar target/type-1.0-SNAPSHOT.jar server config.yml

Health Check

To see your applications health enter url http://localhost:8081/healthcheck

Try it out!

This application uses JWT for authorization. In order to perform CRUD payment operations you need to get a JWT token first. To get a token do:

curl -H "Content-Type: application/json" -X POST -d '{"user":"Joe Bloggs","password":"p4ssw0rd"}' http://localhost:8080/payments/login -v

This will return a token which is needed for all calls to the payments api. You send the token by setting the Authorization header in the request. See below for examples. You can set the expiry of the token in the config.yml.

Note: The user/password of "Joe Bloggs"/"p4ssw0rd" is currently hard coded in the MockUserValidationService.

There is a sample create.json in the examples folder. To create a payment do:

curl -H "Content-Type: application/json" -X POST -d "@create.json" -H "Authorization: Bearer <token>" http://localhost:8080/payments/create -v

Which will return a set of HATEOAS links.

To get a payment do for example:

curl -H "Content-Type: application/json" -X GET -H "Authorization: Bearer <token>" http://localhost:8080/payments/<some-id>

To update a payment edit the create.json and then do for example:

curl -H "Content-Type: application/json" -X PUT -d "@create.json" -H "Authorization: Bearer <token>" http://localhost:8080/payments/update/<some-id>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages