@jarwizz/create-jarshop 0.1.6 → 0.1.8
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/README.md +6 -1
- package/dist/cli.d.ts +14 -0
- package/dist/cli.js +27 -3
- package/dist/cli.js.map +1 -1
- package/dist/template/README.md +1 -1
- package/dist/template/i18n/dashboard/sk.po +6018 -0
- package/dist/template/package.json +6 -2
- package/dist/template/patches/@vendure__dashboard@3.7.1.patch +6535 -0
- package/dist/template/pnpm-lock.yaml +388 -2
- package/dist/template/pnpm-workspace.yaml +2 -0
- package/dist/template/src/plugins/jarshop-checkout/cod-payment-core.ts +102 -0
- package/dist/template/src/plugins/jarshop-checkout/cod-payment.test.ts +71 -1
- package/dist/template/src/plugins/jarshop-checkout/cod-payment.ts +13 -8
- package/dist/template/src/plugins/jarshop-checkout/dashboard/index.tsx +4 -0
- package/dist/template/src/plugins/jarshop-checkout/dashboard/login-branding.tsx +49 -0
- package/dist/template/src/plugins/jarshop-checkout/shipping-rates.ts +13 -0
- package/dist/template/src/seed.ts +34 -3
- package/dist/template/src/vendure-config.ts +9 -1
- package/dist/template/static/email/templates/partials/footer.hbs +1 -1
- package/dist/template/static/email/templates/partials/header.hbs +3 -1
- package/dist/template/turbo.json +1 -0
- package/dist/template/vite.config.mts +28 -1
- package/dist/template/vitest.config.ts +11 -0
- package/dist/template-manifest.json +1 -1
- package/package.json +1 -1
|
@@ -7,10 +7,19 @@ settings:
|
|
|
7
7
|
overrides:
|
|
8
8
|
eslint-import-resolver-typescript: 3.8.7
|
|
9
9
|
|
|
10
|
+
patchedDependencies:
|
|
11
|
+
'@vendure/dashboard@3.7.1': b2c0c0a597ac4bf69c5f19bc99f36e910661cbea1f5c6cc83b9582e6bd522148
|
|
12
|
+
|
|
10
13
|
importers:
|
|
11
14
|
|
|
12
15
|
.:
|
|
13
16
|
dependencies:
|
|
17
|
+
'@aws-sdk/client-s3':
|
|
18
|
+
specifier: 3.1121.0
|
|
19
|
+
version: 3.1121.0
|
|
20
|
+
'@aws-sdk/lib-storage':
|
|
21
|
+
specifier: 3.1121.0
|
|
22
|
+
version: 3.1121.0(@aws-sdk/client-s3@3.1121.0)
|
|
14
23
|
'@nestjs/common':
|
|
15
24
|
specifier: 11.1.28
|
|
16
25
|
version: 11.1.28(reflect-metadata@0.2.2)(rxjs@7.8.2)(supports-color@7.2.0)
|
|
@@ -28,7 +37,7 @@ importers:
|
|
|
28
37
|
version: 3.7.1(pg@8.22.0)(supports-color@7.2.0)(ts-morph@21.0.1)(ts-node@10.9.2(@types/node@24.13.3)(typescript@5.8.2))(typescript@5.8.2)
|
|
29
38
|
'@vendure/dashboard':
|
|
30
39
|
specifier: 3.7.1
|
|
31
|
-
version: 3.7.1(@date-fns/tz@1.5.0)(@floating-ui/dom@1.8.0)(@sinclair/typebox@0.27.12)(@standard-schema/spec@1.1.0)(@tanstack/router-core@1.171.17)(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/extensions@3.29.2(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/pm@3.29.2))(@types/node@24.13.3)(ajv-formats@2.1.1(ajv@8.20.0))(ajv@8.20.0)(csstype@3.2.3)(esbuild@0.28.1)(eslint@10.8.0(jiti@2.7.0)(supports-color@7.2.0))(express@5.2.1(supports-color@7.2.0))(jiti@2.7.0)(lightningcss@1.32.0)(next@16.2.12(@babel/core@7.29.7(supports-color@7.2.0))(react-dom@19.2.8(react@19.2.8))(react@19.2.4))(rollup@4.62.4)(supports-color@7.2.0)(tsx@4.20.3)(typescript@5.8.2)
|
|
40
|
+
version: 3.7.1(patch_hash=b2c0c0a597ac4bf69c5f19bc99f36e910661cbea1f5c6cc83b9582e6bd522148)(@date-fns/tz@1.5.0)(@floating-ui/dom@1.8.0)(@sinclair/typebox@0.27.12)(@standard-schema/spec@1.1.0)(@tanstack/router-core@1.171.17)(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/extensions@3.29.2(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/pm@3.29.2))(@types/node@24.13.3)(ajv-formats@2.1.1(ajv@8.20.0))(ajv@8.20.0)(csstype@3.2.3)(esbuild@0.28.1)(eslint@10.8.0(jiti@2.7.0)(supports-color@7.2.0))(express@5.2.1(supports-color@7.2.0))(jiti@2.7.0)(lightningcss@1.32.0)(next@16.2.12(@babel/core@7.29.7(supports-color@7.2.0))(react-dom@19.2.8(react@19.2.8))(react@19.2.4))(rollup@4.62.4)(supports-color@7.2.0)(tsx@4.20.3)(typescript@5.8.2)
|
|
32
41
|
'@vendure/email-plugin':
|
|
33
42
|
specifier: 3.7.1
|
|
34
43
|
version: 3.7.1(supports-color@7.2.0)(svgo@4.0.2)(typescript@5.8.2)
|
|
@@ -81,6 +90,9 @@ importers:
|
|
|
81
90
|
vite:
|
|
82
91
|
specifier: 7.3.6
|
|
83
92
|
version: 7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)
|
|
93
|
+
vitest:
|
|
94
|
+
specifier: 4.1.10
|
|
95
|
+
version: 4.1.10(@types/node@24.13.3)(msw@2.15.0(@types/node@24.13.3)(typescript@5.8.2))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3))
|
|
84
96
|
|
|
85
97
|
storefront:
|
|
86
98
|
dependencies:
|
|
@@ -243,6 +255,84 @@ packages:
|
|
|
243
255
|
'@apollographql/graphql-playground-html@1.6.29':
|
|
244
256
|
resolution: {integrity: sha512-xCcXpoz52rI4ksJSdOCxeOCn2DLocxwHf9dVT/Q90Pte1LX+LY+91SFtJF3KXVHH8kEin+g1KKCQPKBjZJfWNA==}
|
|
245
257
|
|
|
258
|
+
'@aws-sdk/checksums@3.1000.29':
|
|
259
|
+
resolution: {integrity: sha512-Dtu0gr4dnATZAPwEYbpCsG+MpLM7OAliy2gTepEFQwl1vZ6DL3QMH2FveMa3HLvPsOdhJsPRB3KtxVhph9T75A==}
|
|
260
|
+
engines: {node: '>=20.0.0'}
|
|
261
|
+
|
|
262
|
+
'@aws-sdk/client-s3@3.1121.0':
|
|
263
|
+
resolution: {integrity: sha512-hBnoqaVBeWdkgXcJElMXA2yUZWkBCBntu2qmN+tfqmzC+j4LzJC3ox8qIgS2WdMS1cb8UwyBogUVrkRXybNm0A==}
|
|
264
|
+
engines: {node: '>=20.0.0'}
|
|
265
|
+
|
|
266
|
+
'@aws-sdk/core@3.977.9':
|
|
267
|
+
resolution: {integrity: sha512-reqPFEQrZxDZpeGj4PFMepBeR5LGYHRqq/L0motTzgFkCRBA4rFdaVXDSLYyGHhxVz7sT2PDnPN9CluGSfgyJA==}
|
|
268
|
+
engines: {node: '>=20.0.0'}
|
|
269
|
+
|
|
270
|
+
'@aws-sdk/credential-provider-env@3.972.70':
|
|
271
|
+
resolution: {integrity: sha512-H404B7dJl2mCrBqahDEYsanB0xhdDp6tXnXcTUnXmmpy2Q3J0Ho0bUajZ2jr/RdwzCyS59Gi8xXIFwPLGBl6Uw==}
|
|
272
|
+
engines: {node: '>=20.0.0'}
|
|
273
|
+
|
|
274
|
+
'@aws-sdk/credential-provider-http@3.972.72':
|
|
275
|
+
resolution: {integrity: sha512-X98zYOrVOeuosCX+6ktf29FC2N2GHPLia7qv6mzPzTc+RPAuHWCDS++Z6JK7eGYqb/v6uaW7bAXaOvDBfol+0w==}
|
|
276
|
+
engines: {node: '>=20.0.0'}
|
|
277
|
+
|
|
278
|
+
'@aws-sdk/credential-provider-ini@3.973.15':
|
|
279
|
+
resolution: {integrity: sha512-Rykg6s5ceBuynMOGWgoowO4N+27JfnqXAnVaSunZl0hOO1XodSrxGNz6sCEbnmS0lAfQZDKyb3fbr46gSuv6Sg==}
|
|
280
|
+
engines: {node: '>=20.0.0'}
|
|
281
|
+
|
|
282
|
+
'@aws-sdk/credential-provider-login@3.972.77':
|
|
283
|
+
resolution: {integrity: sha512-Jb59xfEISoN5mmbnA+HYqdtrSX3CgCtJoof+V5D8/TgUI56W63GEEd5Y58WijU3Ou6+WEgaLD1feVzaRXV5IDQ==}
|
|
284
|
+
engines: {node: '>=20.0.0'}
|
|
285
|
+
|
|
286
|
+
'@aws-sdk/credential-provider-node@3.972.81':
|
|
287
|
+
resolution: {integrity: sha512-Rml+WitoFvXmv6JZ18U/xGdGDGGvB/mOin0ya0lTnTrdC0Z1lrVxTYh7iNklZBcvcRMrs4DoEf6xy1KWyrLQQw==}
|
|
288
|
+
engines: {node: '>=20.0.0'}
|
|
289
|
+
|
|
290
|
+
'@aws-sdk/credential-provider-process@3.972.70':
|
|
291
|
+
resolution: {integrity: sha512-2ry03fGRJr4sV3jI+ocjj5JqALnFD6ymM5KiNCDZMvq8bX2GSbE0vji4aM43TVCl2nXqqLRZaUxdq/KeWRAY4Q==}
|
|
292
|
+
engines: {node: '>=20.0.0'}
|
|
293
|
+
|
|
294
|
+
'@aws-sdk/credential-provider-sso@3.973.14':
|
|
295
|
+
resolution: {integrity: sha512-jkhg/8ocAAoc0RFyLMhCw+/zZh7gystQgd4F4hznNa8P4Cc501PQmxd+jGLiMHodPJ+7Zv/3znM62gZojyasmA==}
|
|
296
|
+
engines: {node: '>=20.0.0'}
|
|
297
|
+
|
|
298
|
+
'@aws-sdk/credential-provider-web-identity@3.972.76':
|
|
299
|
+
resolution: {integrity: sha512-d3AGyVu759PGr35mEB2s22xxlNEA5rpdxtSPJthfPFJvoQ8dt357iVPECqWfUxXp1toJAvKmbtcIYVGigaGsCA==}
|
|
300
|
+
engines: {node: '>=20.0.0'}
|
|
301
|
+
|
|
302
|
+
'@aws-sdk/lib-storage@3.1121.0':
|
|
303
|
+
resolution: {integrity: sha512-sx86QqM0/HjKNCS5eQGcaP9Q8GKg3FtCExO/6FfGyw00JNUsFJPmEKNCJIkWY7OmKS9jIOuJe/DtAgfr/+G/bQ==}
|
|
304
|
+
engines: {node: '>=20.0.0'}
|
|
305
|
+
peerDependencies:
|
|
306
|
+
'@aws-sdk/client-s3': ^3.1121.0
|
|
307
|
+
|
|
308
|
+
'@aws-sdk/middleware-sdk-s3@3.972.75':
|
|
309
|
+
resolution: {integrity: sha512-wMIsNumRVKaNMKhvU/s9VrdEwE8S6gSzXp4RygFG5BEMnGkkXf8cjh8zf7cKJBpUDpqTWqwbz5isEgp9rH6Lng==}
|
|
310
|
+
engines: {node: '>=20.0.0'}
|
|
311
|
+
|
|
312
|
+
'@aws-sdk/nested-clients@3.997.44':
|
|
313
|
+
resolution: {integrity: sha512-NhEgryjlBF9w38ZXqGymQV28IhkYa1mKhlbYnqIis57AYwWGVYfUPgg/qC2rLRqOUfblxx++irvju10kVTa8Vw==}
|
|
314
|
+
engines: {node: '>=20.0.0'}
|
|
315
|
+
|
|
316
|
+
'@aws-sdk/signature-v4-multi-region@3.996.46':
|
|
317
|
+
resolution: {integrity: sha512-L+2xZTye/2T96f3lwCws0Zw6GG2JHZW9e8FpVgGBeeExSKyeoZ6CWRpBml/7DNiK/O26jrgPM9F+Ay8VkgzUWQ==}
|
|
318
|
+
engines: {node: '>=20.0.0'}
|
|
319
|
+
|
|
320
|
+
'@aws-sdk/token-providers@3.1116.0':
|
|
321
|
+
resolution: {integrity: sha512-ygIivKqh8aHzNkucOCXHyIBgBpLPfrSI0mCqXF+vLBsPTUKqj0VSqAY0GFPe7lQl4HntjOcQ+KSyS7oUV2C54Q==}
|
|
322
|
+
engines: {node: '>=20.0.0'}
|
|
323
|
+
|
|
324
|
+
'@aws-sdk/types@3.974.5':
|
|
325
|
+
resolution: {integrity: sha512-LkwLL2BLbC6wNNm4JaH9mbEqBMdOZCct6VAYqhdN4U1xrWM+fUJQEfbHwQgDypapOWTRtlk25akb5afM0P8CIQ==}
|
|
326
|
+
engines: {node: '>=20.0.0'}
|
|
327
|
+
|
|
328
|
+
'@aws-sdk/xml-builder@3.972.40':
|
|
329
|
+
resolution: {integrity: sha512-wlFmCIGUlwF4zx/kncw+bmxTQh1HeSJq4mYV/V5cZUSJadDP3kXvGW8Rn21cimj/7y9ju+47oYWXi97vF7czaA==}
|
|
330
|
+
engines: {node: '>=20.0.0'}
|
|
331
|
+
|
|
332
|
+
'@aws/lambda-invoke-store@0.3.0':
|
|
333
|
+
resolution: {integrity: sha512-sl4Bm6yiMNYrZKkqqDFWN0UfnWhlS8ivKxrYl+6t0gCLrqr8y3B2IqZZbFRkfaVVp7C/baApyh71P+LeE1A2sQ==}
|
|
334
|
+
engines: {node: '>=18.0.0'}
|
|
335
|
+
|
|
246
336
|
'@babel/code-frame@7.29.7':
|
|
247
337
|
resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==}
|
|
248
338
|
engines: {node: '>=6.9.0'}
|
|
@@ -1986,6 +2076,30 @@ packages:
|
|
|
1986
2076
|
resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==}
|
|
1987
2077
|
engines: {node: '>=18'}
|
|
1988
2078
|
|
|
2079
|
+
'@smithy/core@3.33.3':
|
|
2080
|
+
resolution: {integrity: sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg==}
|
|
2081
|
+
engines: {node: '>=18.0.0'}
|
|
2082
|
+
|
|
2083
|
+
'@smithy/credential-provider-imds@4.5.2':
|
|
2084
|
+
resolution: {integrity: sha512-A9uSdn72ozbRUSit0eib0TW7nXuNPlaeM0zcGkJ+nE6tFcSDbnmtwoxbTCFBukVQcszDAyvsd7+rTduPTXpygg==}
|
|
2085
|
+
engines: {node: '>=18.0.0'}
|
|
2086
|
+
|
|
2087
|
+
'@smithy/fetch-http-handler@5.7.2':
|
|
2088
|
+
resolution: {integrity: sha512-nZyWTmSpJEXl6VtWVMBJve/7x12DZu6sIX1z1a+ZMaHlQQRs9Zpu6NbTe/gmxYXVRpkjxyDYpZ5gx2IM6f/Wkw==}
|
|
2089
|
+
engines: {node: '>=18.0.0'}
|
|
2090
|
+
|
|
2091
|
+
'@smithy/node-http-handler@4.11.3':
|
|
2092
|
+
resolution: {integrity: sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA==}
|
|
2093
|
+
engines: {node: '>=18.0.0'}
|
|
2094
|
+
|
|
2095
|
+
'@smithy/signature-v4@5.7.3':
|
|
2096
|
+
resolution: {integrity: sha512-7ImGm+FkHRLcBaRttIAMZ6bzJZWb2cJGoYjq46F2UjycujWzrL9GEN9h4w7eQyXJYnltrUhxbbieBAIRrdqpow==}
|
|
2097
|
+
engines: {node: '>=18.0.0'}
|
|
2098
|
+
|
|
2099
|
+
'@smithy/types@4.17.2':
|
|
2100
|
+
resolution: {integrity: sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA==}
|
|
2101
|
+
engines: {node: '>=18.0.0'}
|
|
2102
|
+
|
|
1989
2103
|
'@sqltools/formatter@1.2.5':
|
|
1990
2104
|
resolution: {integrity: sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==}
|
|
1991
2105
|
|
|
@@ -3079,6 +3193,9 @@ packages:
|
|
|
3079
3193
|
boolbase@1.0.0:
|
|
3080
3194
|
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
|
|
3081
3195
|
|
|
3196
|
+
bowser@2.14.1:
|
|
3197
|
+
resolution: {integrity: sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg==}
|
|
3198
|
+
|
|
3082
3199
|
brace-expansion@1.1.18:
|
|
3083
3200
|
resolution: {integrity: sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==}
|
|
3084
3201
|
|
|
@@ -3101,6 +3218,9 @@ packages:
|
|
|
3101
3218
|
buffer-from@1.1.2:
|
|
3102
3219
|
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
|
|
3103
3220
|
|
|
3221
|
+
buffer@5.6.0:
|
|
3222
|
+
resolution: {integrity: sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==}
|
|
3223
|
+
|
|
3104
3224
|
buffer@5.7.1:
|
|
3105
3225
|
resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
|
|
3106
3226
|
|
|
@@ -3935,6 +4055,7 @@ packages:
|
|
|
3935
4055
|
eslint@9.39.5:
|
|
3936
4056
|
resolution: {integrity: sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw==}
|
|
3937
4057
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
|
4058
|
+
deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
|
|
3938
4059
|
hasBin: true
|
|
3939
4060
|
peerDependencies:
|
|
3940
4061
|
jiti: '*'
|
|
@@ -3988,6 +4109,10 @@ packages:
|
|
|
3988
4109
|
eventemitter3@4.0.7:
|
|
3989
4110
|
resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==}
|
|
3990
4111
|
|
|
4112
|
+
events@3.3.0:
|
|
4113
|
+
resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==}
|
|
4114
|
+
engines: {node: '>=0.8.x'}
|
|
4115
|
+
|
|
3991
4116
|
eventsource-parser@3.1.0:
|
|
3992
4117
|
resolution: {integrity: sha512-kJezFj9YFAMLeORyi7aCLxLbD5/qWMQnoMVlVPyHIll7lgRJCc3JVln9Vgl9nwQi0YkMnhdGTMNn7CkRRAptMg==}
|
|
3993
4118
|
engines: {node: '>=18.0.0'}
|
|
@@ -6423,6 +6548,9 @@ packages:
|
|
|
6423
6548
|
resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==}
|
|
6424
6549
|
engines: {node: '>= 0.4'}
|
|
6425
6550
|
|
|
6551
|
+
stream-browserify@3.0.0:
|
|
6552
|
+
resolution: {integrity: sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==}
|
|
6553
|
+
|
|
6426
6554
|
streamsearch@1.1.0:
|
|
6427
6555
|
resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==}
|
|
6428
6556
|
engines: {node: '>=10.0.0'}
|
|
@@ -7337,6 +7465,181 @@ snapshots:
|
|
|
7337
7465
|
dependencies:
|
|
7338
7466
|
xss: 1.0.15
|
|
7339
7467
|
|
|
7468
|
+
'@aws-sdk/checksums@3.1000.29':
|
|
7469
|
+
dependencies:
|
|
7470
|
+
'@aws-sdk/core': 3.977.9
|
|
7471
|
+
'@aws-sdk/types': 3.974.5
|
|
7472
|
+
'@smithy/core': 3.33.3
|
|
7473
|
+
'@smithy/types': 4.17.2
|
|
7474
|
+
tslib: 2.8.1
|
|
7475
|
+
|
|
7476
|
+
'@aws-sdk/client-s3@3.1121.0':
|
|
7477
|
+
dependencies:
|
|
7478
|
+
'@aws-sdk/checksums': 3.1000.29
|
|
7479
|
+
'@aws-sdk/core': 3.977.9
|
|
7480
|
+
'@aws-sdk/credential-provider-node': 3.972.81
|
|
7481
|
+
'@aws-sdk/middleware-sdk-s3': 3.972.75
|
|
7482
|
+
'@aws-sdk/signature-v4-multi-region': 3.996.46
|
|
7483
|
+
'@aws-sdk/types': 3.974.5
|
|
7484
|
+
'@smithy/core': 3.33.3
|
|
7485
|
+
'@smithy/fetch-http-handler': 5.7.2
|
|
7486
|
+
'@smithy/node-http-handler': 4.11.3
|
|
7487
|
+
'@smithy/types': 4.17.2
|
|
7488
|
+
tslib: 2.8.1
|
|
7489
|
+
|
|
7490
|
+
'@aws-sdk/core@3.977.9':
|
|
7491
|
+
dependencies:
|
|
7492
|
+
'@aws-sdk/types': 3.974.5
|
|
7493
|
+
'@aws-sdk/xml-builder': 3.972.40
|
|
7494
|
+
'@aws/lambda-invoke-store': 0.3.0
|
|
7495
|
+
'@smithy/core': 3.33.3
|
|
7496
|
+
'@smithy/signature-v4': 5.7.3
|
|
7497
|
+
'@smithy/types': 4.17.2
|
|
7498
|
+
bowser: 2.14.1
|
|
7499
|
+
tslib: 2.8.1
|
|
7500
|
+
|
|
7501
|
+
'@aws-sdk/credential-provider-env@3.972.70':
|
|
7502
|
+
dependencies:
|
|
7503
|
+
'@aws-sdk/core': 3.977.9
|
|
7504
|
+
'@aws-sdk/types': 3.974.5
|
|
7505
|
+
'@smithy/core': 3.33.3
|
|
7506
|
+
'@smithy/types': 4.17.2
|
|
7507
|
+
tslib: 2.8.1
|
|
7508
|
+
|
|
7509
|
+
'@aws-sdk/credential-provider-http@3.972.72':
|
|
7510
|
+
dependencies:
|
|
7511
|
+
'@aws-sdk/core': 3.977.9
|
|
7512
|
+
'@aws-sdk/types': 3.974.5
|
|
7513
|
+
'@smithy/core': 3.33.3
|
|
7514
|
+
'@smithy/fetch-http-handler': 5.7.2
|
|
7515
|
+
'@smithy/node-http-handler': 4.11.3
|
|
7516
|
+
'@smithy/types': 4.17.2
|
|
7517
|
+
tslib: 2.8.1
|
|
7518
|
+
|
|
7519
|
+
'@aws-sdk/credential-provider-ini@3.973.15':
|
|
7520
|
+
dependencies:
|
|
7521
|
+
'@aws-sdk/core': 3.977.9
|
|
7522
|
+
'@aws-sdk/credential-provider-env': 3.972.70
|
|
7523
|
+
'@aws-sdk/credential-provider-http': 3.972.72
|
|
7524
|
+
'@aws-sdk/credential-provider-login': 3.972.77
|
|
7525
|
+
'@aws-sdk/credential-provider-process': 3.972.70
|
|
7526
|
+
'@aws-sdk/credential-provider-sso': 3.973.14
|
|
7527
|
+
'@aws-sdk/credential-provider-web-identity': 3.972.76
|
|
7528
|
+
'@aws-sdk/nested-clients': 3.997.44
|
|
7529
|
+
'@aws-sdk/types': 3.974.5
|
|
7530
|
+
'@smithy/core': 3.33.3
|
|
7531
|
+
'@smithy/credential-provider-imds': 4.5.2
|
|
7532
|
+
'@smithy/types': 4.17.2
|
|
7533
|
+
tslib: 2.8.1
|
|
7534
|
+
|
|
7535
|
+
'@aws-sdk/credential-provider-login@3.972.77':
|
|
7536
|
+
dependencies:
|
|
7537
|
+
'@aws-sdk/core': 3.977.9
|
|
7538
|
+
'@aws-sdk/nested-clients': 3.997.44
|
|
7539
|
+
'@aws-sdk/types': 3.974.5
|
|
7540
|
+
'@smithy/core': 3.33.3
|
|
7541
|
+
'@smithy/types': 4.17.2
|
|
7542
|
+
tslib: 2.8.1
|
|
7543
|
+
|
|
7544
|
+
'@aws-sdk/credential-provider-node@3.972.81':
|
|
7545
|
+
dependencies:
|
|
7546
|
+
'@aws-sdk/credential-provider-env': 3.972.70
|
|
7547
|
+
'@aws-sdk/credential-provider-http': 3.972.72
|
|
7548
|
+
'@aws-sdk/credential-provider-ini': 3.973.15
|
|
7549
|
+
'@aws-sdk/credential-provider-process': 3.972.70
|
|
7550
|
+
'@aws-sdk/credential-provider-sso': 3.973.14
|
|
7551
|
+
'@aws-sdk/credential-provider-web-identity': 3.972.76
|
|
7552
|
+
'@aws-sdk/types': 3.974.5
|
|
7553
|
+
'@smithy/core': 3.33.3
|
|
7554
|
+
'@smithy/credential-provider-imds': 4.5.2
|
|
7555
|
+
'@smithy/types': 4.17.2
|
|
7556
|
+
tslib: 2.8.1
|
|
7557
|
+
|
|
7558
|
+
'@aws-sdk/credential-provider-process@3.972.70':
|
|
7559
|
+
dependencies:
|
|
7560
|
+
'@aws-sdk/core': 3.977.9
|
|
7561
|
+
'@aws-sdk/types': 3.974.5
|
|
7562
|
+
'@smithy/core': 3.33.3
|
|
7563
|
+
'@smithy/types': 4.17.2
|
|
7564
|
+
tslib: 2.8.1
|
|
7565
|
+
|
|
7566
|
+
'@aws-sdk/credential-provider-sso@3.973.14':
|
|
7567
|
+
dependencies:
|
|
7568
|
+
'@aws-sdk/core': 3.977.9
|
|
7569
|
+
'@aws-sdk/nested-clients': 3.997.44
|
|
7570
|
+
'@aws-sdk/token-providers': 3.1116.0
|
|
7571
|
+
'@aws-sdk/types': 3.974.5
|
|
7572
|
+
'@smithy/core': 3.33.3
|
|
7573
|
+
'@smithy/types': 4.17.2
|
|
7574
|
+
tslib: 2.8.1
|
|
7575
|
+
|
|
7576
|
+
'@aws-sdk/credential-provider-web-identity@3.972.76':
|
|
7577
|
+
dependencies:
|
|
7578
|
+
'@aws-sdk/core': 3.977.9
|
|
7579
|
+
'@aws-sdk/nested-clients': 3.997.44
|
|
7580
|
+
'@aws-sdk/types': 3.974.5
|
|
7581
|
+
'@smithy/core': 3.33.3
|
|
7582
|
+
'@smithy/types': 4.17.2
|
|
7583
|
+
tslib: 2.8.1
|
|
7584
|
+
|
|
7585
|
+
'@aws-sdk/lib-storage@3.1121.0(@aws-sdk/client-s3@3.1121.0)':
|
|
7586
|
+
dependencies:
|
|
7587
|
+
'@aws-sdk/client-s3': 3.1121.0
|
|
7588
|
+
'@smithy/core': 3.33.3
|
|
7589
|
+
'@smithy/types': 4.17.2
|
|
7590
|
+
buffer: 5.6.0
|
|
7591
|
+
events: 3.3.0
|
|
7592
|
+
stream-browserify: 3.0.0
|
|
7593
|
+
tslib: 2.8.1
|
|
7594
|
+
|
|
7595
|
+
'@aws-sdk/middleware-sdk-s3@3.972.75':
|
|
7596
|
+
dependencies:
|
|
7597
|
+
'@aws-sdk/core': 3.977.9
|
|
7598
|
+
'@aws-sdk/signature-v4-multi-region': 3.996.46
|
|
7599
|
+
'@aws-sdk/types': 3.974.5
|
|
7600
|
+
'@smithy/core': 3.33.3
|
|
7601
|
+
'@smithy/types': 4.17.2
|
|
7602
|
+
tslib: 2.8.1
|
|
7603
|
+
|
|
7604
|
+
'@aws-sdk/nested-clients@3.997.44':
|
|
7605
|
+
dependencies:
|
|
7606
|
+
'@aws-sdk/core': 3.977.9
|
|
7607
|
+
'@aws-sdk/signature-v4-multi-region': 3.996.46
|
|
7608
|
+
'@aws-sdk/types': 3.974.5
|
|
7609
|
+
'@smithy/core': 3.33.3
|
|
7610
|
+
'@smithy/fetch-http-handler': 5.7.2
|
|
7611
|
+
'@smithy/node-http-handler': 4.11.3
|
|
7612
|
+
'@smithy/types': 4.17.2
|
|
7613
|
+
tslib: 2.8.1
|
|
7614
|
+
|
|
7615
|
+
'@aws-sdk/signature-v4-multi-region@3.996.46':
|
|
7616
|
+
dependencies:
|
|
7617
|
+
'@aws-sdk/types': 3.974.5
|
|
7618
|
+
'@smithy/signature-v4': 5.7.3
|
|
7619
|
+
'@smithy/types': 4.17.2
|
|
7620
|
+
tslib: 2.8.1
|
|
7621
|
+
|
|
7622
|
+
'@aws-sdk/token-providers@3.1116.0':
|
|
7623
|
+
dependencies:
|
|
7624
|
+
'@aws-sdk/core': 3.977.9
|
|
7625
|
+
'@aws-sdk/nested-clients': 3.997.44
|
|
7626
|
+
'@aws-sdk/types': 3.974.5
|
|
7627
|
+
'@smithy/core': 3.33.3
|
|
7628
|
+
'@smithy/types': 4.17.2
|
|
7629
|
+
tslib: 2.8.1
|
|
7630
|
+
|
|
7631
|
+
'@aws-sdk/types@3.974.5':
|
|
7632
|
+
dependencies:
|
|
7633
|
+
'@smithy/types': 4.17.2
|
|
7634
|
+
tslib: 2.8.1
|
|
7635
|
+
|
|
7636
|
+
'@aws-sdk/xml-builder@3.972.40':
|
|
7637
|
+
dependencies:
|
|
7638
|
+
'@smithy/types': 4.17.2
|
|
7639
|
+
tslib: 2.8.1
|
|
7640
|
+
|
|
7641
|
+
'@aws/lambda-invoke-store@0.3.0': {}
|
|
7642
|
+
|
|
7340
7643
|
'@babel/code-frame@7.29.7':
|
|
7341
7644
|
dependencies:
|
|
7342
7645
|
'@babel/helper-validator-identifier': 7.29.7
|
|
@@ -8839,6 +9142,39 @@ snapshots:
|
|
|
8839
9142
|
|
|
8840
9143
|
'@sindresorhus/merge-streams@4.0.0': {}
|
|
8841
9144
|
|
|
9145
|
+
'@smithy/core@3.33.3':
|
|
9146
|
+
dependencies:
|
|
9147
|
+
'@smithy/types': 4.17.2
|
|
9148
|
+
tslib: 2.8.1
|
|
9149
|
+
|
|
9150
|
+
'@smithy/credential-provider-imds@4.5.2':
|
|
9151
|
+
dependencies:
|
|
9152
|
+
'@smithy/core': 3.33.3
|
|
9153
|
+
'@smithy/types': 4.17.2
|
|
9154
|
+
tslib: 2.8.1
|
|
9155
|
+
|
|
9156
|
+
'@smithy/fetch-http-handler@5.7.2':
|
|
9157
|
+
dependencies:
|
|
9158
|
+
'@smithy/core': 3.33.3
|
|
9159
|
+
'@smithy/types': 4.17.2
|
|
9160
|
+
tslib: 2.8.1
|
|
9161
|
+
|
|
9162
|
+
'@smithy/node-http-handler@4.11.3':
|
|
9163
|
+
dependencies:
|
|
9164
|
+
'@smithy/core': 3.33.3
|
|
9165
|
+
'@smithy/types': 4.17.2
|
|
9166
|
+
tslib: 2.8.1
|
|
9167
|
+
|
|
9168
|
+
'@smithy/signature-v4@5.7.3':
|
|
9169
|
+
dependencies:
|
|
9170
|
+
'@smithy/core': 3.33.3
|
|
9171
|
+
'@smithy/types': 4.17.2
|
|
9172
|
+
tslib: 2.8.1
|
|
9173
|
+
|
|
9174
|
+
'@smithy/types@4.17.2':
|
|
9175
|
+
dependencies:
|
|
9176
|
+
tslib: 2.8.1
|
|
9177
|
+
|
|
8842
9178
|
'@sqltools/formatter@1.2.5': {}
|
|
8843
9179
|
|
|
8844
9180
|
'@standard-schema/spec@1.1.0': {}
|
|
@@ -9844,7 +10180,7 @@ snapshots:
|
|
|
9844
10180
|
- uWebSockets.js
|
|
9845
10181
|
- utf-8-validate
|
|
9846
10182
|
|
|
9847
|
-
'@vendure/dashboard@3.7.1(@date-fns/tz@1.5.0)(@floating-ui/dom@1.8.0)(@sinclair/typebox@0.27.12)(@standard-schema/spec@1.1.0)(@tanstack/router-core@1.171.17)(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/extensions@3.29.2(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/pm@3.29.2))(@types/node@24.13.3)(ajv-formats@2.1.1(ajv@8.20.0))(ajv@8.20.0)(csstype@3.2.3)(esbuild@0.28.1)(eslint@10.8.0(jiti@2.7.0)(supports-color@7.2.0))(express@5.2.1(supports-color@7.2.0))(jiti@2.7.0)(lightningcss@1.32.0)(next@16.2.12(@babel/core@7.29.7(supports-color@7.2.0))(react-dom@19.2.8(react@19.2.8))(react@19.2.4))(rollup@4.62.4)(supports-color@7.2.0)(tsx@4.20.3)(typescript@5.8.2)':
|
|
10183
|
+
'@vendure/dashboard@3.7.1(patch_hash=b2c0c0a597ac4bf69c5f19bc99f36e910661cbea1f5c6cc83b9582e6bd522148)(@date-fns/tz@1.5.0)(@floating-ui/dom@1.8.0)(@sinclair/typebox@0.27.12)(@standard-schema/spec@1.1.0)(@tanstack/router-core@1.171.17)(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/extensions@3.29.2(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/pm@3.29.2))(@types/node@24.13.3)(ajv-formats@2.1.1(ajv@8.20.0))(ajv@8.20.0)(csstype@3.2.3)(esbuild@0.28.1)(eslint@10.8.0(jiti@2.7.0)(supports-color@7.2.0))(express@5.2.1(supports-color@7.2.0))(jiti@2.7.0)(lightningcss@1.32.0)(next@16.2.12(@babel/core@7.29.7(supports-color@7.2.0))(react-dom@19.2.8(react@19.2.8))(react@19.2.4))(rollup@4.62.4)(supports-color@7.2.0)(tsx@4.20.3)(typescript@5.8.2)':
|
|
9848
10184
|
dependencies:
|
|
9849
10185
|
'@babel/core': 7.29.7(supports-color@7.2.0)
|
|
9850
10186
|
'@babel/preset-react': 7.29.7(@babel/core@7.29.7(supports-color@7.2.0))(supports-color@7.2.0)
|
|
@@ -10024,6 +10360,15 @@ snapshots:
|
|
|
10024
10360
|
chai: 6.2.2
|
|
10025
10361
|
tinyrainbow: 3.1.1
|
|
10026
10362
|
|
|
10363
|
+
'@vitest/mocker@4.1.10(msw@2.15.0(@types/node@24.13.3)(typescript@5.8.2))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3))':
|
|
10364
|
+
dependencies:
|
|
10365
|
+
'@vitest/spy': 4.1.10
|
|
10366
|
+
estree-walker: 3.0.3
|
|
10367
|
+
magic-string: 0.30.21
|
|
10368
|
+
optionalDependencies:
|
|
10369
|
+
msw: 2.15.0(@types/node@24.13.3)(typescript@5.8.2)
|
|
10370
|
+
vite: 7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)
|
|
10371
|
+
|
|
10027
10372
|
'@vitest/mocker@4.1.10(msw@2.15.0(@types/node@24.13.3)(typescript@6.0.3))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3))':
|
|
10028
10373
|
dependencies:
|
|
10029
10374
|
'@vitest/spy': 4.1.10
|
|
@@ -10311,6 +10656,8 @@ snapshots:
|
|
|
10311
10656
|
|
|
10312
10657
|
boolbase@1.0.0: {}
|
|
10313
10658
|
|
|
10659
|
+
bowser@2.14.1: {}
|
|
10660
|
+
|
|
10314
10661
|
brace-expansion@1.1.18:
|
|
10315
10662
|
dependencies:
|
|
10316
10663
|
balanced-match: 1.0.2
|
|
@@ -10338,6 +10685,11 @@ snapshots:
|
|
|
10338
10685
|
|
|
10339
10686
|
buffer-from@1.1.2: {}
|
|
10340
10687
|
|
|
10688
|
+
buffer@5.6.0:
|
|
10689
|
+
dependencies:
|
|
10690
|
+
base64-js: 1.5.1
|
|
10691
|
+
ieee754: 1.2.1
|
|
10692
|
+
|
|
10341
10693
|
buffer@5.7.1:
|
|
10342
10694
|
dependencies:
|
|
10343
10695
|
base64-js: 1.5.1
|
|
@@ -11472,6 +11824,8 @@ snapshots:
|
|
|
11472
11824
|
|
|
11473
11825
|
eventemitter3@4.0.7: {}
|
|
11474
11826
|
|
|
11827
|
+
events@3.3.0: {}
|
|
11828
|
+
|
|
11475
11829
|
eventsource-parser@3.1.0: {}
|
|
11476
11830
|
|
|
11477
11831
|
eventsource@3.0.7:
|
|
@@ -14424,6 +14778,11 @@ snapshots:
|
|
|
14424
14778
|
es-errors: 1.3.0
|
|
14425
14779
|
internal-slot: 1.1.0
|
|
14426
14780
|
|
|
14781
|
+
stream-browserify@3.0.0:
|
|
14782
|
+
dependencies:
|
|
14783
|
+
inherits: 2.0.4
|
|
14784
|
+
readable-stream: 3.6.2
|
|
14785
|
+
|
|
14427
14786
|
streamsearch@1.1.0: {}
|
|
14428
14787
|
|
|
14429
14788
|
strict-event-emitter@0.5.1: {}
|
|
@@ -14956,6 +15315,33 @@ snapshots:
|
|
|
14956
15315
|
lightningcss: 1.32.0
|
|
14957
15316
|
tsx: 4.20.3
|
|
14958
15317
|
|
|
15318
|
+
vitest@4.1.10(@types/node@24.13.3)(msw@2.15.0(@types/node@24.13.3)(typescript@5.8.2))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)):
|
|
15319
|
+
dependencies:
|
|
15320
|
+
'@vitest/expect': 4.1.10
|
|
15321
|
+
'@vitest/mocker': 4.1.10(msw@2.15.0(@types/node@24.13.3)(typescript@5.8.2))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3))
|
|
15322
|
+
'@vitest/pretty-format': 4.1.10
|
|
15323
|
+
'@vitest/runner': 4.1.10
|
|
15324
|
+
'@vitest/snapshot': 4.1.10
|
|
15325
|
+
'@vitest/spy': 4.1.10
|
|
15326
|
+
'@vitest/utils': 4.1.10
|
|
15327
|
+
es-module-lexer: 2.3.2
|
|
15328
|
+
expect-type: 1.4.0
|
|
15329
|
+
magic-string: 0.30.21
|
|
15330
|
+
obug: 2.1.4
|
|
15331
|
+
pathe: 2.0.3
|
|
15332
|
+
picomatch: 4.0.5
|
|
15333
|
+
std-env: 4.2.0
|
|
15334
|
+
tinybench: 2.9.0
|
|
15335
|
+
tinyexec: 1.3.0
|
|
15336
|
+
tinyglobby: 0.2.17
|
|
15337
|
+
tinyrainbow: 3.1.1
|
|
15338
|
+
vite: 7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)
|
|
15339
|
+
why-is-node-running: 2.3.0
|
|
15340
|
+
optionalDependencies:
|
|
15341
|
+
'@types/node': 24.13.3
|
|
15342
|
+
transitivePeerDependencies:
|
|
15343
|
+
- msw
|
|
15344
|
+
|
|
14959
15345
|
vitest@4.1.10(@types/node@24.13.3)(msw@2.15.0(@types/node@24.13.3)(typescript@6.0.3))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)):
|
|
14960
15346
|
dependencies:
|
|
14961
15347
|
'@vitest/expect': 4.1.10
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decisions behind cash on delivery, with nothing from Vendure in them.
|
|
3
|
+
*
|
|
4
|
+
* This file is the counterpart of `cod-payment.ts` in the way `order-lifecycle-core.ts`
|
|
5
|
+
* is the counterpart of `order-lifecycle-process.ts`: the rules live here, and the
|
|
6
|
+
* Vendure handler only gives them Vendure's shape. Keeping the rules free of imports
|
|
7
|
+
* lets the platform's contract matrix prove them from the root workspace, where this
|
|
8
|
+
* project's dependencies are never installed.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export type CashOnDeliveryAuthorization<Metadata> =
|
|
12
|
+
| {
|
|
13
|
+
amount: number;
|
|
14
|
+
state: "Authorized";
|
|
15
|
+
transactionId: string;
|
|
16
|
+
metadata: Metadata;
|
|
17
|
+
}
|
|
18
|
+
| {
|
|
19
|
+
amount: number;
|
|
20
|
+
state: "Declined";
|
|
21
|
+
errorMessage: string;
|
|
22
|
+
metadata: Metadata;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type CashOnDeliverySettlement = { success: true };
|
|
26
|
+
|
|
27
|
+
/** One order, one cash collection: the id is the order's, so it cannot drift from it. */
|
|
28
|
+
export function cashOnDeliveryTransactionId(orderCode: string): string {
|
|
29
|
+
return `cod:${orderCode}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Cash on delivery, with the memory of what has already been collected.
|
|
34
|
+
*
|
|
35
|
+
* The memory matters because a collected payment is finished. Authorizing it again is
|
|
36
|
+
* how one order is charged twice, and it is refused here rather than only in Vendure's
|
|
37
|
+
* payment state machine, so a shop reading these rules through the adapter contract sees
|
|
38
|
+
* the same answer the shop itself gives.
|
|
39
|
+
*
|
|
40
|
+
* A ledger is created rather than kept in this module, so a caller that needs an
|
|
41
|
+
* untouched one — the contract matrix runs every rule from a clean start — can have it
|
|
42
|
+
* without reaching into private state.
|
|
43
|
+
*/
|
|
44
|
+
export interface CashOnDeliveryLedger {
|
|
45
|
+
/**
|
|
46
|
+
* Checkout only records that cash will be collected. The payment stays Authorized
|
|
47
|
+
* until an operator confirms the money arrived, so nothing here pretends it was
|
|
48
|
+
* received.
|
|
49
|
+
*/
|
|
50
|
+
authorize<Metadata>(input: {
|
|
51
|
+
orderCode: string;
|
|
52
|
+
amount: number;
|
|
53
|
+
metadata: Metadata;
|
|
54
|
+
}): CashOnDeliveryAuthorization<Metadata>;
|
|
55
|
+
|
|
56
|
+
/** An operator's statement that the cash arrived; there is no gateway to ask. */
|
|
57
|
+
settle(transactionId: string): CashOnDeliverySettlement;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* An operator undoing a collection: either the cash never arrived, or it was
|
|
61
|
+
* marked collected by mistake. Vendure lets a settled payment be cancelled, so
|
|
62
|
+
* the ledger has to forget it too — otherwise the order could never be paid
|
|
63
|
+
* again, which is stricter than the platform and not what anyone asked for.
|
|
64
|
+
*/
|
|
65
|
+
cancel(transactionId: string): CashOnDeliverySettlement;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function createCashOnDeliveryLedger(): CashOnDeliveryLedger {
|
|
69
|
+
const collected = new Set<string>();
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
authorize(input) {
|
|
73
|
+
const transactionId = cashOnDeliveryTransactionId(input.orderCode);
|
|
74
|
+
|
|
75
|
+
if (collected.has(transactionId)) {
|
|
76
|
+
return {
|
|
77
|
+
amount: input.amount,
|
|
78
|
+
state: "Declined",
|
|
79
|
+
errorMessage: "The cash for this order has already been collected",
|
|
80
|
+
metadata: input.metadata,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
amount: input.amount,
|
|
86
|
+
state: "Authorized",
|
|
87
|
+
transactionId,
|
|
88
|
+
metadata: input.metadata,
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
settle(transactionId) {
|
|
93
|
+
collected.add(transactionId);
|
|
94
|
+
return { success: true };
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
cancel(transactionId) {
|
|
98
|
+
collected.delete(transactionId);
|
|
99
|
+
return { success: true };
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|