Skip to content

Commit

Permalink
Merge branch '3.7.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
nardil committed Nov 23, 2023
2 parents 819b964 + cdbd1d4 commit 505e9f8
Show file tree
Hide file tree
Showing 23 changed files with 387 additions and 19 deletions.
Expand Up @@ -49,3 +49,28 @@ When method put
Then status 400

* match response == { categoria: 'RICHIESTA', codice: 'SINTASSI', descrizione: 'Richiesta non valida', dettaglio: '#notnull' }

Scenario Outline: Stazione V2 <field> non valida

* set stazione.versione = 'V2'
* set <fieldRequest> = <fieldValue>

Given url backofficeBaseurl
And path 'intermediari', idIntermediario, 'stazioni', idStazione
And headers basicAutenticationHeader
And request stazione
When method put
Then status 400

* match response == { categoria: 'RICHIESTA', codice: 'SINTASSI', descrizione: 'Richiesta non valida', dettaglio: '#notnull' }
* match response.dettaglio contains <fieldResponse>

Examples:
| field | fieldRequest | fieldValue | fieldResponse |
| password | stazione.password | loremIpsum | 'password' |
| abilitato | stazione.abilitato | null | 'abilitato' |
| abilitato | stazione.abilitato | 'zzz' | 'abilitato' |
| versione | stazione.versione | null | 'versione' |
| versione | stazione.versione | loremIpsum | 'versione' |
| versione | stazione.versione | 'zzz' | 'versione' |
| versione | stazione.versione | '' | 'versione' |
Expand Up @@ -44,3 +44,38 @@ And match response ==
versione : 'V1'
}
"""

Scenario: Configurazione stazione V2

* def stazione = read('classpath:test/api/backoffice/v1/intermediari/put/msg/stazione.json')
* set stazione.password = null
* set stazione.versione = 'V2'

Given url backofficeBaseurl
And path 'intermediari', idIntermediario
And headers basicAutenticationHeader
And request intermediario
When method put
Then assert responseStatus == 200 || responseStatus == 201

Given url backofficeBaseurl
And path 'intermediari', idIntermediario, 'stazioni', idStazione
And headers basicAutenticationHeader
And request stazione
When method put
Then assert responseStatus == 200 || responseStatus == 201

Given url backofficeBaseurl
And path 'intermediari', idIntermediario, 'stazioni', idStazione
And headers basicAutenticationHeader
When method get
Then status 200
And match response ==
"""
{
idStazione : '#(idStazione)',
abilitato : true,
domini : '#ignore',
versione : 'V2'
}
"""
Expand Up @@ -2,6 +2,8 @@

import java.util.Objects;

import org.apache.commons.lang3.ArrayUtils;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

Expand Down Expand Up @@ -145,9 +147,20 @@ private String toIndentedString(java.lang.Object o) {
@Override
public void validate() throws ValidationException {
ValidatorFactory vf = ValidatorFactory.newInstance();
vf.getValidator("password", this.password).notNull().minLength(1).maxLength(35);
vf.getValidator("abilitato", this.abilitato).notNull();
vf.getValidator("versione", this.versione).notNull();

// valore versione non valido
VersioneStazione versioneStazione = VersioneStazione.fromValue(this.getVersione());
if(versioneStazione == null) {
throw new ValidationException("Codifica inesistente per versione. Valore fornito [" + this.getVersione() + "] valori possibili " + ArrayUtils.toString(VersioneStazione.values()));
}

if(versioneStazione.equals(VersioneStazione.V1)) {
vf.getValidator("password", this.password).notNull().minLength(1).maxLength(35);
} else {
vf.getValidator("password", this.password).maxLength(35);
}
}
}

Expand Down
Expand Up @@ -47,6 +47,10 @@ public static PutStazioneDTO getPutStazioneDTO(StazionePost stazionePost, String
stazione.setCodStazione(idStazione);
stazione.setPassword(stazionePost.getPassword());

if(stazione.getPassword() == null) {
stazione.setPassword("");
}

if(stazionePost.getVersione() != null) {
// valore versione non valido
VersioneStazione versioneStazione = VersioneStazione.fromValue(stazionePost.getVersione());
Expand Down Expand Up @@ -75,6 +79,10 @@ public static Stazione toRsModel(it.govpay.bd.model.Stazione stazione, List<it.g
rsModel.abilitato(stazione.isAbilitato())
.idStazione(stazione.getCodStazione())
.password(stazione.getPassword());

if(stazione.getPassword().equals("")) {
rsModel.setPassword(null);
}

if(stazione.getVersione() != null) {
switch (stazione.getVersione()) {
Expand Down Expand Up @@ -104,6 +112,10 @@ public static StazioneIndex toRsModelIndex(it.govpay.bd.model.Stazione stazione)
.domini(UriBuilderUtils.getListDomini(stazione.getCodStazione()))
.password(stazione.getPassword());

if(stazione.getPassword().equals("")) {
rsModel.setPassword(null);
}

if(stazione.getVersione() != null) {
switch (stazione.getVersione()) {
case V1:
Expand Down
Expand Up @@ -5218,13 +5218,13 @@ components:
stazionePost:
type: object
required:
- password
- abilitato
- versione
properties:
password:
type: string
description: Ragione sociale dell'intermediario PagoPA
description: >-
Password per la stazione, non necessaria nel modello unico. Resta obbligatoria per la versione = V1.
example: 123456
abilitato:
type: boolean
Expand Down
5 changes: 5 additions & 0 deletions wars/web-console/src/main/angular/console/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions wars/web-console/src/main/angular/console/package.json
Expand Up @@ -39,6 +39,7 @@
"rxjs": "^5.5.2",
"survey-angular": "^1.9.23",
"surveyjs-widgets": "^1.9.23",
"vkbeautify": "^0.99.3",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.14"
},
Expand Down
Expand Up @@ -72,6 +72,10 @@ import { ProfiloUtenteViewComponent } from './elements/detail-view/views/dialog-
import { ScrollerContainerComponent } from './elements/list-view/scroller-container/scroller-container.component';
import { SslConfigComponent } from './elements/detail-view/views/ssl-config/ssl-config.component';
import { SurveyComponent } from './elements/survey/survey.component';
import { PayloadViewComponent } from './elements/payload-view/payload-view.component';
import { TableViewComponent } from './elements/table-view/table-view.component';

import { XmlPipe } from './pipes/xml.pipe';

import { httpInterceptorProviders } from './services/http-interceptors';

Expand Down Expand Up @@ -117,7 +121,10 @@ import { httpInterceptorProviders } from './services/http-interceptors';
IamLoginCardComponent,
SslConfigComponent,
SurveyComponent,
OAuth2LoginCardComponent
OAuth2LoginCardComponent,
PayloadViewComponent,
TableViewComponent,
XmlPipe
],
imports: [
BrowserModule,
Expand Down
Expand Up @@ -4,15 +4,13 @@
<input class="stazione-input-prefix" matInput placeholder="Id stazione" formControlName="idStazione_ctrl" maxlength="2" autocomplete="off" required>
</mat-form-field>
<mat-form-field class="col-12 col-md-6" color="accent" [formGroup]="fGroup">
<input matInput placeholder="Password" formControlName="password_ctrl" autocomplete="off" required>
<input matInput placeholder="Password" formControlName="password_ctrl" autocomplete="off" [required]="_isPasswordRequired">
</mat-form-field>
</div>
<div class="row position-relative">
<mat-form-field class="col-12 col-md-6" color="accent" [formGroup]="fGroup">
<mat-select placeholder="Versione" formControlName="versione_ctrl" required>
<mat-option *ngFor="let item of versioni" [value]="item.value">{{item.label}}</mat-option>
</mat-select>
</mat-form-field>
<div class="col-12 col-md-6" [formGroup]="fGroup">
<mat-slide-toggle class="mt-3" formControlName="modelloUnico_ctrl" color="accent" (change)="_modelloUnicoChange($event)">Modello unico</mat-slide-toggle>
</div>
<div class="col-12 col-md-6" [formGroup]="fGroup">
<mat-slide-toggle class="mt-3" formControlName="abilita_ctrl" color="accent">Abilitato</mat-slide-toggle>
</div>
Expand Down
Expand Up @@ -15,6 +15,7 @@ export class StazioneViewComponent implements IFormComponent, OnInit, AfterViewI
@Input() parent: any;

protected versioni: any[];
protected _isPasswordRequired: boolean = true;

constructor(public us: UtilService) {}

Expand All @@ -23,7 +24,7 @@ export class StazioneViewComponent implements IFormComponent, OnInit, AfterViewI

this.fGroup.addControl('idStazione_ctrl', new FormControl('', Validators.required));
this.fGroup.addControl('password_ctrl', new FormControl('', Validators.required));
this.fGroup.addControl('versione_ctrl', new FormControl('', Validators.required));
this.fGroup.addControl('modelloUnico_ctrl', new FormControl(false));
this.fGroup.addControl('abilita_ctrl', new FormControl(false));
}

Expand All @@ -38,8 +39,13 @@ export class StazioneViewComponent implements IFormComponent, OnInit, AfterViewI
}
this.fGroup.controls['idStazione_ctrl'].setValue((idStazione)?idStazione:'');
this.fGroup.controls['password_ctrl'].setValue((this.json.password)?this.json.password:'');
this.fGroup.controls['versione_ctrl'].setValue((this.json.password)?this.json.versione:'');
let _modelloUnicoValue = this.json.versione ? UtilService.MODELLO_UNICO_BOOLEAN_DA_VERSIONE[this.json.versione] : false;
this.fGroup.controls['modelloUnico_ctrl'].setValue(_modelloUnicoValue);
this.fGroup.controls['abilita_ctrl'].setValue((this.json.abilitato)?this.json.abilitato:false);

// controllo required campo password
this._isPasswordRequired = !_modelloUnicoValue;
this.setPasswordRequired(this._isPasswordRequired);
}
});
}
Expand All @@ -58,9 +64,24 @@ export class StazioneViewComponent implements IFormComponent, OnInit, AfterViewI
}
_json.abilitato = _info['abilita_ctrl'];
_json.password = (_info['password_ctrl'])?_info['password_ctrl']:null;
_json.versione = (_info['versione_ctrl'])?_info['versione_ctrl']:null;
let _versioneFromBoolean = UtilService.VERSIONE_DA_MODELLO_UNICO_BOOLEAN[_info['modelloUnico_ctrl']];
_json.versione = _versioneFromBoolean;
//_json.versione = (_info['versione_ctrl'])?_info['versione_ctrl']:null;

return _json;
}

protected _modelloUnicoChange(event: any) {
this._isPasswordRequired = !event.checked;
this.setPasswordRequired(this._isPasswordRequired);
}

protected setPasswordRequired(pwdRequired: boolean) {
const controls: any = this.fGroup.controls;
if (pwdRequired) {
controls.password_ctrl.setValidators(Validators.required);
} else {
controls.password_ctrl.clearValidators();
}
}
}
Expand Up @@ -18,4 +18,68 @@
</div>
</div>
</mat-card>

<mat-card class="shadow no-border-radius mb-4" *ngIf="dettaglioRichiesta.length > 0">
<p class="d-block matcard-title pb-3 color-gray regular-24">Messaggio di richiesta</p>
<div class="d-block" *ngIf="dettaglioRichiesta.length != 0">
<link-key-value-view class="d-block link-key-value-fill-mat-card" *ngFor="let item of dettaglioRichiesta" [info]="item"></link-key-value-view>
</div>

<ng-container *ngIf="_json.parametriRichiesta">
<div class="container p-0" *ngIf="_json.parametriRichiesta.headers">
<div class="row lh-130 regular-16 mt-2 mb-2 break-all">
<div class="col-12 col-sm-4 color-gray lh-130 mb-2 mb-sm-0">Header:</div>
<div class="col-12 col-sm-8">
<link-table-view [data]="_json.parametriRichiesta.headers" [attributes]="_tableAttributes"></link-table-view>
</div>
</div>
</div>

<div class="container p-0" *ngIf="_json.parametriRichiesta.payload">
<div class="row lh-130 regular-16 mb-2 break-all">
<div class="col-12 col-sm-4 color-gray lh-130 mb-2 mb-sm-0">Payload:</div>
<div class="col-12 col-sm-8">
<link-payload-view
[data]="_json"
[attribute]="'parametriRichiesta'"
[showCopy]="true"
(copied)="onCopied($event)">
</link-payload-view>
</div>
</div>
</div>
</ng-container>
</mat-card>

<mat-card class="shadow no-border-radius mb-4" *ngIf="dettaglioRisposta.length > 0">
<p class="d-block matcard-title pb-3 color-gray regular-24">Messaggio di risposta</p>
<div class="d-block" *ngIf="dettaglioRisposta.length != 0">
<link-key-value-view class="d-block link-key-value-fill-mat-card" *ngFor="let item of dettaglioRisposta" [info]="item"></link-key-value-view>
</div>

<ng-container *ngIf="_json.parametriRisposta">
<div class="container p-0" *ngIf="_json.parametriRichiesta.headers">
<div class="row lh-130 regular-16 mt-2 mb-2 break-all">
<div class="col-12 col-sm-4 color-gray lh-130 mb-2 mb-sm-0">Header:</div>
<div class="col-12 col-sm-8">
<link-table-view [data]="_json.parametriRisposta.headers" [attributes]="_tableAttributes"></link-table-view>
</div>
</div>
</div>

<div class="container p-0" *ngIf="_json.parametriRisposta.payload">
<div class="row lh-130 regular-16 mb-2 break-all">
<div class="col-12 col-sm-4 color-gray lh-130 mb-2 mb-sm-0">Payload:</div>
<div class="col-12 col-sm-8">
<link-payload-view
[data]="_json"
[attribute]="'parametriRisposta'"
[showCopy]="true"
(copied)="onCopied($event)">
</link-payload-view>
</div>
</div>
</div>
</ng-container>
</mat-card>
</div>

0 comments on commit 505e9f8

Please sign in to comment.