GithubHelp home page GithubHelp logo

italia / fatturapa-testsdi Goto Github PK

View Code? Open in Web Editor NEW
61.0 27.0 24.0 10.81 MB

Sistema d'Interscambio di test

License: GNU Affero General Public License v3.0

PHP 88.43% HTML 10.88% Vue 0.21% Makefile 0.48%
fatturapa

fatturapa-testsdi's People

Contributors

alranel avatar em- avatar enrigen avatar hmonglee avatar marcopeca avatar pes8 avatar simevo avatar valamiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fatturapa-testsdi's Issues

FullDemo::testCheckExpiration2 fails

to reproduce run ./vendor/bin/phpunit tests/FullDemo.php --filter testCheckExpiration2 and get:

1) FullDemo::testCheckExpiration2
Failed asserting that 0 matches expected 1.

.../tests/FullDemo.php:92
.../tests/FullDemo.php:865

this is caused by RicezioneFattureHandler::NotificaDecorrenzaTermini:

  • it is not storing the notification (should call Base::receive)
  • it is trying to set to R_EXPIRED the invoice with invoice_id received from ES, but that row in invoices table does not "belong" to recipient (it should set to R_EXPIRED the invoice with remote_id equal to invoice_id received from sdi)

it would be easier to implement RicezioneFattureHandler::NotificaDecorrenzaTermini reusing code from TrasmissioneFattureHandler::NotificaDecorrenzaTermini

Console error or any artisan command

Executing any "php artisan" command inside the rpc directory gives me this error:

In Application.php line 937:
[Symfony\Component\HttpKernel\Exception\NotFoundHttpException]

When I try to open the welcome page I receive this laravel error:

Sorry, the page you are looking for could not be found.

Reading the ticket #40 I tried commenting this line and it works
https://github.com/italia/fatturapa-testsdi/blob/master/rpc/packages/fatturapa/control/src/ControlServiceProvider.php#L26
Even the welcome page starts working!

Considering the previous ticket, however, i have a working database that has already been created by the core migration so I really don't understand why this fix works.
The web.php file seems fine to me.

make channels table configurable via UI

after #23 !

this would allow users to configure the test system, specifying which SDIcoop channel is registered to send/receive invoices for a given VAT no (partita IVA)

implement /rpc/refuse flow

impacts:

  • SOAP (fix SdIRiceviNotificaHandler and TrasmissioneFattureHandler to set the status to {I,R}_{ACCEPTED,REFUSED} based on Esito)
  • recipient
  • sdi
  • and issuer

write tests beforehand !

All config files should not be tracked on git

It's always a bad idea to track settings files.
For laravel I started a pull request (#58) to use the .env file instead of requiring database.php editing.

For core and soap packages we could use default files that should be renamed to a standard and untracked name to be used.

Problem with database migration on mysql

I get this error:
SQLSTATE[HY000]: General error: 1005 Can't create table testsdi.#sql-7608_a0 (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table notifications add constraint noti fications_invoice_id_foreign foreign key (invoice_id) references invoices (id))

The problem is caused by the fact that invoices.id is unsigned however notifications.invoice_id is not

actors and issuers endpoints should return unique actors/issuers

when the channels table has been populated with:

INSERT INTO channels(cedente, issuer) VALUES ('IT-23456789012', '0000003');
INSERT INTO channels(cedente, issuer) VALUES ('IT-99999999999', '0000003');           
INSERT INTO channels(cedente, issuer) VALUES ('IT-19999999999', '0000003'); 
INSERT INTO channels(cedente, issuer) VALUES ('IT-88888888888', '0000002');           
INSERT INTO channels(cedente, issuer) VALUES ('IT-18888888888', '0000002'); 
INSERT INTO channels(cedente, issuer) VALUES ('IT-11888888888', '0000002'); 
INSERT INTO channels(cedente, issuer) VALUES ('IT-11188888888', '0000002');
INSERT INTO channels(cedente, issuer) VALUES ('IT-77777777777', '0000001');

https://testsdi.simevo.com/sdi/rpc/issuers returns:

{
  "issuers": [
    "0000001",
    "0000002",
    "0000003",
    "0000003",
    "0000003",
    "0000002",
    "0000002",
    "0000002",
    "0000002",
    "0000001"
  ]
}

where as it should return:

{
  "issuers": [
    "0000001",
    "0000002",
    "0000003"
  ]
}

and http://testsdi.simevo.com/sdi/rpc/actors returns:

{"actors":["sdi","td0000001","td0000002","td0000003","td0000003","td0000003","td0000002","td0000002","td0000002","td0000002","td0000001"]}

where as it should return:

{"actors":["sdi","td0000001","td0000002","td0000003"]}

only allow uploads of XML files of size <= 5 MB

on POST /td000000x/rpc/upload:

  • file size check: invoices can be 5 MB max
  • file types check: only XML / xml allowed

probably PHP’s max_upload_filesize and nginx client_max_body_size should also be set to 5 MB

invoice flows in case of transmit error

for example for issuer state machine, the state diagram currently shows that to go to I_INVALID the invoice has to pass via I_TRANSMITTED, but:

  • in case of SOAP error or timeout it should stay in I_UPLOADED (i.e. retry transmission)
  • successful SOAP call but with errore' field set will move invoice from I_UPLOADEDstraight toI_INVALID`

N_PENDING -> N_RECEIVED

the N_PENDING status for notifications is really the same as N_RECEIVED, they have the same description "event has been triggered and must be processed"

search in README all occurrences of N_PENDING & replace them with N_RECEIVED

dynamic routing and configuration of the number of actors

currently actors are setup by manually symlinking in /var/www/html (see README)

user should be able to configure the number of simulated issuer/receiver (TD = trasmittente / destinatario) actors in rpc/config.php

dynamic routing will make sure that the actors will be reachable at:

  • /sdi (there's only one exchange system)
  • /td0000001, /td0000002 ... (td stands for trasmittente/destinatario, Italian for issuer/receiver)

this involves:

  • placing a basic routing index.php in home that looks at the first segment of the path and requires the correct page
  • and configuting the web server accordingly

Error on index declaration in channels table migration on mysql

This is the error
SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'cedente' used in key specification without a key length

I would define a new id field for this table and use it as index instead of a text field.
In alternative the quicker fix to keep all as it is is to define the key with a max length

Change 20180923120240_create_channels_table.php line 18
$table->primary('cedente');
in
$table->primary([DB::raw('cedente(191)')]);

The choice of 191 is related to compatibility with older version of mysql, innodb and utf8
https://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes/31474509

Setup Laravel Error - missing rpc/bootstrap/cache folder

Folder rpc/bootstrap/cache is missing and in the "Configuring and Installing" readme section isn't explicitly written to create it.

If it's not present the artisan command will throw an error:

The /var/www/html/rpc/bootstrap/cache directory must be present and writable.

completare README

struttura base del README:

  • Getting Started
    • Prerequisites: TODO sudo apt install ...
    • Configuring and Installing (potrebbe corrispondere all'attuale "Configurazione" ma mancano info su config apache, composer ...)
    • Demo (OK attuale "Test WSDL con Postman")
  • Testing
    • Unit tests TODO
    • Linting TODO
  • Contributing TODO
  • Authors TODO
  • License TODO

types generated by wsdl2phpgenerator are not used in SOAP server handler classes

http://teamdigitale1.example.com/sdi/test.php:

image

( ! ) Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Call to undefined method stdClass::getNomeFile() in /var/www/html/sdi/SdIRiceviFile/SdIRiceviFile_service.php:41 Stack trace: #0 /var/www/html/sdi/SdIRiceviFile/SdIRiceviFile_service.php(41): SoapClient->__soapCall('RiceviFile', Array) #1 /var/www/html/sdi/test.php(26): SdIRiceviFile_service->RiceviFile(Object(fileSdIBase_Type)) #2 {main} thrown in /var/www/html/sdi/SdIRiceviFile/SdIRiceviFile_service.php on line 41
( ! ) SoapFault: Call to undefined method stdClass::getNomeFile() in /var/www/html/sdi/SdIRiceviFile/SdIRiceviFile_service.php on line 41
Call Stack
#	Time	Memory	Function	Location
1	0.0019	231128	{main}( )	.../test.php:0
2	0.0086	278608	SdIRiceviFile_service->RiceviFile( )	.../test.php:26
3	0.0086	279008	__soapCall ( )	.../SdIRiceviFile_service.php:41

All the uploaded invoices go straight to invalid section

As per title all the uploaded invoices (even the very one used in the README gif) just go straight to the"I_INVALID: ES notified it was invalid " section. Is there a way to understand what's wrong? At the moment i'm getting literally zero feedback from the app.
Also clicking on "Add" in /sdi/rpc/mchannels throws a 400 error

SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column "key" violates not-null constraintDETAIL:  Failing row contains (9999993, IT-123456789, null, null). (SQL: insert into "actors" ("code", "id") values (IT-123456789, 9999993))

Any support would be very appreciated. Thank you!

signing

  • create public/private keys for all parties
  • exchange public keys during config
  • sign all outbound XML messages
  • verify XML signatures for all inbound messages

FullDemo::testUploadWrongFileExtension fails

to reproduce run ./vendor/bin/phpunit tests/FullDemo.php --filter testUploadWrongFileExtension and get:

1) FullDemo::testUploadWrongFileExtension
Failed asserting that 200 matches expected 400.

.../tests/FullDemo.php:224

it should respond with http code 400 if I send a file with extension != 'xml'

move Laravel package to new repo

I would suggest moving the Laravel packages to a dedicated repo. The main Laravel app is also not really required as its just a plain new Laravel installation that requires the packages via composer.

Something like

  • Sdicoop-soap
  • laravel-sdicoop that requires sdicoop-soap

a separate Laravel-example app repo can than be created if needed with a new Laravel install and the composer.json setup to load the individual packages.

Composer install error

Hello, I get the last commit this morning and when I composer install :

In Connection.php line 664: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "channels" does not exist LINE 1: select distinct "issuer" from "channels" ^ (SQL: select distinct "issuer" from "channels") In Connection.php line 330: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "channels" does not exist LINE 1: select distinct "issuer" from "channels" ^ Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1 Script cd rpc && composer install handling the post-install-cmd event returned with error code 1

Looks like Laravel try to register ServiceProvider when executing php artisan package:discover and the FatturaPa\Control\ControlServiceProvider includes routes/web.php which need to access to issuer table which does not already exist because we create tables after with php artisan migrate.

error accessing database/storage/time_travel.json

occasionally upon pushing files to the development server you may get errors accessing the storage dirs; a quick fix is:

sudo chown www-data /var/www/html/sdi/database/storage/time_travel.json 

better fix: setup the user/group for the storage folders once and for all

Ricezione file messaggio

Salve,
avrei bisogno di un chiarimento. Nella cartella soap/TrasmissioneFatture ci dovrebbe essere il codice per ricevere le notifiche da SDI: però non trovo il codice che, di fatto, scarica il file messaggio in un determinato percorso di destinazione oppure dove sta la variabile che lo contiene, una volta ricevuto.
Mi potreste indicare il file php e/o la sezione di codice che se ne occupa?
Oppure ho frainteso lo scopo del codice in oggetto?
Grazie.

refactor controllers in control package inside rpc

according to separation of concerns best practice, the controllers in control package inside rpc are too messy and probably wrongly named

InvoiceController handles stuff which is not specific to invoices
they should be reassigned differently, for example based on the actors:

  • BaseController (goes to Base, for non-actor-specific endpoints)
  • TdController (goes to.../td000000x/... routes)
  • SdiController (goes to Exchange and handles /sdi/... routes)

another option is to create helper classes

implement SdIRiceviFileHandler::RiceviFile checks

soap/SdIRiceviFile/SdIRiceviFileHandler.php SdIRiceviFileHandler::RiceviFile validate submitted file using subset of Elenco_Controlli_V1.5:

  • Codice 00001 Nome file non valido
  • Codice 00002 Nome file duplicato
  • Codice 00003 Le dimensioni del file superano quelle ammesse
  • Codice 00106 File / archivio vuoto o corrotto
  • Codice 00200 File non conforme al formato

on error, return error code

datetime endpoint to return JSON

It would be nice if GET sdi/rpc/datetime returned JSON such as:

{
  timestamp: 150000000,
  datetime:  2018-10-11 10:15:55.000000,
  speed: 1000
}

docker-compose

provide a docker-compose to set up quicky an instance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.