A simple SpringBoot application imitating a Paytech client.
-
Set an API_KEY environment variable:
export API_KEY=<YOUR_API_KEY>
-
Use one of the following methods to start the application:
- Build the code using the Maven Wrapper:
for Windows use:
./mvnw -DAPI_KEY=${API_KEY} clean packageRun it via CLI from the root of the project:mvnw.cmd -DAPI_KEY=${API_KEY} clean packagejava -DAPI_KEY=${API_KEY} -jar target/testtask-1.0.0.jar - Navigate to PaytechClientApplication and run directly from IDE
- Build the code using the Maven Wrapper:
-
Go to localhost:8080 to interact with the app.
Требуется создать простое веб-приложение на Spring Boot (дизайн не важен, можно использовать например Freemarker или Thymeleaf). Пользователь вводит сумму и нажимает кнопку "Оплатить". После этого происходит вызов метода createPayment нашего API для создания депозита:
POST https://engine-sandbox.pay.tech/api/v1/payments
Authorization: Bearer ************
Content-Type: application/json
{
"paymentType": "DEPOSIT",
"amount": {введенная пользователем сумма},
"currency": "EUR"
}
В случае успеха пользователь редиректится на полученный в ответе redirectUrl. В случае ошибки - показывается страница с ошибкой.
- Add localization support