106 lines
4.0 KiB
JavaScript
106 lines
4.0 KiB
JavaScript
import { z } from 'zod';
|
|
export function registerPaymentsTools(client) {
|
|
return [
|
|
{
|
|
name: 'toast_list_payments',
|
|
description: 'List all payments within a date range',
|
|
inputSchema: z.object({
|
|
startDate: z.string().describe('Start date (ISO 8601 format)'),
|
|
endDate: z.string().describe('End date (ISO 8601 format)'),
|
|
page: z.number().optional().describe('Page number (default: 1)'),
|
|
pageSize: z.number().optional().describe('Items per page (default: 100)'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.payments.list(args.startDate, args.endDate, {
|
|
page: args.page,
|
|
pageSize: args.pageSize,
|
|
});
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_get_payment',
|
|
description: 'Get details of a specific payment',
|
|
inputSchema: z.object({
|
|
paymentGuid: z.string().describe('Payment GUID'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.payments.get(args.paymentGuid);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_void_payment',
|
|
description: 'Void a payment',
|
|
inputSchema: z.object({
|
|
paymentGuid: z.string().describe('Payment GUID'),
|
|
voidReason: z.string().optional().describe('Reason for voiding'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.payments.void(args.paymentGuid, args.voidReason);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_refund_payment',
|
|
description: 'Refund a payment',
|
|
inputSchema: z.object({
|
|
paymentGuid: z.string().describe('Payment GUID'),
|
|
refundAmount: z.number().describe('Amount to refund in cents'),
|
|
refundReason: z.string().optional().describe('Reason for refund'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.payments.refund(args.paymentGuid, args.refundAmount, args.refundReason);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_list_tips',
|
|
description: 'List all tips within a date range',
|
|
inputSchema: z.object({
|
|
startDate: z.string().describe('Start date (ISO 8601 format)'),
|
|
endDate: z.string().describe('End date (ISO 8601 format)'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.payments.listTips(args.startDate, args.endDate);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
];
|
|
}
|
|
//# sourceMappingURL=payments-tools.js.map
|