Documentation
Closed this issue · 5 comments
Is there any documentation ?
There's not documentation at the moment, sorry.
You can take a look at how this works on the tests and I hope to find some time to add some documentation on the near future, but it is not possible for us to add it right now.
First of all, thank you for answering
Finally figured out how the library works. But I get the following error from the ticketbai Endpoint:
<ResultadosValidacion>
<Codigo>001</Codigo>
<Descripcion>Certificado remitente debe estar homologado y no revocado y no caducado (más de un mes) </Descripcion>
<Azalpena>Igorlearen ziurtagiria homologatuta, errebokatu gabea eta (hilabete baino gehiago) iraungi gabea egon behar da</Azalpena>
</ResultadosValidacion>
--- Extra information ----
endpoint : https://tbai-z.prep.gipuzkoa.eus/sarrerak/alta
method: POST
Headers : application/xml;charset=UTF-8;
About the Certificate :
I have a .p12 Device Certificates to sign. which I have generated from :
https://servicios.izenpe.com/ticketbai/mostrarHome.do;jsessionid=BCaX90FmNojaUdDhYp1CmlDRki0HsJygdL7eFEbVS_VGimM2DOm3!-696173953!770136521
I have verified if the certificate is valid using the following tools
-AutoFirma
-https://servicios.izenpe.com/gestionCertificados/mostrarValidacionCertificado.do
This is how I generate the ticketbai invoice
use Barnetik\Tbai\Fingerprint;
use Barnetik\Tbai\Invoice\Data\Detail;
use Barnetik\Tbai\Fingerprint\Vendor;
use Barnetik\Tbai\Header\RectifiedInvoice;
use Barnetik\Tbai\Header\RectifyingAmount;
use Barnetik\Tbai\Header\RectifyingInvoice;
use Barnetik\Tbai\Invoice;
use Barnetik\Tbai\Invoice\Breakdown;
use Barnetik\Tbai\Invoice\Breakdown\ForeignServiceSubjectNotExemptBreakdownItem;
use Barnetik\Tbai\Invoice\Breakdown\NationalSubjectNotExemptBreakdownItem;
use Barnetik\Tbai\Invoice\Breakdown\VatDetail;
use Barnetik\Tbai\Invoice\Data;
use Barnetik\Tbai\Invoice\Header;
use Barnetik\Tbai\Subject;
use Barnetik\Tbai\ValueObject\Amount;
use Barnetik\Tbai\ValueObject\Date;
use Barnetik\Tbai\ValueObject\Time;
use Barnetik\Tbai\ValueObject\VatId;
use Barnetik\Tbai\Subject\Issuer;
use Barnetik\Tbai\Subject\Recipient;
use Barnetik\Tbai\TicketBai;
use Barnetik\Tbai\PrivateKey;
$territory = TicketBai::TERRITORY_GIPUZKOA;
$privateKey = PrivateKey::p12("cert/SOLDISP_0199999712_CERT.p12");
$certPassword = "cert/gipuzkoa.txt";
$mom = new TicketBaiMother;
$ticketbai = $mom->createTicketBai("Y8634589H", "Y81255555", "TBAIGIPRE00000000795","Y8634572H" ,"TESTAPP" ,"1.0.0", $territory ,false);
$signedFilename = @tempnam(__DIR__ . '/signedXmls', 'signed-');
rename($signedFilename, $signedFilename . '.xml');
$signedFilename = $signedFilename . '.xml';
$ticketbai->sign($privateKey,"certificate pasword", $signedFilename);
do you know anything about this error?
I haven't tried device certificates yet, I will request one and test if i can reproduce this error.
Will tell you more today.
I just tested a device certificate and seems to work flawlessly.
About your code, I can see how you sign the document and that should work, but I don't see how you send the document. Do you use the provided endpoint API? Communication between server and client must be signed too, if you are using another certificate for this communication the problem may be there too.
This should work if you use the same certificate for signing the xml document and the communication:
$endpoint = new \Barnetik\Tbai\Api\Gipuzkoa\Endpoint\Endpoint(true); // true to use testing environment. false or empty to use production env
$response = $endpoint->submitInvoice($ticketbai, $privateKey, "certificate pasword");
Its works perfectly. I didn't know the request must be signed too . thank you