@fleetless/contracts 7.1.0-next.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6827,7 +6827,7 @@
6827
6827
  "not_found"
6828
6828
  ],
6829
6829
  "transport": "http",
6830
- "notes": "Rendered once, with `pdfkit`, when the invoice is issued, and stored as bytes — an issued invoice never changes, so this always answers the same PDF for the same id. `404 not_found` for an unknown id or one from another org."
6830
+ "notes": "Rendered once, with `pdfkit`, when the invoice is issued, and stored as bytes — an issued invoice never changes, so this always answers the same PDF for the same id. `404 not_found` for an unknown id or one from another org. This reads historical Cloud invoices only: a due charge has no PDF of its own here — its eventual Lexware invoice is a document, read through `GET /api/billing/documents/:id/file`."
6831
6831
  },
6832
6832
  {
6833
6833
  "method": "GET",
@@ -6931,7 +6931,7 @@
6931
6931
  "params": [
6932
6932
  {
6933
6933
  "name": "id",
6934
- "description": "The invoice id, from `billingInvoice.id`, of the open invoice to pay — or a due charge's id, from `dunning.invoice_id`."
6934
+ "description": "The invoice id, from `billingInvoice.id`, of the open invoice to pay — or, before the issuer cutover, a due charge's id, from `dunning.invoice_id`."
6935
6935
  }
6936
6936
  ],
6937
6937
  "query": null,
@@ -6950,7 +6950,41 @@
6950
6950
  "payment_provider_unavailable"
6951
6951
  ],
6952
6952
  "transport": "http",
6953
- "notes": "The required operation_key binds the org, invoice and request; reuse with changed input is 409 target_state_conflict (purchaseConflictDetails). :id may be an issued invoice or a due charge with no number. Recheck current buyer eligibility, VIES, invoice status, owed amount and original currency before every new provider call. Invalid VAT is state invalid_vat_id with rule vat_id_invalid, without a payment. Pending/eligible/held has no redirect; after VIES recovers, the owner must confirm the current quote. An issued USD invoice remains held/legacy_usd_invoice: never convert it or call the provider anew until the integration decision resolves the conflict. Already-created payments retain recorded currency/amount and are looked up/reconciled, never replaced. Under the org lock, confirmation checks the current owed amount and returns the same payment identity on retries. invoice_not_open is a typed conflict; 404 not_found for unknown/foreign invoice. Pending itself never pays an invoice, lifts a lock or resets dunning."
6953
+ "notes": "The required operation_key binds the org, invoice and request; reuse with changed input is 409 target_state_conflict (purchaseConflictDetails). :id may be an issued invoice or a due charge with no number. Recheck current buyer eligibility, VIES, invoice status, owed amount and original currency before every new provider call. Invalid VAT is state invalid_vat_id with rule vat_id_invalid, without a payment. Pending/eligible/held has no redirect; after VIES recovers, the owner must confirm the current quote. An issued USD invoice remains held/legacy_usd_invoice: never convert it or call the provider anew until the integration decision resolves the conflict. Already-created payments retain recorded currency/amount and are looked up/reconciled, never replaced. Under the org lock, confirmation checks the current owed amount and returns the same payment identity on retries. invoice_not_open is a typed conflict; 404 not_found for unknown/foreign invoice. Pending itself never pays an invoice, lifts a lock or resets dunning. After the issuer cutover, :id names a historical open FL-… invoice only; a due charge after the cutover answers 404 not_found here — pay it with POST /api/billing/charges/:id/pay instead."
6954
+ },
6955
+ {
6956
+ "method": "POST",
6957
+ "path": "/api/billing/charges/:id/pay",
6958
+ "section": "billing",
6959
+ "summary": "Records an owner-confirmed payment intent for a due Lexware-issuer charge.",
6960
+ "audience": "developer",
6961
+ "auth": "developer",
6962
+ "rateLimited": true,
6963
+ "ownerTier": true,
6964
+ "status": 201,
6965
+ "params": [
6966
+ {
6967
+ "name": "id",
6968
+ "description": "The due charge id, from `billingCharge.id` in `GET /api/billing`'s `charges`."
6969
+ }
6970
+ ],
6971
+ "query": null,
6972
+ "request": "invoice-pay-request",
6973
+ "response": "checkout-response",
6974
+ "errors": [
6975
+ "validation_error",
6976
+ "unauthorized",
6977
+ "token_expired",
6978
+ "token_revoked",
6979
+ "tier_required",
6980
+ "not_found",
6981
+ "target_state_conflict",
6982
+ "rate_limited",
6983
+ "billing_unavailable",
6984
+ "payment_provider_unavailable"
6985
+ ],
6986
+ "transport": "http",
6987
+ "notes": "The required operation_key binds the org, charge and request, exactly like POST /api/billing/invoices/:id/pay; reuse with changed input is 409 target_state_conflict (purchaseConflictDetails). :id is a due charge's own id (billingCharge.id) — never a historical Cloud invoice; an invoice id, an unknown id or one from another org all answer 404 not_found alike. Recheck current buyer eligibility, the charge's own status and the owed amount before every new provider call: a charge already paid, cancelled or uncollectible is invoice_not_open, a typed 409 conflict. Pending/eligible/held has no redirect; after recovery the owner must confirm the current quote. Already-created payments retain their recorded currency/amount and are looked up/reconciled, never replaced. Under the org lock, confirmation checks the current owed amount and returns the same payment identity on retries."
6954
6988
  },
