Skip to content

Commit

Permalink
feat : [PPD-167] spontaneous payments call (#1)
Browse files Browse the repository at this point in the history
* [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
6 people authored Jun 13, 2022
1 parent 62694e4 commit c95b562
Show file tree
Hide file tree
Showing 51 changed files with 2,428 additions and 375 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target/**/*
.vscode
/.idea/
emulatorcert.crt
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
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 ]
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
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
121 changes: 120 additions & 1 deletion README.md
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 api-test/Spontaneous Payments - Local.postman_environment.json
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"
}
60 changes: 60 additions & 0 deletions api-test/Spontaneous Payments.postman_collection.json
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": []
}
]
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
image: 'spontaneous-payments:latest'
build:
context: .
container_name: app
container_name: spontaneous-payments
ports:
- 8080:8080

2 changes: 2 additions & 0 deletions openapi/generate_openapi.sh
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
Loading

0 comments on commit c95b562

Please sign in to comment.