shabaaspay-mcp-server 1.0.4 → 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/api/client.d.ts +37 -0
- package/dist/api/client.js +69 -0
- package/dist/mcp-handler/discovery.js +115 -0
- package/dist/mcp-handler/mcp.js +29 -4
- package/dist/mcp-handler/schema-helpers.d.ts +0 -2
- package/dist/mcp-handler/schema-helpers.js +0 -3
- package/dist/mcp-handler/server-card.js +138 -5
- package/dist/mcp-handler/tools/implementations.d.ts +7 -0
- package/dist/mcp-handler/tools/implementations.js +260 -0
- package/dist/mcp-handler/tools/index.js +28 -1
- package/dist/server/http-server.js +1 -1
- package/dist/tools/auth.js +8 -1
- package/dist/tools/capability-prompts.d.ts +16 -0
- package/dist/tools/capability-prompts.js +76 -0
- package/dist/tools/index.d.ts +255 -10
- package/dist/tools/index.js +4 -1
- package/dist/tools/merchant-operations.d.ts +214 -0
- package/dist/tools/merchant-operations.js +115 -0
- package/dist/tools/payment-agreements.d.ts +27 -6
- package/dist/tools/payment-agreements.js +50 -0
- package/dist/tools/payment-initiations.d.ts +4 -4
- package/dist/tools/todays-earnings.d.ts +20 -0
- package/dist/tools/todays-earnings.js +80 -0
- package/dist/types/index.d.ts +182 -10
- package/dist/types/index.js +72 -1
- package/package.json +4 -2
- package/readme.md +15 -19
- package/server.json +2 -2
package/dist/api/client.d.ts
CHANGED
|
@@ -30,6 +30,11 @@ export declare class ShabaasApiClient {
|
|
|
30
30
|
token: string;
|
|
31
31
|
fetchedAt: string;
|
|
32
32
|
}>;
|
|
33
|
+
getTodaysEarnings(options?: RequestAuthOptions): Promise<ApiResponse>;
|
|
34
|
+
listActivePaymentAgreements(params?: {
|
|
35
|
+
page?: number;
|
|
36
|
+
status?: string;
|
|
37
|
+
}, options?: RequestAuthOptions): Promise<ApiResponse>;
|
|
33
38
|
getPaymentAgreement(id: string, options?: RequestAuthOptions): Promise<ApiResponse>;
|
|
34
39
|
createPaymentAgreement(data: {
|
|
35
40
|
name: string;
|
|
@@ -59,6 +64,38 @@ export declare class ShabaasApiClient {
|
|
|
59
64
|
amount: string | number;
|
|
60
65
|
description?: string;
|
|
61
66
|
}, options?: RequestAuthOptions): Promise<ApiResponse>;
|
|
67
|
+
initiateDirectDebitPublic(data: {
|
|
68
|
+
amount: string | number;
|
|
69
|
+
name: string;
|
|
70
|
+
consent_received: boolean | string;
|
|
71
|
+
bsb: string | number;
|
|
72
|
+
account_number: string | number;
|
|
73
|
+
phone_number?: string;
|
|
74
|
+
notes?: string;
|
|
75
|
+
destination?: unknown;
|
|
76
|
+
}, options?: RequestAuthOptions): Promise<ApiResponse>;
|
|
77
|
+
updateBilateralAgreement(data: {
|
|
78
|
+
id?: string;
|
|
79
|
+
phone_number?: string;
|
|
80
|
+
maximum_amount: string | number;
|
|
81
|
+
frequency: string;
|
|
82
|
+
agreement_type?: string;
|
|
83
|
+
number_of_transactions_permitted: number;
|
|
84
|
+
}, options?: RequestAuthOptions): Promise<ApiResponse>;
|
|
85
|
+
generateInvoice(data: {
|
|
86
|
+
phone_number?: string;
|
|
87
|
+
invoice: {
|
|
88
|
+
amount: string | number;
|
|
89
|
+
description?: string;
|
|
90
|
+
bill_to?: string;
|
|
91
|
+
address?: string;
|
|
92
|
+
receiver_abn?: string;
|
|
93
|
+
ref_no?: string;
|
|
94
|
+
gst_included?: boolean;
|
|
95
|
+
gst_does_not_apply?: boolean;
|
|
96
|
+
email?: string;
|
|
97
|
+
};
|
|
98
|
+
}, options?: RequestAuthOptions): Promise<ApiResponse>;
|
|
62
99
|
getPaymentLink(data: {
|
|
63
100
|
amount: string;
|
|
64
101
|
reference?: string;
|
package/dist/api/client.js
CHANGED
|
@@ -119,6 +119,26 @@ class ShabaasApiClient {
|
|
|
119
119
|
const token = await this.getTokenForRequest(options?.requestUuid);
|
|
120
120
|
return { token, fetchedAt: new Date().toISOString() };
|
|
121
121
|
}
|
|
122
|
+
async getTodaysEarnings(options) {
|
|
123
|
+
return await this.withAuthRetry(async (token) => {
|
|
124
|
+
const response = await this.client.get('/api/public/todays_earnings', {
|
|
125
|
+
headers: { Authorization: token },
|
|
126
|
+
});
|
|
127
|
+
return response.data;
|
|
128
|
+
}, options?.requestUuid);
|
|
129
|
+
}
|
|
130
|
+
async listActivePaymentAgreements(params = {}, options) {
|
|
131
|
+
return await this.withAuthRetry(async (token) => {
|
|
132
|
+
const query = new URLSearchParams();
|
|
133
|
+
if (params.page != null)
|
|
134
|
+
query.set('page', String(params.page));
|
|
135
|
+
if (params.status != null)
|
|
136
|
+
query.set('status', params.status);
|
|
137
|
+
const qs = query.toString();
|
|
138
|
+
const response = await this.client.get(`/api/public/payment_agreements${qs ? `?${qs}` : ''}`, { headers: { Authorization: token } });
|
|
139
|
+
return response.data;
|
|
140
|
+
}, options?.requestUuid);
|
|
141
|
+
}
|
|
122
142
|
async getPaymentAgreement(id, options) {
|
|
123
143
|
return await this.withAuthRetry(async (token) => {
|
|
124
144
|
const response = await this.client.get(`/api/public/payment_agreement?id=${encodeURIComponent(id)}`, { headers: { Authorization: token } });
|
|
@@ -213,6 +233,55 @@ class ShabaasApiClient {
|
|
|
213
233
|
return response.data;
|
|
214
234
|
}, options?.requestUuid);
|
|
215
235
|
}
|
|
236
|
+
async initiateDirectDebitPublic(data, options) {
|
|
237
|
+
return await this.withAuthRetry(async (token) => {
|
|
238
|
+
const amount = normalizeAmount(data.amount);
|
|
239
|
+
const response = await this.client.post('/api/public/payment_initiation/direct_debit', {
|
|
240
|
+
direct_debit: {
|
|
241
|
+
name: data.name,
|
|
242
|
+
amount,
|
|
243
|
+
consent_received: data.consent_received,
|
|
244
|
+
bsb: data.bsb,
|
|
245
|
+
account_number: data.account_number,
|
|
246
|
+
phone_number: data.phone_number,
|
|
247
|
+
notes: data.notes,
|
|
248
|
+
},
|
|
249
|
+
destination: data.destination,
|
|
250
|
+
}, {
|
|
251
|
+
headers: {
|
|
252
|
+
Authorization: token,
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
return response.data;
|
|
256
|
+
}, options?.requestUuid);
|
|
257
|
+
}
|
|
258
|
+
async updateBilateralAgreement(data, options) {
|
|
259
|
+
return await this.withAuthRetry(async (token) => {
|
|
260
|
+
const response = await this.client.patch('/api/public/payment_agreement/bilateral', {
|
|
261
|
+
payment_agreement: {
|
|
262
|
+
id: data.id,
|
|
263
|
+
phone_number: data.phone_number,
|
|
264
|
+
maximum_amount: data.maximum_amount,
|
|
265
|
+
frequency: data.frequency,
|
|
266
|
+
agreement_type: data.agreement_type,
|
|
267
|
+
number_of_transactions_permitted: data.number_of_transactions_permitted,
|
|
268
|
+
},
|
|
269
|
+
}, { headers: { Authorization: token } });
|
|
270
|
+
return response.data;
|
|
271
|
+
}, options?.requestUuid);
|
|
272
|
+
}
|
|
273
|
+
async generateInvoice(data, options) {
|
|
274
|
+
const apiKey = (options?.requestUuid ?? '').trim();
|
|
275
|
+
if (!apiKey) {
|
|
276
|
+
throw new Error('API key is required for generate_invoice.');
|
|
277
|
+
}
|
|
278
|
+
const response = await this.client.post('/api/public/generate_invoice', {
|
|
279
|
+
api_key: apiKey,
|
|
280
|
+
phone_number: data.phone_number,
|
|
281
|
+
invoice: data.invoice,
|
|
282
|
+
});
|
|
283
|
+
return response.data;
|
|
284
|
+
}
|
|
216
285
|
async getPaymentLink(data, options) {
|
|
217
286
|
return await this.withAuthRetry(async (token) => {
|
|
218
287
|
const response = await this.client.post('/api/get_url', data, {
|
|
@@ -274,6 +274,121 @@ async function listTools(env) {
|
|
|
274
274
|
],
|
|
275
275
|
},
|
|
276
276
|
},
|
|
277
|
+
{
|
|
278
|
+
name: 'initiate_direct_debit',
|
|
279
|
+
description: 'Initiate a direct debit payment with account details and consent.',
|
|
280
|
+
...sharedExecution,
|
|
281
|
+
openapi_operation: { method: 'post', path: '/api/public/payment_initiation/direct_debit' },
|
|
282
|
+
output_openapi_schema_ref: '#/components/schemas/SuccessPaymentInitiationResponse',
|
|
283
|
+
required_arguments: ['name', 'amount', 'consent_received', 'bsb', 'account_number'],
|
|
284
|
+
optional_arguments: ['phone_number', 'notes', 'destination', 'include_raw'],
|
|
285
|
+
argument_hints: {
|
|
286
|
+
consent_received: 'Must be true / "true".',
|
|
287
|
+
},
|
|
288
|
+
argument_schema: {
|
|
289
|
+
name: { type: 'string' },
|
|
290
|
+
amount: { oneOf: [{ type: 'number', exclusiveMinimum: 0 }, { type: 'string', pattern: '^\\d+(\\.\\d{1,2})?$' }] },
|
|
291
|
+
consent_received: { oneOf: [{ type: 'boolean' }, { type: 'string', enum: ['true', 'false'] }] },
|
|
292
|
+
bsb: { oneOf: [{ type: 'string' }, { type: 'number' }] },
|
|
293
|
+
account_number: { oneOf: [{ type: 'string' }, { type: 'number' }] },
|
|
294
|
+
},
|
|
295
|
+
example: {
|
|
296
|
+
tool: 'initiate_direct_debit',
|
|
297
|
+
arguments: { name: 'John Citizen', amount: '10.00', consent_received: true, bsb: '062000', account_number: '12345678' },
|
|
298
|
+
},
|
|
299
|
+
decision_guidance: {
|
|
300
|
+
when_to_use: 'Use to create a direct debit payment initiation from account details.',
|
|
301
|
+
preconditions: ['name, amount, consent_received, bsb, account_number'],
|
|
302
|
+
retryable_errors: ['AUTH_MISSING_OR_INVALID'],
|
|
303
|
+
non_retryable_errors: ['INVALID_REQUEST', 'BUSINESS_RULE_FAILURE'],
|
|
304
|
+
next_best_tool_on_failure: 'get_payment_initiation',
|
|
305
|
+
},
|
|
306
|
+
idempotency_notes: 'Creates a new payment initiation and is non-idempotent without caller deduplication.',
|
|
307
|
+
error_contract: [
|
|
308
|
+
{ status: 400, code: 'INVALID_REQUEST', when: 'Malformed direct_debit payload or missing required fields' },
|
|
309
|
+
{ status: 401, code: 'AUTH_MISSING_OR_INVALID', when: 'Session/API key missing or invalid' },
|
|
310
|
+
{ status: 422, code: 'BUSINESS_RULE_FAILURE', when: 'Consent/amount/cooldown or provider validation failed' },
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: 'update_bilateral_agreement',
|
|
315
|
+
description: 'Update bilateral parameters for a payment agreement.',
|
|
316
|
+
...sharedExecution,
|
|
317
|
+
openapi_operation: { method: 'patch', path: '/api/public/payment_agreement/bilateral' },
|
|
318
|
+
output_openapi_schema_ref: '#/components/schemas/SuccessPaymentAgreementResponse',
|
|
319
|
+
required_arguments: ['maximum_amount', 'frequency', 'number_of_transactions_permitted'],
|
|
320
|
+
optional_arguments: ['id', 'phone_number', 'agreement_type', 'include_raw'],
|
|
321
|
+
argument_hints: {
|
|
322
|
+
frequency: 'Use supported stored codes like ADHO, DAIL, FRTN, INDA, MIAN, MNTH, QURT, WEEK, YEAR.',
|
|
323
|
+
},
|
|
324
|
+
argument_schema: {
|
|
325
|
+
id: { type: 'string' },
|
|
326
|
+
phone_number: { type: 'string' },
|
|
327
|
+
maximum_amount: { oneOf: [{ type: 'string' }, { type: 'number' }] },
|
|
328
|
+
frequency: { type: 'string' },
|
|
329
|
+
number_of_transactions_permitted: { type: 'integer', minimum: 1 },
|
|
330
|
+
},
|
|
331
|
+
example: {
|
|
332
|
+
tool: 'update_bilateral_agreement',
|
|
333
|
+
arguments: { id: '2882PA20251227045450257', maximum_amount: '100.00', frequency: 'MNTH', number_of_transactions_permitted: 2 },
|
|
334
|
+
},
|
|
335
|
+
decision_guidance: {
|
|
336
|
+
when_to_use: 'Use to amend bilateral parameters on an existing payment agreement.',
|
|
337
|
+
preconditions: ['id or phone_number, maximum_amount, frequency, number_of_transactions_permitted'],
|
|
338
|
+
retryable_errors: ['AUTH_MISSING_OR_INVALID'],
|
|
339
|
+
non_retryable_errors: ['RESOURCE_NOT_FOUND', 'VALIDATION_OR_BUSINESS_RULE'],
|
|
340
|
+
next_best_tool_on_failure: 'get_payment_agreement',
|
|
341
|
+
},
|
|
342
|
+
idempotency_notes: 'Updates agreement settings and is non-idempotent under concurrent updates.',
|
|
343
|
+
error_contract: [
|
|
344
|
+
{ status: 400, code: 'INVALID_REQUEST', when: 'Malformed bilateral amend payload' },
|
|
345
|
+
{ status: 401, code: 'AUTH_MISSING_OR_INVALID', when: 'Session/API key missing or invalid' },
|
|
346
|
+
{ status: 404, code: 'RESOURCE_NOT_FOUND', when: 'Payment agreement not found' },
|
|
347
|
+
{ status: 422, code: 'VALIDATION_OR_BUSINESS_RULE', when: 'Amount/rule validation failed' },
|
|
348
|
+
],
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: 'generate_invoice',
|
|
352
|
+
description: 'Generate checkout URL for invoice flow.',
|
|
353
|
+
...sharedExecution,
|
|
354
|
+
openapi_operation: { method: 'post', path: '/api/public/generate_invoice' },
|
|
355
|
+
output_openapi_schema_ref: 'inline: { message, data: { checkout_url } }',
|
|
356
|
+
required_arguments: ['invoice'],
|
|
357
|
+
optional_arguments: [
|
|
358
|
+
'phone_number',
|
|
359
|
+
'include_raw',
|
|
360
|
+
'invoice.description',
|
|
361
|
+
'invoice.bill_to',
|
|
362
|
+
'invoice.address',
|
|
363
|
+
'invoice.receiver_abn',
|
|
364
|
+
'invoice.ref_no',
|
|
365
|
+
'invoice.gst_included',
|
|
366
|
+
'invoice.gst_does_not_apply',
|
|
367
|
+
'invoice.email',
|
|
368
|
+
],
|
|
369
|
+
argument_hints: {
|
|
370
|
+
'invoice.amount': 'Invoice amount (AUD); max 1000',
|
|
371
|
+
},
|
|
372
|
+
example: {
|
|
373
|
+
tool: 'generate_invoice',
|
|
374
|
+
arguments: {
|
|
375
|
+
invoice: { amount: '50.00', gst_included: true },
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
decision_guidance: {
|
|
379
|
+
when_to_use: 'Use to generate invoice checkout URL for external collection flow.',
|
|
380
|
+
preconditions: ['invoice payload'],
|
|
381
|
+
retryable_errors: ['AUTH_MISSING_OR_INVALID'],
|
|
382
|
+
non_retryable_errors: ['INVALID_REQUEST', 'VALIDATION_OR_BUSINESS_RULE'],
|
|
383
|
+
next_best_tool_on_failure: null,
|
|
384
|
+
},
|
|
385
|
+
idempotency_notes: 'Creates a new invoice checkout URL/session per call; treat as non-idempotent.',
|
|
386
|
+
error_contract: [
|
|
387
|
+
{ status: 400, code: 'INVALID_REQUEST', when: 'Invalid invoice payload shape' },
|
|
388
|
+
{ status: 401, code: 'AUTH_MISSING_OR_INVALID', when: 'Session/API key missing or invalid' },
|
|
389
|
+
{ status: 422, code: 'VALIDATION_OR_BUSINESS_RULE', when: 'Invoice validation/business rule failure' },
|
|
390
|
+
],
|
|
391
|
+
},
|
|
277
392
|
];
|
|
278
393
|
if (!prod) {
|
|
279
394
|
toolsList.push({
|
package/dist/mcp-handler/mcp.js
CHANGED
|
@@ -47,26 +47,51 @@ async function runWithMcpContextLock(fn) {
|
|
|
47
47
|
*/
|
|
48
48
|
function buildAllowedToolsList(policy, env) {
|
|
49
49
|
const allTools = [
|
|
50
|
+
{
|
|
51
|
+
name: 'list_active_payment_agreements',
|
|
52
|
+
description: 'List the merchant\'s active PayTo payment agreements. Use for requests like "list my active agreements".',
|
|
53
|
+
inputSchema: httpMcpToolSchema(index_js_2.ListActivePaymentAgreementsInputSchema),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'get_todays_earnings',
|
|
57
|
+
description: 'Today\'s settled payment cash summary (AEST) for the merchant and branches. Use for "how much cash came in today?".',
|
|
58
|
+
inputSchema: httpMcpToolSchema(index_js_2.GetTodaysEarningsInputSchema),
|
|
59
|
+
},
|
|
50
60
|
{
|
|
51
61
|
name: 'get_payment_agreement',
|
|
52
|
-
description:
|
|
62
|
+
description: 'Retrieve payment agreement details with AI insights.',
|
|
53
63
|
inputSchema: httpMcpToolSchema(index_js_2.GetPaymentAgreementInputSchema),
|
|
54
64
|
},
|
|
55
65
|
{
|
|
56
66
|
name: 'create_payment_agreement',
|
|
57
|
-
description:
|
|
67
|
+
description: 'Create a new payment agreement.',
|
|
58
68
|
inputSchema: httpMcpToolSchema(index_js_2.CreatePaymentAgreementInputSchema),
|
|
59
69
|
},
|
|
60
70
|
{
|
|
61
71
|
name: 'initiate_payment',
|
|
62
|
-
description:
|
|
72
|
+
description: 'Initiate a payment against an agreement.',
|
|
63
73
|
inputSchema: httpMcpToolSchema(index_js_2.InitiatePaymentInputSchema),
|
|
64
74
|
},
|
|
65
75
|
{
|
|
66
76
|
name: 'get_payment_initiation',
|
|
67
|
-
description:
|
|
77
|
+
description: 'Retrieve payment initiation by ID.',
|
|
68
78
|
inputSchema: httpMcpToolSchema(index_js_2.GetPaymentInitiationInputSchema),
|
|
69
79
|
},
|
|
80
|
+
{
|
|
81
|
+
name: 'initiate_direct_debit',
|
|
82
|
+
description: 'Initiate direct debit using account details and consent.',
|
|
83
|
+
inputSchema: httpMcpToolSchema(index_js_2.InitiateDirectDebitInputSchema),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'update_bilateral_agreement',
|
|
87
|
+
description: 'Update bilateral configuration of a payment agreement.',
|
|
88
|
+
inputSchema: httpMcpToolSchema(index_js_2.UpdateBilateralAgreementInputSchema),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'generate_invoice',
|
|
92
|
+
description: 'Generate invoice checkout URL for external invoice flow.',
|
|
93
|
+
inputSchema: httpMcpToolSchema(index_js_2.GenerateInvoiceInputSchema),
|
|
94
|
+
},
|
|
70
95
|
...(env.SHABAAS_ENVIRONMENT === 'production'
|
|
71
96
|
? []
|
|
72
97
|
: [{
|
|
@@ -3,6 +3,4 @@
|
|
|
3
3
|
* Remote HTTP clients authenticate via the connection (OAuth / Authorization header);
|
|
4
4
|
* omitting `authorization` from published inputSchema avoids agents prompting users for keys.
|
|
5
5
|
*/
|
|
6
|
-
/** Appended to tool descriptions for streamable HTTP ListTools so agents do not prompt for API keys. */
|
|
7
|
-
export declare const HTTP_MCP_SESSION_AUTH_HINT = " Remote MCP (HTTP): session is authenticated via OAuth or Authorization header\u2014do not ask the user for an API key.";
|
|
8
6
|
export declare function stripAuthorizationFieldFromJsonSchema(schema: unknown): unknown;
|
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
* omitting `authorization` from published inputSchema avoids agents prompting users for keys.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.HTTP_MCP_SESSION_AUTH_HINT = void 0;
|
|
9
8
|
exports.stripAuthorizationFieldFromJsonSchema = stripAuthorizationFieldFromJsonSchema;
|
|
10
|
-
/** Appended to tool descriptions for streamable HTTP ListTools so agents do not prompt for API keys. */
|
|
11
|
-
exports.HTTP_MCP_SESSION_AUTH_HINT = ' Remote MCP (HTTP): session is authenticated via OAuth or Authorization header—do not ask the user for an API key.';
|
|
12
9
|
function stripAuthorizationFieldFromJsonSchema(schema) {
|
|
13
10
|
if (!schema || typeof schema !== 'object')
|
|
14
11
|
return schema;
|
|
@@ -30,9 +30,41 @@ function toStrictObjectSchema(schema) {
|
|
|
30
30
|
}
|
|
31
31
|
function buildServerCard(env) {
|
|
32
32
|
const tools = [
|
|
33
|
+
{
|
|
34
|
+
name: 'list_active_payment_agreements',
|
|
35
|
+
description: 'List the merchant\'s active PayTo payment agreements. Use when the user asks to list or find their active agreements.',
|
|
36
|
+
inputSchema: toStrictObjectSchema((0, schema_helpers_js_1.stripAuthorizationFieldFromJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(index_js_1.ListActivePaymentAgreementsInputSchema))),
|
|
37
|
+
metadata: {
|
|
38
|
+
schemaVersion: '2026-04-15',
|
|
39
|
+
requiredArguments: [],
|
|
40
|
+
optionalArguments: ['page', 'status', 'include_raw'],
|
|
41
|
+
openapiOperation: { method: 'get', path: '/api/public/payment_agreements' },
|
|
42
|
+
outputSchemaRef: 'inline: { payment_agreements: PaymentAgreement[], count, status_filter }',
|
|
43
|
+
errorContract: [
|
|
44
|
+
{ status: 401, code: 'AUTH_MISSING_OR_INVALID', when: 'Session/API key missing or invalid' },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'get_todays_earnings',
|
|
51
|
+
description: 'Today\'s settled payment cash summary (AEST) for the authenticated merchant and branches. Use when asked how much cash came in today.',
|
|
52
|
+
inputSchema: toStrictObjectSchema((0, schema_helpers_js_1.stripAuthorizationFieldFromJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(index_js_1.GetTodaysEarningsInputSchema))),
|
|
53
|
+
metadata: {
|
|
54
|
+
schemaVersion: '2026-04-15',
|
|
55
|
+
requiredArguments: [],
|
|
56
|
+
optionalArguments: ['include_raw'],
|
|
57
|
+
openapiOperation: { method: 'get', path: '/api/public/todays_earnings' },
|
|
58
|
+
outputSchemaRef: 'inline: { date, timezone, currency, count, total_amount }',
|
|
59
|
+
errorContract: [
|
|
60
|
+
{ status: 401, code: 'AUTH_MISSING_OR_INVALID', when: 'Session/API key missing or invalid' },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
64
|
+
},
|
|
33
65
|
{
|
|
34
66
|
name: 'get_payment_agreement',
|
|
35
|
-
description:
|
|
67
|
+
description: 'Retrieve payment agreement details with AI insights.',
|
|
36
68
|
inputSchema: toStrictObjectSchema((0, schema_helpers_js_1.stripAuthorizationFieldFromJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(index_js_1.GetPaymentAgreementInputSchema))),
|
|
37
69
|
metadata: {
|
|
38
70
|
schemaVersion: '2026-04-15',
|
|
@@ -50,7 +82,7 @@ function buildServerCard(env) {
|
|
|
50
82
|
},
|
|
51
83
|
{
|
|
52
84
|
name: 'create_payment_agreement',
|
|
53
|
-
description:
|
|
85
|
+
description: 'Create a new payment agreement.',
|
|
54
86
|
inputSchema: withCreatePaymentAgreementConditionals(toStrictObjectSchema((0, schema_helpers_js_1.stripAuthorizationFieldFromJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(index_js_1.CreatePaymentAgreementInputSchema)))),
|
|
55
87
|
metadata: {
|
|
56
88
|
schemaVersion: '2026-04-15',
|
|
@@ -69,7 +101,7 @@ function buildServerCard(env) {
|
|
|
69
101
|
},
|
|
70
102
|
{
|
|
71
103
|
name: 'initiate_payment',
|
|
72
|
-
description:
|
|
104
|
+
description: 'Initiate a payment against an agreement.',
|
|
73
105
|
inputSchema: toStrictObjectSchema((0, schema_helpers_js_1.stripAuthorizationFieldFromJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(index_js_1.InitiatePaymentInputSchema))),
|
|
74
106
|
metadata: {
|
|
75
107
|
schemaVersion: '2026-04-15',
|
|
@@ -88,7 +120,7 @@ function buildServerCard(env) {
|
|
|
88
120
|
},
|
|
89
121
|
{
|
|
90
122
|
name: 'get_payment_initiation',
|
|
91
|
-
description:
|
|
123
|
+
description: 'Retrieve payment initiation by ID.',
|
|
92
124
|
inputSchema: toStrictObjectSchema((0, schema_helpers_js_1.stripAuthorizationFieldFromJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(index_js_1.GetPaymentInitiationInputSchema))),
|
|
93
125
|
metadata: {
|
|
94
126
|
schemaVersion: '2026-04-15',
|
|
@@ -104,12 +136,62 @@ function buildServerCard(env) {
|
|
|
104
136
|
},
|
|
105
137
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
106
138
|
},
|
|
139
|
+
{
|
|
140
|
+
name: 'initiate_direct_debit',
|
|
141
|
+
description: 'Initiate direct debit using account details and explicit consent.',
|
|
142
|
+
inputSchema: toStrictObjectSchema((0, schema_helpers_js_1.stripAuthorizationFieldFromJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(index_js_1.InitiateDirectDebitInputSchema))),
|
|
143
|
+
metadata: {
|
|
144
|
+
schemaVersion: '2026-04-15',
|
|
145
|
+
requiredArguments: ['name', 'amount', 'consent_received', 'bsb', 'account_number'],
|
|
146
|
+
optionalArguments: ['phone_number', 'notes', 'destination', 'include_raw'],
|
|
147
|
+
openapiOperation: { method: 'post', path: '/api/public/payment_initiation/direct_debit' },
|
|
148
|
+
outputSchemaRef: '#/components/schemas/SuccessPaymentInitiationResponse',
|
|
149
|
+
},
|
|
150
|
+
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false },
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'update_bilateral_agreement',
|
|
154
|
+
description: 'Update bilateral terms for an existing payment agreement.',
|
|
155
|
+
inputSchema: toStrictObjectSchema((0, schema_helpers_js_1.stripAuthorizationFieldFromJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(index_js_1.UpdateBilateralAgreementInputSchema))),
|
|
156
|
+
metadata: {
|
|
157
|
+
schemaVersion: '2026-04-15',
|
|
158
|
+
requiredArguments: ['maximum_amount', 'frequency', 'number_of_transactions_permitted'],
|
|
159
|
+
optionalArguments: ['id', 'phone_number', 'agreement_type', 'include_raw'],
|
|
160
|
+
openapiOperation: { method: 'patch', path: '/api/public/payment_agreement/bilateral' },
|
|
161
|
+
outputSchemaRef: '#/components/schemas/SuccessPaymentAgreementResponse',
|
|
162
|
+
},
|
|
163
|
+
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false },
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'generate_invoice',
|
|
167
|
+
description: 'Generate external invoice checkout URL.',
|
|
168
|
+
inputSchema: toStrictObjectSchema((0, schema_helpers_js_1.stripAuthorizationFieldFromJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(index_js_1.GenerateInvoiceInputSchema))),
|
|
169
|
+
metadata: {
|
|
170
|
+
schemaVersion: '2026-04-15',
|
|
171
|
+
requiredArguments: ['invoice.amount'],
|
|
172
|
+
optionalArguments: [
|
|
173
|
+
'phone_number',
|
|
174
|
+
'include_raw',
|
|
175
|
+
'invoice.description',
|
|
176
|
+
'invoice.bill_to',
|
|
177
|
+
'invoice.address',
|
|
178
|
+
'invoice.receiver_abn',
|
|
179
|
+
'invoice.ref_no',
|
|
180
|
+
'invoice.gst_included',
|
|
181
|
+
'invoice.gst_does_not_apply',
|
|
182
|
+
'invoice.email',
|
|
183
|
+
],
|
|
184
|
+
openapiOperation: { method: 'post', path: '/api/public/generate_invoice' },
|
|
185
|
+
outputSchemaRef: 'inline: { message, data: { checkout_url } }',
|
|
186
|
+
},
|
|
187
|
+
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false },
|
|
188
|
+
},
|
|
107
189
|
];
|
|
108
190
|
const isProduction = env.SHABAAS_ENVIRONMENT === 'production';
|
|
109
191
|
if (!isProduction) {
|
|
110
192
|
tools.push({
|
|
111
193
|
name: 'get_auth_token',
|
|
112
|
-
description:
|
|
194
|
+
description: 'Get ShaBaas API authorization token (non-production helper).',
|
|
113
195
|
inputSchema: {
|
|
114
196
|
type: 'object',
|
|
115
197
|
additionalProperties: false,
|
|
@@ -152,6 +234,19 @@ function buildServerCard(env) {
|
|
|
152
234
|
tools,
|
|
153
235
|
resources: [],
|
|
154
236
|
prompts: [
|
|
237
|
+
{
|
|
238
|
+
name: 'todays_earnings',
|
|
239
|
+
description: 'Answer how much settled cash came in today (AEST) by calling get_todays_earnings for the merchant and branches.',
|
|
240
|
+
arguments: [],
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'list_active_agreements',
|
|
244
|
+
description: 'List the merchant\'s active PayTo agreements, then use get_payment_agreement for details on a specific ID.',
|
|
245
|
+
arguments: [
|
|
246
|
+
{ name: 'page', description: 'Optional page number', required: false },
|
|
247
|
+
{ name: 'status', description: 'Optional status filter (default active; use all for every agreement)', required: false },
|
|
248
|
+
],
|
|
249
|
+
},
|
|
155
250
|
{
|
|
156
251
|
name: 'create_payto_agreement',
|
|
157
252
|
description: 'Draft parameters for a new PayTo agreement, then call create_payment_agreement with validated fields.',
|
|
@@ -170,6 +265,44 @@ function buildServerCard(env) {
|
|
|
170
265
|
{ name: 'payment_initiation_id', description: 'Optional initiation ID', required: false },
|
|
171
266
|
],
|
|
172
267
|
},
|
|
268
|
+
{
|
|
269
|
+
name: 'initiate_direct_debit',
|
|
270
|
+
description: 'Draft direct debit parameters, then call initiate_direct_debit with validated account and consent fields.',
|
|
271
|
+
arguments: [
|
|
272
|
+
{ name: 'name', description: 'Account holder name', required: true },
|
|
273
|
+
{ name: 'amount', description: 'Debit amount (e.g. 10.00)', required: true },
|
|
274
|
+
{ name: 'consent_received', description: 'Must be true', required: true },
|
|
275
|
+
{ name: 'bsb', description: 'Payer BSB', required: true },
|
|
276
|
+
{ name: 'account_number', description: 'Payer account number', required: true },
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: 'update_bilateral_agreement',
|
|
281
|
+
description: 'Prepare bilateral amendment fields and call update_bilateral_agreement for an existing payment agreement.',
|
|
282
|
+
arguments: [
|
|
283
|
+
{ name: 'id', description: 'Payment agreement id (or use phone_number)', required: false },
|
|
284
|
+
{ name: 'phone_number', description: 'Alternative payer lookup', required: false },
|
|
285
|
+
{ name: 'maximum_amount', description: 'Updated maximum amount', required: true },
|
|
286
|
+
{ name: 'frequency', description: 'Frequency code (e.g. WEEK, MNTH)', required: true },
|
|
287
|
+
{ name: 'number_of_transactions_permitted', description: 'Allowed transaction count', required: true },
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: 'generate_invoice',
|
|
292
|
+
description: 'Draft invoice payload and call generate_invoice to get an external checkout URL.',
|
|
293
|
+
arguments: [
|
|
294
|
+
{ name: 'invoice.amount', description: 'Invoice amount (AUD); max 1000', required: true },
|
|
295
|
+
{ name: 'invoice.description', description: 'Invoice description', required: false },
|
|
296
|
+
{ name: 'invoice.bill_to', description: 'Bill to name', required: false },
|
|
297
|
+
{ name: 'invoice.address', description: 'Billing address', required: false },
|
|
298
|
+
{ name: 'invoice.receiver_abn', description: 'Receiver ABN', required: false },
|
|
299
|
+
{ name: 'invoice.ref_no', description: 'Invoice reference number', required: false },
|
|
300
|
+
{ name: 'invoice.gst_included', description: 'GST included in amount (default false)', required: false },
|
|
301
|
+
{ name: 'invoice.gst_does_not_apply', description: 'GST does not apply', required: false },
|
|
302
|
+
{ name: 'invoice.email', description: 'Customer email for invoice', required: false },
|
|
303
|
+
{ name: 'phone_number', description: 'Customer phone', required: false },
|
|
304
|
+
],
|
|
305
|
+
},
|
|
173
306
|
],
|
|
174
307
|
metadata: {
|
|
175
308
|
schemaVersion: '2026-04-15',
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
import type { Env } from '../types.js';
|
|
8
8
|
/** get_auth_token: Fetch bearer token. Sandbox only. */
|
|
9
9
|
export declare function getAuthToken(args: any, baseUrl: string, env: Env): Promise<Response>;
|
|
10
|
+
/** get_todays_earnings: settled cash summary for today (AEST), merchant + branches. */
|
|
11
|
+
export declare function getTodaysEarnings(args: any, baseUrl: string, env: Env, bearer: string): Promise<Response>;
|
|
12
|
+
/** list_active_payment_agreements: GET merchant PayTo agreements (active by default). */
|
|
13
|
+
export declare function listActivePaymentAgreements(args: any, baseUrl: string, env: Env, bearer: string): Promise<Response>;
|
|
10
14
|
/** get_payment_agreement: GET agreement by ID. Enriches with insights and summary when enrich !== false. */
|
|
11
15
|
export declare function getPaymentAgreement(args: any, baseUrl: string, env: Env, bearer: string): Promise<Response>;
|
|
12
16
|
/** create_payment_agreement: POST new agreement to backend */
|
|
@@ -15,3 +19,6 @@ export declare function createPaymentAgreement(args: any, baseUrl: string, env:
|
|
|
15
19
|
export declare function initiatePayment(args: any, baseUrl: string, env: Env, bearer: string, requestId: string): Promise<Response>;
|
|
16
20
|
/** get_payment_initiation: GET initiation status by ID */
|
|
17
21
|
export declare function getPaymentInitiation(args: any, baseUrl: string, env: Env, bearer: string): Promise<Response>;
|
|
22
|
+
export declare function initiateDirectDebit(args: any, baseUrl: string, env: Env, bearer: string, requestId: string): Promise<Response>;
|
|
23
|
+
export declare function updateBilateralAgreement(args: any, baseUrl: string, env: Env, bearer: string): Promise<Response>;
|
|
24
|
+
export declare function generateInvoice(args: any, baseUrl: string, env: Env, apiKey: string): Promise<Response>;
|