@attesso/types 1.0.5 → 1.0.6
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/mandate.d.ts +153 -1
- package/dist/mandate.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/mandate.d.ts
CHANGED
|
@@ -9,24 +9,176 @@ export interface Mandate {
|
|
|
9
9
|
signature: string;
|
|
10
10
|
status: MandateStatus;
|
|
11
11
|
createdAt: Date;
|
|
12
|
+
amount?: number;
|
|
13
|
+
spendingLimit?: number;
|
|
14
|
+
totalCharged?: number;
|
|
15
|
+
feeMode?: FeeMode;
|
|
12
16
|
}
|
|
13
17
|
export type MandateStatus = 'active' | 'revoked' | 'expired';
|
|
18
|
+
/**
|
|
19
|
+
* Fee mode determines how fees are calculated relative to the specified amount.
|
|
20
|
+
*
|
|
21
|
+
* - `markup` (default): Fees are added on top of the amount. Use for commerce
|
|
22
|
+
* where the agent needs exact spending power (e.g., "buy this €100 item").
|
|
23
|
+
* User charged: amount + fees. Agent can spend: exactly the amount.
|
|
24
|
+
*
|
|
25
|
+
* - `inclusive`: Fees are deducted from the amount. Use for fixed budgets
|
|
26
|
+
* where the total charge must not exceed the amount (e.g., "€500/month stipend").
|
|
27
|
+
* User charged: exactly the amount. Agent can spend: amount - fees.
|
|
28
|
+
*/
|
|
29
|
+
export type FeeMode = 'markup' | 'inclusive';
|
|
30
|
+
/**
|
|
31
|
+
* Regional fee structure for Stripe processing fees.
|
|
32
|
+
*/
|
|
33
|
+
export type FeeRegion = 'EEA' | 'US' | 'UK' | 'CUSTOM';
|
|
34
|
+
/**
|
|
35
|
+
* Fee breakdown returned with mandate creation.
|
|
36
|
+
*/
|
|
37
|
+
export interface MandateFees {
|
|
38
|
+
/** Platform fee in cents (typically 1%) */
|
|
39
|
+
platform: number;
|
|
40
|
+
/** Developer fee in cents (if applicable) */
|
|
41
|
+
developer: number;
|
|
42
|
+
/** Stripe processing fee in cents */
|
|
43
|
+
processing: number;
|
|
44
|
+
/** Total fees in cents */
|
|
45
|
+
total: number;
|
|
46
|
+
}
|
|
14
47
|
export interface CreateMandateRequest {
|
|
15
48
|
botId: string;
|
|
16
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The amount in cents. Interpretation depends on feeMode:
|
|
51
|
+
* - markup (default): This is the spending limit. Fees added on top.
|
|
52
|
+
* - inclusive: This is the total charge. Fees deducted.
|
|
53
|
+
*/
|
|
54
|
+
amount: number;
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Use `amount` instead. Kept for backward compatibility.
|
|
57
|
+
*/
|
|
58
|
+
maxAmount?: number;
|
|
17
59
|
currency?: string;
|
|
18
60
|
merchant?: string;
|
|
19
61
|
expiresAt?: string;
|
|
20
62
|
signature: string;
|
|
63
|
+
/**
|
|
64
|
+
* Fee calculation mode. Default: 'markup'.
|
|
65
|
+
* @see FeeMode for detailed explanation.
|
|
66
|
+
*/
|
|
67
|
+
feeMode?: FeeMode;
|
|
68
|
+
/**
|
|
69
|
+
* Region for Stripe fee calculation. Default: 'EEA'.
|
|
70
|
+
*/
|
|
71
|
+
region?: FeeRegion;
|
|
72
|
+
/**
|
|
73
|
+
* Developer fee percentage (0-5%). Applied on top of platform fee.
|
|
74
|
+
*/
|
|
75
|
+
developerFeePercent?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Developer fixed fee in cents. Added to percentage-based fee.
|
|
78
|
+
*/
|
|
79
|
+
developerFeeFixed?: number;
|
|
21
80
|
}
|
|
22
81
|
export interface MandateResponse {
|
|
23
82
|
id: string;
|
|
24
83
|
botId: string;
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Use spendingLimit/totalCharged instead.
|
|
86
|
+
*/
|
|
25
87
|
maxAmount: number;
|
|
26
88
|
currency: string;
|
|
27
89
|
merchant?: string;
|
|
28
90
|
expiresAt?: string;
|
|
29
91
|
status: MandateStatus;
|
|
30
92
|
createdAt: string;
|
|
93
|
+
/**
|
|
94
|
+
* Input amount specified when creating the mandate.
|
|
95
|
+
*/
|
|
96
|
+
amount?: number;
|
|
97
|
+
/**
|
|
98
|
+
* What the agent can spend (in cents).
|
|
99
|
+
* For markup mode: equals the input amount.
|
|
100
|
+
* For inclusive mode: input amount minus fees.
|
|
101
|
+
*/
|
|
102
|
+
spendingLimit?: number;
|
|
103
|
+
/**
|
|
104
|
+
* What the user is charged (in cents).
|
|
105
|
+
* For markup mode: input amount plus fees.
|
|
106
|
+
* For inclusive mode: equals the input amount.
|
|
107
|
+
*/
|
|
108
|
+
totalCharged?: number;
|
|
109
|
+
/**
|
|
110
|
+
* Fee calculation mode used.
|
|
111
|
+
*/
|
|
112
|
+
feeMode?: FeeMode;
|
|
113
|
+
/**
|
|
114
|
+
* Breakdown of fees charged.
|
|
115
|
+
*/
|
|
116
|
+
fees?: MandateFees;
|
|
117
|
+
paymentId?: string;
|
|
118
|
+
stripePaymentIntentId?: string;
|
|
119
|
+
deviceAttested?: boolean;
|
|
120
|
+
devicePlatform?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Request for fee preview (without creating a mandate).
|
|
124
|
+
*/
|
|
125
|
+
export interface PreviewFeesRequest {
|
|
126
|
+
/**
|
|
127
|
+
* The amount in cents to preview fees for.
|
|
128
|
+
*/
|
|
129
|
+
amount: number;
|
|
130
|
+
/**
|
|
131
|
+
* Fee calculation mode. Default: 'markup'.
|
|
132
|
+
*/
|
|
133
|
+
feeMode?: FeeMode;
|
|
134
|
+
/**
|
|
135
|
+
* Region for Stripe fee calculation. Default: 'EEA'.
|
|
136
|
+
*/
|
|
137
|
+
region?: FeeRegion;
|
|
138
|
+
/**
|
|
139
|
+
* Developer fee percentage (0-5%).
|
|
140
|
+
*/
|
|
141
|
+
developerFeePercent?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Developer fixed fee in cents.
|
|
144
|
+
*/
|
|
145
|
+
developerFeeFixed?: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Response from fee preview.
|
|
149
|
+
*/
|
|
150
|
+
export interface PreviewFeesResponse {
|
|
151
|
+
/**
|
|
152
|
+
* Input amount specified.
|
|
153
|
+
*/
|
|
154
|
+
amount: number;
|
|
155
|
+
/**
|
|
156
|
+
* Fee mode used for calculation.
|
|
157
|
+
*/
|
|
158
|
+
feeMode: FeeMode;
|
|
159
|
+
/**
|
|
160
|
+
* What the agent can spend (cents).
|
|
161
|
+
*/
|
|
162
|
+
spendingLimit: number;
|
|
163
|
+
/**
|
|
164
|
+
* What the user would be charged (cents).
|
|
165
|
+
*/
|
|
166
|
+
totalCharged: number;
|
|
167
|
+
/**
|
|
168
|
+
* Breakdown of fees.
|
|
169
|
+
*/
|
|
170
|
+
fees: MandateFees;
|
|
171
|
+
/**
|
|
172
|
+
* Total fee as percentage of user payment.
|
|
173
|
+
*/
|
|
174
|
+
feePercentage: number;
|
|
175
|
+
/**
|
|
176
|
+
* Whether the fee percentage is within the 10% cap.
|
|
177
|
+
*/
|
|
178
|
+
validationPassed: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Minimum amount required to stay within fee cap.
|
|
181
|
+
*/
|
|
182
|
+
minimumRequired?: number;
|
|
31
183
|
}
|
|
32
184
|
//# sourceMappingURL=mandate.d.ts.map
|
package/dist/mandate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mandate.d.ts","sourceRoot":"","sources":["../src/mandate.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;
|
|
1
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AE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAClB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@attesso/types",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "TypeScript
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "TypeScript type definitions for the Attesso Settlement Protocol.",
|
|
5
5
|
"author": "Attesso",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"require": "./dist/index.js"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"typescript": "^5.7.0"
|
|
31
|
-
},
|
|
32
29
|
"scripts": {
|
|
33
30
|
"build": "tsc",
|
|
34
31
|
"dev": "tsc --watch",
|
|
35
32
|
"clean": "rm -rf dist"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"typescript": "^5.7.0"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|