send_invoice
Send invoices to customers through the Visa Acceptance platform. This tool processes invoice delivery using a required invoice ID for transaction completion.
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 handler function that implements the core logic of the 'send_invoice' tool, sending the invoice via Cybersource REST API and masking customer info.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.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-68 (registration)Definition of the tool object/module for 'send_invoice', which is exported as default and includes method name, description, parameters, and execute handler reference.const tool = (context: VisaContext): Tool => ({ method: 'send_invoice', name: 'Send Invoice', description: sendInvoicePrompt(context), parameters: sendInvoiceParameters(context), actions: { invoices: { update: true, }, }, execute: sendInvoice, });
- typescript/src/shared/tools.ts:40-53 (registration)Registration of the send_invoice tool within the createTools function, which aggregates and returns all available tools including sendInvoiceToolModule(context).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) ]; }
- Helper function generating the description/prompt for the send_invoice tool.export const sendInvoicePrompt = (context: VisaContext = {} as VisaContext) => ` This tool will send an invoice to the customer from Visa Acceptance. `;