6955
6989
  {
6956
6990
  "method": "POST",
@@ -448,7 +448,7 @@
448
448
  "type": "string",
449
449
  "format": "uuid",
450
450
  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
451
- "description": "The open invoice dunning is chasing — or, while the payer's VAT ID is unsettled, the due charge that becomes one: it has no number yet and is not in `invoices`. `POST /api/billing/invoices/:id/pay` takes either."
451
+ "description": "What dunning is chasing: a historical open `FL-…` invoice, or a due charge. Before the issuer cutover a due charge appears here only while the payer's VAT ID is unsettled; it has no number yet, is not in `invoices`, and `POST /api/billing/invoices/:id/pay` takes either. After the cutover this is always a due charge (in `charges`): pay it with `POST /api/billing/charges/:id/pay`."
452
452
  },
453
453
  "gross_cents": {
454
454
  "type": "integer",
@@ -651,6 +651,14 @@
651
651
  },
652
652
  "description": "What a payment-method change may offer right now, so a client offers exactly what the cloud accepts. `applepay` is absent when it needs an open invoice and none is open; `[]` when the org has no billing account."
653
653
  },
654
+ "issuer": {
655
+ "type": "string",
656
+ "enum": [
657
+ "cloud",
658
+ "lexware"
659
+ ],
660
+ "description": "Which system issues this org's charges: `cloud` before the issuer cutover, or `lexware` after it."
661
+ },
654
662
  "invoices": {
655
663
  "type": "array",
656
664
  "items": {
@@ -728,7 +736,226 @@
728
736
  ],
729
737
  "additionalProperties": false
730
738
  },
