E-Factura Integration Guide · E-Factura Integration Guide ... Model of application of digital ......
Transcript of E-Factura Integration Guide · E-Factura Integration Guide ... Model of application of digital ......
Prepared by AlfaSoft S.R.L for e-Government Center of Republic of Moldova IFB: 6-C.2.2 1
E-Factura Integration Guide (API developed for external accounting information systems)
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 2 System administrated by Fiscservinform
Table of Contents
1. Executive summary ........................................................................................................................................ 3
1.1. General overview of e-Factura integration guide ...................................................................................... 3
1.2. Objectives of the present Integration Guide .............................................................................................. 3
1.3. Abbreviations and acronyms used in this document .................................................................................. 3
1.4. References ............................................................................................................................................ 4
2. General e-Factura IS capabilities .................................................................................................................... 4
3. Workflow processes ........................................................................................................................................ 4
4. Service operations, structures and code samples ........................................................................................... 11
4.1. Module Authorization and Authentication of AS .................................................................................... 12
4.2. TaxpayersResponse GetTaxpayersInfo (TaxpayersRequest request); ........................................................ 13
4.3. SeriaNumberResponse GetSeriaAndNumbers(SeriaNumberRequest request); .......................................... 15
4.4. QRCodesResponse GetInvoicesQRcodes (InvoicesRequest request); ....................................................... 17
4.5. InvoicesResponse GetInvoicesBySeriaNumber (InvoicesRequest request); ............................................... 19
4.6. InvoicesResponse GetInvoicesForSigning (SignRequest request); ........................................................... 21
4.7. InvoicesResponse GetAcceptedInvoices (ActorBaseRequest request); ..................................................... 23
4.8. InvoicesResponse GetRejectedInvoices (ActorBaseRequest request); ...................................................... 24
4.9. RejectedResponse PostRejectedInvoices (RejectRequest request); ........................................................... 26
4.10. AcceptedResponse PostAcceptedInvoices (AcceptedRequest request); ..................................................... 27
4.11. CanceledResponse PostCanceledInvoices (CanceledRequest request); ..................................................... 28
4.12. PostInvocesResponse PostInvoices (PostInvocesRequest request); ........................................................... 30
4.13. InvoicesResponse SearchInvoices (SearchRequest request); .................................................................... 31
4.14. LogsResponse GetLogs(LogsRequest request) ....................................................................................... 34
5. Model of application of digital signatures ...................................................................................................... 35
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 3 System administrated by Fiscservinform
1. Executive summary
1.1. General overview of e-Factura integration guide
The present document is developed based on Request for Change Proposal No. RC002 and
Estimate Acceptance No. EA002. It describes the technical interfaces exposed by e-Factura IS for
accounting information systems that will use e-Factura IS.
This document contains all information that is required for a complete understanding of e-Factura
from the integration point of view. E-Factura integration guide is accompanied by a .NET
samples that exemplify the integration based on the main interaction scenarios.
1.2. Objectives of the present Integration Guide
This document describes the technical interfaces exposed by e-Factura IS for external accounting
information systems that are used by Economic Agents (Suppliers, Buyers and Transporters) who
are also users of e-Factura.
The target audience of this document is the accounting systems development teams (1C etc).
1.3. Abbreviations and acronyms used in this document
Abbreviations and acronyms used in this document are defined and explained in the table below:
Abbreviation/Acronym Description
AS Accounting Systems
API Application Programming Interface
DB Database
E-Factura Information system that allows creation and processing of electronic
Tax Invoices and Waybills.
EW Electronic Waybill
ETI Electronic Tax Invoice
FSI S.E. “Fiscservinform”
GET HTTP request method that is designed to retrieve information from
the server.
ICT Information and Communications Technologies
IS Information system
MSTI Main State Tax Inspectorate
POST HTTP request that a web server accept the data enclosed in the
request message's body for storage
STS State Tax Service
SOAP Simple Object Access Protocol
TR Technical Requirements
UI User Interface
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 4 System administrated by Fiscservinform
1.4. References
This document is developed within Change Request RC002 – namely the paragraph
“Development of functionality Integration of business accounting systems through API".
2. General e-Factura IS capabilities E-Factura API represents a shared and reusable platform-level service. Its main scope of is to
allow Companies to interact with e-Factura using their accounting systems (1C accounting and
others). It allows user’s accounting systems to receive Party’s data and current status for EWs and
ETIs created in accounting systems, EWs’/ETIs’ series and number and QR code.
3. Workflow processes
Below are exposed the scenarios of EW/ETI processing – each scheme shows specific part of
workflow and interaction between Economic Agent Accounting Systems and e-Factura via API.
Figure 1.
Authorization and Authentication of Company’ AS in e-Factura API:
Description:
To have opportunity of integration Company’s AS with e-Factura IS, the first step should be
creation of special user account by e-Factura User who has Manager’s role (Company Director).
This is done using e-Factura IS user interface.
As communication with e-Factura’ API is realized over secure connection (https) the second step
should be SSL certificates configuration (see p. 4.1. for how to do this).
When user’s AS attempts to connect to e-Factura API, the third party certification authority
performs validation of SSL certificates allowing to go forward only in case when SSL certificate
are validated.
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 5 System administrated by Fiscservinform
Figure 2.
EW/ETI is created and signed by Supplier in its AS:
Description:
Supplier’s Accounting Systems gets information about Buyer and Transporter from e-Factura IS.
After information from e-Factura IS is obtained, Supplier decides about further algorithm of
processing of EW/ETI – will it be processed in electronic form either will be printed on paper and
processed out of e-Factura (decision depends on Buyer/Transporter type – resident or non-
resident).
If Supplier decides to continue processing of EW/ETI in e-Factura IS, the AS requests from e-
Factura IS the series and number for EW/ETI. After series and number are generated by e-Factura
the AS created EW/ETI and associates series and numbers with this specific EW/ETI.
AS applies digital signature using digital certificates then sends signed EW/ETI to e-Factura IS
for saving.
Figure 3.
EW/ETI is created by Supplier in AS, but is signed in E-Factura IS:
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 6 System administrated by Fiscservinform
Description:
The sequence of processes of creation EW/ETI that are NOT signed is similar with previous case
with exception of getting series and number from e-Factura and application of it to newly
generated EW/ETI. Thus, EW/ETI is sent to e-Factura IS unsigned. This, as well as all further
steps of processing EW/ETI, will be performed within e-Factura IS by the means of its standard
UI functionality.
Figure 4.
EW/ETI is signed (and optionally accepted) by Buyer in his AS:
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 7 System administrated by Fiscservinform
Description:
After Buyer requests all incoming EWs/ETIs (related to his/her account), e-Factura returns these
invoices (in XML format).
During following step, the Buyer saves incoming EWs/ETIs in AS and signs them using digital
certificate (as an optional intermediary step can be acceptance of incoming EWs/ETIs after
saving in AS).
Similarly to Figure 1 the signed EWs/ETIs are sent by AS to e-Factura then saved there.
Figure 5.
EW/ETI acceptance process:
Description:
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 8 System administrated by Fiscservinform
As was described in Figure 3, the acceptance of incoming EWs/ETIs by Buyer into his/her AS
represents an optional intermediary step before signing EWs/ETIs.
When user uses acceptance functionality of his/her AS, it sends list accepted EWs/ETIs (their
series and numbers) to e-Factura IS that marks these EWs/ETIs as accepted.
Figure 6.
EW/ETI rejection process:
Description:
Rejection of incoming EW/ETI represents an opposite process to acceptance. The process of
rejection is preformed next step after saving incoming EWs/ETIs. The process of rejection is
similar to the process described into Figures 3 and 4 (is done priory to signing). When user
activates rejection functionality of his/her AS, this sends the list of rejected EWs/ETIs (their
series and numbers) to e-Factura IS that marks these EWs/ETIs as rejected.
Figure 7.
Cancellation by Supplier of EW ETI rejected by Buyer:
Description:
As a step following after Buyer’s rejection of EW/ETI (Figure 6), API allows Supplier to cancel
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 9 System administrated by Fiscservinform
rejected EW/ETI. The sequence of processes is follow – Supplier’s AS gets EWs/ETIs that were
rejected by Buyer. Supplier cancels these EWs/ETIs within his/her AS (e-Factura saves these
EWs/ETIs as canceled).
Figure 8.
Cancellation by Supplier of EW ETI created by him:
Description:
API allows Supplier to cancel EWs/ETIs created by him before they are signed by Buyer.
Supplier’s AS marks EW/ETI as cancelled and sends this information to e-Factura IS via API. If
Buyer didn’t sign EW/ETI that Supplier wants to cancel, e-Factura allows cancellation (displays
the message that EW/ETI is successfully canceled). If EW/ETI that Supplier wants to cancel is
already signed by Buyer, e-Factura IS doesn’t cancel it and transmits message about impossibility
to cancel this EW/ETI.
Figure 9.
Getting QR Code by Supplier
Description:
API allows to get from e-Factura IS the QR codes for assigning them to EWs/ETIs in Supplier’s
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 10 System administrated by Fiscservinform
AS. AS requests QR code(s) via API, e-Factura returns QR code(s).
Figure 10.
Process EW ETI by Transporter
Description:
According to sequence Transporter gets Ews/ETIs related to his/her account. e-Factura IS returns
these documents.
During following step, the Transporter saves incoming EWs/ETIs in AS and signs them using
digital certificate. Similarly to Figures 1 and 3 the signed EWs/ETIs are sent by AS to e-Factura
then saved there.
Figure 11.
Searching process
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 11 System administrated by Fiscservinform
Description:
User performs search in his/her AS by any of available searching criteria. API transfers searching
request to e-Factura. Finally, E-Factura IS returns search results that correspond to search criteria.
4. Service operations, structures and code samples There are several methods that are used within e-Factura API. Below you will find the
authorization and authentication module as well as general list of all methods:
1. Module Authorization and Authentication of AS
2. TaxpayersResponse GetTaxpayersInfo(TaxpayersRequest request);
3. SeriaNumberResponse GetSeriaAndNumbers(SeriaNumberRequest request);
4. QRCodesResponse GetInvoicesQRcodes(InvoicesRequest request);
5. InvoicesResponse GetInvoicesBySeriaNumber(InvoicesRequest request);
6. InvoicesResponse GetInvoicesForSigning(SignRequest request);
7. InvoicesResponse GetAcceptedInvoices(ActorBaseRequest request);
8. InvoicesResponse GetRejectedInvoices(ActorBaseRequest request);
9. RejectedResponse PostRejectedInvoices(RejectRequest request);
10. AcceptedResponse PostAcceptedInvoices(AcceptedRequest request);
11. CanceledResponse PostCanceledInvoices(CanceledRequest request);
12. PostInvocesResponse PostInvoices(PostInvocesRequest request);
13. InvoicesResponse SearchInvoices(SearchRequest request);
14. LogsResponse GetLogs(LogsRequest request)
Detailed description of e-Factura API service operations, structures as well as samples of code for
usage these methods are described below.
NOTE: Please, take into consideration that each method can be requested no more than
once every 30 seconds.
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 12 System administrated by Fiscservinform
4.1. Module Authorization and Authentication of AS
4.1.1. Creation of e-Factura API User(s)
The first step to start using e-Factura API is creation of new API User. This functionality is
available for e-Factura Users who have Director’s role. API User have special role that allows
taking advantages of all e-Factura API functionalities. To create new API Use please, perform
following actions:
1. Go to “Settings” compartment
2. Select “Company Users” folder in profile menu bar
3. Click “Register API User” button.
4. Fill in all fields of new User form as is shown on figure below:
5. Click “Register” button of new Account form to save entered information.
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 13 System administrated by Fiscservinform
4.1.2. E-Factura API configuration
Add configuration in web.config
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService">
<security mode="TransportWithMessageCredential" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://api-test.fisc.md/Service.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService"
contract="E_FacturaService.IService"
name="BasicHttpBinding_IService" />
</client>
4.1.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
4.2. TaxpayersResponse GetTaxpayersInfo (TaxpayersRequest request);
4.2.1. Service operations
Signature GetTaxpayersInfo (TaxpayersRequest request):
TaxpayersResponse
Description Gets the information about the company and its status in e-
Factura
Returns A structure that contains the Results, TimeStamp and
RequestId
Input parameters
Name Type Description
request TaxpayersRequest A structure representing
list of Fiscal Codes and
RequestId
Faults
Code Reason
AuthenticationFailedException Service consumer authentication process failed.
AutorizationFailedException Service consumer authorization process failed.
InternalErrorException
4.2.2. Structure
Member Type Required/Optional Description
TaxpayersRequest
RequestId string Required External identificator
(is unique for every
request, but can be
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 14 System administrated by Fiscservinform
reused for result the
was returner earlier).
This ID is associated
with corresponding
RequestID of method
calling and associates
requests and returns.
FiscalCodes Array of string Required, at least one
element
The actual batch of
taxpayers fiscal codes
TaxpayersResponse
Result Array of Taxpayer Required Array of taxpayers
corresponded
requested fiscal codes
TimeStamp DateTime Required Timestamp of action
Status Int Required Represent the status
of response: 1-
accepted for
execution, 2-
successfully executed,
3 – error when
executing
RequestId string Required External request
identificator.
This ID is associated
with corresponding
RequestID of method
calling and associates
requests and returns.
Taxpayer
IDNO string Required Idno or Idnp of
taxpayer
Name string Required Taxpayer name
Address string Required Taxpayer address
TaxpayerType int Required Taxpayer type: 1 -
Juridic, 2- Phisical
person, 3- Non
Resident
IsEFacturaActor bool Required Is a actor E-Factura
system
ExistInTaxRegistry bool Required Is registered in
taxregistry (Fisc)
4.2.3. Code sample for calling method:
private EFacturaApiRef.ServiceClient _client;
_client = new EFacturaApiRef.ServiceClient();
_client.ClientCredentials.UserName.UserName = "supplier";
_client.ClientCredentials.UserName.Password = "supplier";
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 15 System administrated by Fiscservinform
string newid=Guid.NewGuid().ToString();
var request = new TaxpayersRequest {FiscalCodes = new[] {"1003600106115", "1002600046027"}, RequestId = newid};
var response = _client.GetTaxpayersInfo(request);
foreach (var info in response.Result)
{
Console.WriteLine(info.Name+" "+info.IDNO+" "+info.Address);
}
4.3. SeriaNumberResponse GetSeriaAndNumbers(SeriaNumberRequest
request);
4.3.1. Service operations
Signature GetSeriaAndNumbers (SeriaNumberRequest request):
SeriaNumberResponse
Description Gets Series and Numbers from E-Factura IS
Returns A structure that contains the Results, TimeStamp and RequestId
Input parameters
Name Type Description
request SeriaNumberRequest A structure representing
parameters for generating
seria numbers pairs and
RequestId
4.3.2. Structure
Member Type Required/Optional Description
SeriaNumberRequest
RequestId string Required External identificator.
This ID is associated
with corresponding
RequestID of method
calling and associates
requests and returns.
This ID is associated
with corresponding
RequestID of method
calling and associates
requests and returns.
Count int Required, great than 0 The count of series
number pairs that should
be generated
StartNumber int Optional, great than 0 The start number great
than 0, in case if need to
generate series number
pairs starting from
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 16 System administrated by Fiscservinform
specific number This is
valid for cases when
Company has dedicated
range of series and
numbers.
Seria string Optional The series name for
seria - numbers pairs
This is valid for cases
when Company has
dedicated range of series
and numbers.
InvoiceType int Required, default 0 0 – ETI (Electronic Tax
Invoice), 1- EW
(Electronic Waybill)
SeriaNumberResponse
Results Array of
SeriaAndNumber
Required Array of series number
pairs
TimeStamp DateTime Required Timestamp of action
Status Int Required Represent the status of
response:
1- accepted for
execution, 2-
successfully executed, 3
– error when executing
RequestId string Required External request
identificator
This ID is associated
with corresponding
RequestID of method
calling and associates
requests and returns.
SeriaAndNumber
Seria string Required Seria name - name of
series that is currently
active or series that was
indicated in request in
conditions of series
dedicated for a
Company.
Number string Required Number
Status Int Required Status: 2-
IssuedForExternalUse,3-
UsedFromExternal,
These statuses are used
for general information
purposes.
4.3.3. Code sample for calling method:
private EFacturaApiRef.ServiceClient _client;
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 17 System administrated by Fiscservinform
_client = new EFacturaApiRef.ServiceClient();
_client.ClientCredentials.UserName.UserName = "supplier";
_client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString();
var request = new SeriaNumberRequest
{
RequestId = newid,
Count = 10
};
var response = _client.GetSeriaAndNumbers(request);
foreach (var info in response.SeriaAndNumbers)
{
Console.WriteLine(info.Seria + " " + info.Number);
}
4.4. QRCodesResponse GetInvoicesQRcodes (InvoicesRequest request);
4.4.1. Service operations
Signature GetInvoicesQRcodes (InvoicesRequest request):
QRCodesResponse
Description Gets the information QR Code image and QR Code text
Returns A structure that contains the Results(Array of QR Code Images
and QR Code Text), TimeStamp and RequestId
Input parameters
Name Type Description
request InvoicesRequest A structure representing list
of InvoiceIndentificators
and RequestId
Faults
Code Reason
AuthenticationFailedException Service consumer authentication process failed.
AutorizationFailedException Service consumer authorization process failed.
InternalErrorException
4.4.2. Structure
Member Type Required/Optional Description
InvoicesRequest
RequestId string Required External identifier
SeriaAndNumbers Array of
InvoiceIndentificator
Required, at least
one element
The actual batch of invoice
identifiers
QRCodesResponse
Result Array of
InvoiceQRCode
Required Array of QR Codes corresponded
requested invoices(Series and
Number)
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 18 System administrated by Fiscservinform
TimeStamp DateTime Required Timestamp of action
Status Int Required Represent the status of response: 1-
accepted for execution, 2-
successfully executed, 3 – error
when executing
RequestId string Required External request identifier
InvoiceIndentificator
-+Number string Required Invoice Number
Seria string Required Invoice Series
InvoiceQRCode
QRCode Array of byte Required QR Code Image
QRCodeText string Required Text for QR Code
eg. http://efactura2.alfa-
xp.com/EFactura.aspx?id=b78db52a-
beb3-444e-9342-1747a24f704e
Seria string Required Invoice series
Number string Required Invoice Number
TimeStamp DateTime Required Timestamp of action
Message string Optional If Status = 3. The Message contains
error info
Status int Required 2 - Ok
3- Error
4.4.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString(); var request = new InvoicesRequest { SeriaAndNumbers = new List<InvoiceIndentificator> { new InvoiceIndentificator { Number = "000004664", Seria = "EA7A"}, new InvoiceIndentificator { Number = "000004664", Seria = "EAA" } }.ToArray(), RequestId = newid }; var response = _client.GetInvoicesQRcodes(request); foreach (var info in response.Results) { Console.WriteLine(info.Seria + " " + info.Number + " "+info.QRCode +" Error Message: "+ info.Message); }
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 19 System administrated by Fiscservinform
4.5. InvoicesResponse GetInvoicesBySeriaNumber (InvoicesRequest
request);
4.5.1. Service operations
Signature GetInvoicesBySeriaNumber (InvoicesRequest request):
InvoicesResponse
Description Gets the invoices
Returns A structure that contains the Results(Array of invoices),
TimeStamp and RequestId
Input parameters
Name Type Description
request InvoicesRequest A structure representing list
of InvoiceIndentificators
and RequestId
Faults
Code Reason
AuthenticationFailedException Service consumer authentication process failed.
AutorizationFailedException Service consumer authorization process failed.
InternalErrorException
4.5.2. Structure
Member Type Required/Optional Description
InvoicesRequest
RequestId string Required External identifier
SeriaAndNumbers Array of
InvoiceIndentificator
Required, at least one
element
The actual batch of
invoice identifier
InvoicesXmlResponse
Results Array of Invoice Required Array of Invoices
TimeStamp DateTime Required Timestamp of
action
Status Int Required Represent the
status of response:
1- accepted for
execution, 2-
successfully
executed, 3 – error
when executing
:RequestId string Required External request
identifier
XmlInvoice
Xml string Required Invoice presented
in xml format
conform schema
.xsd
Number string Required Invoice Number
Seria string Required Invoice Series
Message string Optional If Status = 3. The
Message contains
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 20 System administrated by Fiscservinform
error info
Status string Optional 2 - Ok
3- Error
TimeStamp DateTime Required Timestamp of
action InvoiceStatus int Required Invoice Status:
available statuses
Draft = 0,
Signed by Supplier
= 1,
Rejected by Buyer
= 2,
Accepted by Buyer
= 3,
Canceled by
Supplier = 5,
Sent to Buyer = 7,
Signed by Buyer =
8,
Transported
(signed that
services/goods
were received) =
10
4.5.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString(); var request = new InvoicesRequest { SeriaAndNumbers = new List<InvoiceIndentificator> { new InvoiceIndentificator { Number = "000004664", Seria = "EA7A"}, new InvoiceIndentificator { Number = "000004664", Seria = "EAA" } }.ToArray(), RequestId = newid }; var response = _client.GetInvoicesBySeriaNumber(request); foreach (var info in response.Results) { Console.WriteLine(info.Seria + " " + info.Number + " " + info.Xml + " Error Message: " + info.Message); }
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 21 System administrated by Fiscservinform
4.6. InvoicesResponse GetInvoicesForSigning (SignRequest request);
4.6.1. Service operations
Signature GetInvoicesForSigning (SignRequest request):
InvoicesResponse
Description Gets the invoice content for sign
Returns A structure that contains the Results(Array of invoices),
TimeStamp and RequestId
Input parameters
Name Type Description
request SignRequest A structure representing
Order Of Signature, Actor
Role and RequestId
Faults
Code Reason
AuthenticationFailedException Service consumer authentication process failed.
AutorizationFailedException Service consumer authorization process failed.
InternalErrorException
4.6.2. Structure
Member Type Required/Optional Description
SignRequest
RequestId string Required External identifier
Order Int Required only for
Supplier
1-Invoice status
Draft (without
signature), 2-
Signed only 1
Signature
ActorRole int Required, great than 0 The actor role in
SIA E-Factura: 1-
supplier, 2 – buyer,
3 - transporter
InvoicesXmlResponse
Results Array of Invoice Required Array of Invoices
TimeStamp DateTime Required Timestamp of
action
Status Int Required Represent the
status of response:
1- accepted for
execution, 2-
successfully
executed, 3 – error
when executing
RequestId string Required External request
identifier
XmlInvoice
Xml string Required Invoice presented
in xml format
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 22 System administrated by Fiscservinform
conform schema
.xsd
Number string Required Invoice Number
Seria string Required Invoice Series
Message string Optional If Status = 3. The
Message contains
error info
Status string Optional 2 - Ok
3- Error
TimeStamp DateTime Required Timestamp of
action InvoiceStatus int Required Invoice Status:
available statuses
Draft = 0,
Signed by Supplier
= 1,
Rejected by Buyer
= 2,
Accepted by Buyer
= 3,
Canceled by
Supplier = 5,
Sent to Buyer = 7,
Signed by Buyer =
8,
Transported
(signed that
services/goods
were received) =
10
4.6.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString(); var request = new SignRequest { RequestId = newid, ActorRole = 1, Order = 1 }; var response = _client.GetInvoicesForSigning(request); foreach (var info in response.Results) { Console.WriteLine(info.Seria + " " + info.Number + " " + info.Xml + " Error Message: " + info.Message); }
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 23 System administrated by Fiscservinform
4.7. InvoicesResponse GetAcceptedInvoices (ActorBaseRequest request);
4.7.1. Service operations
Signature GetAcceptedInvoices (ActorBaseRequest request):
InvoicesResponse
Description Gets the invoice content for Signing
Returns A structure that contains the Results(Array of invoices),
TimeStamp and RequestId
Input parameters
Name Type Description
request ActorBaseRequest A structure representing
Actor Role and RequestId
Faults
Code Reason
AuthenticationFailedException Service consumer authentication process failed.
AutorizationFailedException Service consumer authorization process failed.
InternalErrorException
4.7.2. Structure
Member Type Required/Optional Description
ActorBaseRequest
RequestId string Required External identifier
ActorRole int Required, great than 0 The actor role in
SIA E-Factura: 1-
supplier, 2 – buyer,
3 - transporter
InvoicesResponse
Results Array of Invoice Required Array of Invoices
TimeStamp DateTime Required Timestamp of
action
Status Int Required Represent the
status of response:
1- accepted for
execution, 2-
successfully
executed, 3 – error
when executing
RequestId string Required External request
identifier
Invoice
Number string Required Invoice Number
Seria string Required Invoice Series
Message string Optional If Status = 3. The
Message contains
error info
Status string Optional 2 - Ok
3- Error
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 24 System administrated by Fiscservinform
TimeStamp DateTime Required Timestamp of
action InvoiceStatus int Required Invoice Status:
available statuses
Draft = 0,
Signed by Supplier
= 1,
Rejected by Buyer
= 2,
Accepted by Buyer
= 3,
Canceled by
Supplier = 5,
Sent to Buyer = 7,
Signed by Buyer =
8,
Transported
(signed that
services/goods
were received) =
10
4.7.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString(); var request = new ActorBaseRequest { RequestId = newid }; var response = _client.GetAcceptedInvoices(request); foreach (var info in response.Results) { Console.WriteLine(info.Seria + " " + info.Number + " " + info.Xml + " Error Message: " + info.Message); }
4.8. InvoicesResponse GetRejectedInvoices (ActorBaseRequest request);
4.8.1. Service operations
Signature GetRejectedInvoices (ActorBaseRequestrequest): InvoicesResponse
Description Gets Rejected invoices from e-Factura IS
Returns A structure that contains the Results, TimeStamp and RequestId
Input parameters
Name Type Description
request ActorBaseRequest A structure representing
parameters for searching
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 25 System administrated by Fiscservinform
invoices and RequestId
4.8.2. Structure
Member Type Required/Optional Description
ActorBaseRequest
RequestId string Required External identifier
ActorRole int Required, great than 0 The actor role in SIA E-
Factura: 1-supplier, 2 –
buyer, 3 - transporter
InvoicesResponse
Results Array of Invoice Required Array of Invoices
TimeStamp DateTime Required Timestamp of action
Status Int Required Represent the status of
response:
1- accepted for execution, 2-
successfully executed, 3 –
error when executing
RequestId string Required External request identifier
Invoice
Number string Required Invoice Number
Seria string Required Invoice Series
Message string Optional Not used in this method
Status string Optional Not used in this method
TimeStamp DateTime Required Timestamp of action InvoiceStatus int Required Invoice Status: available
statuses
Draft = 0,
Signed by Supplier = 1,
Rejected by Buyer = 2,
Accepted by Buyer = 3,
Canceled by Supplier = 5,
Sent to Buyer = 7,
Signed by Buyer = 8,
Transported (signed that
services/goods were
received) = 10
4.8.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString(); var request = new ActorBaseRequest { RequestId = newid, ActorRole = 1 }; var response = _client.GetRejectedInvoices(request);
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 26 System administrated by Fiscservinform
foreach (var info in response.Results) { Console.WriteLine(info.Seria + " " + info.Number + " " + info.Xml + " Error Message: " + info.Message); }
4.9. RejectedResponse PostRejectedInvoices (RejectRequest request);
4.9.1. Service operations
Signature PostRejectedInvoices (RejectRequest request): RejectedResponse
Description Posts Rejected invoices to e-Factura IS
Returns A structure that contains the Results, TimeStamp and RequestId
Input parameters
Name Type Description
request RejectRequest A structure that represents
rejected invoices and
RequestId
4.9.2. Structure
Member Type Required/Optional Description
RejectRequest
RequestId string Required External identifier
InvoicesComments Array of
InvoiceComment
Required The rejected invoices
identifiers and commentaries
RejectedResponse
Results Array of
InvoiceResult
Required Array of Invoices
TimeStamp DateTime Required Timestamp of action
Status Int Required Represent the status of
response:
1- accepted for execution, 2-
successfully executed, 3 –
error when executing
RequestId string Required External request identifier
InvoiceComment
Comment string Required Reject Comment
Number string Required Invoice Number
Seria string Required Invoice Series
InvoiceResult
Number string Required Invoice Number
Seria string Required Invoice Series
Message string Optional The Message in case if
rejection is impossible or
was some errors
Status string Optional Status of Rejection: 2-
success, 3 - Error
TimeStamp DateTime Required Timestamp of action
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 27 System administrated by Fiscservinform
4.9.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString(); var request = new RejectRequest { InvoicesComments = new List<InvoiceComment> { new InvoiceComment { Number = "0000046766", Seria = "EA7A", Comment = "reject ha ha ha" }, new InvoiceComment { Number = "000004663", Seria = "EAA", Comment = "reject ha ha ha" } }.ToArray(), RequestId = newid }; var response = _client.PostRejectedInvoices(request); foreach (var info in response.Results) { Console.WriteLine(info.Seria + " " + info.Number+ " " + info.Message); }
4.10. AcceptedResponse PostAcceptedInvoices (AcceptedRequest request);
4.10.1. Service operations
Signature PostAcceptedInvoices (AcceptedRequest request): AcceptedResponse
Description Posts Accepted invoices to e-Factura IS
Returns A structure that contains the Results, TimeStamp and RequestId
Input parameters
Name Type Description
request AcceptedRequest A structure that represents
accepted invoices and
RequestId
4.10.2. Structure
Member Type Required/Optional Description
AcceptedRequest
RequestId string Required External identifier
SeriaAndNumbers Array of
InvoiceIndentificator
Required The accepted invoices
identifiers
AcceptedResponse
Results Array of
InvoiceResult
Required Array of Invoices
TimeStamp DateTime Required Timestamp of action
Status Int Required Represent the status of
response:
1- accepted for
execution, 2-successfully
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 28 System administrated by Fiscservinform
executed, 3 – error when
executing
RequestId string Required External request
identifier
InvoiceResult
Number string Required Invoice Number
Seria string Required Invoice Series
Message string Optional The Message in case if
acceptance is impossible
or was some errors
Status string Required Status of Accept: 2 -
Success, 3-Error
TimeStamp DateTime Required Timestamp of action
4.10.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString(); var request = new AcceptedRequest { SeriaAndNumbers = new List<InvoiceIndentificator> { new InvoiceIndentificator { Number = "000004664", Seria = "EA7A"}, new InvoiceIndentificator { Number = "000004664", Seria = "EAA" } }.ToArray(), RequestId = newid }; var response = _client.PostAcceptedInvoices(request); foreach (var info in response.Results) { Console.WriteLine(info.Seria + " " + info.Number + " " + info.Message); }
4.11. CanceledResponse PostCanceledInvoices (CanceledRequest request);
4.11.1. Service operations
Signature PostCanceledInvoices (CanceledRequest request): CanceledResponse
Description Posts Canceled invoices to e-Factura IS
Returns A structure that contains the Results, TimeStamp and RequestId
Input parameters
Name Type Description
request CanceledRequest A structure that represents
canceled invoices and
RequestId
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 29 System administrated by Fiscservinform
4.11.2. Structure
Member Type Required/Optional Description
CanceledRequest
RequestId string Required External identifier
InvoicesComments Array of
InvoiceComment
Required The canceled invoices
identifier
CanceledResponse
Results Array of
InvoiceResult
Required Array of Invoices
TimeStamp DateTime Required Timestamp of action
Status Int Required Represent the status of
response:
1- accepted for
execution, 2-successfully
executed, 3 – error when
executing
RequestId string Required External request
identifier
InvoiceComment
Comment string Required Canceled Comment
Number string Required Invoice Number
Seria string Required Invoice Series
InvoiceResult
Number string Required Invoice Number
Seria string Required Invoice Series
Message string Optional The Message in case if
cancelation is impossible
or was some errors
Status string Optional Status of Accept: 2-
success, 3 - Error
TimeStamp DateTime Required Timestamp of action
4.11.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString(); var request = new AcceptedRequest { SeriaAndNumbers = new List<InvoiceIndentificator> { new InvoiceIndentificator { Number = "000004664", Seria = "EA7A"}, new InvoiceIndentificator { Number = "000004664", Seria = "EAA" } }.ToArray(), RequestId = newid }; var response = _client.PostCanceledInvoices(request);
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 30 System administrated by Fiscservinform
foreach (var info in response.Results) { Console.WriteLine(info.Seria + " " + info.Number + " " + info.Message); }
4.12. PostInvocesResponse PostInvoices (PostInvocesRequest request);
4.12.1. Service operations
Signature PostInvoices (PostInvocesRequest request): PostInvocesResponse
Description Posts invoices to SIA E-Factura
Returns A structure that contains the Results, TimeStamp and RequestId
Input parameters
Name Type Description
request PostInvocesRequest A structure that represents
invoices and RequestId
4.12.2. Structure
Member Type Required/Optional Description
PostInvocesRequest
RequestId string Required External identifier
InvoicesXml string Required The representation of
invoices in xml format
ActorRole int Required, great than 0 The actor role in SIA E-
Factura: 1-supplier, 2 –
buyer, 3 - transporter
InvoicesXmlStatus string Required Xml Status:1- signed, 0-
unsigned
PostInvocesResponse
TotalInvoices int Required Number of invoices sent
by client
TotalInvoicesPosted int Required Number of invoice
posted
TimeStamp DateTime Required Timestamp of action
Status Int Required Represent the status of
response:
1- accepted for
execution, 2-
successfully executed, 3
– error when executing
RequestId string Required External request
identifier
ErrorMessage string Optional Contains error code and
description (Error
codes: 1- Invalid XML,
2-Error during
processing )
4.12.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client;
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 31 System administrated by Fiscservinform
_client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier"; string newid = Guid.NewGuid().ToString(); var request = new PostInvocesRequest() { RequestId = newid, InvoicesXml = @"<Documents> <Document> <SupplierInfo> <DeliveryDate>2014-04-22T00:00:00.804Z</DeliveryDate> <Supplier IDNO=""1002600001257""> <BankAccount Account=""22241410046"" /> </Supplier> <Buyer IDNO=""1002600003354""> <BankAccount Account=""2224710SV12365037100"" /> </Buyer> <Merchandises> <Row Code=""1"" Name=""Abon. Contactell "" UnitOfMeasure=""buc "" Quantity=""-1"" UnitPriceWithoutTVA=""-15.00"" TotalPriceWithoutTVA=""-15.00"" TVA=""20"" TotalTVA=""3.00"" TotalPrice=""-18.00"" /> <Row Code=""1"" Name=""Abon. Contactell 111"" UnitOfMeasure=""buc "" Quantity=""-1"" UnitPriceWithoutTVA=""-15.00"" TotalPriceWithoutTVA=""-15.00"" TVA=""20"" TotalTVA=""3.00"" TotalPrice=""-18.00"" /> </Merchandises> </SupplierInfo> </Document> </Documents>", InvoicesXmlStatus = 0 }; var response = _client.PostInvoices(request); Console.WriteLine("response=" + response.TotalInvoicesPosted);
4.13. InvoicesResponse SearchInvoices (SearchRequest request);
4.13.1. Service operations
Signature SearchInvoices (SearchRequest request): InvoicesResponse
Description Gets the invoice content conform search criteria
Returns A structure that contains the Results(Array of invoices),
TimeStamp and RequestId
Input parameters
Name Type Description
request SearchRequest A structure representing
Invoice Search Criteria
Faults
Code Reason
AuthenticationFailedException Service consumer authentication process failed.
AutorizationFailedException Service consumer authorization process failed.
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 32 System administrated by Fiscservinform
InternalErrorException
4.13.2. Structure
Member Type Required/Optional Description
SearchRequest
RequestId string Required External identifier
ActorRole int Required, great than 0 The actor role in
SIA E-Factura: 1-
supplier, 2 – buyer,
3 - transporter
Parameters SearchParameters Required Parameters for
search invoices
SearchParameters
InvoiceStatus int Required Invoice Status:
available statuses
Draft = 0,
Signed by Supplier
= 1,
Rejected by Buyer
= 2,
Accepted by Buyer
= 3,
Canceled by
Supplier = 5,
Sent to Buyer = 7,
Signed by Buyer =
8,
Transported
(signed that
services/goods
were received) =
10
SupplierIDNO string Optional Supplier IDNO
BuyerIDNO string Optional Buyer IDNO
TransporterIDNO string Optional Transporter IDNO
Seria string Optional Invoice Series
Number string Optional Invoice Number
InvoiceType int Optional Invoice Type
(Taxinvoice=0
Waybill=1)
IssuedOn DateSearch Optional Issued Date
DeliveredOn DateSearch Optional Delivered Date
RegisteredOn DateSearch Optional Registered Date
DateSearch
StartDate DateTime Required
EndDate DateTime Optional
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 33 System administrated by Fiscservinform
Represent the
status of response:
1- accepted for
execution, 2-
successfully
executed, 3 – error
when executing
InvoicesResponse
Results Array of Invoice Required Array of Invoices
TimeStamp DateTime Required Timestamp of action
Status Int Required Represent the status of
response:
1- accepted for execution, 2-
successfully executed, 3 –
error when executing
RequestId string Required External request identifier
Invoice
Number string Required Invoice Number
Seria string Required Invoice Series
Message string Optional Not used in this method
Status string Optional Not used in this method
TimeStamp DateTime Required Timestamp of action
InvoiceStatus int Required Invoice Status: available
statuses
Draft = 0,
Signed by Supplier = 1,
Rejected by Buyer = 2,
Accepted by Buyer = 3,
Canceled by Supplier = 5,
Sent to Buyer = 7,
Signed by Buyer = 8,
Transported (signed that
services/goods were
received) = 10
4.13.3. Code sample for calling method:
private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier";
string newid = Guid.NewGuid().ToString(); var request = new SearchRequest { RequestId = newid, ActorRole = 1, Parameters = new SearchParameters { InvoiceStatus = 7,
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 34 System administrated by Fiscservinform
IssuedOn = new DateSearch { StartDate = DateTime.Now.AddDays(-100), EndDate = DateTime.Now}, BuyerIDNO = "1002600001431" } }; var response = _client.SearchInvoices(request); foreach (var info in response.Results) { Console.WriteLine(info.Seria + " " + info.Number + " " + info.Xml + " Error Message: " + info.Message); }
4.14. LogsResponse GetLogs(LogsRequest request)
4.14.1. Service operations
Signature GetLogs (LogsRequestrequest): LogsResponse
Description GetLogs from SIA E-Factura
Returns A structure that contains the Results, TimeStamp and RequestId
Input parameters
Name Type Description
request LogsRequest A structure that represents
time period and RequestId
4.14.2. Structure
Member Type Required /
Optional
Description
LogsRequest
RequestId string Required External identifier
From DateTime Required Start period
To DateTime Optional End period
LogsResponse
Results Array of
RequestLog
Required Array of RequestLog
RequestLog
Username string Required User Name that invoked method
Method string Required Method Name
StartDateTime DateTime Required Start of execution
EndDateTime DateTime Required End of execution
Status int Required Status of execution
Error string Optional Error message in case if is executete with error
Response string Required Response returned in JASON format ex.
{"Results":[{"Status":2,"Seria":"EAA","Number"
:"000005949"},
{"Status":2,"Seria":"EAA","Number":"00000595
0"},
{"Status":2,"Seria":"EAA","Number":"00000595
1"}],
"TimeStamp":"\/Date(1408460536810)\/","Status
":2,"RequestId":"4a1d38e8-7377-4748-97e4-
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 35 System administrated by Fiscservinform
0ed41c1fc189"}
4.14.3. Code sample for calling method: private EFacturaApiRef.ServiceClient _client; _client = new EFacturaApiRef.ServiceClient(); _client.ClientCredentials.UserName.UserName = "supplier"; _client.ClientCredentials.UserName.Password = "supplier"; string newid = Guid.NewGuid().ToString(); LogsRequest request = new LogsRequest { RequestId = newid, From = DateTime.Now.AddDays(-1), To = DateTime.Now }; var logs = _client.GetLogs(request); foreach (var log in logs.Results) { Console.WriteLine("Method: {0}, User: {1}, DateTime: {2} Status: {3}, Result: {4}",log.Method, log.Username,log.StartDateTime, log.Status, log.Response); }
5. Model of application of digital signatures The source XML contains all necessary data from EW/ETI (Electronic Waybill or Tax Invoice)
as is shown below. E-Factura creates a hash that has to be signed with digital signature (is
highlighted below).
<Document> <SupplierInfo> <Seria>EAA</Seria> <Number>000005424</Number> <DeliveryDate>2014-09-14T08:58:49.891Z</DeliveryDate> <Supplier IDNO="1002600001257" TaxpayerType="1" Title="Firma mea" Address="Adres Supplier"> <BankAccount Account="12332325524" BranchTitle="BEM" BranchCode="MDXSFF" /> </Supplier> <Buyer IDNO="1002600003815" TaxpayerType="1" Title="VITALITE - MIHAELA S.R.L." Address="Adres Buyer"> <BankAccount Account="122332325524" BranchTitle="BE9M" BranchCode="MDXSFF" /> </Buyer> <Transporter IDNO="1002600001257" TaxpayerType="1" Title="Firma mea" Address="Adres Supplier"> <BankAccount Account="12332325524" BranchTitle="BEM" BranchCode="MDXSFF" /> </Transporter> <DelegateName>12345</DelegateName> <DelegateDate>2014-08-14T08:58:49.891Z</DelegateDate> <Total>124434.04</Total> <TotalTVA>22444.04</TotalTVA> <Merchandises> <Row Code="122414" Name="Medicamente" UnitOfMeasure="buc." Quantity="4" UnitPriceWithoutTVA="142.4" TotalPriceWithoutTVA="1335.4" TVA="20" TotalTVA="100" TotalPrice="10035.5" /> </Merchandises> </SupplierInfo> </Document>
The hash is signed with digital signature (is shown below):
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 36 System administrated by Fiscservinform
<SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI="#_ce6076c8-4b53-47a9-bdac-a9dde2fabce6"> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="#default samlp saml ds xs xsi" /> </Transform> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue>DDwa1NO5Ms7zhP5J1aK4hJ9MhhA=</DigestValue> </Reference> </SignedInfo> <SignatureValue>DU0kHrZATBCYXoc0SSrpa6Yn0wX19HPJ6zN2ZIXuYpEObaBM3MrJl4RnODUMWTW8LknBhmmepNZDvUuZs8SVka/kp0GLoKRJ8LFshnKeOtnb3+iSqH1YN/Qajsz1YECQPXSr57+7fegrMUD/wKX5Mu4zShDDRtH8ppv+MysO72E=</SignatureValue> <KeyInfo> <X509Data> <X509Certificate>MIIBnDCCAQUCBEbTmfQwDQYJKoZIhvcNAQEEBQAwFTETMBEGA1UEAxMKd3d3LnNwLmNvbTAeFw0wNzA4MjgwMzQzNDhaFw0xNzA4MjUwMzQzNDhaMBUxEzARBgNVBAMTCnd3dy5zcC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJX7T4CftxFxWWb8H2fz7ihrArk1jbR7xlUWvEZ+0ns72RhmH0NBEYaJIMCHFWHKexW5pOiFYCJsJykCqTVkhzO01fvkOSa++037Ro/XqBUHssLeCXseFLCYhFutnddqG643fPS3X5ygMOrJnPDct7ijPjeRRUP/4WyLkQrv2zF/AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAMHNI8XhF8+D6IBLqAphM31/LvWggeVBYCo7+7s1hssALqJ99Xuc7Vi8nykxuKuMJpILFJGnMhz15DaLgjqa7Ah9kyHz4bw7CwBbMEIpvn1JAglYodtsbKhcnJ8iw1e2AZX6DosfjdvrS/FLV0N1ZA6+5fTf0pI26BF3OsIBjqI0=</X509Certificate> </X509Data> </KeyInfo> </Signature>
After signing the system creates a hash with digital signature encapsulated inside (information
from EW/ETI is highlighted, signature is marked with bold):
<Document> <SupplierInfo> <Seria>EAA</Seria> <Number>000005424</Number> <DeliveryDate>2014-09-14T08:58:49.891Z</DeliveryDate> <Supplier IDNO="1002600001257" TaxpayerType="1" Title="Firma mea" Address="Adres Supplier"> <BankAccount Account="12332325524" BranchTitle="BEM" BranchCode="MDXSFF" /> </Supplier> <Buyer IDNO="1002600003815" TaxpayerType="1" Title="VITALITE - MIHAELA S.R.L." Address="Adres Buyer"> <BankAccount Account="122332325524" BranchTitle="BE9M" BranchCode="MDXSFF" /> </Buyer> <Transporter IDNO="1002600001257" TaxpayerType="1" Title="Firma mea" Address="Adres Supplier"> <BankAccount Account="12332325524" BranchTitle="BEM" BranchCode="MDXSFF" /> </Transporter> <DelegateName>12345</DelegateName> <DelegateDate>2014-08-14T08:58:49.891Z</DelegateDate> <Total>124434.04</Total> <TotalTVA>22444.04</TotalTVA>
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 37 System administrated by Fiscservinform
<Merchandises> <Row Code="122414" Name="Medicamente" UnitOfMeasure="buc." Quantity="4" UnitPriceWithoutTVA="142.4" TotalPriceWithoutTVA="1335.4" TVA="20" TotalTVA="100" TotalPrice="10035.5" /> </Merchandises> </SupplierInfo> <Signatures> <SignatureContent> <SignedDoc> <hash Id="_ce6076c8-4b53-47a9-bdac-a9dde2fabce6">C4B68F459EBE040AA715F6963023B6F2E5F46F3E</hash> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI="#_ce6076c8-4b53-47a9-bdac-a9dde2fabce6"> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="#default samlp saml ds xs xsi" /> </Transform> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue>DDwa1NO5Ms7zhP5J1aK4hJ9MhhA=</DigestValue> </Reference> </SignedInfo> <SignatureValue>DU0kHrZATBCYXoc0SSrpa6Yn0wX19HPJ6zN2ZIXuYpEObaBM3MrJl4RnODUMWTW8LknBhmmepNZDvUuZs8SVka/kp0GLoKRJ8LFshnKeOtnb3+iSqH1YN/Qajsz1YECQPXSr57+7fegrMUD/wKX5Mu4zShDDRtH8ppv+MysO72E=</SignatureValue> <KeyInfo> <X509Data> <X509Certificate>MIIBnDCCAQUCBEbTmfQwDQYJKoZIhvcNAQEEBQAwFTETMBEGA1UEAxMKd3d3LnNwLmNvbTAeFw0wNzA4MjgwMzQzNDhaFw0xNzA4MjUwMzQzNDhaMBUxEzARBgNVBAMTCnd3dy5zcC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJX7T4CftxFxWWb8H2fz7ihrArk1jbR7xlUWvEZ+0ns72RhmH0NBEYaJIMCHFWHKexW5pOiFYCJsJykCqTVkhzO01fvkOSa++037Ro/XqBUHssLeCXseFLCYhFutnddqG643fPS3X5ygMOrJnPDct7ijPjeRRUP/4WyLkQrv2zF/AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAMHNI8XhF8+D6IBLqAphM31/LvWggeVBYCo7+7s1hssALqJ99Xuc7Vi8nykxuKuMJpILFJGnMhz15DaLgjqa7Ah9kyHz4bw7CwBbMEIpvn1JAglYodtsbKhcnJ8iw1e2AZX6DosfjdvrS/FLV0N1ZA6+5fTf0pI26BF3OsIBjqI0=</X509Certificate> </X509Data> </KeyInfo> </Signature> </SignedDoc> </SignatureContent> </Signatures> </Document>
System applies next (second) digital signature that is shown below:
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI="#_1078426c-56ed-4dcf-82c9-ea76a5404622">
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 38 System administrated by Fiscservinform
<Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="#default samlp saml ds xs xsi" /> </Transform> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue>ES2nLM56z6K815OYPbtQBIFuObQ=</DigestValue> </Reference> </SignedInfo> <SignatureValue>ToMFLMN2m/uTz5p1MbE3B3+7opEZ92ay7g5xDI+egTceJPBkd1ff1/fDDdhq4+eWb9pLmC7TJJG73f3ZIZ3G4p5uqfAXLgyRSS6lMftl5GIXgMcpLgUm/MwWUdMmjAVwXpDX2iDpd2CqssYdAL6oDFPlNWeA03PntTchq2M3MZQ=</SignatureValue> <KeyInfo> <X509Data> <X509Certificate>MIIBnDCCAQUCBEbTmfQwDQYJKoZIhvcNAQEEBQAwFTETMBEGA1UEAxMKd3d3LnNwLmNvbTAeFw0wNzA4MjgwMzQzNDhaFw0xNzA4MjUwMzQzNDhaMBUxEzARBgNVBAMTCnd3dy5zcC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJX7T4CftxFxWWb8H2fz7ihrArk1jbR7xlUWvEZ+0ns72RhmH0NBEYaJIMCHFWHKexW5pOiFYCJsJykCqTVkhzO01fvkOSa++037Ro/XqBUHssLeCXseFLCYhFutnddqG643fPS3X5ygMOrJnPDct7ijPjeRRUP/4WyLkQrv2zF/AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAMHNI8XhF8+D6IBLqAphM31/LvWggeVBYCo7+7s1hssALqJ99Xuc7Vi8nykxuKuMJpILFJGnMhz15DaLgjqa7Ah9kyHz4bw7CwBbMEIpvn1JAglYodtsbKhcnJ8iw1e2AZX6DosfjdvrS/FLV0N1ZA6+5fTf0pI26BF3OsIBjqI0=</X509Certificate> </X509Data> </KeyInfo> </Signature>
After second digital signature is applied, E-Factura IS encapsulates this signature into file (see
below). Information from EW/ETI is highlighted with yellow color, first signature is highlighted
with green color:
<Document> <SupplierInfo> <Seria>EAA</Seria> <Number>000005424</Number> <DeliveryDate>2014-09-14T08:58:49.891Z</DeliveryDate> <Supplier IDNO="1002600001257" TaxpayerType="1" Title="Firma mea" Address="Adres Supplier"> <BankAccount Account="12332325524" BranchTitle="BEM" BranchCode="MDXSFF" /> </Supplier> <Buyer IDNO="1002600003815" TaxpayerType="1" Title="VITALITE - MIHAELA S.R.L." Address="Adres Buyer"> <BankAccount Account="122332325524" BranchTitle="BE9M" BranchCode="MDXSFF" /> </Buyer> <Transporter IDNO="1002600001257" TaxpayerType="1" Title="Firma mea" Address="Adres Supplier"> <BankAccount Account="12332325524" BranchTitle="BEM" BranchCode="MDXSFF" /> </Transporter> <DelegateName>12345</DelegateName> <DelegateDate>2014-08-14T08:58:49.891Z</DelegateDate> <Total>124434.04</Total> <TotalTVA>22444.04</TotalTVA> <Merchandises> <Row Code="122414" Name="Medicamente" UnitOfMeasure="buc." Quantity="4" UnitPriceWithoutTVA="142.4" TotalPriceWithoutTVA="1335.4" TVA="20" TotalTVA="100" TotalPrice="10035.5" /> </Merchandises>
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 39 System administrated by Fiscservinform
</SupplierInfo> <Signatures> <SignatureContent> <SignedDoc> <hash Id="_ce6076c8-4b53-47a9-bdac-a9dde2fabce6">C4B68F459EBE040AA715F6963023B6F2E5F46F3E</hash> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI="#_ce6076c8-4b53-47a9-bdac-a9dde2fabce6"> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="#default samlp saml ds xs xsi" /> </Transform> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue>DDwa1NO5Ms7zhP5J1aK4hJ9MhhA=</DigestValue> </Reference> </SignedInfo> <SignatureValue>DU0kHrZATBCYXoc0SSrpa6Yn0wX19HPJ6zN2ZIXuYpEObaBM3MrJl4RnODUMWTW8LknBhmmepNZDvUuZs8SVka/kp0GLoKRJ8LFshnKeOtnb3+iSqH1YN/Qajsz1YECQPXSr57+7fegrMUD/wKX5Mu4zShDDRtH8ppv+MysO72E=</SignatureValue> <KeyInfo> <X509Data> <X509Certificate>MIIBnDCCAQUCBEbTmfQwDQYJKoZIhvcNAQEEBQAwFTETMBEGA1UEAxMKd3d3LnNwLmNvbTAeFw0wNzA4MjgwMzQzNDhaFw0xNzA4MjUwMzQzNDhaMBUxEzARBgNVBAMTCnd3dy5zcC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJX7T4CftxFxWWb8H2fz7ihrArk1jbR7xlUWvEZ+0ns72RhmH0NBEYaJIMCHFWHKexW5pOiFYCJsJykCqTVkhzO01fvkOSa++037Ro/XqBUHssLeCXseFLCYhFutnddqG643fPS3X5ygMOrJnPDct7ijPjeRRUP/4WyLkQrv2zF/AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAMHNI8XhF8+D6IBLqAphM31/LvWggeVBYCo7+7s1hssALqJ99Xuc7Vi8nykxuKuMJpILFJGnMhz15DaLgjqa7Ah9kyHz4bw7CwBbMEIpvn1JAglYodtsbKhcnJ8iw1e2AZX6DosfjdvrS/FLV0N1ZA6+5fTf0pI26BF3OsIBjqI0=</X509Certificate> </X509Data> </KeyInfo> </Signature> </SignedDoc> </SignatureContent> <SignatureContent> <SignedDoc> <hash Id="_1078426c-56ed-4dcf-82c9-ea76a5404622">6AAA03073E262FAC81546AB40A6523A10389C95D</hash> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI="#_1078426c-56ed-4dcf-82c9-ea76a5404622"> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="#default samlp saml ds xs xsi" /> </Transform> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
e-Factura Integration Guide (API for external accounting systems)
Document prepared by Alfa -Soft S.R.L 40 System administrated by Fiscservinform
<DigestValue>ES2nLM56z6K815OYPbtQBIFuObQ=</DigestValue> </Reference> </SignedInfo> <SignatureValue>ToMFLMN2m/uTz5p1MbE3B3+7opEZ92ay7g5xDI+egTceJPBkd1ff1/fDDdhq4+eWb9pLmC7TJJG73f3ZIZ3G4p5uqfAXLgyRSS6lMftl5GIXgMcpLgUm/MwWUdMmjAVwXpDX2iDpd2CqssYdAL6oDFPlNWeA03PntTchq2M3MZQ=</SignatureValue> <KeyInfo> <X509Data> <X509Certificate>MIIBnDCCAQUCBEbTmfQwDQYJKoZIhvcNAQEEBQAwFTETMBEGA1UEAxMKd3d3LnNwLmNvbTAeFw0wNzA4MjgwMzQzNDhaFw0xNzA4MjUwMzQzNDhaMBUxEzARBgNVBAMTCnd3dy5zcC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJX7T4CftxFxWWb8H2fz7ihrArk1jbR7xlUWvEZ+0ns72RhmH0NBEYaJIMCHFWHKexW5pOiFYCJsJykCqTVkhzO01fvkOSa++037Ro/XqBUHssLeCXseFLCYhFutnddqG643fPS3X5ygMOrJnPDct7ijPjeRRUP/4WyLkQrv2zF/AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAMHNI8XhF8+D6IBLqAphM31/LvWggeVBYCo7+7s1hssALqJ99Xuc7Vi8nykxuKuMJpILFJGnMhz15DaLgjqa7Ah9kyHz4bw7CwBbMEIpvn1JAglYodtsbKhcnJ8iw1e2AZX6DosfjdvrS/FLV0N1ZA6+5fTf0pI26BF3OsIBjqI0=</X509Certificate> </X509Data> </KeyInfo> </Signature> </SignedDoc> </SignatureContent> </Signatures> </Document>
The procedure of signing is repeated as much as is needed, each cycle system creates a hash, next
digital signature is added identically to examples described above.
Note: Archive with application that demonstrates functionalities of e-Factura IS API as well as
archive with files - XML schemes for Electronic Waybill and Electronic Tax Invoice are attached
to this document.