Skip to main content
Glama
zakblacki

Satim Payment Gateway Integration

by zakblacki

validate_payment_response

Process and verify payment response statuses to ensure accurate order confirmation when integrating with the SATIM payment gateway system.

Instructions

Validate and interpret payment response status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
responseYesOrder confirmation response object

Implementation Reference

  • Executes the validation logic by checking if payment is accepted or rejected using helper methods, determines status (ACCEPTED, REJECTED, ERROR, UNKNOWN), and returns a JSON-formatted response including status, display message, contact info flag, and the original response.
    case "validate_payment_response": const response = args.response as OrderConfirmationResponse; const isAccepted = SatimPaymentGateway.isPaymentAccepted(response); const isRejected = SatimPaymentGateway.isPaymentRejected(response); let status = "UNKNOWN"; let displayMessage = ""; if (isAccepted) { status = "ACCEPTED"; displayMessage = response.params?.respCode_desc || response.actionCodeDescription || "Payment accepted"; } else if (isRejected) { status = "REJECTED"; displayMessage = "Your transaction was rejected / Votre transaction a été rejetée / تم رفض معاملتك"; } else { status = "ERROR"; displayMessage = response.params?.respCode_desc || response.actionCodeDescription || "Unknown error"; } return { content: [ { type: "text", text: JSON.stringify({ status, displayMessage, shouldShowContactInfo: status === "REJECTED" || status === "ERROR", contactNumber: "3020 3020", response }, null, 2) } ] };
  • Registers the 'validate_payment_response' tool within the MCP server's listTools response, specifying its name, description, and input schema requiring a 'response' object.
    { name: "validate_payment_response", description: "Validate and interpret payment response status", inputSchema: { type: "object", properties: { response: { type: "object", description: "Order confirmation response object" } }, required: ["response"] } }
  • TypeScript interface defining the expected structure of the OrderConfirmationResponse object passed as input to the validate_payment_response tool.
    interface OrderConfirmationResponse { orderNumber?: string; actionCode?: number; actionCodeDescription?: string; amount?: number; errorCode?: string; errorMessage?: string; orderStatus?: number; approvalCode?: string; authCode?: number; cardholderName?: string; depositAmount?: number; currency?: string; pan?: string; ip?: string; params?: { respCode?: string; respCode_desc?: string; udf1?: string; udf2?: string; udf3?: string; udf4?: string; udf5?: string; }; }
  • Static helper methods on the SatimPaymentGateway class that determine if the payment response indicates acceptance (orderStatus === 2) or rejection (orderStatus === 3), used directly in the tool handler.
    static isPaymentAccepted(response: OrderConfirmationResponse): boolean { return response.params?.respCode === "00" && response.errorCode === "0" && response.orderStatus === 2; } /** * Validate payment rejection status */ static isPaymentRejected(response: OrderConfirmationResponse): boolean { return response.params?.respCode === "00" && response.errorCode === "0" && response.orderStatus === 3; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zakblacki/Satim-Payment-Gateway-Integration'

If you have feedback or need assistance with the MCP directory API, please join our Discord server