731
- "description": "Newest first, at most 24."
739
+ "description": "Cloud-issued invoices from before the issuer cutover; read-only, never grows after it. Newest first, at most 24."
740
+ },
741
+ "charges": {
742
+ "type": "array",
743
+ "items": {
744
+ "type": "object",
745
+ "properties": {
746
+ "id": {
747
+ "type": "string",
748
+ "format": "uuid",
749
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
750
+ "description": "The due charge's id — never a Cloud invoice number. Pay it with `POST /api/billing/charges/:id/pay`."
751
+ },
752
+ "kind": {
753
+ "type": "string",
754
+ "enum": [
755
+ "first",
756
+ "renewal",
757
+ "change"
758
+ ],
759
+ "description": "What caused the charge: the first charge after checkout, a scheduled renewal, or a mid-period plan change."
760
+ },
761
+ "status": {
762
+ "type": "string",
763
+ "enum": [
764
+ "due",
765
+ "paid",
766
+ "uncollectible",
767
+ "cancelled"
768
+ ],
769
+ "description": "The charge's own status. A charged back or manually refunded charge stays `paid` — refunds and chargebacks are handled in Mollie or Lexware by hand; this status and the invoice it names are unchanged, and the resulting Lexware credit note appears under `GET /api/billing/documents` instead."
770
+ },
771
+ "currency": {
772
+ "type": "string",
773
+ "const": "eur",
774
+ "description": "Every charge billed through Lexware is EUR."
775
+ },
776
+ "net_cents": {
777
+ "type": "integer",
778
+ "minimum": 0,
779
+ "maximum": 9007199254740991,
780
+ "description": "The charge, excluding VAT, in integer cents."
781
+ },
782
+ "vat_rate_percent": {
783
+ "type": "integer",
784
+ "minimum": 0,
785
+ "maximum": 100,
786
+ "description": "The VAT rate applied, in whole percent."
787
+ },
788
+ "vat_cents": {
789
+ "type": "integer",
790
+ "minimum": 0,
791
+ "maximum": 9007199254740991,
792
+ "description": "VAT, in integer cents (`vatCents`)."
793
+ },
794
+ "gross_cents": {
795
+ "type": "integer",
796
+ "minimum": 0,
797
+ "maximum": 9007199254740991,
798
+ "description": "Net plus VAT, in integer cents."
799
+ },
800
+ "period_start": {
801
+ "type": "string",
802
+ "format": "date-time",
803
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
804
+ "description": "The covered period's start."
805
+ },
806
+ "period_end": {
807
+ "type": "string",
808
+ "format": "date-time",
809
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
810
+ "description": "The covered period's end."
811
+ },
812
+ "due_at": {
813
+ "type": "string",
814
+ "format": "date-time",
815
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
816
+ "description": "When this charge is due."
817
+ },
818
+ "paid_at": {
819
+ "anyOf": [
820
+ {
821
+ "type": "string",
822
+ "format": "date-time",
823
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
824
+ },
825
+ {
826
+ "type": "null"
827
+ }
828
+ ],
829
+ "description": "When this charge was paid, or `null` while unpaid."
830
+ },
831
+ "invoice": {
832
+ "oneOf": [
833
+ {
834
+ "type": "object",
835
+ "properties": {
836
+ "state": {
837
+ "type": "string",
838
+ "const": "not_issued",
839
+ "description": "Not collected (due, a failed retry, or uncollectible): no invoice exists."
840
+ }
841
+ },
842
+ "required": [
843
+ "state"
844
+ ],
845
+ "additionalProperties": false
846
+ },
847
+ {
848
+ "type": "object",
849
+ "properties": {
850
+ "state": {
851
+ "type": "string",
852
+ "const": "pending",
853
+ "description": "Collected; the Lexware invoice is not yet confirmed."
854
+ }
855
+ },
856
+ "required": [
857
+ "state"
858
+ ],
859
+ "additionalProperties": false
860
+ },
861
+ {
862
+ "type": "object",
863
+ "properties": {
864
+ "state": {
865
+ "type": "string",
866
+ "const": "issued",
867
+ "description": "Lexware has confirmed the invoice."
868
+ },
869
+ "document_id": {
870
+ "type": "string",
871
+ "format": "uuid",
872
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
873
+ "description": "The Lexware document's id — read it with `GET /api/billing/documents/:id`."
874
+ }
875
+ },
876
+ "required": [
877
+ "state",
878
+ "document_id"
879
+ ],
880
+ "additionalProperties": false
881
+ }
882
+ ],
883
+ "description": "Whether a Lexware invoice exists for this charge yet, and which document it names once it does."
884
+ }
885
+ },
886
+ "required": [
887
+ "id",
888
+ "kind",
889
+ "status",
890
+ "currency",
891
+ "net_cents",
892
+ "vat_rate_percent",
893
+ "vat_cents",
894
+ "gross_cents",
895
+ "period_start",
896
+ "period_end",
897
+ "due_at",
898
+ "paid_at",
899
+ "invoice"
900
+ ],
901
+ "additionalProperties": false,
902
+ "allOf": [
903
+ {
904
+ "if": {
905
+ "properties": {
906
+ "status": {
907
+ "const": "paid"
908
+ }
909
+ },
910
+ "required": [
911
+ "status"
912
+ ]
913
+ },
914
+ "then": {
915
+ "properties": {
916
+ "invoice": {
917
+ "properties": {
918
+ "state": {
919
+ "enum": [
920
+ "pending",
921
+ "issued"
922
+ ]
923
+ }
924
+ }
925
+ }
926
+ }
927
+ }
928
+ },
929
+ {
930
+ "if": {
931
+ "properties": {
932
+ "status": {
933
+ "enum": [
934
+ "due",
935
+ "uncollectible",
936
+ "cancelled"
937
+ ]
938
+ }
939
+ },
940
+ "required": [
941
+ "status"
942
+ ]
943
+ },
944
+ "then": {
945
+ "properties": {
946
+ "invoice": {
947
+ "properties": {
948
+ "state": {
949
+ "const": "not_issued"
950
+ }
951
+ }
952
+ }
953
+ }
954
+ }
955
+ }
956
+ ]
957
+ },
958
+ "description": "Newest first, at most 24. Lists only due charges with issuer `lexware` — never a pre-cutover charge, a legacy payment (legacy_issued/legacy_held/legacy_person/legacy_usd) or a late USD collection: none of those carry a Lexware intent, and they stay in `invoices` or nowhere. `[]` while `issuer` is `cloud`."
732
959
  }
