@fleetless/contracts 16.1.0-next.2 → 17.0.0-next.1
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.
- package/CHANGELOG.md +30 -24
- package/artifacts/openapi.json +131 -134
- package/artifacts/routes.json +10 -7
- package/artifacts/schema/billing-change-response.schema.json +24 -49
- package/artifacts/schema/billing-details-conflict-details.schema.json +78 -0
- package/artifacts/schema/billing-view.schema.json +0 -24
- package/artifacts/schema/checkout-response.schema.json +50 -3
- package/artifacts/schema/purchase-conflict-details.schema.json +26 -2
- package/artifacts/schema/purchase-intent-draft.schema.json +24 -1
- package/artifacts/schema/purchase-intent-payment-started.schema.json +26 -2
- package/artifacts/schema/purchase-intent-response.schema.json +50 -51
- package/dist/billing.d.ts +63 -38
- package/dist/billing.js +44 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/plans.d.ts +2 -15
- package/dist/plans.js +14 -27
- package/dist/routes.js +38 -7
- package/package.json +1 -1
package/dist/billing.d.ts
CHANGED
|
@@ -7375,6 +7375,8 @@ export type PlanChangePrepareResponse = z.infer<typeof planChangePrepareResponse
|
|
|
7375
7375
|
* Why an intent is held. Lexware never holds a purchase: its contact and
|
|
7376
7376
|
* invoice follow the payment. A checkout or paid change is held only while an
|
|
7377
7377
|
* issuer cutover runs (`issuer_cutover_in_progress`, minutes, then try again).
|
|
7378
|
+
* `mandate_policy_unresolved` is written no more (fleetless/fleetless#1185): it
|
|
7379
|
+
* stays for the method changes stored while they were on hold.
|
|
7378
7380
|
*/
|
|
7379
7381
|
export declare const purchaseHoldReason: z.ZodEnum<{
|
|
7380
7382
|
legacy_usd_invoice: "legacy_usd_invoice";
|
|
@@ -7490,6 +7492,13 @@ export declare const purchaseIntentDraft: z.ZodDiscriminatedUnion<readonly [z.Zo
|
|
|
7490
7492
|
}, z.core.$strict>], "state">;
|
|
7491
7493
|
export type PurchaseIntentDraft = z.infer<typeof purchaseIntentDraft>;
|
|
7492
7494
|
export declare const purchaseIntentPaymentStarted: z.ZodObject<{
|
|
7495
|
+
operation: z.ZodEnum<{
|
|
7496
|
+
checkout: "checkout";
|
|
7497
|
+
paid_change: "paid_change";
|
|
7498
|
+
invoice_payment: "invoice_payment";
|
|
7499
|
+
payment_method_invoice: "payment_method_invoice";
|
|
7500
|
+
mandate_setup: "mandate_setup";
|
|
7501
|
+
}>;
|
|
7493
7502
|
state: z.ZodLiteral<"payment_started">;
|
|
7494
7503
|
payment_id: z.ZodUUID;
|
|
7495
7504
|
payment: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -7501,12 +7510,6 @@ export declare const purchaseIntentPaymentStarted: z.ZodObject<{
|
|
|
7501
7510
|
}, z.core.$strict>], "kind">;
|
|
7502
7511
|
intent_id: z.ZodUUID;
|
|
7503
7512
|
operation_key: z.ZodUUID;
|
|
7504
|
-
operation: z.ZodEnum<{
|
|
7505
|
-
checkout: "checkout";
|
|
7506
|
-
paid_change: "paid_change";
|
|
7507
|
-
invoice_payment: "invoice_payment";
|
|
7508
|
-
payment_method_invoice: "payment_method_invoice";
|
|
7509
|
-
}>;
|
|
7510
7513
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
7511
7514
|
}, z.core.$strict>;
|
|
7512
7515
|
export type PurchaseIntentPaymentStarted = z.infer<typeof purchaseIntentPaymentStarted>;
|
|
@@ -7625,6 +7628,13 @@ export declare const purchaseIntent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7625
7628
|
}>;
|
|
7626
7629
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
7627
7630
|
}, z.core.$strict>, z.ZodObject<{
|
|
7631
|
+
operation: z.ZodEnum<{
|
|
7632
|
+
checkout: "checkout";
|
|
7633
|
+
paid_change: "paid_change";
|
|
7634
|
+
invoice_payment: "invoice_payment";
|
|
7635
|
+
payment_method_invoice: "payment_method_invoice";
|
|
7636
|
+
mandate_setup: "mandate_setup";
|
|
7637
|
+
}>;
|
|
7628
7638
|
state: z.ZodLiteral<"payment_started">;
|
|
7629
7639
|
payment_id: z.ZodUUID;
|
|
7630
7640
|
payment: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -7636,12 +7646,6 @@ export declare const purchaseIntent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7636
7646
|
}, z.core.$strict>], "kind">;
|
|
7637
7647
|
intent_id: z.ZodUUID;
|
|
7638
7648
|
operation_key: z.ZodUUID;
|
|
7639
|
-
operation: z.ZodEnum<{
|
|
7640
|
-
checkout: "checkout";
|
|
7641
|
-
paid_change: "paid_change";
|
|
7642
|
-
invoice_payment: "invoice_payment";
|
|
7643
|
-
payment_method_invoice: "payment_method_invoice";
|
|
7644
|
-
}>;
|
|
7645
7649
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
7646
7650
|
}, z.core.$strict>, z.ZodObject<{
|
|
7647
7651
|
quote: z.ZodObject<{
|
|
@@ -7768,6 +7772,7 @@ export declare const checkoutResponse: z.ZodUnion<readonly [z.ZodDiscriminatedUn
|
|
|
7768
7772
|
checkout: "checkout";
|
|
7769
7773
|
invoice_payment: "invoice_payment";
|
|
7770
7774
|
payment_method_invoice: "payment_method_invoice";
|
|
7775
|
+
mandate_setup: "mandate_setup";
|
|
7771
7776
|
}>;
|
|
7772
7777
|
}, z.core.$strict>]>;
|
|
7773
7778
|
export type CheckoutResponse = z.infer<typeof checkoutResponse>;
|
|
@@ -9514,7 +9519,7 @@ export declare const checkoutOpenDetails: z.ZodObject<{
|
|
|
9514
9519
|
checkout_url: z.ZodNullable<z.ZodURL>;
|
|
9515
9520
|
}, z.core.$strict>;
|
|
9516
9521
|
export type CheckoutOpenDetails = z.infer<typeof checkoutOpenDetails>;
|
|
9517
|
-
/** `409 target_state_conflict` details when a paid change needs VIES and VIES did not answer. Nothing is stored. */
|
|
9522
|
+
/** `409 target_state_conflict` details when a paid change or a billing-details edit needs VIES and VIES did not answer. Nothing is stored. */
|
|
9518
9523
|
export declare const viesUnavailableDetails: z.ZodObject<{
|
|
9519
9524
|
field: z.ZodLiteral<"billing.vat_id">;
|
|
9520
9525
|
rule: z.ZodLiteral<"vies_unavailable">;
|
|
@@ -9674,6 +9679,13 @@ export declare const purchaseConflictDetails: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
9674
9679
|
}>;
|
|
9675
9680
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
9676
9681
|
}, z.core.$strict>, z.ZodObject<{
|
|
9682
|
+
operation: z.ZodEnum<{
|
|
9683
|
+
checkout: "checkout";
|
|
9684
|
+
paid_change: "paid_change";
|
|
9685
|
+
invoice_payment: "invoice_payment";
|
|
9686
|
+
payment_method_invoice: "payment_method_invoice";
|
|
9687
|
+
mandate_setup: "mandate_setup";
|
|
9688
|
+
}>;
|
|
9677
9689
|
state: z.ZodLiteral<"payment_started">;
|
|
9678
9690
|
payment_id: z.ZodUUID;
|
|
9679
9691
|
payment: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -9685,12 +9697,6 @@ export declare const purchaseConflictDetails: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
9685
9697
|
}, z.core.$strict>], "kind">;
|
|
9686
9698
|
intent_id: z.ZodUUID;
|
|
9687
9699
|
operation_key: z.ZodUUID;
|
|
9688
|
-
operation: z.ZodEnum<{
|
|
9689
|
-
checkout: "checkout";
|
|
9690
|
-
paid_change: "paid_change";
|
|
9691
|
-
invoice_payment: "invoice_payment";
|
|
9692
|
-
payment_method_invoice: "payment_method_invoice";
|
|
9693
|
-
}>;
|
|
9694
9700
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
9695
9701
|
}, z.core.$strict>, z.ZodObject<{
|
|
9696
9702
|
quote: z.ZodObject<{
|
|
@@ -9827,6 +9833,42 @@ export declare const billingDetailsUpdate: z.ZodObject<{
|
|
|
9827
9833
|
vat_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9828
9834
|
}, z.core.$strict>;
|
|
9829
9835
|
export type BillingDetailsUpdate = z.infer<typeof billingDetailsUpdate>;
|
|
9836
|
+
/**
|
|
9837
|
+
* `PATCH /api/billing/details`'s `409 target_state_conflict` details
|
|
9838
|
+
* (fleetless/fleetless#1185). Nothing is saved in any of them.
|
|
9839
|
+
*
|
|
9840
|
+
* - A field a purchase would refuse: `field` as the checkout names it
|
|
9841
|
+
* (`billing.kind`, `billing.vat_id`, `billing.tax_id`,
|
|
9842
|
+
* `billing.address.state`, `billing.invoice_email`), `rule` the refusal.
|
|
9843
|
+
* - `vies_unavailable` (`viesUnavailableDetails`): the country or the VAT ID
|
|
9844
|
+
* changed and VIES did not answer; check again.
|
|
9845
|
+
* - `buyer_changed`: the billing details changed while this edit was decided;
|
|
9846
|
+
* read them again.
|
|
9847
|
+
*/
|
|
9848
|
+
export declare const billingDetailsConflictDetails: z.ZodUnion<readonly [z.ZodObject<{
|
|
9849
|
+
field: z.ZodString;
|
|
9850
|
+
rule: z.ZodEnum<{
|
|
9851
|
+
company_required: "company_required";
|
|
9852
|
+
vat_id_required: "vat_id_required";
|
|
9853
|
+
vat_id_invalid: "vat_id_invalid";
|
|
9854
|
+
tax_id_required: "tax_id_required";
|
|
9855
|
+
us_state_required: "us_state_required";
|
|
9856
|
+
public_email_domain: "public_email_domain";
|
|
9857
|
+
invoice_not_open: "invoice_not_open";
|
|
9858
|
+
}>;
|
|
9859
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
9860
|
+
field: z.ZodLiteral<"billing.vat_id">;
|
|
9861
|
+
rule: z.ZodLiteral<"vies_unavailable">;
|
|
9862
|
+
reason: z.ZodEnum<{
|
|
9863
|
+
vies_unavailable: "vies_unavailable";
|
|
9864
|
+
vies_unverified: "vies_unverified";
|
|
9865
|
+
vies_identifier_missing: "vies_identifier_missing";
|
|
9866
|
+
}>;
|
|
9867
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
9868
|
+
field: z.ZodLiteral<"billing">;
|
|
9869
|
+
rule: z.ZodLiteral<"buyer_changed">;
|
|
9870
|
+
}, z.core.$strict>]>;
|
|
9871
|
+
export type BillingDetailsConflictDetails = z.infer<typeof billingDetailsConflictDetails>;
|
|
9830
9872
|
/**
|
|
9831
9873
|
* The payment methods Fleetless takes: card, PayPal and Apple Pay, in EUR and USD, and no others (André, 2026-10-04).
|
|
9832
9874
|
* Apple Pay is a Mollie method of its own at checkout and for a change, but the mandate it leaves is a card mandate.
|
|
@@ -9837,7 +9879,7 @@ export declare const paymentMethodKind: z.ZodEnum<{
|
|
|
9837
9879
|
applepay: "applepay";
|
|
9838
9880
|
}>;
|
|
9839
9881
|
export type PaymentMethodKind = z.infer<typeof paymentMethodKind>;
|
|
9840
|
-
/** `POST /api/billing/payment-method`'s body. */
|
|
9882
|
+
/** `POST /api/billing/payment-method`'s body. One operation key names one method: keep the key until its payment is finished. */
|
|
9841
9883
|
export declare const paymentMethodChangeRequest: z.ZodObject<{
|
|
9842
9884
|
operation_key: z.ZodUUID;
|
|
9843
9885
|
method: z.ZodEnum<{
|
|
@@ -9980,9 +10022,6 @@ export declare const billingAccount: z.ZodObject<{
|
|
|
9980
10022
|
vat_cents: z.ZodNumber;
|
|
9981
10023
|
gross_cents: z.ZodNumber;
|
|
9982
10024
|
}, z.core.$strip>>;
|
|
9983
|
-
current_price: z.ZodNullable<z.ZodObject<{
|
|
9984
|
-
net_cents: z.ZodNumber;
|
|
9985
|
-
}, z.core.$strip>>;
|
|
9986
10025
|
scheduled: z.ZodObject<{
|
|
9987
10026
|
cycle: z.ZodNullable<z.ZodEnum<{
|
|
9988
10027
|
monthly: "monthly";
|
|
@@ -10138,9 +10177,6 @@ export declare const billingView: z.ZodObject<{
|
|
|
10138
10177
|
vat_cents: z.ZodNumber;
|
|
10139
10178
|
gross_cents: z.ZodNumber;
|
|
10140
10179
|
}, z.core.$strip>>;
|
|
10141
|
-
current_price: z.ZodNullable<z.ZodObject<{
|
|
10142
|
-
net_cents: z.ZodNumber;
|
|
10143
|
-
}, z.core.$strip>>;
|
|
10144
10180
|
scheduled: z.ZodObject<{
|
|
10145
10181
|
cycle: z.ZodNullable<z.ZodEnum<{
|
|
10146
10182
|
monthly: "monthly";
|
|
@@ -10551,9 +10587,6 @@ export declare const billingChangeResponse: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
10551
10587
|
vat_cents: z.ZodNumber;
|
|
10552
10588
|
gross_cents: z.ZodNumber;
|
|
10553
10589
|
}, z.core.$strip>>;
|
|
10554
|
-
current_price: z.ZodNullable<z.ZodObject<{
|
|
10555
|
-
net_cents: z.ZodNumber;
|
|
10556
|
-
}, z.core.$strip>>;
|
|
10557
10590
|
scheduled: z.ZodObject<{
|
|
10558
10591
|
cycle: z.ZodNullable<z.ZodEnum<{
|
|
10559
10592
|
monthly: "monthly";
|
|
@@ -10741,9 +10774,6 @@ export declare const billingChangeResponse: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
10741
10774
|
vat_cents: z.ZodNumber;
|
|
10742
10775
|
gross_cents: z.ZodNumber;
|
|
10743
10776
|
}, z.core.$strip>>;
|
|
10744
|
-
current_price: z.ZodNullable<z.ZodObject<{
|
|
10745
|
-
net_cents: z.ZodNumber;
|
|
10746
|
-
}, z.core.$strip>>;
|
|
10747
10777
|
scheduled: z.ZodObject<{
|
|
10748
10778
|
cycle: z.ZodNullable<z.ZodEnum<{
|
|
10749
10779
|
monthly: "monthly";
|
|
@@ -10977,6 +11007,7 @@ export declare const purchaseIntentResponse: z.ZodUnion<readonly [z.ZodDiscrimin
|
|
|
10977
11007
|
checkout: "checkout";
|
|
10978
11008
|
invoice_payment: "invoice_payment";
|
|
10979
11009
|
payment_method_invoice: "payment_method_invoice";
|
|
11010
|
+
mandate_setup: "mandate_setup";
|
|
10980
11011
|
}>;
|
|
10981
11012
|
}, z.core.$strict>, z.ZodObject<{
|
|
10982
11013
|
intent: z.ZodObject<{
|
|
@@ -11060,9 +11091,6 @@ export declare const purchaseIntentResponse: z.ZodUnion<readonly [z.ZodDiscrimin
|
|
|
11060
11091
|
vat_cents: z.ZodNumber;
|
|
11061
11092
|
gross_cents: z.ZodNumber;
|
|
11062
11093
|
}, z.core.$strip>>;
|
|
11063
|
-
current_price: z.ZodNullable<z.ZodObject<{
|
|
11064
|
-
net_cents: z.ZodNumber;
|
|
11065
|
-
}, z.core.$strip>>;
|
|
11066
11094
|
scheduled: z.ZodObject<{
|
|
11067
11095
|
cycle: z.ZodNullable<z.ZodEnum<{
|
|
11068
11096
|
monthly: "monthly";
|
|
@@ -11250,9 +11278,6 @@ export declare const purchaseIntentResponse: z.ZodUnion<readonly [z.ZodDiscrimin
|
|
|
11250
11278
|
vat_cents: z.ZodNumber;
|
|
11251
11279
|
gross_cents: z.ZodNumber;
|
|
11252
11280
|
}, z.core.$strip>>;
|
|
11253
|
-
current_price: z.ZodNullable<z.ZodObject<{
|
|
11254
|
-
net_cents: z.ZodNumber;
|
|
11255
|
-
}, z.core.$strip>>;
|
|
11256
11281
|
scheduled: z.ZodObject<{
|
|
11257
11282
|
cycle: z.ZodNullable<z.ZodEnum<{
|
|
11258
11283
|
monthly: "monthly";
|
package/dist/billing.js
CHANGED
|
@@ -670,16 +670,25 @@ const intentIdentity = {
|
|
|
670
670
|
* Why an intent is held. Lexware never holds a purchase: its contact and
|
|
671
671
|
* invoice follow the payment. A checkout or paid change is held only while an
|
|
672
672
|
* issuer cutover runs (`issuer_cutover_in_progress`, minutes, then try again).
|
|
673
|
+
* `mandate_policy_unresolved` is written no more (fleetless/fleetless#1185): it
|
|
674
|
+
* stays for the method changes stored while they were on hold.
|
|
673
675
|
*/
|
|
674
676
|
export const purchaseHoldReason = z.enum([
|
|
675
677
|
'legacy_usd_invoice', 'legacy_payer_unresolved', 'mandate_policy_unresolved', 'issuer_cutover_in_progress',
|
|
676
678
|
]);
|
|
677
679
|
export const purchaseRefusalRule = z.enum(['company_required', 'vat_id_required', 'vat_id_invalid', 'tax_id_required', 'us_state_required', 'public_email_domain', 'invoice_not_open']);
|
|
678
680
|
// Cross-field invariants also travel in JSON Schema so non-TypeScript callers
|
|
679
|
-
// cannot treat an invoice payment as an unbound checkout or a
|
|
681
|
+
// cannot treat an invoice payment as an unbound checkout or a mandate setup as a charge.
|
|
682
|
+
//
|
|
683
|
+
// A mandate setup (fleetless/fleetless#1185) is the 0.00 payment that changes the
|
|
684
|
+
// payment method: it is `payment_started` on the hosted page, never quoted, never
|
|
685
|
+
// waiting for VIES. `held` with `mandate_policy_unresolved` is only a row stored
|
|
686
|
+
// while the change was on hold (2026-10-16 to 17.0.0); the reason still names no
|
|
687
|
+
// other operation.
|
|
680
688
|
const intentRules = [
|
|
681
689
|
{ if: { properties: { operation: { enum: ['invoice_payment', 'payment_method_invoice'] } }, required: ['operation'] }, then: { required: ['invoice_id'] } },
|
|
682
|
-
{ if: { properties: { operation: { const: 'mandate_setup' } }, required: ['operation'] }, then: { properties: { state: {
|
|
690
|
+
{ if: { properties: { operation: { const: 'mandate_setup' } }, required: ['operation'] }, then: { properties: { state: { enum: ['held', 'payment_started'] } } } },
|
|
691
|
+
{ if: { properties: { operation: { const: 'mandate_setup' }, state: { const: 'held' } }, required: ['operation', 'state'] }, then: { properties: { reason: { const: 'mandate_policy_unresolved' } }, required: ['reason'] } },
|
|
683
692
|
{ if: { properties: { reason: { const: 'mandate_policy_unresolved' } }, required: ['reason'] }, then: { properties: { operation: { const: 'mandate_setup' } } } },
|
|
684
693
|
{ if: { properties: { payment: { properties: { kind: { const: 'mandate' } }, required: ['kind'] } }, required: ['payment'] }, then: { properties: { operation: { const: 'paid_change' } } } },
|
|
685
694
|
];
|
|
@@ -687,11 +696,17 @@ function validateIntent(intent, ctx) {
|
|
|
687
696
|
if (['invoice_payment', 'payment_method_invoice'].includes(intent.operation) && !intent.invoice_id) {
|
|
688
697
|
ctx.addIssue({ code: 'custom', path: ['invoice_id'], message: 'An invoice-paying intent must name the invoice or due charge.' });
|
|
689
698
|
}
|
|
690
|
-
if (
|
|
691
|
-
ctx.addIssue({ code: 'custom', path: ['
|
|
699
|
+
if (intent.operation === 'mandate_setup' && intent.state !== 'held' && intent.state !== 'payment_started') {
|
|
700
|
+
ctx.addIssue({ code: 'custom', path: ['state'], message: 'A mandate setup is a started hosted payment, or a stored hold.' });
|
|
701
|
+
}
|
|
702
|
+
if (intent.operation === 'mandate_setup' && intent.state === 'held' && intent.reason !== 'mandate_policy_unresolved') {
|
|
703
|
+
ctx.addIssue({ code: 'custom', path: ['reason'], message: 'A held mandate setup is the stored mandate_policy_unresolved hold.' });
|
|
704
|
+
}
|
|
705
|
+
if (intent.reason === 'mandate_policy_unresolved' && intent.operation !== 'mandate_setup') {
|
|
706
|
+
ctx.addIssue({ code: 'custom', path: ['reason'], message: 'Only a mandate setup was held as mandate_policy_unresolved.' });
|
|
692
707
|
}
|
|
693
708
|
if (intent.payment?.kind === 'mandate' && intent.operation !== 'paid_change') {
|
|
694
|
-
ctx.addIssue({ code: 'custom', path: ['payment'], message: 'Owner checkout
|
|
709
|
+
ctx.addIssue({ code: 'custom', path: ['payment'], message: 'Owner checkout, invoice payment and mandate setup require a hosted payment.' });
|
|
695
710
|
}
|
|
696
711
|
}
|
|
697
712
|
/** Unaccepted intents. No draft contains a provider redirect or billing decision. */
|
|
@@ -708,7 +723,7 @@ const draftVariants = [
|
|
|
708
723
|
];
|
|
709
724
|
export const purchaseIntentDraft = z.discriminatedUnion('state', draftVariants).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
710
725
|
const paymentStartedVariant = z.object({
|
|
711
|
-
...intentIdentity, state: z.literal('payment_started'), payment_id: z.uuid(),
|
|
726
|
+
...intentIdentity, operation: purchaseOperation, state: z.literal('payment_started'), payment_id: z.uuid(),
|
|
712
727
|
payment: z.discriminatedUnion('kind', [
|
|
713
728
|
z.object({ kind: z.literal('hosted'), checkout_id: z.uuid(), checkout_url: z.url() }).strict(),
|
|
714
729
|
z.object({ kind: z.literal('mandate') }).strict(),
|
|
@@ -738,8 +753,9 @@ const nonChangeDraft = z.discriminatedUnion('state', [
|
|
|
738
753
|
draftVariants[3].safeExtend({ operation: nonChangeChargeOperation }),
|
|
739
754
|
draftVariants[4].safeExtend({ operation: nonChangeChargeOperation }),
|
|
740
755
|
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
756
|
+
// A method change starts its 0.00 hosted payment at once: `mandate_setup` is `payment_started` here, and in no draft but `held`.
|
|
741
757
|
const nonChangePaymentStarted = paymentStartedVariant
|
|
742
|
-
.safeExtend({ operation:
|
|
758
|
+
.safeExtend({ operation: nonChangeOperation })
|
|
743
759
|
.superRefine(validateIntent).meta({ allOf: intentRules });
|
|
744
760
|
const paidChangeOperation = z.literal('paid_change');
|
|
745
761
|
// A paid change is decided in its request: it never waits for VIES.
|
|
@@ -829,7 +845,7 @@ export const checkoutOpenDetails = z.object({
|
|
|
829
845
|
expires_at: z.iso.datetime().nullable().meta({ description: 'When the open payment expires at the provider, or `null` when unknown.' }),
|
|
830
846
|
checkout_url: z.url().nullable().meta({ description: 'Where the open payment continues, or `null` when the provider no longer offers it.' }),
|
|
831
847
|
}).strict();
|
|
832
|
-
/** `409 target_state_conflict` details when a paid change needs VIES and VIES did not answer. Nothing is stored. */
|
|
848
|
+
/** `409 target_state_conflict` details when a paid change or a billing-details edit needs VIES and VIES did not answer. Nothing is stored. */
|
|
833
849
|
export const viesUnavailableDetails = z.object({
|
|
834
850
|
field: vatIdField,
|
|
835
851
|
rule: z.literal('vies_unavailable'),
|
|
@@ -921,12 +937,31 @@ export const billingDetailsUpdate = z.object({
|
|
|
921
937
|
description: 'Replaces the VAT ID; `null` clears it. Omitted leaves it as it is. A new ID is re-checked through VIES.',
|
|
922
938
|
}),
|
|
923
939
|
}).strict();
|
|
940
|
+
/**
|
|
941
|
+
* `PATCH /api/billing/details`'s `409 target_state_conflict` details
|
|
942
|
+
* (fleetless/fleetless#1185). Nothing is saved in any of them.
|
|
943
|
+
*
|
|
944
|
+
* - A field a purchase would refuse: `field` as the checkout names it
|
|
945
|
+
* (`billing.kind`, `billing.vat_id`, `billing.tax_id`,
|
|
946
|
+
* `billing.address.state`, `billing.invoice_email`), `rule` the refusal.
|
|
947
|
+
* - `vies_unavailable` (`viesUnavailableDetails`): the country or the VAT ID
|
|
948
|
+
* changed and VIES did not answer; check again.
|
|
949
|
+
* - `buyer_changed`: the billing details changed while this edit was decided;
|
|
950
|
+
* read them again.
|
|
951
|
+
*/
|
|
952
|
+
export const billingDetailsConflictDetails = z.union([
|
|
953
|
+
z.object({ field: z.string().min(1), rule: purchaseRefusalRule }).strict()
|
|
954
|
+
.meta({ description: 'A field a purchase would refuse. Nothing is saved.' }),
|
|
955
|
+
viesUnavailableDetails,
|
|
956
|
+
z.object({ field: z.literal('billing'), rule: z.literal('buyer_changed') }).strict()
|
|
957
|
+
.meta({ description: 'The billing details changed meanwhile. Nothing is saved.' }),
|
|
958
|
+
]);
|
|
924
959
|
/**
|
|
925
960
|
* The payment methods Fleetless takes: card, PayPal and Apple Pay, in EUR and USD, and no others (André, 2026-10-04).
|
|
926
961
|
* Apple Pay is a Mollie method of its own at checkout and for a change, but the mandate it leaves is a card mandate.
|
|
927
962
|
*/
|
|
928
963
|
export const paymentMethodKind = z.enum(['card', 'paypal', 'applepay']);
|
|
929
|
-
/** `POST /api/billing/payment-method`'s body. */
|
|
964
|
+
/** `POST /api/billing/payment-method`'s body. One operation key names one method: keep the key until its payment is finished. */
|
|
930
965
|
export const paymentMethodChangeRequest = z.object({
|
|
931
966
|
operation_key: purchaseOperationKey,
|
|
932
967
|
method: paymentMethodKind.meta({
|
|
@@ -1003,15 +1038,6 @@ export const billingAccount = z.object({
|
|
|
1003
1038
|
vat_cents: z.number().int().meta({ description: 'VAT on the next charge, in integer cents.' }),
|
|
1004
1039
|
gross_cents: z.number().int().meta({ description: 'The next charge including VAT, in integer cents.' }),
|
|
1005
1040
|
}).nullable().meta({ description: '`null` while a cancel is pending or nothing else renews.' }),
|
|
1006
|
-
current_price: z.object({
|
|
1007
|
-
net_cents: z.number().int().meta({
|
|
1008
|
-
description: 'One period of the current plan, cycle and add-ons at the agreed price, excluding VAT, in integer cents.',
|
|
1009
|
-
}),
|
|
1010
|
-
}).nullable().meta({
|
|
1011
|
-
description: 'What one period (`cycle`) of the current plan costs this organization: the price it agreed, which stays when the ' +
|
|
1012
|
-
'catalogue changes. Show this, not the catalogue price, as the price of a billed organization. `null` when no agreed ' +
|
|
1013
|
-
'price is recorded for the current plan, cycle and add-ons.',
|
|
1014
|
-
}),
|
|
1015
1041
|
scheduled: z.object({
|
|
1016
1042
|
cycle: billingCycle.nullable().meta({ description: "A cycle change queued for the period's end, or `null`." }),
|
|
1017
1043
|
addons: orgAddons.nullable().meta({ description: "Add-on counts queued for the period's end, or `null`." }),
|
package/dist/index.d.ts
CHANGED
|
@@ -87,8 +87,8 @@ export type { PlanId, PlanLimitKey, PlanLimits, PlanFeature, PlanFeatures, PlanP
|
|
|
87
87
|
export { planCurrency, orgAddons, orgPlanUsage, planChangeKeep, planChangeReason, pendingPlanChange, orgLock, orgPlan, planChangeRequest, planChangePrepareRequest, planChangeDecisionLookupQuery, planChangeDecisionStatusResponse, planOverrides, adminPlanChangeRequest, } from './plans.js';
|
|
88
88
|
export type { PlanCurrency, OrgAddons, OrgPlanUsage, PlanChangeKeep, PlanChangeReason, PendingPlanChange, OrgLock, OrgPlan, PlanChangeRequest, PlanChangePrepareRequest, PlanChangeDecisionLookupQuery, PlanChangeDecisionStatusResponse, PlanOverrides, AdminPlanChangeRequest, } from './plans.js';
|
|
89
89
|
export { ianaTimeZones } from './iana-time-zones.js';
|
|
90
|
-
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingInvoicePdfQuery, billingAccount, billingView, billingChangeResponse, billingDocumentKind, billingDocumentStatus, billingDocumentProfile, billingDocumentFormat, billingDocument, billingDocumentList, billingDocumentFileRole, billingDocumentDetail, billingDocumentFileQuery, billingIssuer, billingChargeInvoice, billingCharge, chargePayRequest, } from './billing.js';
|
|
91
|
-
export type { PayerKind, BillingCycle, VatTreatment, PayerRefusalRule, VatDecision, ChargeAmounts, BillingState, QuoteLine, CheckoutQuote, BillingAddress, BillingDetails, CheckoutRequest, CheckoutResponse, CheckoutStatus, VatIdStatus, VatIdCheckRequest, VatIdCheckResponse, BillingChangeRequest, BillingCancelRequest, BillingDetailsUpdate, PaymentMethodKind, PaymentMethodChangeRequest, BillingAccountStatus, PaymentMethod, InvoiceStatus, BillingInvoice, BillingInvoicePdfQuery, BillingAccount, BillingView, BillingChangeResponse, BillingDocumentKind, BillingDocumentStatus, BillingDocumentProfile, BillingDocumentFormat, BillingDocument, BillingDocumentList, BillingDocumentFileRole, BillingDocumentDetail, BillingDocumentFileQuery, BillingIssuer, BillingChargeInvoice, BillingCharge, ChargePayRequest, } from './billing.js';
|
|
90
|
+
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, billingDetailsConflictDetails, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingInvoicePdfQuery, billingAccount, billingView, billingChangeResponse, billingDocumentKind, billingDocumentStatus, billingDocumentProfile, billingDocumentFormat, billingDocument, billingDocumentList, billingDocumentFileRole, billingDocumentDetail, billingDocumentFileQuery, billingIssuer, billingChargeInvoice, billingCharge, chargePayRequest, } from './billing.js';
|
|
91
|
+
export type { PayerKind, BillingCycle, VatTreatment, PayerRefusalRule, VatDecision, ChargeAmounts, BillingState, QuoteLine, CheckoutQuote, BillingAddress, BillingDetails, CheckoutRequest, CheckoutResponse, CheckoutStatus, VatIdStatus, VatIdCheckRequest, VatIdCheckResponse, BillingChangeRequest, BillingCancelRequest, BillingDetailsUpdate, BillingDetailsConflictDetails, PaymentMethodKind, PaymentMethodChangeRequest, BillingAccountStatus, PaymentMethod, InvoiceStatus, BillingInvoice, BillingInvoicePdfQuery, BillingAccount, BillingView, BillingChangeResponse, BillingDocumentKind, BillingDocumentStatus, BillingDocumentProfile, BillingDocumentFormat, BillingDocument, BillingDocumentList, BillingDocumentFileRole, BillingDocumentDetail, BillingDocumentFileQuery, BillingIssuer, BillingChargeInvoice, BillingCharge, ChargePayRequest, } from './billing.js';
|
|
92
92
|
export { controllerRegisterAddress, controllerRegisterPrivacyContact, controllerRegisterRepresentative, controllerRegisterWrite, controllerRegisterOrgRecord, controllerRegisterOrgResponse } from './controller-register.js';
|
|
93
93
|
export type { ControllerRegisterWrite, ControllerRegisterOrgResponse } from './controller-register.js';
|
|
94
94
|
export { purchaseBillingDetails, purchaseOperationKey, purchaseOperation, purchaseQuote, billingDecisionDisplayRequest, confirmationProof, billingDecisionAmounts, billingDecisionPeriod, billingDecisionSnapshot, billingDecisionDisplayResponse, planChangePrepareResponse, purchaseHoldReason, purchaseRefusalRule, purchaseIntent, purchaseIntentLookupQuery, purchaseIntentDraft, purchaseIntentPaymentStarted, purchaseIntentAcceptedWithoutPayment, purchaseIntentConfirmRequest, purchaseConflictDetails, invoicePayRequest, purchaseIntentResponse, vatDecision, viesPendingReason, formatEur, C4_ACTIONS, C4_TEXT_IDS, c4ActionOf, c4Declaration, storedBillingDecisionSnapshot, checkoutStartResponse, checkoutDraftResponse, checkoutOpenDetails, viesUnavailableDetails, } from './billing.js';
|
package/dist/index.js
CHANGED
|
@@ -96,7 +96,7 @@ export { planId, PLAN_ORDER, planLimitKey, planLimits, planFeature, planFeatures
|
|
|
96
96
|
export { planCurrency, orgAddons, orgPlanUsage, planChangeKeep, planChangeReason, pendingPlanChange, orgLock, orgPlan, planChangeRequest, planChangePrepareRequest, planChangeDecisionLookupQuery, planChangeDecisionStatusResponse, planOverrides, adminPlanChangeRequest, } from './plans.js';
|
|
97
97
|
export { ianaTimeZones } from './iana-time-zones.js';
|
|
98
98
|
// 2026-10-04 — billing through Mollie (#104).
|
|
99
|
-
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingInvoicePdfQuery, billingAccount, billingView, billingChangeResponse,
|
|
99
|
+
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, billingDetailsConflictDetails, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingInvoicePdfQuery, billingAccount, billingView, billingChangeResponse,
|
|
100
100
|
// 2026-10-19 — Lexware billing documents (fleetless/fleetless#544).
|
|
101
101
|
billingDocumentKind, billingDocumentStatus, billingDocumentProfile, billingDocumentFormat, billingDocument, billingDocumentList, billingDocumentFileRole, billingDocumentDetail, billingDocumentFileQuery,
|
|
102
102
|
// 2026-10-19 — the Lexware issuer cutover (fleetless/fleetless#327).
|
package/dist/plans.d.ts
CHANGED
|
@@ -197,21 +197,8 @@ export declare function yearlyEurCents(monthEurCents: number): number;
|
|
|
197
197
|
export declare function pricesFromEurMonth(eurMonthCents: number): PlanPrices;
|
|
198
198
|
/**
|
|
199
199
|
* The catalogue: limits, prices and features as the decision table
|
|
200
|
-
* (2026-09-30) states them,
|
|
201
|
-
*
|
|
202
|
-
* have it. And fleetless/fleetless#1175 (2026-11-19) made Pro hold a fleet
|
|
203
|
-
* (ten robots and apps, fifteen seats, 500 app users, 500 hours of live
|
|
204
|
-
* video), raised Plus to five seats and 100 app users, put a developer's
|
|
205
|
-
* own two-factor (`two_factor`) on every plan, and set the prices to 30 €
|
|
206
|
-
* and 150 € a month.
|
|
207
|
-
*
|
|
208
|
-
* **Asset storage is the same on every sold plan**, one gigabyte per robot:
|
|
209
|
-
* what a robot's meshes need depends on its CAD, not on the plan, so it is
|
|
210
|
-
* no plan differentiator. An organization that needs more gets it as an
|
|
211
|
-
* override (`planOverrides.asset_bytes_per_robot`), and no plan below
|
|
212
|
-
* Enterprise raises it — a consumer that names the way up from this limit
|
|
213
|
-
* must not read it off `nextPlanRaising`, which answers `enterprise`.
|
|
214
|
-
*
|
|
200
|
+
* (2026-09-30) states them, except that the audit export is on every plan,
|
|
201
|
+
* as the developer docs (`plans-and-limits.md`) and the cloud have it.
|
|
215
202
|
* Live video is in milliseconds, asset storage in decimal bytes per robot;
|
|
216
203
|
* Enterprise's limits and features are `null` / `true` throughout because
|
|
217
204
|
* they are set by contract, not read off this table.
|
package/dist/plans.js
CHANGED
|
@@ -138,21 +138,8 @@ export function pricesFromEurMonth(eurMonthCents) {
|
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
140
|
* The catalogue: limits, prices and features as the decision table
|
|
141
|
-
* (2026-09-30) states them,
|
|
142
|
-
*
|
|
143
|
-
* have it. And fleetless/fleetless#1175 (2026-11-19) made Pro hold a fleet
|
|
144
|
-
* (ten robots and apps, fifteen seats, 500 app users, 500 hours of live
|
|
145
|
-
* video), raised Plus to five seats and 100 app users, put a developer's
|
|
146
|
-
* own two-factor (`two_factor`) on every plan, and set the prices to 30 €
|
|
147
|
-
* and 150 € a month.
|
|
148
|
-
*
|
|
149
|
-
* **Asset storage is the same on every sold plan**, one gigabyte per robot:
|
|
150
|
-
* what a robot's meshes need depends on its CAD, not on the plan, so it is
|
|
151
|
-
* no plan differentiator. An organization that needs more gets it as an
|
|
152
|
-
* override (`planOverrides.asset_bytes_per_robot`), and no plan below
|
|
153
|
-
* Enterprise raises it — a consumer that names the way up from this limit
|
|
154
|
-
* must not read it off `nextPlanRaising`, which answers `enterprise`.
|
|
155
|
-
*
|
|
141
|
+
* (2026-09-30) states them, except that the audit export is on every plan,
|
|
142
|
+
* as the developer docs (`plans-and-limits.md`) and the cloud have it.
|
|
156
143
|
* Live video is in milliseconds, asset storage in decimal bytes per robot;
|
|
157
144
|
* Enterprise's limits and features are `null` / `true` throughout because
|
|
158
145
|
* they are set by contract, not read off this table.
|
|
@@ -175,7 +162,7 @@ export const PLANS = {
|
|
|
175
162
|
},
|
|
176
163
|
features: {
|
|
177
164
|
app_mcp: false,
|
|
178
|
-
two_factor:
|
|
165
|
+
two_factor: false,
|
|
179
166
|
require_two_factor: false,
|
|
180
167
|
app_oidc: false,
|
|
181
168
|
hosted_logo: false,
|
|
@@ -189,12 +176,12 @@ export const PLANS = {
|
|
|
189
176
|
id: 'plus',
|
|
190
177
|
name: 'Plus',
|
|
191
178
|
limits: {
|
|
192
|
-
seats:
|
|
179
|
+
seats: 3,
|
|
193
180
|
robots: 3,
|
|
194
181
|
apps: 3,
|
|
195
|
-
app_users:
|
|
182
|
+
app_users: 25,
|
|
196
183
|
live_video_ms_per_month: 360_000_000,
|
|
197
|
-
asset_bytes_per_robot:
|
|
184
|
+
asset_bytes_per_robot: 2_000_000_000,
|
|
198
185
|
history_days: 30,
|
|
199
186
|
audit_days: 30,
|
|
200
187
|
collection_records: 250_000,
|
|
@@ -209,19 +196,19 @@ export const PLANS = {
|
|
|
209
196
|
audit_export: true,
|
|
210
197
|
addons: false,
|
|
211
198
|
},
|
|
212
|
-
prices: pricesFromEurMonth(
|
|
199
|
+
prices: pricesFromEurMonth(2900),
|
|
213
200
|
support: 'email',
|
|
214
201
|
},
|
|
215
202
|
pro: {
|
|
216
203
|
id: 'pro',
|
|
217
204
|
name: 'Pro',
|
|
218
205
|
limits: {
|
|
219
|
-
seats:
|
|
220
|
-
robots:
|
|
221
|
-
apps:
|
|
222
|
-
app_users:
|
|
223
|
-
live_video_ms_per_month:
|
|
224
|
-
asset_bytes_per_robot:
|
|
206
|
+
seats: 5,
|
|
207
|
+
robots: 5,
|
|
208
|
+
apps: 5,
|
|
209
|
+
app_users: 50,
|
|
210
|
+
live_video_ms_per_month: 900_000_000,
|
|
211
|
+
asset_bytes_per_robot: 3_000_000_000,
|
|
225
212
|
history_days: 90,
|
|
226
213
|
audit_days: 90,
|
|
227
214
|
collection_records: 1_000_000,
|
|
@@ -236,7 +223,7 @@ export const PLANS = {
|
|
|
236
223
|
audit_export: true,
|
|
237
224
|
addons: true,
|
|
238
225
|
},
|
|
239
|
-
prices: pricesFromEurMonth(
|
|
226
|
+
prices: pricesFromEurMonth(14900),
|
|
240
227
|
support: 'priority',
|
|
241
228
|
},
|
|
242
229
|
enterprise: {
|
package/dist/routes.js
CHANGED
|
@@ -3234,8 +3234,14 @@ export const ROUTES = [
|
|
|
3234
3234
|
summary: 'Recovers a purchase intent by operation key or intent ID.',
|
|
3235
3235
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3236
3236
|
params: [], query: purchaseIntentLookupQuery, request: null, response: purchaseIntentResponse,
|
|
3237
|
-
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
3238
|
-
notes: 'Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org;
|
|
3237
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict', ...MOLLIE], transport: 'http',
|
|
3238
|
+
notes: 'Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; ' +
|
|
3239
|
+
'unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost ' +
|
|
3240
|
+
'response returns the same intent/payment identity and, for a paid change, its billing result. A proof is never returned here; a ' +
|
|
3241
|
+
'still-eligible decision needs a fresh C.4 display and explicit Owner click. A started hosted payment is read at the provider ' +
|
|
3242
|
+
'first: 409 target_state_conflict with `{ field: billing, rule: checkout_not_open }` when it is no longer open there (paid, ' +
|
|
3243
|
+
'canceled, expired or failed), and 502 payment_provider_unavailable when the provider does not answer. A `mandate_setup` whose ' +
|
|
3244
|
+
'payment the provider never answered also answers that 502: send its `POST /api/billing/payment-method` again with the same key.',
|
|
3239
3245
|
},
|
|
3240
3246
|
{
|
|
3241
3247
|
method: 'POST', path: '/api/billing/intents/:id/display', section: 'billing',
|
|
@@ -3297,11 +3303,22 @@ export const ROUTES = [
|
|
|
3297
3303
|
},
|
|
3298
3304
|
{
|
|
3299
3305
|
method: 'PATCH', path: '/api/billing/details', section: 'billing',
|
|
3300
|
-
summary: "Edits company billing details
|
|
3306
|
+
summary: "Edits the company's billing details; details a purchase would refuse are not saved.",
|
|
3301
3307
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3302
3308
|
params: [], query: null, request: billingDetailsUpdate, response: billingView,
|
|
3303
|
-
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
3304
|
-
notes:
|
|
3309
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict'], transport: 'http',
|
|
3310
|
+
notes: '404 not_found when no billing account exists. Send only the fields that change: company name, full address with state, Tax ID, ' +
|
|
3311
|
+
'VAT ID, invoice email. The merged company is decided as a checkout decides its buyer, and saved only when a purchase would ' +
|
|
3312
|
+
'accept it. Every refusal is 409 target_state_conflict with `billingDetailsConflictDetails` and saves nothing: `{ field, rule }` ' +
|
|
3313
|
+
'for a field a purchase refuses (`rule` a `purchaseRefusalRule`; `field` one of `billing.kind`, `billing.vat_id`, ' +
|
|
3314
|
+
'`billing.tax_id`, `billing.address.state`, `billing.invoice_email`), `vat_id_invalid` at `billing.vat_id` when VIES does not ' +
|
|
3315
|
+
'know the VAT ID; `viesUnavailableDetails` (`field: billing.vat_id`, `rule: vies_unavailable`) when VIES did not answer within ' +
|
|
3316
|
+
'its 15 seconds: send the same edit again; `{ field: billing, rule: buyer_changed }` when the details changed while the edit was ' +
|
|
3317
|
+
'decided: read `GET /api/billing` and send it again. VIES is asked only when the country or the VAT ID changes, in another EU ' +
|
|
3318
|
+
'country; any other edit keeps the recorded VIES answer and needs none. A saved edit re-prices open due charges, updates the ' +
|
|
3319
|
+
'invoicing contact and invalidates quotes made for the old details. An issued invoice keeps the details it was issued with. An ' +
|
|
3320
|
+
'edit creates no payment, activates no plan, pays no invoice, clears no dunning and lifts no lock. A person account from before ' +
|
|
3321
|
+
'company-only purchases is saved without these checks; it cannot buy.',
|
|
3305
3322
|
},
|
|
3306
3323
|
{
|
|
3307
3324
|
method: 'POST', path: '/api/billing/change', section: 'billing',
|
|
@@ -3325,12 +3342,26 @@ export const ROUTES = [
|
|
|
3325
3342
|
},
|
|
3326
3343
|
{
|
|
3327
3344
|
method: 'POST', path: '/api/billing/payment-method', section: 'billing',
|
|
3328
|
-
summary: "
|
|
3345
|
+
summary: "Starts a payment-method change: a hosted payment of 0.00 for a new mandate.",
|
|
3329
3346
|
audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 201,
|
|
3330
3347
|
params: [], query: null, request: paymentMethodChangeRequest, response: checkoutResponse,
|
|
3331
3348
|
errors: ['target_state_conflict', ...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
|
|
3332
3349
|
transport: 'http',
|
|
3333
|
-
notes:
|
|
3350
|
+
notes: 'Offer `payment_method_options`. A change is a 0.00 `first` payment on the provider\'s hosted page, restricted to the chosen ' +
|
|
3351
|
+
'method: the answer is operation `mandate_setup` in `payment_started` with `payment.kind` hosted at once; redirect to its ' +
|
|
3352
|
+
'`checkout_url`. Nothing is quoted, so there is no `eligible` step, no confirmation and no VIES. It pays no invoice and clears ' +
|
|
3353
|
+
'no dunning or lock: open invoices stay open. When the provider reports it paid, the new mandate is the account\'s and every ' +
|
|
3354
|
+
'other valid mandate of the customer is revoked; canceled, expired or failed, nothing changes. `GET /api/billing/checkout/:id` ' +
|
|
3355
|
+
'with the `checkout_id` reads the outcome (`purpose: payment_method`). Use one operation_key per method until its payment is ' +
|
|
3356
|
+
'finished. The same key again answers 200 with the same `payment_started` while the payment is open. 502 ' +
|
|
3357
|
+
'payment_provider_unavailable when the provider did not answer: the same key again resumes, and sends the same payment again ' +
|
|
3358
|
+
'under the same idempotency key. 409 target_state_conflict with `{ field: billing, rule: checkout_not_open }` when the key\'s ' +
|
|
3359
|
+
'payment is finished or can no longer be sent: start again with a new key. Same key with another method is a typed ' +
|
|
3360
|
+
'operation_key_reused conflict. A change stored while changes were on hold reads `held` with `mandate_policy_unresolved`; start ' +
|
|
3361
|
+
'again with a new key. Apple Pay with zero-amount changes disabled pays an open invoice through operation ' +
|
|
3362
|
+
'payment_method_invoice, with the buyer/VIES gate, current-amount reconfirmation and USD legacy hold of invoices/:id/pay; ' +
|
|
3363
|
+
'without an open invoice, 400 validation_error has field method and rule applepay_needs_open_invoice. An invoice charged back ' +
|
|
3364
|
+
'is never retried automatically. 404 not_found when no billing account is active or past due.',
|
|
3334
3365
|
},
|
|
3335
3366
|
{
|
|
3336
3367
|
method: 'POST', path: '/api/billing/cancel', section: 'billing',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetless/contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0-next.1",
|
|
4
4
|
"description": "Fleetless wire contracts: the bridge-cloud protocol, the REST API schemas and the error codes, as zod schemas with generated JSON Schema and OpenAPI artifacts.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Dehne Robotik GmbH",
|