@use-stall/types 0.3.17 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-stall/types",
3
- "version": "0.3.17",
3
+ "version": "0.4.0",
4
4
  "description": "Type declarations for Stall SDKs",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
package/src/device.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface DeviceType {
7
7
  organization: string;
8
8
  locations: string[];
9
9
  name: string;
10
+ type: "terminal" | "flex";
10
11
  description: string;
11
12
  code: string;
12
13
  paired: boolean;
package/src/payments.d.ts CHANGED
@@ -33,6 +33,22 @@ export interface UnifiedPaymentMethodType {
33
33
  instant_clear: boolean; // whether the payment is cleared instantly like cash or custom
34
34
  }
35
35
 
36
+ // The method actually used to collect one specific payment — richer than
37
+ // UnifiedPaymentMethodType (which just describes what a provider supports), since it
38
+ // captures the named device config and this collection's own details. No optional fields —
39
+ // original_amount/cash always carry real (possibly zero) values so callers never need to
40
+ // null-check them.
41
+ export interface UnifiedChargedPaymentMethodType extends UnifiedPaymentMethodType {
42
+ name: string;
43
+ method_id: string; // the device's payment-method serial/reference; distinct from the
44
+ // top-level UnifiedPaymentCollectionType.external_id (an external provider's own reference)
45
+ original_amount: number;
46
+ cash: {
47
+ tendered: number;
48
+ change: number;
49
+ };
50
+ }
51
+
36
52
  export interface UnifiedPaymentProviderConfigType {
37
53
  id: string;
38
54
  provider: string; // provider id
@@ -53,7 +69,8 @@ export interface UnifiedPaymentProviderConfigType {
53
69
 
54
70
  export interface FrontendPaymentMethodType {
55
71
  id: string;
56
- provider: {
72
+ // Absent for methods with no payment gateway to resolve, e.g. cash.
73
+ provider?: {
57
74
  id: string; // provider id
58
75
  name: string;
59
76
  logo: string;
@@ -98,7 +115,7 @@ export interface UnifiedPaymentCollectionType {
98
115
  };
99
116
  provider_id: string;
100
117
  external_id: string;
101
- payment_method: UnifiedPaymentMethodType;
118
+ payment_method: UnifiedChargedPaymentMethodType;
102
119
  note: string;
103
120
  device: {
104
121
  id: string;