733
960
  },
734
961
  "required": [
@@ -736,7 +963,9 @@
736
963
  "account",
737
964
  "payment_method",
738
965
  "payment_method_options",
739
- "invoices"
966
+ "issuer",
967
+ "invoices",
968
+ "charges"
740
969
  ],
741
970
  "additionalProperties": false,
742
971
  "description": "The billing view after the change."
@@ -1034,7 +1263,11 @@
1034
1263
  "enum": [
1035
1264
  "legacy_usd_invoice",
1036
1265
  "legacy_payer_unresolved",
1037
- "mandate_policy_unresolved"
1266
+ "mandate_policy_unresolved",
1267
+ "lexware_contact_pending",
1268
+ "lexware_contact_changed",
1269
+ "issuer_cutover_in_progress",
1270
+ "lexware_issuance_paused"
1038
1271
  ]
1039
1272
  },
1040
1273
  "original_amount": {
@@ -1822,7 +2055,7 @@
1822
2055
  "type": "string",
1823
2056
  "format": "uuid",
1824
2057
  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
1825
- "description": "The open invoice dunning is chasing — or, while the payer's VAT ID is unsettled, the due charge that becomes one: it has no number yet and is not in `invoices`. `POST /api/billing/invoices/:id/pay` takes either."
2058
+ "description": "What dunning is chasing: a historical open `FL-…` invoice, or a due charge. Before the issuer cutover a due charge appears here only while the payer's VAT ID is unsettled; it has no number yet, is not in `invoices`, and `POST /api/billing/invoices/:id/pay` takes either. After the cutover this is always a due charge (in `charges`): pay it with `POST /api/billing/charges/:id/pay`."
1826
2059
  },
1827
2060
  "gross_cents": {
1828
2061
  "type": "integer",
@@ -2025,6 +2258,14 @@
2025
2258
  },
2026
2259
  "description": "What a payment-method change may offer right now, so a client offers exactly what the cloud accepts. `applepay` is absent when it needs an open invoice and none is open; `[]` when the org has no billing account."
2027
2260
  },
2261
+ "issuer": {
2262
+ "type": "string",
2263
+ "enum": [
2264
+ "cloud",
2265
+ "lexware"
2266
+ ],
2267
+ "description": "Which system issues this org's charges: `cloud` before the issuer cutover, or `lexware` after it."
2268
+ },
2028
2269
  "invoices": {
2029
2270
  "type": "array",
2030
2271
  "items": {
@@ -2102,7 +2343,226 @@
2102
2343
  ],
2103
2344
  "additionalProperties": false
2104
2345
  },
