=============== LIBRARY RULES =============== From library maintainers: - Maven coordinate: com.housedevinci:stripe-einvoice-spring-boot-starter, current version 0.1.0. - Outputs are XRechnung 3.0 (UBL) and Peppol BIS Billing 3.0 (UBL), both EN 16931 documents. - The API may still change before 1.0; see CHANGELOG.md. - Validation artefacts are vendored with a SHA-256 each; nothing is downloaded at build or run time. ### Run the application with numbering API only Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/README.md Builds the project, starts PostgreSQL via Docker Compose, and runs the application with a generated chain secret. The application starts in numbering-only mode as configured by einvoice.issuance.enabled: false. ```bash ./mvnw -q -DskipTests install # the sample resolves its siblings from the local repository cd stripe-einvoice-sample docker compose up -d EINVOICE_CHAIN_SECRET=$(head -c 32 /dev/urandom | base64) ../mvnw spring-boot:run ``` -------------------------------- ### Run the sample end-to-end with Testcontainers Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/README.md Clones the repository and runs the sample tests, which start PostgreSQL via Testcontainers and produce a validator-clean Peppol BIS Billing 3.0 UBL invoice and XRechnung. Requires Docker only. ```bash git clone https://github.com/1of1Canopus/stripe-einvoice && cd stripe-einvoice ./mvnw -pl stripe-einvoice-sample -am test ``` -------------------------------- ### YAML step with run before if Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/docs/SECURITY-REVIEW-test-release-step-harness.md Example of a YAML step where the `if` key appears after the `run` key. The harness fails to detect the `if: false` because it stops scanning at the `run` line, causing the step to be incorrectly considered enabled. ```yaml - name: Remove any pre-existing Maven wrapper distribution run: rm -rf ~/.m2/wrapper/dists if: false ``` -------------------------------- ### Allocate invoice number in service Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/README.md Example service method that uses IssuanceNumberingService to allocate a legal number for a finalized Stripe invoice. The legal number is BT-1; Stripe's own number is stored as a reference. ```java @Service class Invoicing { private final IssuanceNumberingService numbering; // from the starter void onInvoiceFinalized(String stripeInvoiceId, String stripeNumber, Instant finalizedAt) { Issuance issuance = numbering.allocate(stripeInvoiceId, "", stripeNumber, finalizedAt); // issuance.legalNumber().value() is BT-1. Stripe's own number is stored as a reference. } } ``` -------------------------------- ### Define StripeInvoiceSource bean Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/README.md Required bean to provide the Stripe invoice source. Alternatively, set einvoice.stripe.api-key to use the SDK. If neither this bean nor a custom DocumentRenderer/Validator is provided, the module may fail to start or run in numbering-only mode. ```java @Bean StripeInvoiceSource source() { ... } // or set einvoice.stripe.api-key and take the SDK ``` -------------------------------- ### Configure einvoice properties Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/README.md YAML configuration for the starter. Includes required fields like seller.name, tax-zone, numbering.prefix, and optional settings for webhooks, archive, and more. Note that 'test' mode WARNs at startup and uses a separate series. ```yaml einvoice: mode: live # 'test' WARNs at every startup and uses a separate series seller: id: acme-fr tax-zone: Europe/Paris # required, no default: it decides the invoice date and fiscal year name: Atelier Riviere SAS # BT-27. Setting it is what turns the document writer on vat-id: FR25900000019 # checked at startup, check digit included electronic-address: FR25900000019 electronic-address-scheme: "9957" # Peppol EAS; mandatory for the Peppol profile address: line1: 12 rue des Lilas city: Lyon postal-code: "69003" country: FR contact: # mandatory for XRechnung (BR-DE-2, BR-DE-6, BR-DE-7) name: Comptabilite telephone: "+33 4 72 00 00 00" email: factures@atelier-riviere.invalid payment: # mandatory for XRechnung (BR-DE-1) means-code: "58" account-id: FR7630006000011234567890189 documents: profile: peppol-bis-ubl # or xrechnung-ubl buyer-reference: PO-9912 # BT-10; mandatory for XRechnung (BR-DE-15), a Leitweg-ID for B2G numbering: prefix: "INV-{fiscalYear}-" # required, no default; {fiscalYear} is required when the series # resets each year (below) - never a static year, or the second # January reuses the first year's numbers width: 6 fiscal-year-reset: true chain: hmac-secret: ${EINVOICE_CHAIN_SECRET} # base64 of >= 32 bytes, from the environment hmac-key-id: k1 stripe: webhook-secrets: # a keyring: Stripe's own rotation leaves two secrets live primary: ${EINVOICE_WEBHOOK_SECRET} api-key: ${EINVOICE_STRIPE_KEY} # restricted, read-scoped; this module never writes to Stripe archive: type: filesystem # or supply your own ArchiveStore bean (an S3 one ships in core) root: /var/lib/einvoice/archive ``` -------------------------------- ### Run the application with Stripe intake Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/README.md Runs the application with the intake profile, requiring EINVOICE_CHAIN_SECRET, EINVOICE_WEBHOOK_SECRET, and EINVOICE_STRIPE_KEY. Placeholder values are refused and cause startup failure with a specific message. ```bash EINVOICE_CHAIN_SECRET=$(head -c 32 /dev/urandom | base64) \ EINVOICE_WEBHOOK_SECRET=whsec_from_your_stripe_dashboard \ EINVOICE_STRIPE_KEY=rk_test_your_restricted_read_scoped_key \ ../mvnw spring-boot:run -Dspring-boot.run.profiles=intake ``` -------------------------------- ### Add Maven dependency Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/README.md Add the stripe-einvoice-spring-boot-starter dependency to your project. ```xml com.housedevinci stripe-einvoice-spring-boot-starter 0.1.0 ``` -------------------------------- ### Shell loop with missing jar skip (D15-03) Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/docs/SECURITY-REVIEW-fix-release-scan-resolution.md The loop iterates over core jars, resolves the corresponding jar in the scan set, and skips if not found. The `|| continue` causes the assertion to pass when the core jar is absent, and the loop only covers the core module, not the starter. ```shell for built in stripe-einvoice-core/target/stripe-einvoice-core-*.jar; do ... resolved="$scan/$(basename "$built")" [ -f "$resolved" ] || continue ``` -------------------------------- ### IssuanceReprocess.reprocess sequence Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/docs/SECURITY-REVIEW-feat-reprocess-refused.md Shows the order of operations in the reprocess method: re-open, record, acknowledge, and process. The re-open is committed first, then record and acknowledge in separate transactions, then process. ```text inbound.reopenForReprocess(...) // committed: the row is RECEIVED, attempts 0, next_attempt_at NULL findings.record(...) // own transaction findings.acknowledge(..., request.justification(), ...) // own transaction, screens again unitOfWork.process(eventId) ``` -------------------------------- ### Old step body failure output Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/docs/SECURITY-REVIEW-fix-release-scan-resolution.md Error output from the old step body (dependency:copy-dependencies without package or -am) when run against a synthetic reactor with an empty local Maven repository. Shows the failure to resolve the reactor's own module from Maven Central. ```text [ERROR] Failed to execute goal on project stripe-einvoice-spring-boot-starter: Could not resolve dependencies for project com.housedevinci:stripe-einvoice-spring-boot-starter:jar:99.99.99-probe [ERROR] dependency: com.housedevinci:stripe-einvoice-core:jar:99.99.99-probe (compile) [ERROR] Could not find artifact com.housedevinci:stripe-einvoice-core:jar:99.99.99-probe in central ``` -------------------------------- ### markFailed call with ruleId (D9-02) Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/docs/SECURITY-REVIEW-feat-reprocess-refused.md Shows the two calls in issue() that pass the host validator's ruleId to markFailed and inbound.transition. The ruleId is free text and can contain characters that fail the new charset validation, causing an exception and stranding the issuance. ```java writer.markFailed(..., IssuanceState.FAILED_VALIDATION, report.ruleId()); inbound.transition(event.eventId(), InboundState.FAILED_ISSUANCE, code, report.ruleId(), ...); ``` -------------------------------- ### Permit webhook endpoint in security config Source: https://github.com/1of1canopus/stripe-einvoice/blob/main/README.md In your security configuration, leave the webhook path unauthenticated. The HMAC over the exact bytes received is its authentication. ```java .requestMatchers(HttpMethod.POST, "/webhooks/stripe").permitAll() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.