Access to add and change pages is restricted. See: https://cwiki.apache.org/confluence/display/OFBIZ/Wiki+access

This is not a technical documentation, this document is just for developer collaboration in implementing the new eInvoicing plugin. Feel free to modify this document when working or planning on the eInvoicing plugin.

Goal

The goal of the eInvoicing plugin is to provide the functionality in Ofbiz to upload and download Invoices to and from an Invoice Registry. The Invoice Registry is just a place where Invoices can be stored, it could be a national Tax Authority, where you upload Invoices for reporting and tax purposes, or it could be a non-governmental registry used as a central Invoice exchange mechanism for Parties. 

Increments

Note: An Increment is a concrete stepping stone toward the Product Goal, similar to a keystone. Increments are further split into Stories.

  1. Upload Invoices
  2. Download Invoices

Stories

Note: A story is a piece of work that should take less than a week to complete, expressed as an end goal from the software user's perspective. A story is further split into specific Tasks.

Upload Invoices stories:

  • Create Invoice Upload workflow for Romanian ANAF Invoice Registry
  • Create Invoice Upload workflow for Saudi Arabia ZATCA Invoice Registry
  • Manual Invoice Upload to ANAF
  • Manual Invoice Upload to ZATCA
  • Automatic Invoice Upload to ANAF
  • Automatic Invoice Upload to ZATCA

Download Invoices stories:

  • Create Download Invoice workflow for Romanian ANAF Invoice Registry
  • View received Invoices from ANAF
  • Auto-import received Invoices from ANAF into Ofbiz

Tasks

Create Invoice Upload workflow for Romanian ANAF Invoice Registry:

  • Gather ANAF upload requirements
  • Create the ANAF Invoice Upload visual workflow

Create Invoice Upload workflow for Saudi Arabia ZATCA Invoice Registry:

  • Gather ZATCA upload requirements
  • Create the ZATCA Invoice Upload visual workflow


WORK IN PROGRESS

This section is used for collaboration. 

  1. Pick a task from the task list above.
  2. Write in here the task that you plan to work on next to your name.

Note: when picking a task, make sure you go through the list below, so you don't pick a task that somebody else is already working on.

Example:

Groza Danut

  • Gather ANAF upload requirements
  • Gather ZATCA upload requirements

Note: For the moment I finished working on the above 2 tasks, so feel free to work on them if you want.

WORK FINISHED

Gather ANAF upload requirements

The eInvoicing for Romania has a different workflow:
A. Boarding stage: ANAF uses OAuth to generate a token so the flow is:
1. Ofbiz sends a request to ANAF authorization server using OAuth2 Authorization Code Flow
2. The user is redirected to the ANAF login page, where he needs to present his digital signature(yes, each end user need his own digital signature)
3. Upon successful authentication Ofbiz gets a JWT access and refresh token from ANAF.

B. Reporting stage.
1. Ofbiz converts the Invoice to the accepted format(UBL, CN, CII or RASP)
2. Ofbiz sends the Invoice xml to the upload api using the JWT access token for authentication. Note: there are 2 upload apis: one is the testing environment, and one is the production environment, but you still need valid credentials for testing.
3. Ofbiz sends a request to the ANAF status api and gets the response whether the Invoice was accepted, or rejected and the reason for rejection. Upon fixing the rejection issue, we need to resend the invoice.

Gather ZATCA upload requirements

From the ML

Omar Abdullwahhab:

First ZATCA uses x509 certificates, and the procedures has to be done in
two stages.
A. The boarding stage
1. the reporting software ( ofbiz for example ) will generate  a CSR (
Certificate signing request )
2. The reporting software will send this CSR to ZATCA via rest api.
3. ZATCA will respond with (CSID) X509 temporary certificate along with a
secret -basic auth for further requests - ( for pre-production or for
proving that the software reports the invoices correctly).
4. the reporting software will use this certificate to simulate the
reporting of different invoice types ( Simplified invoice, Standard
invoice, Credit Note, Debit note ...etc).
5. After successful reporting, the software will send a request to ZATCA
API to get the production CSID ( X509).

B. Reporting stage.
1. After getting the production (CSID) X509 from the boarding stage ,
 The software now is ready for reporting real financial transactions.
2. The reported invoices has to be signed by the reporting software and it
have to be in compliance with UBL 2.1

C. Ofbiz and ZATCA
1. Of course the transactions and tables of ofbiz has to be changed to fit
for additional fields.
2. Ofbiz transactions ( Sales Invoices, Purchase invoices ..etc) will be
converted to UBL Xml Invoices.
3. The XML Invoices after signing it and generating QR code for it, it is
saved in a local disk file / database table or whatever is applicable.
4. Then the software will make  a json request for the XML invoice and send
it to the ZATCA api.
5. ZATCA will responed with the status of reporting ( Reported, not
reported ).

For further information here is the useful link

https://zatca.gov.sa/en/E-Invoicing/SystemsDevelopers/Pages/default.aspx

  • No labels