@fire-spark/payments-cash 0.0.0-stage → 0.1.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.
@@ -0,0 +1,11 @@
1
+ import { PaymentAdapter } from "@fire-spark/payments";
2
+ //#region src/index.d.ts
3
+ /** Cash has no provider: nothing can fail remotely. */
4
+ declare const cashErrors: Readonly<Record<string, import("@fire-spark/payments").PaymentErrorEntry>>;
5
+ /**
6
+ * Cash collected by staff at the counter (kiosk) or at the door (delivery).
7
+ * The intent stays IDLE until the store marks the order as paid.
8
+ */
9
+ declare const cashPayments: () => PaymentAdapter;
10
+ //#endregion
11
+ export { cashErrors, cashPayments };
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ import { definePaymentErrors } from "@fire-spark/payments";
2
+ //#region src/index.ts
3
+ /** Cash has no provider: nothing can fail remotely. */
4
+ const cashErrors = definePaymentErrors({});
5
+ const idle = (ctx) => {
6
+ const metadata = { attempt_reference: ctx.attemptReference };
7
+ return {
8
+ status: "IDLE",
9
+ amount: ctx.amount.value,
10
+ metadata
11
+ };
12
+ };
13
+ /**
14
+ * Cash collected by staff at the counter (kiosk) or at the door (delivery).
15
+ * The intent stays IDLE until the store marks the order as paid.
16
+ */
17
+ const cashPayments = () => {
18
+ return {
19
+ provider: "firespark",
20
+ method: "CASH",
21
+ errors: cashErrors,
22
+ start: async (ctx) => idle(ctx),
23
+ cancel: async (_ctx, result) => ({
24
+ ...result,
25
+ status: "CANCELLED"
26
+ })
27
+ };
28
+ };
29
+ //#endregion
30
+ export { cashErrors, cashPayments };
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@fire-spark/payments-cash",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Fire Spark cash payments adapter (collected at the counter or the door)",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "dependencies": {
20
+ "@fire-spark/payments": "0.1.0",
21
+ "@fire-spark/types": "0.0.4"
22
+ },
23
+ "devDependencies": {
24
+ "tsdown": "^0.22.14",
25
+ "typescript": "^7.0.2",
26
+ "vitest": "^2.1.8"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "tsdown": {
32
+ "entry": [
33
+ "src/index.ts"
34
+ ],
35
+ "format": [
36
+ "esm"
37
+ ],
38
+ "platform": "neutral",
39
+ "dts": {
40
+ "tsconfig": "tsconfig.build.json"
41
+ },
42
+ "clean": true,
43
+ "deps": {
44
+ "neverBundle": [
45
+ "@fire-spark/payments",
46
+ "@fire-spark/types"
47
+ ]
48
+ }
49
+ },
50
+ "scripts": {
51
+ "build": "tsdown",
52
+ "dev": "tsdown --watch",
53
+ "check-types": "tsc --noEmit",
54
+ "test:utils": "vitest run",
55
+ "lint": "oxlint ./src --max-warnings=0",
56
+ "format": "oxfmt ./src",
57
+ "check-format": "oxfmt --check ./src"
58
+ }
6
59
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.