send_invoice
Send invoices to customers through the Visa Acceptance platform by providing the required invoice ID to process billing communications.
Instructions
This tool will send an invoice to the customer from Visa Acceptance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice_id | Yes | Invoice ID (required) |
Implementation Reference
- The main handler function that executes the send_invoice tool. It uses the Cybersource InvoicesApi to perform a send action on the specified invoice_id, masks sensitive customer information, handles errors, and returns the result or error message.export const sendInvoice = async ( visaClient: any, context: VisaContext, params: z.infer<ReturnType<typeof sendInvoiceParameters>> ) => { try { const invoiceApiInstance = new cybersourceRestApi.InvoicesApi(visaClient.configuration, visaClient.visaApiClient); const result = await new Promise((resolve, reject) => { invoiceApiInstance.performSendAction(params.invoice_id, (error: any, data: any, response: any) => { if (error) { reject(error); } else { resolve({ data, status: response['status'] }); } }); }); const maskedResult = maskInvoiceCustomerInfo(result); return maskedResult; } catch (error) { return 'Failed to send invoice'; } };
- Zod schema defining the input parameters for the send_invoice tool: an object with required 'invoice_id' string field.export const sendInvoiceParameters = ( context: VisaContext = {} as VisaContext ) => { return z.object({ invoice_id: z.string().describe('Invoice ID (required)') }); };
- typescript/src/shared/invoices/sendInvoice.ts:57-70 (registration)Defines the Tool object configuration for the 'send_invoice' tool, including method name, description (from prompt), parameters (from schema), actions, and references the handler function. Exported as default for use in tools.ts.const tool = (context: VisaContext): Tool => ({ method: 'send_invoice', name: 'Send Invoice', description: sendInvoicePrompt(context), parameters: sendInvoiceParameters(context), actions: { invoices: { update: true, }, }, execute: sendInvoice, }); export default tool;
- typescript/src/shared/tools.ts:40-53 (registration)The createTools function collects and returns all available tools, registering 'send_invoice' via sendInvoiceToolModule(context) at line 46 (relative to file). This is the central registry for all invoice and payment link tools.export function createTools(context: VisaContext): Tool[] { return [ createInvoiceToolModule(context), updateInvoiceToolModule(context), getInvoiceToolModule(context), listInvoicesToolModule(context), sendInvoiceToolModule(context), cancelInvoiceToolModule(context), createPaymentLinkToolModule(context), updatePaymentLinkToolModule(context), getPaymentLinkToolModule(context), listPaymentLinkToolModule(context) ]; }