I had to take over a project where someone quit and need help understanding about how a type of gateway might work. It would be easy if I knew what gateway was used, but unfortunately we are unaware of what the plan was.
Can someone help me figure out how this actually communicates with a gateway? It seems to me like the code is sending itself the request?? Does this mean that the server is configured to handle the gateway request? With other gateways, like paypal, I'm used to just sending an HTTP request to their servers directly.
Are there types of gateways that reside on the host machine? Really confused here.
$payClientIP = "127.0.0.1";
$payClientPort = "9050";
$payClientSocket = -1;
$payClientTimeout = 5;
$payClientSocket = fsockopen($payClientIP, $payClientPort, $errno, $errstr, $payClientTimeout);
function sendCommand($payClientSocket, $command) {
global $payClientTimeout;
socket_set_timeout($payClientSocket, $payClientTimeout);
$buf = $command . "\n";
$response = fputs($payClientSocket, $buf) == strlen($buf);
}
sendCommand($payClientSocket, "7,CardSecurityCode,$cscValue");
sendCommand($payClientSocket, "7,CardNum,$cardNumber");
sendCommand($payClientSocket, "7,CardExp,$cardExpiry");
sendCommand($payClientSocket,"6,$orderInfo,$merchantID,$amount,$locale");
What I'm trying to locate is the command to physically send the request, but I cannot find one. The code actually works and debits the card.