@fantastic.dev/better-stripe 0.89.0 → 0.90.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.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.js +61 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js +18 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js +67 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js +372 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts +24 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js +113 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.d.ts +55 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.js +87 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts +7 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js +130 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/readLifetime.d.ts +14 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/readLifetime.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/readLifetime.js +60 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/readLifetime.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js +126 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.d.mts +627 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs +488 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.d.mts +214 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs +63 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.d.mts +75 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs +145 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts +7 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs +26 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/appendAck.d.ts +14 -0
- package/dist/client/billing/renewalAttach/internal/c10/appendAck.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/appendAck.js +202 -0
- package/dist/client/billing/renewalAttach/internal/c10/appendAck.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.d.ts +23 -0
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.js +117 -0
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/configureEvents.d.ts +23 -0
- package/dist/client/billing/renewalAttach/internal/c10/configureEvents.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/configureEvents.js +111 -0
- package/dist/client/billing/renewalAttach/internal/c10/configureEvents.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.d.ts +11 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.js +376 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCodec.d.ts +16 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCodec.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCodec.js +119 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCodec.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownData.d.ts +30 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownData.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownData.js +74 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownData.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownerBinding.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownerBinding.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownerBinding.js +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownerBinding.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/privacy.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/privacy.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/privacy.js +175 -0
- package/dist/client/billing/renewalAttach/internal/c10/privacy.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/publicApi.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/publicApi.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/publicApi.js +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/publicApi.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.d.mts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs +4 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.d.mts +26 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs +42 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.d.mts +7 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs +60 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.d.mts +335 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs +122 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.d.mts +46 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs +87 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.d.mts +35 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs +90 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.d.mts +132 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs +82 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.d.mts +4 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs +23 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.d.mts +16 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs +41 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.d.mts +43 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs +132 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.d.mts +200 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs +150 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.d.mts +124 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs +127 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.d.mts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs +69 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs +152 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.d.mts +5 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs +243 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.d.mts +17 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs +75 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs +173 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.d.mts +4 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs +4 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.d.mts +7 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs +30 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.d.mts +29 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs +33 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f19.json +452 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs +173 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs +449 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.d.mts +9 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs +27 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.d.mts +7 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs +150 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.d.mts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs +503 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs +91 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.d.mts +14 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs +41 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.d.mts +103 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs +46 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.d.mts +73 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs +294 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs +60 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.d.mts +58 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs +96 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.js +40 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/capture.d.ts +88 -0
- package/dist/client/billing/renewalAttach/internal/material/capture.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/capture.js +181 -0
- package/dist/client/billing/renewalAttach/internal/material/capture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/classifiers.d.ts +522 -0
- package/dist/client/billing/renewalAttach/internal/material/classifiers.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/classifiers.js +226 -0
- package/dist/client/billing/renewalAttach/internal/material/classifiers.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/nodeKernel.d.ts +17 -0
- package/dist/client/billing/renewalAttach/internal/material/nodeKernel.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/nodeKernel.js +95 -0
- package/dist/client/billing/renewalAttach/internal/material/nodeKernel.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.d.ts +338 -0
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.js +122 -0
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/requiredJson.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/material/requiredJson.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/requiredJson.js +174 -0
- package/dist/client/billing/renewalAttach/internal/material/requiredJson.js.map +1 -0
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
- package/dist/component/usage/allowance.fixtures.d.ts +16 -16
- package/dist/component/usageCredits/accounting.fixtures.d.ts +16 -16
- package/docs/renewal-context-reads.md +28 -0
- package/docs/renewal-phase-assembly.md +23 -0
- package/docs/renewal-raw-acquisition.md +64 -0
- package/package.json +1 -1
- package/src/client/billing/renewalAttach/internal/acquisition/array-order.test.js +70 -0
- package/src/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js +23 -0
- package/src/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js +77 -0
- package/src/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js +418 -0
- package/src/client/billing/renewalAttach/internal/acquisition/rawAcquisition.ts +160 -0
- package/src/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.ts +110 -0
- package/src/client/billing/renewalAttach/internal/acquisition/rawWireSource.ts +156 -0
- package/src/client/billing/renewalAttach/internal/acquisition/readLifetime.ts +64 -0
- package/src/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js +138 -0
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs +510 -0
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs +64 -0
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs +159 -0
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs +25 -0
- package/src/client/billing/renewalAttach/internal/c10/appendAck.first.test.ts +86 -0
- package/src/client/billing/renewalAttach/internal/c10/appendAck.ts +226 -0
- package/src/client/billing/renewalAttach/internal/c10/appendCodec.test.ts +186 -0
- package/src/client/billing/renewalAttach/internal/c10/arrayOrder.test.ts +47 -0
- package/src/client/billing/renewalAttach/internal/c10/attachEvents.ts +144 -0
- package/src/client/billing/renewalAttach/internal/c10/compiler.test.ts +443 -0
- package/src/client/billing/renewalAttach/internal/c10/configureEvents.ts +145 -0
- package/src/client/billing/renewalAttach/internal/c10/eventCapture.ts +464 -0
- package/src/client/billing/renewalAttach/internal/c10/eventCodec.ts +131 -0
- package/src/client/billing/renewalAttach/internal/c10/hardening.test.ts +175 -0
- package/src/client/billing/renewalAttach/internal/c10/historicalClassifier.test.ts +114 -0
- package/src/client/billing/renewalAttach/internal/c10/ownData.ts +103 -0
- package/src/client/billing/renewalAttach/internal/c10/ownerBinding.ts +2 -0
- package/src/client/billing/renewalAttach/internal/c10/ownerContinuations.test.ts +283 -0
- package/src/client/billing/renewalAttach/internal/c10/privacy.ts +181 -0
- package/src/client/billing/renewalAttach/internal/c10/publicApi.ts +8 -0
- package/src/client/billing/renewalAttach/internal/c10/reflectionPrivacy.test.ts +87 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs +3 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs +49 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs +63 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs +160 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs +88 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs +102 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs +82 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs +20 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs +41 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs +137 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs +153 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs +127 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs +85 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs +170 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs +6 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs +295 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs +78 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs +177 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs +8 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs +34 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs +32 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f19.json +452 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs +177 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs +466 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs +29 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs +165 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs +507 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs +89 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs +38 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs +45 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs +309 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs +58 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs +104 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.ts +43 -0
- package/src/client/billing/renewalAttach/internal/material/capture.ts +243 -0
- package/src/client/billing/renewalAttach/internal/material/classifiers.test.ts +510 -0
- package/src/client/billing/renewalAttach/internal/material/classifiers.ts +313 -0
- package/src/client/billing/renewalAttach/internal/material/nodeKernel.ts +118 -0
- package/src/client/billing/renewalAttach/internal/material/readMaterial.ts +176 -0
- package/src/client/billing/renewalAttach/internal/material/requiredJson.ts +183 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
renewalSubscription,
|
|
4
|
+
renewalPrice,
|
|
5
|
+
renewalBillingCustomer,
|
|
6
|
+
} from "./f09.mjs";
|
|
7
|
+
import {
|
|
8
|
+
referenceId,
|
|
9
|
+
equal,
|
|
10
|
+
conflict,
|
|
11
|
+
unsupported,
|
|
12
|
+
supportedVersion,
|
|
13
|
+
timestamp,
|
|
14
|
+
resourceId,
|
|
15
|
+
productId,
|
|
16
|
+
} from "./f02.mjs";
|
|
17
|
+
import { profileOf } from "./f00.mjs";
|
|
18
|
+
import { qualifySourceDiscounts } from "./f03.mjs";
|
|
19
|
+
import { qualifyOriginalSettings } from "./f04.mjs";
|
|
20
|
+
const attachedReference = z.union([
|
|
21
|
+
resourceId("sub_sched"),
|
|
22
|
+
z
|
|
23
|
+
.object({
|
|
24
|
+
id: resourceId("sub_sched"),
|
|
25
|
+
object: z.literal("subscription_schedule"),
|
|
26
|
+
deleted: z.literal(false).optional(),
|
|
27
|
+
customer_account: resourceId("acct").optional(),
|
|
28
|
+
livemode: z.boolean().optional(),
|
|
29
|
+
})
|
|
30
|
+
.passthrough(),
|
|
31
|
+
]);
|
|
32
|
+
export function validateReadMaterial(args, prepared, scheduleId) {
|
|
33
|
+
supportedVersion(args.apiVersion);
|
|
34
|
+
const subscription = renewalSubscription
|
|
35
|
+
.extend({ schedule: scheduleId ? attachedReference : z.null() })
|
|
36
|
+
.safeParse(args.freshSubscription);
|
|
37
|
+
if (!subscription.success)
|
|
38
|
+
unsupported("unsupported_original_subscription_state");
|
|
39
|
+
const source = subscription.data;
|
|
40
|
+
if (scheduleId) {
|
|
41
|
+
if (
|
|
42
|
+
referenceId(source.schedule, "sub_sched", "subscription_schedule") !==
|
|
43
|
+
scheduleId
|
|
44
|
+
)
|
|
45
|
+
conflict("schedule_association_mismatch");
|
|
46
|
+
if (
|
|
47
|
+
typeof source.schedule === "object" &&
|
|
48
|
+
source.schedule !== null &&
|
|
49
|
+
((source.schedule.customer_account !== undefined &&
|
|
50
|
+
source.schedule.customer_account !==
|
|
51
|
+
prepared.expected.customerAccountId) ||
|
|
52
|
+
(source.schedule.livemode !== undefined &&
|
|
53
|
+
source.schedule.livemode !== prepared.expected.livemode))
|
|
54
|
+
)
|
|
55
|
+
conflict("schedule_association_mismatch");
|
|
56
|
+
}
|
|
57
|
+
const { schedule: originalSchedule, ...original } =
|
|
58
|
+
prepared.providerSnapshot.subscription;
|
|
59
|
+
// Compare complete captured bodies, not parser outputs that may omit own keys.
|
|
60
|
+
const { schedule: freshSchedule, ...fresh } = args.freshSubscription;
|
|
61
|
+
if (scheduleId ? originalSchedule !== null : freshSchedule !== null)
|
|
62
|
+
conflict("schedule_association_mismatch");
|
|
63
|
+
if (!equal(original, fresh)) conflict("original_source_drift");
|
|
64
|
+
const target = renewalPrice.safeParse(args.targetPrice);
|
|
65
|
+
if (!target.success || !target.data.active)
|
|
66
|
+
unsupported("unsupported_target_price");
|
|
67
|
+
if (!equal(args.targetPrice, prepared.providerSnapshot.targetPrice))
|
|
68
|
+
conflict("target_price_drift");
|
|
69
|
+
if (
|
|
70
|
+
prepared.providerSnapshot.billingCustomer === undefined ||
|
|
71
|
+
args.billingCustomer === undefined
|
|
72
|
+
)
|
|
73
|
+
unsupported("missing_retained_billing_customer");
|
|
74
|
+
const customer = renewalBillingCustomer.safeParse(args.billingCustomer);
|
|
75
|
+
if (!customer.success) unsupported("unsupported_billing_customer");
|
|
76
|
+
if (!equal(args.billingCustomer, prepared.providerSnapshot.billingCustomer))
|
|
77
|
+
conflict("billing_customer_drift");
|
|
78
|
+
const referenceContext = {
|
|
79
|
+
customerAccountId: prepared.expected.customerAccountId,
|
|
80
|
+
livemode: prepared.expected.livemode,
|
|
81
|
+
};
|
|
82
|
+
if (
|
|
83
|
+
referenceId(source.customer, "cus", "customer", referenceContext) !==
|
|
84
|
+
customer.data.id ||
|
|
85
|
+
customer.data.customer_account !== prepared.expected.customerAccountId ||
|
|
86
|
+
customer.data.livemode !== prepared.expected.livemode
|
|
87
|
+
)
|
|
88
|
+
conflict("billing_customer_identity_mismatch");
|
|
89
|
+
const item = source.items.data[0];
|
|
90
|
+
if (
|
|
91
|
+
productId(item.price.product, referenceContext) !==
|
|
92
|
+
prepared.expected.currentProductId ||
|
|
93
|
+
productId(target.data.product, referenceContext) !==
|
|
94
|
+
prepared.expected.targetProductId
|
|
95
|
+
)
|
|
96
|
+
unsupported("product_identity_mismatch");
|
|
97
|
+
if (
|
|
98
|
+
args.observedAt < prepared.expected.periodStart ||
|
|
99
|
+
args.observedAt >= prepared.expected.periodEnd
|
|
100
|
+
)
|
|
101
|
+
unsupported("outside_original_paid_period");
|
|
102
|
+
for (const field of [
|
|
103
|
+
"billing_thresholds",
|
|
104
|
+
"managed_payments",
|
|
105
|
+
"next_pending_invoice_item_invoice",
|
|
106
|
+
"pending_invoice_item_interval",
|
|
107
|
+
"pending_setup_intent",
|
|
108
|
+
"canceled_at",
|
|
109
|
+
"ended_at",
|
|
110
|
+
"trial_settings",
|
|
111
|
+
])
|
|
112
|
+
if (source[field] !== null) unsupported(`unsupported_original_${field}`);
|
|
113
|
+
if (item.billing_thresholds !== null)
|
|
114
|
+
unsupported("unsupported_item_billing_thresholds");
|
|
115
|
+
if (item.current_trial !== null)
|
|
116
|
+
unsupported("unsupported_or_missing_item_current_trial");
|
|
117
|
+
if (
|
|
118
|
+
!Array.isArray(source.billing_schedules) ||
|
|
119
|
+
source.billing_schedules.length
|
|
120
|
+
)
|
|
121
|
+
unsupported("unsupported_original_billing_schedules");
|
|
122
|
+
if (
|
|
123
|
+
source.trial_end !== null &&
|
|
124
|
+
(!timestamp.safeParse(source.trial_end).success ||
|
|
125
|
+
Number(source.trial_end) > prepared.expected.periodStart)
|
|
126
|
+
)
|
|
127
|
+
unsupported("unsupported_original_trial");
|
|
128
|
+
if (source.status_details != null || source.presentment_details != null)
|
|
129
|
+
unsupported("unsupported_special_billing_state");
|
|
130
|
+
const originalSettings = qualifyOriginalSettings(source, item, customer.data);
|
|
131
|
+
const profile = profileOf(source, item.price, target.data, args.apiVersion);
|
|
132
|
+
const anchor = timestamp.parse(source.billing_cycle_anchor);
|
|
133
|
+
if (anchor > prepared.expected.periodStart)
|
|
134
|
+
unsupported("unqualified_anchor_after_paid_period_start");
|
|
135
|
+
const discounts = qualifySourceDiscounts(
|
|
136
|
+
source.discounts,
|
|
137
|
+
"subscription",
|
|
138
|
+
prepared.expected,
|
|
139
|
+
customer.data.id,
|
|
140
|
+
args.observedAt,
|
|
141
|
+
);
|
|
142
|
+
const itemDiscounts = qualifySourceDiscounts(
|
|
143
|
+
item.discounts,
|
|
144
|
+
"item",
|
|
145
|
+
prepared.expected,
|
|
146
|
+
customer.data.id,
|
|
147
|
+
args.observedAt,
|
|
148
|
+
);
|
|
149
|
+
return {
|
|
150
|
+
prepared,
|
|
151
|
+
subscription: source,
|
|
152
|
+
item,
|
|
153
|
+
customer: customer.data,
|
|
154
|
+
targetPrice: target.data,
|
|
155
|
+
profile,
|
|
156
|
+
discounts,
|
|
157
|
+
itemDiscounts,
|
|
158
|
+
originalSettings,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { renewalSnapshot } from "./f10.mjs";
|
|
3
|
+
export const timestamp = z
|
|
4
|
+
.number()
|
|
5
|
+
.int()
|
|
6
|
+
.nonnegative()
|
|
7
|
+
.max(Number.MAX_SAFE_INTEGER);
|
|
8
|
+
export const resourceId = (prefix) =>
|
|
9
|
+
z
|
|
10
|
+
.string()
|
|
11
|
+
.max(255)
|
|
12
|
+
.regex(new RegExp(`^${prefix}_[A-Za-z0-9_]+$`));
|
|
13
|
+
export class ProjectionError extends Error {
|
|
14
|
+
kind;
|
|
15
|
+
constructor(kind, reason) {
|
|
16
|
+
super(reason);
|
|
17
|
+
this.kind = kind;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function unsupported(reason) {
|
|
21
|
+
throw new ProjectionError("unsupported", reason);
|
|
22
|
+
}
|
|
23
|
+
export function conflict(reason) {
|
|
24
|
+
throw new ProjectionError("conflict", reason);
|
|
25
|
+
}
|
|
26
|
+
export const object = (value) => z.record(z.string(), z.unknown()).parse(value);
|
|
27
|
+
export const canonical = (value) => JSON.stringify(renewalSnapshot(value));
|
|
28
|
+
export const binding = (namespace, value) =>
|
|
29
|
+
`${namespace}:v1:${canonical(value)}`;
|
|
30
|
+
export const equal = (left, right) => canonical(left) === canonical(right);
|
|
31
|
+
function referenceFacts(reference, context) {
|
|
32
|
+
if (
|
|
33
|
+
context &&
|
|
34
|
+
((reference.livemode !== undefined &&
|
|
35
|
+
reference.livemode !== context.livemode) ||
|
|
36
|
+
(reference.customer_account !== undefined &&
|
|
37
|
+
reference.customer_account !== context.customerAccountId))
|
|
38
|
+
)
|
|
39
|
+
unsupported("expanded_reference_scope_mismatch");
|
|
40
|
+
}
|
|
41
|
+
export function referenceId(value, prefix, kind, context) {
|
|
42
|
+
if (typeof value === "string") return resourceId(prefix).parse(value);
|
|
43
|
+
const reference = object(value);
|
|
44
|
+
if (reference.object !== kind || reference.deleted === true)
|
|
45
|
+
unsupported(`invalid_${kind}_reference`);
|
|
46
|
+
referenceFacts(reference, context);
|
|
47
|
+
return resourceId(prefix).parse(reference.id);
|
|
48
|
+
}
|
|
49
|
+
export function productId(value, context) {
|
|
50
|
+
const id = z.string().min(1).max(255).regex(/\S/);
|
|
51
|
+
if (typeof value === "string") return id.parse(value);
|
|
52
|
+
const reference = object(value);
|
|
53
|
+
if (reference.object !== "product" || reference.deleted === true)
|
|
54
|
+
unsupported("invalid_product_reference");
|
|
55
|
+
referenceFacts(reference, context);
|
|
56
|
+
return id.parse(reference.id);
|
|
57
|
+
}
|
|
58
|
+
export function failure(error, scheduleId) {
|
|
59
|
+
const known = error instanceof ProjectionError;
|
|
60
|
+
const kind = known ? error.kind : "unsupported";
|
|
61
|
+
const reason = known ? error.message : "incomplete_or_unsupported_schema";
|
|
62
|
+
if (kind === "unsupported" && scheduleId)
|
|
63
|
+
return { status: "attached_unconfigured", scheduleId, reason };
|
|
64
|
+
return { status: kind, reason };
|
|
65
|
+
}
|
|
66
|
+
export const readInput = z
|
|
67
|
+
.object({
|
|
68
|
+
prepared: z.unknown(),
|
|
69
|
+
freshSubscription: z.unknown(),
|
|
70
|
+
targetPrice: z.unknown(),
|
|
71
|
+
billingCustomer: z.unknown().optional(),
|
|
72
|
+
apiVersion: z.string(),
|
|
73
|
+
observedAt: timestamp,
|
|
74
|
+
})
|
|
75
|
+
.strict();
|
|
76
|
+
export const configureInput = readInput
|
|
77
|
+
.extend({
|
|
78
|
+
attachReceipt: z.unknown(),
|
|
79
|
+
schedule: z.unknown(),
|
|
80
|
+
configureKey: z.string(),
|
|
81
|
+
firstDispatchedAt: timestamp,
|
|
82
|
+
})
|
|
83
|
+
.strict();
|
|
84
|
+
export function supportedVersion(version) {
|
|
85
|
+
if (version !== "2026-09-30.endive")
|
|
86
|
+
unsupported("unqualified_api_version_profile");
|
|
87
|
+
return version;
|
|
88
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { resourceId, unsupported } from "./f02.mjs";
|
|
3
|
+
const customId = z.string().min(1).max(255).regex(/\S/);
|
|
4
|
+
const originalRedemptions = z
|
|
5
|
+
.array(
|
|
6
|
+
z
|
|
7
|
+
.object({
|
|
8
|
+
id: resourceId("di"),
|
|
9
|
+
object: z.literal("discount"),
|
|
10
|
+
deleted: z.literal(false).optional(),
|
|
11
|
+
customer_account: resourceId("acct"),
|
|
12
|
+
customer: z
|
|
13
|
+
.union([
|
|
14
|
+
resourceId("cus"),
|
|
15
|
+
z
|
|
16
|
+
.object({
|
|
17
|
+
id: resourceId("cus"),
|
|
18
|
+
object: z.literal("customer"),
|
|
19
|
+
deleted: z.literal(false).optional(),
|
|
20
|
+
livemode: z.boolean().optional(),
|
|
21
|
+
customer_account: resourceId("acct").nullable().optional(),
|
|
22
|
+
})
|
|
23
|
+
.passthrough(),
|
|
24
|
+
])
|
|
25
|
+
.nullable()
|
|
26
|
+
.optional(),
|
|
27
|
+
subscription: resourceId("sub").nullable(),
|
|
28
|
+
subscription_item: resourceId("si").nullable(),
|
|
29
|
+
start: z.number().int().nonnegative(),
|
|
30
|
+
end: z.null(),
|
|
31
|
+
source: z
|
|
32
|
+
.object({
|
|
33
|
+
type: z.literal("coupon"),
|
|
34
|
+
coupon: z
|
|
35
|
+
.object({
|
|
36
|
+
id: customId,
|
|
37
|
+
object: z.literal("coupon"),
|
|
38
|
+
deleted: z.literal(false).optional(),
|
|
39
|
+
livemode: z.boolean().optional(),
|
|
40
|
+
duration: z.literal("forever"),
|
|
41
|
+
applies_to: z
|
|
42
|
+
.object({ products: z.array(customId) })
|
|
43
|
+
.strict()
|
|
44
|
+
.optional(),
|
|
45
|
+
})
|
|
46
|
+
.passthrough(),
|
|
47
|
+
})
|
|
48
|
+
.passthrough(),
|
|
49
|
+
})
|
|
50
|
+
.passthrough(),
|
|
51
|
+
)
|
|
52
|
+
.max(20);
|
|
53
|
+
export function qualifySourceDiscounts(
|
|
54
|
+
value,
|
|
55
|
+
level,
|
|
56
|
+
context,
|
|
57
|
+
customerId,
|
|
58
|
+
observedAt,
|
|
59
|
+
) {
|
|
60
|
+
const parsed = originalRedemptions.safeParse(value);
|
|
61
|
+
if (!parsed.success)
|
|
62
|
+
unsupported("incomplete_or_unsupported_discount_evidence");
|
|
63
|
+
if (!parsed.data.length) unsupported("ambiguous_empty_discount_hierarchy");
|
|
64
|
+
if (
|
|
65
|
+
new Set(parsed.data.map((discount) => discount.id)).size !==
|
|
66
|
+
parsed.data.length
|
|
67
|
+
)
|
|
68
|
+
unsupported("duplicate_discount_redemptions");
|
|
69
|
+
for (const discount of parsed.data) {
|
|
70
|
+
const customer = discount.customer;
|
|
71
|
+
if (
|
|
72
|
+
discount.customer_account !== context.customerAccountId ||
|
|
73
|
+
discount.start > observedAt ||
|
|
74
|
+
(typeof customer === "string" && customer !== customerId) ||
|
|
75
|
+
(typeof customer === "object" &&
|
|
76
|
+
customer !== null &&
|
|
77
|
+
(customer.id !== customerId ||
|
|
78
|
+
(customer.livemode !== undefined &&
|
|
79
|
+
customer.livemode !== context.livemode) ||
|
|
80
|
+
(customer.customer_account !== undefined &&
|
|
81
|
+
customer.customer_account !== context.customerAccountId))) ||
|
|
82
|
+
(level === "subscription" &&
|
|
83
|
+
(discount.subscription !== context.subscriptionId ||
|
|
84
|
+
discount.subscription_item !== null)) ||
|
|
85
|
+
(level === "item" &&
|
|
86
|
+
(discount.subscription_item !== context.itemId ||
|
|
87
|
+
(discount.subscription !== null &&
|
|
88
|
+
discount.subscription !== context.subscriptionId)))
|
|
89
|
+
)
|
|
90
|
+
unsupported("discount_owner_or_start_mismatch");
|
|
91
|
+
const coupon = discount.source.coupon;
|
|
92
|
+
if (coupon.livemode !== undefined && coupon.livemode !== context.livemode)
|
|
93
|
+
unsupported("discount_coupon_mode_mismatch");
|
|
94
|
+
if (
|
|
95
|
+
coupon.applies_to &&
|
|
96
|
+
(!coupon.applies_to.products.includes(context.currentProductId) ||
|
|
97
|
+
!coupon.applies_to.products.includes(context.targetProductId))
|
|
98
|
+
)
|
|
99
|
+
unsupported("discount_product_applicability");
|
|
100
|
+
}
|
|
101
|
+
return parsed.data;
|
|
102
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { settingsInput } from "./f08.mjs";
|
|
2
|
+
import { projectRenewalPhaseSettings } from "./f07.mjs";
|
|
3
|
+
import { projectRenewalItemSettings } from "./f06.mjs";
|
|
4
|
+
import { explicitTaxIds } from "./f05.mjs";
|
|
5
|
+
import { unsupported } from "./f02.mjs";
|
|
6
|
+
const invoiceSchema = settingsInput.shape.settings.shape.invoice_settings
|
|
7
|
+
.unwrap()
|
|
8
|
+
.omit({ days_until_due: true })
|
|
9
|
+
.extend({
|
|
10
|
+
issuer: settingsInput.shape.context.shape.effectiveInvoiceIssuer,
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
/**
|
|
14
|
+
* Classify actual original subscription/item fields before any attachment.
|
|
15
|
+
* The field projections below are validation views, not fabricated phase reads
|
|
16
|
+
* or provider acknowledgement. Their output is never dispatched or adopted.
|
|
17
|
+
*/
|
|
18
|
+
export function qualifyOriginalSettings(subscription, item, customer) {
|
|
19
|
+
const invoice = invoiceSchema.safeParse(subscription.invoice_settings);
|
|
20
|
+
if (!invoice.success) unsupported("unsupported_original_invoice_settings");
|
|
21
|
+
const automaticTax = settingsInput.shape.settings.shape.automatic_tax
|
|
22
|
+
.unwrap()
|
|
23
|
+
.safeParse(subscription.automatic_tax);
|
|
24
|
+
if (!automaticTax.success) unsupported("unsupported_original_automatic_tax");
|
|
25
|
+
const parsedContext = settingsInput.shape.context.safeParse({
|
|
26
|
+
customerId: customer.id,
|
|
27
|
+
customerAccountId: customer.customer_account,
|
|
28
|
+
livemode: customer.livemode,
|
|
29
|
+
effectiveCollectionMethod: subscription.collection_method,
|
|
30
|
+
effectiveAutomaticTax: automaticTax.data.enabled,
|
|
31
|
+
effectiveInvoiceIssuer: invoice.data.issuer,
|
|
32
|
+
});
|
|
33
|
+
if (!parsedContext.success)
|
|
34
|
+
unsupported("unsupported_original_billing_context");
|
|
35
|
+
const context = parsedContext.data;
|
|
36
|
+
const taxLevels = {
|
|
37
|
+
subscription: explicitTaxIds(
|
|
38
|
+
subscription.default_tax_rates,
|
|
39
|
+
"original_subscription",
|
|
40
|
+
),
|
|
41
|
+
item: explicitTaxIds(item.tax_rates, "original_item"),
|
|
42
|
+
};
|
|
43
|
+
const projection = projectRenewalPhaseSettings({
|
|
44
|
+
context,
|
|
45
|
+
settings: {
|
|
46
|
+
application_fee_percent: subscription.application_fee_percent,
|
|
47
|
+
billing_thresholds: subscription.billing_thresholds,
|
|
48
|
+
collection_method: subscription.collection_method,
|
|
49
|
+
default_payment_method: subscription.default_payment_method,
|
|
50
|
+
on_behalf_of: subscription.on_behalf_of,
|
|
51
|
+
transfer_data: subscription.transfer_data,
|
|
52
|
+
automatic_tax: automaticTax.data,
|
|
53
|
+
default_tax_rates: subscription.default_tax_rates,
|
|
54
|
+
// days_until_due is a top-level Subscription field in Stripe 23.
|
|
55
|
+
invoice_settings: {
|
|
56
|
+
...invoice.data,
|
|
57
|
+
days_until_due: subscription.days_until_due,
|
|
58
|
+
},
|
|
59
|
+
description: subscription.description,
|
|
60
|
+
metadata: null,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
if (projection.status !== "projected")
|
|
64
|
+
unsupported(`unsupported_original_settings_${projection.reason}`);
|
|
65
|
+
const itemProjection = projectRenewalItemSettings({
|
|
66
|
+
effectiveAutomaticTax: context.effectiveAutomaticTax,
|
|
67
|
+
livemode: context.livemode,
|
|
68
|
+
settings: {
|
|
69
|
+
billing_thresholds: item.billing_thresholds,
|
|
70
|
+
tax_rates: item.tax_rates,
|
|
71
|
+
metadata: item.metadata,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
if (itemProjection.status !== "projected")
|
|
75
|
+
unsupported(`unsupported_original_${itemProjection.reason}`);
|
|
76
|
+
return {
|
|
77
|
+
context,
|
|
78
|
+
invoice: invoice.data,
|
|
79
|
+
automaticTax: automaticTax.data,
|
|
80
|
+
taxLevels,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { taxRate } from "./f08.mjs";
|
|
3
|
+
import { equal, unsupported } from "./f02.mjs";
|
|
4
|
+
/** Null/absent read hierarchies are not evidence of an explicit empty list. */
|
|
5
|
+
export function explicitTaxIds(value, level) {
|
|
6
|
+
const parsed = z.array(taxRate).max(20).safeParse(value);
|
|
7
|
+
if (!parsed.success) unsupported(`unproven_${level}_tax_hierarchy`);
|
|
8
|
+
return parsed.data.map((tax) => tax.id);
|
|
9
|
+
}
|
|
10
|
+
export function preserveTaxLevels(original, phaseTax, phaseItemTax) {
|
|
11
|
+
const phase = explicitTaxIds(phaseTax, "phase_default");
|
|
12
|
+
const item = explicitTaxIds(phaseItemTax, "phase_item");
|
|
13
|
+
if (!equal(original.subscription, phase))
|
|
14
|
+
unsupported("phase_default_tax_retention_mismatch");
|
|
15
|
+
// An empty item array means no item override. Its subscription/phase default
|
|
16
|
+
// applies instead. Equal current totals cannot authorize changing that level.
|
|
17
|
+
if (original.item.length > 0 !== item.length > 0)
|
|
18
|
+
unsupported("item_tax_override_level_changed");
|
|
19
|
+
if (!equal(original.item, item)) unsupported("item_tax_retention_mismatch");
|
|
20
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { renewalSnapshot } from "./f10.mjs";
|
|
3
|
+
import { taxRate } from "./f08.mjs";
|
|
4
|
+
const inputSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
effectiveAutomaticTax: z.boolean(),
|
|
7
|
+
livemode: z.boolean(),
|
|
8
|
+
settings: z
|
|
9
|
+
.object({
|
|
10
|
+
billing_thresholds: z.null(),
|
|
11
|
+
tax_rates: z.array(taxRate).max(20).nullable().optional(),
|
|
12
|
+
metadata: z
|
|
13
|
+
.record(z.string().max(40), z.string().min(1).max(500))
|
|
14
|
+
.nullable(),
|
|
15
|
+
})
|
|
16
|
+
.strict(),
|
|
17
|
+
})
|
|
18
|
+
.strict();
|
|
19
|
+
/** Field projection only. The assembler must derive effective tax from defaults. */
|
|
20
|
+
export function projectRenewalItemSettings(input) {
|
|
21
|
+
let args;
|
|
22
|
+
try {
|
|
23
|
+
args = inputSchema.parse(renewalSnapshot(input));
|
|
24
|
+
} catch {
|
|
25
|
+
return { status: "unsupported", reason: "unsupported_item_settings" };
|
|
26
|
+
}
|
|
27
|
+
const { settings: source } = args;
|
|
28
|
+
if (
|
|
29
|
+
(args.effectiveAutomaticTax && source.tax_rates?.length) ||
|
|
30
|
+
source.tax_rates?.some((tax) => tax.livemode !== args.livemode)
|
|
31
|
+
)
|
|
32
|
+
return { status: "unsupported", reason: "incompatible_item_tax" };
|
|
33
|
+
const settings = {};
|
|
34
|
+
if (source.tax_rates != null)
|
|
35
|
+
settings.tax_rates = source.tax_rates.length
|
|
36
|
+
? source.tax_rates.map((tax) => tax.id)
|
|
37
|
+
: "";
|
|
38
|
+
if (source.metadata !== null && Object.keys(source.metadata).length)
|
|
39
|
+
settings.metadata = source.metadata;
|
|
40
|
+
return { status: "projected", settings, requiresProviderQualification: true };
|
|
41
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { renewalSnapshot } from "./f10.mjs";
|
|
2
|
+
import { settingsInput } from "./f08.mjs";
|
|
3
|
+
const identity = (ref) => (typeof ref === "string" ? ref : ref.id);
|
|
4
|
+
/**
|
|
5
|
+
* Map only the named fields of a provider phase. The aggregate assembler must
|
|
6
|
+
* correlate context with its full acknowledged schedule and unchanged defaults.
|
|
7
|
+
* A projection is neither a complete phase nor evidence of provider retention.
|
|
8
|
+
*/
|
|
9
|
+
export function projectRenewalPhaseSettings(input) {
|
|
10
|
+
let args;
|
|
11
|
+
try {
|
|
12
|
+
args = settingsInput.parse(renewalSnapshot(input));
|
|
13
|
+
} catch {
|
|
14
|
+
return { status: "unsupported", reason: "unsupported_phase_settings" };
|
|
15
|
+
}
|
|
16
|
+
const { settings: source, context } = args;
|
|
17
|
+
const failure = (reason) => ({
|
|
18
|
+
status: "unsupported",
|
|
19
|
+
reason,
|
|
20
|
+
});
|
|
21
|
+
const referenceMatches = (ref) => {
|
|
22
|
+
if (ref == null || typeof ref === "string") return true;
|
|
23
|
+
const customer = ref.customer;
|
|
24
|
+
if (
|
|
25
|
+
typeof customer === "object" &&
|
|
26
|
+
customer !== null &&
|
|
27
|
+
((customer.livemode !== undefined &&
|
|
28
|
+
customer.livemode !== context.livemode) ||
|
|
29
|
+
(customer.customer_account !== undefined &&
|
|
30
|
+
customer.customer_account !== context.customerAccountId))
|
|
31
|
+
)
|
|
32
|
+
return false;
|
|
33
|
+
return (
|
|
34
|
+
(ref.livemode === undefined || ref.livemode === context.livemode) &&
|
|
35
|
+
(ref.customer_account == null ||
|
|
36
|
+
ref.customer_account === context.customerAccountId) &&
|
|
37
|
+
(customer == null || identity(customer) === context.customerId)
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
const references = [
|
|
41
|
+
source.default_payment_method,
|
|
42
|
+
source.on_behalf_of,
|
|
43
|
+
source.transfer_data?.destination,
|
|
44
|
+
...(source.invoice_settings?.account_tax_ids ?? []),
|
|
45
|
+
...(source.default_tax_rates ?? []),
|
|
46
|
+
source.automatic_tax?.liability?.account,
|
|
47
|
+
source.invoice_settings?.issuer?.account,
|
|
48
|
+
];
|
|
49
|
+
if (!references.every(referenceMatches))
|
|
50
|
+
return failure("foreign_setting_reference");
|
|
51
|
+
const issuerIdentity = (issuer) =>
|
|
52
|
+
issuer.type === "self" ? "self" : identity(issuer.account);
|
|
53
|
+
if (
|
|
54
|
+
source.invoice_settings?.issuer != null &&
|
|
55
|
+
issuerIdentity(source.invoice_settings.issuer) !==
|
|
56
|
+
issuerIdentity(context.effectiveInvoiceIssuer)
|
|
57
|
+
)
|
|
58
|
+
return failure("invoice_issuer_mismatch");
|
|
59
|
+
for (const taxId of source.invoice_settings?.account_tax_ids ?? []) {
|
|
60
|
+
if (typeof taxId === "string") continue;
|
|
61
|
+
const owner = taxId.owner;
|
|
62
|
+
if (
|
|
63
|
+
issuerIdentity(owner) !==
|
|
64
|
+
issuerIdentity(context.effectiveInvoiceIssuer) ||
|
|
65
|
+
(owner.type === "account" && !referenceMatches(owner.account))
|
|
66
|
+
)
|
|
67
|
+
return failure("foreign_invoice_tax_owner");
|
|
68
|
+
}
|
|
69
|
+
if (
|
|
70
|
+
source.collection_method != null &&
|
|
71
|
+
source.collection_method !== context.effectiveCollectionMethod
|
|
72
|
+
)
|
|
73
|
+
return failure("collection_method_mismatch");
|
|
74
|
+
if (
|
|
75
|
+
source.automatic_tax !== undefined &&
|
|
76
|
+
source.automatic_tax.enabled !== context.effectiveAutomaticTax
|
|
77
|
+
)
|
|
78
|
+
return failure("automatic_tax_mismatch");
|
|
79
|
+
if (context.effectiveAutomaticTax && source.default_tax_rates?.length)
|
|
80
|
+
return failure("automatic_and_manual_tax");
|
|
81
|
+
const out = {};
|
|
82
|
+
if (source.collection_method !== null)
|
|
83
|
+
out.collection_method = source.collection_method;
|
|
84
|
+
if (source.default_payment_method !== null)
|
|
85
|
+
out.default_payment_method = identity(source.default_payment_method);
|
|
86
|
+
if (source.on_behalf_of !== null)
|
|
87
|
+
out.on_behalf_of = identity(source.on_behalf_of);
|
|
88
|
+
if (source.transfer_data !== null) {
|
|
89
|
+
out.transfer_data = {
|
|
90
|
+
destination: identity(source.transfer_data.destination),
|
|
91
|
+
};
|
|
92
|
+
if (source.transfer_data.amount_percent !== null)
|
|
93
|
+
out.transfer_data.amount_percent = source.transfer_data.amount_percent;
|
|
94
|
+
}
|
|
95
|
+
const mapIssuer = (issuer) =>
|
|
96
|
+
issuer?.type === "account"
|
|
97
|
+
? { type: "account", account: identity(issuer.account) }
|
|
98
|
+
: { type: "self" };
|
|
99
|
+
if (source.automatic_tax !== undefined) {
|
|
100
|
+
out.automatic_tax = { enabled: source.automatic_tax.enabled };
|
|
101
|
+
if (source.automatic_tax.liability != null)
|
|
102
|
+
out.automatic_tax.liability = mapIssuer(source.automatic_tax.liability);
|
|
103
|
+
}
|
|
104
|
+
if (source.default_tax_rates != null)
|
|
105
|
+
out.default_tax_rates = source.default_tax_rates.length
|
|
106
|
+
? source.default_tax_rates.map(identity)
|
|
107
|
+
: "";
|
|
108
|
+
const invoice = source.invoice_settings;
|
|
109
|
+
if (invoice !== null) {
|
|
110
|
+
const mapped = {};
|
|
111
|
+
if (invoice.account_tax_ids !== null)
|
|
112
|
+
mapped.account_tax_ids = invoice.account_tax_ids.length
|
|
113
|
+
? invoice.account_tax_ids.map(identity)
|
|
114
|
+
: "";
|
|
115
|
+
if (invoice.custom_fields !== null)
|
|
116
|
+
mapped.custom_fields = invoice.custom_fields.length
|
|
117
|
+
? invoice.custom_fields.map(({ name, value }) => ({ name, value }))
|
|
118
|
+
: "";
|
|
119
|
+
if (invoice.issuer !== null) mapped.issuer = mapIssuer(invoice.issuer);
|
|
120
|
+
if (invoice.days_until_due !== null) {
|
|
121
|
+
if (context.effectiveCollectionMethod !== "send_invoice")
|
|
122
|
+
return failure("incompatible_invoice_due_days");
|
|
123
|
+
mapped.days_until_due = invoice.days_until_due;
|
|
124
|
+
}
|
|
125
|
+
if (invoice.description !== null) mapped.description = invoice.description;
|
|
126
|
+
if (invoice.footer !== null) mapped.footer = invoice.footer;
|
|
127
|
+
if (Object.keys(mapped).length) out.invoice_settings = mapped;
|
|
128
|
+
}
|
|
129
|
+
if (source.description !== null) out.description = source.description;
|
|
130
|
+
if (source.metadata !== null && Object.keys(source.metadata).length)
|
|
131
|
+
out.metadata = source.metadata;
|
|
132
|
+
return {
|
|
133
|
+
status: "projected",
|
|
134
|
+
settings: out,
|
|
135
|
+
requiresProviderQualification: true,
|
|
136
|
+
};
|
|
137
|
+
}
|