@fire-spark/payments-cash 0.9.1 → 0.10.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/dist/index.d.ts CHANGED
@@ -19,5 +19,11 @@ type CashPaymentsOptions = {
19
19
  * The tender stays IDLE until the store marks the order as paid.
20
20
  */
21
21
  declare const cashPayments: (options?: CashPaymentsOptions) => PaymentAdapter;
22
+ /**
23
+ * Card terminal (datáfono) not connected to Fire Spark: staff charges it on
24
+ * the standalone terminal and marks the order as paid, like cash. Nothing is
25
+ * captured on the device, so the tender stays IDLE with no details.
26
+ */
27
+ declare const cardTerminalPayments: () => PaymentAdapter;
22
28
  //#endregion
23
- export { CashDetails, CashPaymentsOptions, cashCapabilities, cashDetails, cashErrors, cashPayments };
29
+ export { CashDetails, CashPaymentsOptions, cardTerminalPayments, cashCapabilities, cashDetails, cashErrors, cashPayments };
package/dist/index.js CHANGED
@@ -47,5 +47,31 @@ const cashPayments = (options = {}) => {
47
47
  })
48
48
  };
49
49
  };
50
+ /**
51
+ * Card terminal (datáfono) not connected to Fire Spark: staff charges it on
52
+ * the standalone terminal and marks the order as paid, like cash. Nothing is
53
+ * captured on the device, so the tender stays IDLE with no details.
54
+ */
55
+ const cardTerminalPayments = () => {
56
+ const start = async (ctx) => {
57
+ const metadata = { attempt_reference: ctx.attemptReference };
58
+ return {
59
+ status: "IDLE",
60
+ amount: ctx.amount.value,
61
+ metadata
62
+ };
63
+ };
64
+ return {
65
+ provider: "firespark",
66
+ method: "PIN_PAD",
67
+ errors: cashErrors,
68
+ capabilities: cashCapabilities,
69
+ start,
70
+ cancel: async (_ctx, result) => ({
71
+ ...result,
72
+ status: "CANCELLED"
73
+ })
74
+ };
75
+ };
50
76
  //#endregion
51
- export { cashCapabilities, cashDetails, cashErrors, cashPayments };
77
+ export { cardTerminalPayments, cashCapabilities, cashDetails, cashErrors, cashPayments };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fire-spark/payments-cash",
3
- "version": "0.9.1",
4
- "description": "Fire Spark cash payments adapter (collected at the counter or the door)",
3
+ "version": "0.10.0",
4
+ "description": "Fire Spark cash and card terminal (datafono) payments adapters (collected at the counter or the door)",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "files": [
@@ -17,8 +17,8 @@
17
17
  }
18
18
  },
19
19
  "dependencies": {
20
- "@fire-spark/payments": "^0.9.1",
21
- "@fire-spark/types": "^0.9.1"
20
+ "@fire-spark/payments": "^0.10.0",
21
+ "@fire-spark/types": "^0.10.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "tsdown": "^0.22.14",