get_transaction_by_order
Retrieve transaction details using an order number to verify payments, track status, and manage records in the Bayarcash payment system.
Instructions
Get transaction details by order number
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| order_number | Yes | Order number to retrieve |
Implementation Reference
- src/index.ts:278-294 (handler)MCP tool handler for 'get_transaction_by_order': validates input schema, calls BayarcashClient.getTransactionByOrderNumber, formats result as JSON text content.case 'get_transaction_by_order': { // Validate input const validation = validateInput(orderNumberSchema, args); if (!validation.success) { throw new McpError(ErrorCode.InvalidParams, `Validation error: ${validation.error}`); } const result = await bayarcash.getTransactionByOrderNumber(validation.data.order_number); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
- src/smithery.ts:89-101 (handler)Smithery MCP tool registration and handler for 'get_transaction_by_order': inline Zod schema validation, calls BayarcashClient.getTransactionByOrderNumber, returns JSON text.// Tool: Get transaction by order server.tool( 'get_transaction_by_order', 'Get transaction details by order number', { order_number: z.string().describe('Order number to retrieve') }, async ({ order_number }) => { const result = await bayarcash.getTransactionByOrderNumber(order_number); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/validation.ts:86-88 (schema)Zod schema for validating tool input: requires order_number string.export const orderNumberSchema = z.object({ order_number: z.string().min(1, 'Order number is required') });
- src/index.ts:130-142 (schema)Static input schema definition advertised in ListTools response.{ name: 'get_transaction_by_order', description: 'Get transaction details by order number', inputSchema: { type: 'object', properties: { order_number: { type: 'string', description: 'Order number to retrieve' } }, required: ['order_number'] }
- src/bayarcash-client.ts:323-330 (helper)BayarcashClient helper method: performs API GET /transactions/order/{orderNumber} to fetch transaction by order number.async getTransactionByOrderNumber(orderNumber: string): Promise<Transaction> { try { const response = await this.axiosInstance.get(`/transactions/order/${orderNumber}`); return response.data.data || response.data; } catch (error) { this.handleError(error); } }