2105
- "description": "Newest first, at most 24."
2346
+ "description": "Cloud-issued invoices from before the issuer cutover; read-only, never grows after it. Newest first, at most 24."
2347
+ },
2348
+ "charges": {
2349
+ "type": "array",
2350
+ "items": {
2351
+ "type": "object",
2352
+ "properties": {
2353
+ "id": {
2354
+ "type": "string",
2355
+ "format": "uuid",
2356
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
2357
+ "description": "The due charge's id — never a Cloud invoice number. Pay it with `POST /api/billing/charges/:id/pay`."
2358
+ },
2359
+ "kind": {
2360
+ "type": "string",
2361
+ "enum": [
2362
+ "first",
2363
+ "renewal",
2364
+ "change"
2365
+ ],
2366
+ "description": "What caused the charge: the first charge after checkout, a scheduled renewal, or a mid-period plan change."
2367
+ },
2368
+ "status": {
2369
+ "type": "string",
2370
+ "enum": [
2371
+ "due",
2372
+ "paid",
2373
+ "uncollectible",
2374
+ "cancelled"
2375
+ ],
2376
+ "description": "The charge's own status. A charged back or manually refunded charge stays `paid` — refunds and chargebacks are handled in Mollie or Lexware by hand; this status and the invoice it names are unchanged, and the resulting Lexware credit note appears under `GET /api/billing/documents` instead."
2377
+ },
2378
+ "currency": {
2379
+ "type": "string",
2380
+ "const": "eur",
2381
+ "description": "Every charge billed through Lexware is EUR."
2382
+ },
2383
+ "net_cents": {
2384
+ "type": "integer",
2385
+ "minimum": 0,
2386
+ "maximum": 9007199254740991,
2387
+ "description": "The charge, excluding VAT, in integer cents."
2388
+ },
2389
+ "vat_rate_percent": {
2390
+ "type": "integer",
2391
+ "minimum": 0,
2392
+ "maximum": 100,
2393
+ "description": "The VAT rate applied, in whole percent."
2394
+ },
2395
+ "vat_cents": {
2396
+ "type": "integer",
2397
+ "minimum": 0,
2398
+ "maximum": 9007199254740991,
2399
+ "description": "VAT, in integer cents (`vatCents`)."
2400
+ },
2401
+ "gross_cents": {
2402
+ "type": "integer",
2403
+ "minimum": 0,
2404
+ "maximum": 9007199254740991,
2405
+ "description": "Net plus VAT, in integer cents."
2406
+ },
2407
+ "period_start": {
2408
+ "type": "string",
2409
+ "format": "date-time",
2410
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
2411
+ "description": "The covered period's start."
2412
+ },
2413
+ "period_end": {
2414
+ "type": "string",
2415
+ "format": "date-time",
2416
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
2417
+ "description": "The covered period's end."
2418
+ },
2419
+ "due_at": {
2420
+ "type": "string",
2421
+ "format": "date-time",
2422
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
2423
+ "description": "When this charge is due."
2424
+ },
2425
+ "paid_at": {
2426
+ "anyOf": [
2427
+ {
2428
+ "type": "string",
2429
+ "format": "date-time",
2430
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
2431
+ },
2432
+ {
2433
+ "type": "null"
2434
+ }
2435
+ ],
2436
+ "description": "When this charge was paid, or `null` while unpaid."
2437
+ },
2438
+ "invoice": {
2439
+ "oneOf": [
2440
+ {
2441
+ "type": "object",
2442
+ "properties": {
2443
+ "state": {
2444
+ "type": "string",
2445
+ "const": "not_issued",
2446
+ "description": "Not collected (due, a failed retry, or uncollectible): no invoice exists."
2447
+ }
2448
+ },
2449
+ "required": [
2450
+ "state"
2451
+ ],
2452
+ "additionalProperties": false
2453
+ },
2454
+ {
2455
+ "type": "object",
2456
+ "properties": {
2457
+ "state": {
2458
+ "type": "string",
2459
+ "const": "pending",
2460
+ "description": "Collected; the Lexware invoice is not yet confirmed."
2461
+ }
2462
+ },
2463
+ "required": [
2464
+ "state"
2465
+ ],
2466
+ "additionalProperties": false
2467
+ },
2468
+ {
2469
+ "type": "object",
2470
+ "properties": {
2471
+ "state": {
2472
+ "type": "string",
2473
+ "const": "issued",
2474
+ "description": "Lexware has confirmed the invoice."
2475
+ },
2476
+ "document_id": {
2477
+ "type": "string",
2478
+ "format": "uuid",
2479
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
2480
+ "description": "The Lexware document's id — read it with `GET /api/billing/documents/:id`."
2481
+ }
2482
+ },
2483
+ "required": [
2484
+ "state",
2485
+ "document_id"
2486
+ ],
2487
+ "additionalProperties": false
2488
+ }
2489
+ ],
2490
+ "description": "Whether a Lexware invoice exists for this charge yet, and which document it names once it does."
2491
+ }
2492
+ },
2493
+ "required": [
2494
+ "id",
2495
+ "kind",
2496
+ "status",
2497
+ "currency",
2498
+ "net_cents",
2499
+ "vat_rate_percent",
2500
+ "vat_cents",
2501
+ "gross_cents",
2502
+ "period_start",
2503
+ "period_end",
2504
+ "due_at",
2505
+ "paid_at",
2506
+ "invoice"
2507
+ ],
2508
+ "additionalProperties": false,
2509
+ "allOf": [
2510
+ {
2511
+ "if": {
2512
+ "properties": {
2513
+ "status": {
2514
+ "const": "paid"
2515
+ }
2516
+ },
2517
+ "required": [
2518
+ "status"
2519
+ ]
2520
+ },
2521
+ "then": {
2522
+ "properties": {
2523
+ "invoice": {
2524
+ "properties": {
2525
+ "state": {
2526
+ "enum": [
2527
+ "pending",
2528
+ "issued"
2529
+ ]
2530
+ }
2531
+ }
2532
+ }
2533
+ }
2534
+ }
2535
+ },
2536
+ {
2537
+ "if": {
2538
+ "properties": {
2539
+ "status": {
2540
+ "enum": [
2541
+ "due",
2542
+ "uncollectible",
2543
+ "cancelled"
2544
+ ]
2545
+ }
2546
+ },
2547
+ "required": [
2548
+ "status"
2549
+ ]
2550
+ },
2551
+ "then": {
2552
+ "properties": {
2553
+ "invoice": {
2554
+ "properties": {
2555
+ "state": {
2556
+ "const": "not_issued"
2557
+ }
2558
+ }
2559
+ }
2560
+ }
2561
+ }
2562
+ }
2563
+ ]
2564
+ },
2565
+ "description": "Newest first, at most 24. Lists only due charges with issuer `lexware` — never a pre-cutover charge, a legacy payment (legacy_issued/legacy_held/legacy_person/legacy_usd) or a late USD collection: none of those carry a Lexware intent, and they stay in `invoices` or nowhere. `[]` while `issuer` is `cloud`."
2106
2566
  }
