This is a starter application that has base setup of Play 2.6 with H2 as database. This repository will constantly updated on better changes.
Please see the documentation at https://www.playframework.com/documentation/latest/Home for more details.
Run this using sbt. If you downloaded this project then you'll find a prepackaged version of sbt in the project directory:
sbt clean run
And then go to http://localhost:9000 to see the running web application.
- Download the payment-api-1.0.tgz file available in the root of the project. If you clone this repo you will get inside the payment-api main directory.
- Extract the tar file in a folder of your preference.
tar -xvzf /path/to/payment-api-1.0.tgz
- You can either navigate to the extracted folder or execute the app from the folder you are.
payment-api-1.0/bin/payment-api -Dplay.http.secret.key=omjigupta
- Download the payment-api-1.0.zip file available in the root of the project.
- Extract the zip file in a folder of your preference.
unzip payment-api-1.0.zip
- Navigate to the extracted folder or execute below command to run it
sh bin/payment-api
By running below command. You can check the test results in the terminal
sbt test
- Java JDK 1.8
- Scala SBT 1.2.8
- Currently, Application is supporting only INR, USD and EUR.
- Currency conversion values are hardcoded for now. Conversion rates added from exchange.
http://localhost:9000/about
By Hitting above request you will be redirected to my LinkedIn profile
http://localhost:9000/
By Hitting this request you can check application is running or not
http://localhost:9000/v1/accounts/424800/balance
http://localhost:9000/v1/accounts/1234/balance
http://localhost:9000/v1/transactions
- HTTP Request:
POST /v1/transactions HTTP/1.1
Accept: application/json
Host: localhost:9000
{
"senderAccountId":324800,
"receiverAccountId":533000,
"amount":10,
"currency":"INR"
}
- HTTP Response:
http://localhost:9000/v1/transactions
- HTTP Request:
POST /v1/transactions HTTP/1.1
Accept: application/json
Host: localhost:9000
{
"senderAccountId":124800,
"receiverAccountId":533000,
"amount":1,
"currency":"EUR"
}
- HTTP Response:
http://localhost:9000/v1/transactions
- HTTP Request:
POST /v1/transactions HTTP/1.1
Accept: application/json
Host: localhost:9000
{
"senderAccountId":124800,
"receiverAccountId":533000,
"amount":1,
"currency":"USD"
}
- HTTP Response: You can see selected part of image.
http://localhost:9000/v1/transactions
- HTTP Request:
POST /v1/transactions HTTP/1.1
Accept: application/json
Host: localhost:9000
{
"senderAccountId":124800,
"receiverAccountId":533000,
"amount":15,
"currency":"EUR"
}
- HTTP Response:
http://localhost:9000/v1/transactions
- HTTP Request:
POST /v1/transactions HTTP/1.1
Accept: application/json
Host: localhost:9000
{
"senderAccountId":124800,
"receiverAccountId":533000,
"amount":-1,
"currency":"EUR"
}
- HTTP Response:
http://localhost:9000/v1/transactions
- HTTP Request:
POST /v1/transactions HTTP/1.1
Accept: application/json
Host: localhost:9000
{
"senderAccountId":324800,
"receiverAccountId":533000,
"amount":10,
"currency":"YEN"
}
- HTTP Response:
http://localhost:9000/v1/transactions
- HTTP Request:
POST /v1/transactions HTTP/1.1
Accept: application/json
Host: localhost:9000
{
"senderAccountId":3200,
"receiverAccountId":533000,
"amount":10,
"currency":"USD"
}
- HTTP Response: