invopop / gobl.fatturapa

GOBL Conversion into FatturaPA in Italy
Apache License 2.0
4 stars 2 forks source link

Communication with SdI - sending invoice #28

Closed torrocus closed 5 months ago

torrocus commented 5 months ago

Pull Request Summary

We have implemented functionalities for sending invoices to SdI.

We've also introduced context, following the pattern established in other packages.

Furthermore, we've standardized CA (public) certificates, consolidating them into a single file. We have overcome authentication problems (on the client side).

Feedback

We have removed the server-related part from this PR to complete the process of sending invoices to SdI as one whole.

Below are some logs from the console commands.

$ go run ./cmd/gobl.fatturapa help
Usage:
  gobl.fatturapa [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  convert     Convert a GOBL JSON into a FatturaPA XML
  help        Help about any command
  server      Server for communication with SdI in selected environment
  transmit    Transmit a FatturaPA XML file to SdI in selected environment
  version     

Flags:
  -h, --help   help for gobl.fatturapa

Use "gobl.fatturapa [command] --help" for more information about a command.

Transmit

$ go run ./cmd/gobl.fatturapa help transmit
Transmit a FatturaPA XML file to SdI in selected environment

Usage:
  gobl.fatturapa transmit [file] [environment] [flags]

Flags:
      --ca-cert string   Path to a file containing the CA certificate
      --cert string      Path to a file containing the SDI PEM certificate
      --env string       Environment for running command (default "test")
  -h, --help             help for transmit
      --key string       Path to a file containing the sender PEM RSA private key
      --verbose          Logs all requests into the console
$ go run ./cmd/gobl.fatturapa transmit --ca-cert ./ca-all.pem --cert ./SDI-B85905495.pem --key ./key_client.key IT01234567890_FPA01.xml 
Invoice sent to SdI.
Here is the response: {29218192 2024-05-31T13:54:56.491+02:00 <nil>}

Co-authored-by: @noplisu Co-authored-by: @torrocus