Documentation
¶
Index ¶
- Constants
- func Amount(m interface{}) string
- func Beneficiary(name string, opts *BeneficiaryOptions) map[string]interface{}
- func ElectronicAddress(identifier, schemeID string) map[string]interface{}
- func FormatAmount(m interface{}) string
- func InvoiceLine(number int, description string, ...) map[string]interface{}
- func InvoiceLineWithOptions(number int, description string, ...) map[string]interface{}
- func PostalAddress(line1, postalCode, city string) map[string]interface{}
- func PostalAddressWithOptions(line1, postalCode, city, country, line2, line3 string) map[string]interface{}
- func Recipient(name, siret, addressLine1, postalCode, city string, opts *RecipientOptions) map[string]interface{}
- func Supplier(name, siret, addressLine1, postalCode, city string, opts *SupplierOptions) map[string]interface{}
- func TotalAmount(exclTax, vat, inclTax, amountDue interface{}) map[string]interface{}
- func TotalAmountWithOptions(exclTax, vat, inclTax, amountDue, discountInclTax interface{}, ...) map[string]interface{}
- func VatLine(rateManual, baseAmountExclTax, vatAmount interface{}) map[string]interface{}
- func VatLineWithOptions(rateManual, baseAmountExclTax, vatAmount interface{}, category string) map[string]interface{}
- type AFNORCredentials
- type BeneficiaryOptions
- type ChorusProCredentials
- type Client
- func (c *Client) DownloadFlowAfnor(flowID string) ([]byte, error)
- func (c *Client) EnsureAuthenticated(forceRefresh bool) error
- func (c *Client) GenerateFacturx(invoiceData interface{}, pdfPath string) ([]byte, error)
- func (c *Client) GenerateFacturxComplete(invoice map[string]interface{}, pdfSourcePath string, ...) (map[string]interface{}, error)
- func (c *Client) GenerateFacturxWithOptions(invoiceData interface{}, pdfPath, profile, outputFormat string, sync bool, ...) ([]byte, error)
- func (c *Client) GenerateTestCertificate(opts *GenerateTestCertificateOptions) (map[string]interface{}, error)
- func (c *Client) GetAFNORCredentialsForAPI() map[string]interface{}
- func (c *Client) GetAfnorCredentials() map[string]interface{}
- func (c *Client) GetChorusCredentialsForAPI() map[string]interface{}
- func (c *Client) GetChorusIdFromSiret(siret, identifierType string) (map[string]interface{}, error)
- func (c *Client) GetChorusProCredentials() map[string]interface{}
- func (c *Client) GetIncomingInvoiceAfnor(flowID string, includeDocument bool) (map[string]interface{}, error)
- func (c *Client) GetInvoiceChorus(cppInvoiceIdentifier int) (map[string]interface{}, error)
- func (c *Client) GetRoutingCodeAfnor(siret, routingIdentifier string) (map[string]interface{}, error)
- func (c *Client) GetSirenAfnor(siren string) (map[string]interface{}, error)
- func (c *Client) GetSiretAfnor(siret string) (map[string]interface{}, error)
- func (c *Client) GetStructureChorus(cppStructureId int) (map[string]interface{}, error)
- func (c *Client) HealthcheckAfnor() (map[string]interface{}, error)
- func (c *Client) ListStructureServicesChorus(cppStructureId int) (map[string]interface{}, error)
- func (c *Client) PollTask(taskID string, timeout, interval *int64) (map[string]interface{}, error)
- func (c *Client) ResetAuth()
- func (c *Client) SearchFlowsAfnor(criteria map[string]interface{}) (map[string]interface{}, error)
- func (c *Client) SearchRoutingCodesAfnor(filters map[string]interface{}, limit int) (map[string]interface{}, error)
- func (c *Client) SearchSirenAfnor(filters map[string]interface{}, limit int) (map[string]interface{}, error)
- func (c *Client) SearchStructureChorus(structureIdentifier, businessName, identifierType string, restrictPrivate bool) (map[string]interface{}, error)
- func (c *Client) SignPdf(pdfPath string, opts *SignPdfOptions) ([]byte, error)
- func (c *Client) SubmitInvoiceAfnor(pdfPath, flowName string, opts *SubmitInvoiceAfnorOptions) (map[string]interface{}, error)
- func (c *Client) SubmitInvoiceChorus(invoiceData map[string]interface{}) (map[string]interface{}, error)
- func (c *Client) ValidateFacturxPdf(pdfPath string, opts *ValidateFacturxPdfOptions) (map[string]interface{}, error)
- func (c *Client) ValidateFacturxXml(xmlContent, profile string) (map[string]interface{}, error)
- func (c *Client) ValidatePdfSignature(pdfPath string) (map[string]interface{}, error)
- type FactPulseAuthError
- type FactPulseError
- type FactPulsePollingTimeout
- type FactPulseValidationError
- type GenerateFacturxCompleteOptions
- type GenerateTestCertificateOptions
- type RecipientOptions
- type SignPdfOptions
- type SubmitInvoiceAfnorOptions
- type SupplierOptions
- type ValidateFacturxPdfOptions
- type ValidationErrorDetail
Constants ¶
const DefaultAPIURL = "https://factpulse.fr"
const DefaultPollingInterval = 2000
const DefaultPollingTimeout = 120000
Variables ¶
This section is empty.
Functions ¶
func Amount ¶
func Amount(m interface{}) string
Amount formats a value as an amount with 2 decimal places
func Beneficiary ¶
func Beneficiary(name string, opts *BeneficiaryOptions) map[string]interface{}
Beneficiary creates a beneficiary (factor) for factoring.
The beneficiary (BG-10 / PayeeTradeParty) is used when payment must be made to a third party different from the supplier, typically a factor (factoring company).
For factored invoices, you also need to: - Use a factored document type (393, 396, 501, 502, 472, 473) - Add an ACC note with the subrogation mention - The beneficiary's IBAN will be used for payment
func ElectronicAddress ¶
ElectronicAddress creates an electronic address. schemeID: "0009"=SIREN, "0225"=SIRET
func FormatAmount ¶
func FormatAmount(m interface{}) string
func InvoiceLine ¶
func InvoiceLine(number int, description string, quantity, unitPriceExclTax, lineTotalExclTax interface{}) map[string]interface{}
InvoiceLine creates an invoice line (aligned with InvoiceLine in models.py)
func InvoiceLineWithOptions ¶
func InvoiceLineWithOptions(number int, description string, quantity, unitPriceExclTax, lineTotalExclTax interface{}, vatRate, vatCategory, unit string, options map[string]interface{}) map[string]interface{}
InvoiceLineWithOptions creates an invoice line with options
func PostalAddress ¶
PostalAddress creates a postal address for the FactPulse API
func PostalAddressWithOptions ¶
func PostalAddressWithOptions(line1, postalCode, city, country, line2, line3 string) map[string]interface{}
PostalAddressWithOptions creates a postal address with options
func Recipient ¶
func Recipient(name, siret, addressLine1, postalCode, city string, opts *RecipientOptions) map[string]interface{}
Recipient creates a recipient with auto-computed SIREN and addresses
func Supplier ¶
func Supplier(name, siret, addressLine1, postalCode, city string, opts *SupplierOptions) map[string]interface{}
Supplier creates a supplier with auto-computed SIREN, intra-EU VAT number and addresses
func TotalAmount ¶
func TotalAmount(exclTax, vat, inclTax, amountDue interface{}) map[string]interface{}
TotalAmount creates a simplified total amount object
func TotalAmountWithOptions ¶
func TotalAmountWithOptions(exclTax, vat, inclTax, amountDue, discountInclTax interface{}, discountReason string, prepayment interface{}) map[string]interface{}
TotalAmountWithOptions creates a total amount object with options
func VatLine ¶
func VatLine(rateManual, baseAmountExclTax, vatAmount interface{}) map[string]interface{}
VatLine creates a VAT line (aligned with VatLine in models.py)
func VatLineWithOptions ¶
func VatLineWithOptions(rateManual, baseAmountExclTax, vatAmount interface{}, category string) map[string]interface{}
VatLineWithOptions creates a VAT line with options
Types ¶
type AFNORCredentials ¶
type AFNORCredentials struct {
FlowServiceURL string `json:"flow_service_url"`
TokenURL string `json:"token_url"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
DirectoryServiceURL string `json:"directory_service_url,omitempty"`
}
AFNORCredentials contains AFNOR PDP credentials for Zero-Trust mode. The FactPulse API uses these credentials to authenticate with the AFNOR PDP.
func NewAFNORCredentials ¶
func NewAFNORCredentials(flowServiceURL, tokenURL, clientID, clientSecret string) *AFNORCredentials
func NewAFNORCredentialsWithDirectory ¶
func NewAFNORCredentialsWithDirectory(flowServiceURL, tokenURL, clientID, clientSecret, directoryServiceURL string) *AFNORCredentials
func (*AFNORCredentials) ToMap ¶
func (c *AFNORCredentials) ToMap() map[string]interface{}
type BeneficiaryOptions ¶
type BeneficiaryOptions struct {
Siret, Siren, Iban, Bic string
}
BeneficiaryOptions contains options for creating a beneficiary (factor)
type ChorusProCredentials ¶
type ChorusProCredentials struct {
PisteClientID string `json:"piste_client_id"`
PisteClientSecret string `json:"piste_client_secret"`
ChorusProLogin string `json:"chorus_pro_login"`
ChorusProPassword string `json:"chorus_pro_password"`
Sandbox bool `json:"sandbox"`
}
ChorusProCredentials contains Chorus Pro credentials for Zero-Trust mode. These credentials are passed in each request and are never stored server-side.
func NewChorusProCredentials ¶
func NewChorusProCredentials(pisteClientID, pisteClientSecret, chorusProLogin, chorusProPassword string, sandbox bool) *ChorusProCredentials
func (*ChorusProCredentials) ToMap ¶
func (c *ChorusProCredentials) ToMap() map[string]interface{}
type Client ¶
type Client struct {
Email, Password, APIURL, ClientUID string
PollingInterval, PollingTimeout int64
ChorusCredentials *ChorusProCredentials
AFNORCredentials *AFNORCredentials
// contains filtered or unexported fields
}
func NewClientWithCredentials ¶
func NewClientWithCredentials(email, password, apiURL, clientUID string, chorusCredentials *ChorusProCredentials, afnorCredentials *AFNORCredentials) *Client
func (*Client) DownloadFlowAfnor ¶
DownloadFlowAfnor downloads the PDF file of an AFNOR flow
func (*Client) EnsureAuthenticated ¶
func (*Client) GenerateFacturx ¶
GenerateFacturx generates a Factur-X invoice from a map/struct and a source PDF.
func (*Client) GenerateFacturxComplete ¶
func (c *Client) GenerateFacturxComplete(invoice map[string]interface{}, pdfSourcePath string, opts *GenerateFacturxCompleteOptions) (map[string]interface{}, error)
GenerateFacturxComplete generates a complete Factur-X PDF with optional validation, signature and submission
func (*Client) GenerateFacturxWithOptions ¶
func (c *Client) GenerateFacturxWithOptions(invoiceData interface{}, pdfPath, profile, outputFormat string, sync bool, timeout *int64) ([]byte, error)
GenerateFacturxWithOptions generates a Factur-X invoice with advanced options.
func (*Client) GenerateTestCertificate ¶
func (c *Client) GenerateTestCertificate(opts *GenerateTestCertificateOptions) (map[string]interface{}, error)
GenerateTestCertificate generates a test certificate (NOT FOR PRODUCTION)
func (*Client) GetAFNORCredentialsForAPI ¶
func (*Client) GetAfnorCredentials ¶
func (*Client) GetChorusCredentialsForAPI ¶
func (*Client) GetChorusIdFromSiret ¶
GetChorusIdFromSiret gets the Chorus Pro ID of a structure from its SIRET
func (*Client) GetChorusProCredentials ¶
Alias plus courts
func (*Client) GetIncomingInvoiceAfnor ¶
func (c *Client) GetIncomingInvoiceAfnor(flowID string, includeDocument bool) (map[string]interface{}, error)
GetIncomingInvoiceAfnor retrieves JSON metadata of an incoming flow (supplier invoice). Downloads an incoming flow from the AFNOR PDP and extracts invoice metadata into a unified JSON format. Supports Factur-X, CII and UBL.
Note: This endpoint uses FactPulse JWT authentication (not AFNOR OAuth). The FactPulse server handles calling the PDP with stored credentials.
flowID: Flow identifier (UUID) includeDocument: If true, includes the original document encoded in base64
Returns invoice metadata (supplier, amounts, dates, etc.)
func (*Client) GetInvoiceChorus ¶
GetInvoiceChorus gets the status of a Chorus Pro invoice
func (*Client) GetRoutingCodeAfnor ¶ added in v3.0.24
func (c *Client) GetRoutingCodeAfnor(siret, routingIdentifier string) (map[string]interface{}, error)
GetRoutingCodeAfnor gets a routing code by SIRET and routing identifier
func (*Client) GetSirenAfnor ¶ added in v3.0.24
GetSirenAfnor gets a legal unit by SIREN in the AFNOR directory
func (*Client) GetSiretAfnor ¶ added in v3.0.24
GetSiretAfnor gets a facility by SIRET in the AFNOR directory
func (*Client) GetStructureChorus ¶
GetStructureChorus gets the details of a Chorus Pro structure
func (*Client) HealthcheckAfnor ¶
HealthcheckAfnor checks the availability of the AFNOR Flow Service
func (*Client) ListStructureServicesChorus ¶
ListStructureServicesChorus lists the services of a Chorus Pro structure
func (*Client) SearchFlowsAfnor ¶
SearchFlowsAfnor searches for AFNOR invoicing flows
func (*Client) SearchRoutingCodesAfnor ¶ added in v3.0.24
func (c *Client) SearchRoutingCodesAfnor(filters map[string]interface{}, limit int) (map[string]interface{}, error)
SearchRoutingCodesAfnor searches for routing codes in the AFNOR directory
func (*Client) SearchSirenAfnor ¶
func (c *Client) SearchSirenAfnor(filters map[string]interface{}, limit int) (map[string]interface{}, error)
SearchSirenAfnor searches for legal units (SIREN) in the AFNOR directory
func (*Client) SearchStructureChorus ¶
func (c *Client) SearchStructureChorus(structureIdentifier, businessName, identifierType string, restrictPrivate bool) (map[string]interface{}, error)
SearchStructureChorus searches for structures on Chorus Pro
func (*Client) SignPdf ¶
func (c *Client) SignPdf(pdfPath string, opts *SignPdfOptions) ([]byte, error)
SignPdf signs a PDF with the server-configured certificate
func (*Client) SubmitInvoiceAfnor ¶
func (c *Client) SubmitInvoiceAfnor(pdfPath, flowName string, opts *SubmitInvoiceAfnorOptions) (map[string]interface{}, error)
SubmitInvoiceAfnor submits an invoice to a PDP via the AFNOR API
func (*Client) SubmitInvoiceChorus ¶
func (c *Client) SubmitInvoiceChorus(invoiceData map[string]interface{}) (map[string]interface{}, error)
SubmitInvoiceChorus submits an invoice to Chorus Pro
func (*Client) ValidateFacturxPdf ¶
func (c *Client) ValidateFacturxPdf(pdfPath string, opts *ValidateFacturxPdfOptions) (map[string]interface{}, error)
ValidateFacturxPdf validates a Factur-X PDF
func (*Client) ValidateFacturxXml ¶
ValidateFacturxXml validates a Factur-X XML
type FactPulseAuthError ¶
type FactPulseAuthError struct{ FactPulseError }
func NewFactPulseAuthError ¶
func NewFactPulseAuthError(msg string) *FactPulseAuthError
type FactPulseError ¶
type FactPulseError struct{ Message string }
func (*FactPulseError) Error ¶
func (e *FactPulseError) Error() string
type FactPulsePollingTimeout ¶
type FactPulsePollingTimeout struct {
FactPulseError
TaskID string
Timeout int64
}
func NewFactPulsePollingTimeout ¶
func NewFactPulsePollingTimeout(taskID string, timeout int64) *FactPulsePollingTimeout
type FactPulseValidationError ¶
type FactPulseValidationError struct {
FactPulseError
Errors []ValidationErrorDetail
}
func NewFactPulseValidationError ¶
func NewFactPulseValidationError(msg string, errors []ValidationErrorDetail) *FactPulseValidationError
type GenerateFacturxCompleteOptions ¶
type GenerateFacturxCompleteOptions struct {
Profile, OutputPath, AfnorFlowName, AfnorTrackingID string
Validate, Sign, SubmitAfnor bool
Timeout int64
SignPdfOptions *SignPdfOptions
}
GenerateFacturxCompleteOptions contains options for GenerateFacturxComplete
type GenerateTestCertificateOptions ¶
type GenerateTestCertificateOptions struct {
CN, Organisation, Email string
ValidityDays, KeySize int
}
GenerateTestCertificateOptions contains options for GenerateTestCertificate
type RecipientOptions ¶
type RecipientOptions struct {
Siren, Country, AddressLine2, ExecutingServiceCode string
}
RecipientOptions contains options for creating a recipient
type SignPdfOptions ¶
SignPdfOptions contains options for SignPdf
type SubmitInvoiceAfnorOptions ¶
type SubmitInvoiceAfnorOptions struct {
FlowSyntax, FlowProfile, TrackingID string
}
SubmitInvoiceAfnorOptions contains options for SubmitInvoiceAfnor
type SupplierOptions ¶
type SupplierOptions struct {
SupplierID int
Siren, VatIntra, Iban, Country, AddressLine2 string
ServiceCode, BankCoordinatesCode int
}
SupplierOptions contains options for creating a supplier
type ValidateFacturxPdfOptions ¶
type ValidateFacturxPdfOptions struct {
Profile string // Factur-X profile (MINIMUM, BASIC, EN16931, EXTENDED). If empty, auto-detected.
UseVerapdf bool // Enable strict PDF/A validation with VeraPDF (default: false)
}
ValidateFacturxPdfOptions options for ValidateFacturxPdf
type ValidationErrorDetail ¶
type ValidationErrorDetail struct{ Level, Item, Reason, Source, Code string }
func (ValidationErrorDetail) String ¶
func (e ValidationErrorDetail) String() string