2107
2567
  },
2108
2568
  "required": [
@@ -2110,7 +2570,9 @@
2110
2570
  "account",
2111
2571
  "payment_method",
2112
2572
  "payment_method_options",
2113
- "invoices"
2573
+ "issuer",
2574
+ "invoices",
2575
+ "charges"
2114
2576
  ],
2115
2577
  "additionalProperties": false,
2116
2578
  "description": "The billing view after the change."
@@ -0,0 +1,54 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "oneOf": [
4
+ {
5
+ "type": "object",
6
+ "properties": {
7
+ "state": {
8
+ "type": "string",
9
+ "const": "not_issued",
10
+ "description": "Not collected (due, a failed retry, or uncollectible): no invoice exists."
11
+ }
12
+ },
13
+ "required": [
14
+ "state"
15
+ ],
16
+ "additionalProperties": false
17
+ },
18
+ {
19
+ "type": "object",
20
+ "properties": {
21
+ "state": {
22
+ "type": "string",
23
+ "const": "pending",
24
+ "description": "Collected; the Lexware invoice is not yet confirmed."
25
+ }
26
+ },
27
+ "required": [
28
+ "state"
29
+ ],
30
+ "additionalProperties": false
31
+ },
32
+ {
33
+ "type": "object",
34
+ "properties": {
35
+ "state": {
36
+ "type": "string",
37
+ "const": "issued",
38
+ "description": "Lexware has confirmed the invoice."
39
+ },
40
+ "document_id": {
41
+ "type": "string",
42
+ "format": "uuid",
43
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
44
+ "description": "The Lexware document's id — read it with `GET /api/billing/documents/:id`."
45
+ }
46
+ },
47
+ "required": [
48
+ "state",
49
+ "document_id"
50
+ ],
51
+ "additionalProperties": false
52
+ }
53
+ ]
54
+ }