generated from pagopa/template-java-microservice
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : [PPD-167] spontaneous payments call (#1)
* [PPD-167] spontaneous payment call: first DRAFT implementation * [PPD-167] spontaneous payment call: added query call to cosmos container * Update spontaneouspayment/openapi/generate_openapi.sh Co-authored-by: Jacopo Carlini <[email protected]> * Update spontaneouspayment/pom.xml Co-authored-by: Jacopo Carlini <[email protected]> * refactor * postman collection * add script to cosmosdb * improved cosmos and readme * minor fix, add draft README, upd openapi * upd readme * [PPD-167] validation * refactor * add run local readme Co-authored-by: aacitelli <[email protected]> Co-authored-by: Jacopo Carlini <[email protected]> Co-authored-by: pasqualespica <[email protected]> Co-authored-by: Francesco Cesareo <[email protected]> Co-authored-by: aacitelli <[email protected]>
- Loading branch information
1 parent
62694e4
commit c95b562
Showing
51 changed files
with
2,428 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
target/**/* | ||
.vscode | ||
/.idea/ | ||
emulatorcert.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 1. `pip install pre-commit` | ||
# 2. `pre-commit install` | ||
# 3. set GITGUARDIAN_API_KEY in your develop environment (get an api key here: https://dashboard.gitguardian.com/workspace/230910/settings/personal/personal-access-tokens) | ||
# more info https://docs.gitguardian.com/internal-repositories-monitoring/integrations/git_hooks/pre_commit | ||
repos: | ||
- repo: https://github.com/gitguardian/ggshield | ||
rev: v1.11.0 | ||
hooks: | ||
- id: ggshield | ||
language_version: python3 | ||
stages: [ commit ] |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# see https://help.github.com/en/articles/about-code-owners#example-of-a-codeowners-file | ||
|
||
* @pagopa/pagopa-tech |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,120 @@ | ||
# template-java-microservice | ||
# Spontaneous Payments | ||
|
||
PagoPA service for citizen/corporate spontaneous payments | ||
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=pagopa_pagopa-api-config&metric=alert_status)](https://sonarcloud.io/project/overview?id=pagopa_pagopa-spontaneous-payments) | ||
|
||
- [Spontaneous Payments](#spontaneous-payments) | ||
* [Api Documentation 📖](#api-documentation---) | ||
* [Technology Stack](#technology-stack) | ||
* [Start Project Locally 🚀](#start-project-locally---) | ||
+ [Prerequisites](#prerequisites) | ||
+ [Run docker container](#run-docker-container) | ||
* [Develop Locally 💻](#develop-locally---) | ||
+ [Run](#run) | ||
+ [Prerequisites](#prerequisites-1) | ||
+ [Run the project](#run-the-project) | ||
+ [Configure Cosmos emulator](#configure-cosmos-emulator) | ||
+ [Testing 🧪](#testing---) | ||
- [Unit testing](#unit-testing) | ||
- [Integration testing](#integration-testing) | ||
- [Load testing](#load-testing) | ||
* [Contributors 👥](#contributors---) | ||
+ [Mainteiners](#mainteiners) | ||
|
||
--- | ||
|
||
## Api Documentation 📖 | ||
|
||
Spring application exposes API to manage the _Spontaneous Payments_. | ||
|
||
See | ||
the [OpenApi 3 here.](https://editor.swagger.io/?url=https://raw.githubusercontent.com/pagopa/pagopa-spontaneous-payments/main/openapi/openapi.yaml) | ||
|
||
In local env typing following url on browser for ui interface: | ||
|
||
``` | ||
http://localhost:8080/swagger-ui/index.html | ||
|
||
``` | ||
or that for `yaml` version | ||
```http://localhost:8080/v3/api-docs/``` | ||
|
||
--- | ||
|
||
## Technology Stack | ||
- Java 11 | ||
- Spring Boot | ||
- Spring Web | ||
- Hibernate | ||
- JPA | ||
- [Spring cosmos api](https://docs.microsoft.com/it-it/azure/cosmos-db/sql/sql-api-spring-data-sdk-samples) | ||
--- | ||
|
||
## Start Project Locally 🚀 | ||
|
||
### Prerequisites | ||
- docker | ||
- [Cosmos emulator](https://docs.microsoft.com/it-it/azure/cosmos-db/linux-emulator?tabs=sql-api%2Cssl-netstd21) | ||
|
||
### Run docker container | ||
|
||
Under main project folder typing : | ||
`docker-compose up --build` | ||
>**NOTE** : before that compile `gpd` service with `mvn clean package` command | ||
|
||
If all right, eventually you'll see something like that: | ||
```sh | ||
... | ||
... | ||
``` | ||
|
||
--- | ||
|
||
## Develop Locally 💻 | ||
|
||
### Run | ||
|
||
```sh | ||
mvn spring-boot:run -Dspring-boot.run.profiles=local | ||
``` | ||
|
||
### Prerequisites | ||
- git | ||
- maven | ||
- jdk-11 | ||
- docker | ||
- cosmosdb emulator | ||
|
||
### Run the project | ||
The easiest way to develop locally is start only db container and run spring-boot application. | ||
``` | ||
... | ||
``` | ||
|
||
### Configure Cosmos emulator | ||
Launch the script in `utilities` folder: | ||
|
||
` | ||
sh cosmos.sh <port> <java_home> | ||
` | ||
### Testing 🧪 | ||
|
||
#### Unit testing | ||
|
||
Typing `mvn clean verify`, if all right you'll see following stuffs | ||
|
||
```sh | ||
|
||
``` | ||
|
||
#### Integration testing | ||
Todo | ||
|
||
#### Load testing | ||
Todo | ||
|
||
## Contributors 👥 | ||
Made with ❤️ from PagoPa S.p.A. | ||
|
||
### Mainteiners | ||
See `CODEOWNERS` file |
15 changes: 15 additions & 0 deletions
15
api-test/Spontaneous Payments - Local.postman_environment.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"id": "c8b8df76-7732-46e9-b3fa-a5dd420b7a87", | ||
"name": "Spontaneous Payments - Local", | ||
"values": [ | ||
{ | ||
"key": "spontaneous-payments-host", | ||
"value": "localhost:8080", | ||
"type": "default", | ||
"enabled": true | ||
} | ||
], | ||
"_postman_variable_scope": "environment", | ||
"_postman_exported_at": "2022-06-09T10:26:50.238Z", | ||
"_postman_exported_using": "Postman/9.19.3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"info": { | ||
"_postman_id": "73cd7230-0252-45b1-b3fb-de2dd0978128", | ||
"name": "Spontaneous Payments", | ||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | ||
"_exporter_id": "205220" | ||
}, | ||
"item": [ | ||
{ | ||
"name": "createSpontaneousPayment", | ||
"event": [ | ||
{ | ||
"listen": "test", | ||
"script": { | ||
"exec": [ | ||
"pm.test(\"createSpontaneousPayment\", function () {", | ||
" pm.response.to.have.status(201);", | ||
"});" | ||
], | ||
"type": "text/javascript" | ||
} | ||
}, | ||
{ | ||
"listen": "prerequest", | ||
"script": { | ||
"exec": [ | ||
"pm.globals.set(\"organizationfiscalcode\", '01234567890');" | ||
], | ||
"type": "text/javascript" | ||
} | ||
} | ||
], | ||
"request": { | ||
"method": "POST", | ||
"header": [], | ||
"body": { | ||
"mode": "raw", | ||
"raw": "{\n \"debtor\": {\n \"type\": \"F\",\n \"fiscalCode\": \"string\",\n \"fullName\": \"string\",\n \"streetName\": \"string\",\n \"civicNumber\": \"string\",\n \"postalCode\": \"string\",\n \"city\": \"string\",\n \"province\": \"string\",\n \"region\": \"string\",\n \"country\": \"string\",\n \"email\": \"string\",\n \"phone\": \"string\"\n },\n \"service\": {\n \"id\": \"string\",\n \"properties\": [\n {\n \"name\": \"string\",\n \"value\": \"string\"\n }\n ]\n }\n}", | ||
"options": { | ||
"raw": { | ||
"language": "json" | ||
} | ||
} | ||
}, | ||
"url": { | ||
"raw": "{{spontaneous-payments-host}}/organizations/{{organizationfiscalcode}}/spontaneouspayments", | ||
"host": [ | ||
"{{spontaneous-payments-host}}" | ||
], | ||
"path": [ | ||
"organizations", | ||
"{{organizationfiscalcode}}", | ||
"spontaneouspayment" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
curl http://localhost:8080/v3/api-docs | python3 -m json.tool > ./openapi.json |
Oops, something went wrong.