Repository navigation
v0.9.0
Minor Changes
-
#25
8fab024Thanks @Chelu97! - Addseries.update(series, body?, config?)(PUT /v1/series/{series}, scopeseries:write) and re-pinspec/openapi.jsonfrom the current public contract (571 operations: 1 added, none removed).src/generated/andsrc/resources/are regenerated.New in the client:
series.updateedits a series with a partial body:name,code,counter_reset(never,annualormonthly),number_format,initial_number,invoice_kindand the deprecatedyear_reset.document_typeis not editable. It answers the updatedSeries. The new typeUpdateSeriesRequestis exported from@factuarea/sdk.- Each fiscal guard of the numbering arrives as
ValidationErrorwithcodebusiness_rule_violationand asubcode:series_code_immutable_with_documents,series_format_immutable_with_documents,series_locked_by_verifactu,series_initial_number_creates_gap,series_invoice_kind_lockedandseries_default_kind_change. Invalid values answerparameter_invalid_value. - Changing only
counter_resetalso emits the webhookseries.updated.PATCHandDELETEon a series keep answering405series_immutable, now withAllow: GET, PUT; archive a series instead of deleting it. invoices.activitiespublishes moreevent_typevalues with an exactmetadatacontract: the result of each AEAT submission (verifactu.record_accepted,verifactu.record_rejected,verifactu.transmission_failed,verifactu.transmission_blocked),invoice.email_failed,invoice.public_link_viewedand the payment eventspayment.payment_created,payment.payment_reversedandpayment.payment_updated, whoseprovideris the gateway (stripe,gocardless,monei,woocommerceorshopify) ornullfor a manual payment.VeriFactuRecordgains the requiredaeat_warning_requires_subsanation(boolean | null). Code that buildsVeriFactuRecordobjects by hand, such as test fixtures typed asVeriFactuRecord, must add it.
-
#25
dab5844Thanks @Chelu97! - Add unattended checkout (self-service kiosks and vending machines) and the VERI*FACTU remission controls, and re-pinspec/openapi.jsonfrom the current public contract (570 operations: 6 added, none removed).src/generated/andsrc/resources/are regenerated.New in the client:
invoices.createissues a paid simplified invoice in one idempotent call. The request acceptstype(F1orF2),prices_include_tax,payment(method,paid_at,reference),operation_onand the optionsregister_verifactuandwait_for_pdf;client_idis optional, so anF2without it is an anonymous ticket. The response is the newInvoiceWithCheckoutBlockstype: the invoice plusverifactu(statusregisteredorfailed,error_code,aeat_status,huella,qr_url,qr_png_base64,legend,csv),pdf(status, signedurl,expires_at) andpublic_url.- A late retry with the same
external_idanswers200withIdempotent-Replayed: trueand the invoice already issued.invoices.createreturns the same body for201and200; callfactuarea.http.requestwhen you need the status or the header. A different type or total answers409idempotency_key_reusedwith subcodeunattended_replay_mismatch, and a request still in flight answers409resource_locked; both arrive asConflictErrorwithcode,subcodeandparam. invoices.pdfandinvoices.pdfLinkacceptformat:a4(default),ticket_80orticket_58.invoices.pdfLink(invoice, params?, config?)keeps the previousinvoices.pdfLink(invoice, config?)call working: a second argument made only of request-option keys (headers,timeout,maxRetries,idempotencyKey) is still read as the options, and any other object is the query.invoices.annulacceptsrevert_collections, which reverts every live payment (reasonissued_in_error) and annuls the invoice atomically.invoices.canAnnulalso returnsrequires_collection_reversalandactive_collections_amount.invoices.correctivelines acceptunit,regime_key,exemption_reasonandexemption_reason_text; an omitted value is inherited from the original line. The conversion of a quote, a proforma or a delivery note can returnwarningsandwarning_codes(zero_rate_line_without_exemption).Invoicegainsoperation_on.- Series carry a purpose:
Series.invoice_kindiscomplete,simplified,correctiveorsimplified_corrective, andnullfor a series that is not of invoices.series.createacceptsinvoice_kind.series.list,series.defaultandseries.activeaccept aninvoice_kindfilter, andseries.activealso takesdocument_type;series.active(params?, config?)keeps theseries.active(config?)call working with the same rule asinvoices.pdfLink. series_idis optional and nullable ininvoices.create.invoices.updateacceptstype(F1orF2).invoices.correctiveacceptscorrection_nature(IorS) andseries_id.invoices.duplicateandseries.activedocument a422response.contacts.imports.showretrieves a contact import (BusinessContactImport), andcontacts.imports.errorsdownloads its errors as CSV and returns aBinaryResponse.BusinessContactImportPreviewgainsimport_uuid,added_count,skipped_count,failed_count,unprocessed_count,statusandfailure_reason, so code that builds that type by hand must add them; its rows gain an optionalresult.- The types
BusinessContactImport,CreateCorrectiveInvoiceRequest,CreateSeriesRequestandUpdateInvoiceRequestare exported from@factuarea/sdk. verifactu.records.retryBlockedreactivates every blocked record at once.VeriFactuRecordgainsaeat_error_code,is_blocked,block_reasonandcan_subsanar, andverifactu.records.subsanarnow returns the id of the new record.VeriFactuStatsgainspending_incident_count,blocked_incident_countandoldest_pending_at.verifactu.representation(show,register,revoke) manages the representation that enables remission by a third party.VeriFactuConfiggainsremission_modeand theactive_representation_*fields, andverifactu.settingsacceptsremission_mode.FactuareaError.lineIndexcarrieserror.line_index, the zero-based position of the document line a domain rule rejected, theNoflines.N.tax_rate. It isnullfor any other error.- The types
CreateInvoiceRequest,InvoiceWithCheckoutBlocks,AnnulInvoiceV1Request,CanAnnulInvoice,CompanyRepresentation,RegisterCompanyRepresentationV1Request,RemissionMode,RepresentationKind,VeriFactuConfig,VeriFactuRecordandVeriFactuStatsare exported from@factuarea/sdk.
Breaking changes (the SDK is in
0.x, so they land in a minor):- A sale line with no
tax_rate, no referenced tax and no product with a tax no longer receives an implicit 21 %. It takes the company's default VAT for the document, or the request is rejected with 422missing_required_param,paramlines.N.tax_rateandline_indexN. - Operations that issue an invoice (
invoices.createwhen it issues,issue,corrective,substituteSimplified, andsendandmarkSentwhen they issue) can answer 422verifactu_not_eligiblewhen a field does not fit the AEAT billing record: a customer name over 120 characters, a Spanish tax ID that is not 9 characters, an invoice number with characters the AEAT does not accept, or more than 12 tax breakdowns.error.paramsays which (client_id,series_id,original_invoice_id,simplified_invoice_uuids,company_name,lines,totalortype). No number is consumed and the invoice stays as it was, so correct the data and repeat. InbulkCreateandbulkStatusthe rejection appears per element infailures. - Issuing and annulling (
annul,void) answer 422verifactu_not_eligiblewith subcodesigning_certificate_unavailablefor a company that has enabled VeriFactu in NO VERIFACTU mode and has no usable certificate, until one is uploaded.error.paramiscertificate,representationorsystem_certificate. Companies with VeriFactu disabled and companies in VERIFACTU mode are not affected. verifactu.records.retryno longer answersmax_retries_exceeded: a record is retried without a cap while the incident lasts.Invoicegains the requiredoperation_on(string | null). Code that buildsInvoiceobjects by hand, such as test fixtures typed asInvoice, must add it.- The payment reversal reason gains
issued_in_errorinInvoicePaymentDetail.reversal_reasonand in thepayment.reversedevent, so an exhaustiveswitchover it needs a new case. It cannot be requested for a single payment withpaymentsRevert.