"The cryptogram wasn’t recovered by the merchant.",
"1" => "The cryptogram is present.",
"2" => "The cryptogram is present on the porter’s card but is unreadable.",
"9" => "The porter has informed the merchant that the cryptogram wasn’t printed on his card.",
);
$processor_error['cvv_response_code'] = array(
"4E" => "Cryptogram incorrect",
"4D" => "Cryptogram correct",
"50" => "Cryptogram untreated",
"53" => "The cryptogram is absent from the authorization request",
"55" => "The bank of the internet user isn't certified, the control couldn’t be carried out",
"??" => "The internet user’s bank or the merchant’s bank didn’t respond for the cryptogram.",
"NO" => "No cryptogram on the card, e.g., AMEX.",
);
$processor_error['bank_response_code'] = array(
"00" => "Transaction approved or handled successfully",
"02" => "Contact card issuer",
"03" => "Invalid acceptor",
"04" => "Retain the card",
"05" => "Don’t honor",
"07" => "Retain the card, special conditions",
"08" => "Approve after identification",
"12" => "Invalid transaction",
"13" => "Invalid sum",
"14" => "Carrier number invalid",
"15" => "Unknown card issuer",
"30" => "Format error",
"31" => "Acquirer organization identifier unknown",
"33" => "Card validity date passed",
"34" => "Fraud suspected",
"41" => "Card lost",
"43" => "Card stolen",
"51" => "Insufficient credit or beyond credit limit",
"54" => "Card validity date passed",
"56" => "Card absent from file",
"57" => "Transaction not permitted with carrier",
"58" => "Transaction not allowed at terminal",
"59" => "Fraud suspected",
"60" => "Card acceptor must contact acquirer",
"61" => "Over the withdrawal limit",
"63" => "Security rules not respected",
"68" => "No response or received too late",
"90" => "System halted momentarily",
"91" => "Card issuer inaccessible",
"96" => "System malfunction",
"97" => "Time out error",
"98" => "Server unavailable, new network connection requested",
"99" => "Incident in originator domain",
);
$processor_error['response_code'] = array(
"00" => "Authorization accepted",
"02" => "Authorization requested by telephone to bank due to an exceeded floor limit on the card ",
"03" => "Remote sales contract non existent, contact your bank.",
"05" => "Authorization refused",
"12" => "Transaction invalid, verify the parameters send in the requ",
"13" => "Invalid sum, verify the amount send in the request",
"17" => "Cancelled by internet user",
"30" => "Format error",
"63" => "Security rules not respected, transaction stopped",
"75" => "Exceeded number of attempts to enter card number",
"90" => "Service temporarily unavailable",
);
if ($mode == 'result') {
$payment_id = db_get_field("SELECT ?:payments.payment_id FROM ?:payments LEFT JOIN ?:payment_processors ON ?:payment_processors.processor_id = ?:payments.processor_id WHERE ?:payment_processors.processor_script = 'atos.php' AND ?:payments.status = 'A'");
$processor_data = fn_get_payment_method_data($payment_id);
$message = escapeshellarg("message=$_REQUEST[DATA]");
// -> Windows : $pathfile="pathfile=c:\\repertoire\\pathfile";
// -> Unix : $pathfile="pathfile=/home/repertoire/pathfile";
$pathfile = "pathfile=".$processor_data['processor_params']['atos_files']. '/pathfile';
// -> Windows : $path_bin = "c:\\repertoire\\bin\\response";
// -> Unix : $path_bin = "/home/repertoire/bin/response";
$path_bin = $processor_data['processor_params']['atos_files']. '/response';
$result = exec("$path_bin $pathfile $message");
// Return: !code!error!v1!v2!v3!...!v29
// - code=0: Function returned variables v1!v2!v3...
// - code=-1: Function returned error message
$tableau = explode ("!", $result);
$code = $tableau[1];
$error = $tableau[2];
$merchant_id = $tableau[3];
$merchant_country = $tableau[4];
$amount = $tableau[5];
$transaction_id = $tableau[6];
$payment_means = $tableau[7];
$transmission_date= $tableau[8];
$payment_time = $tableau[9];
$payment_date = $tableau[10];
$response_code = $tableau[11];
$payment_certificate = $tableau[12];
$authorisation_id = $tableau[13];
$currency_code = $tableau[14];
$card_number = $tableau[15];
$cvv_flag = $tableau[16];
$cvv_response_code = $tableau[17];
$bank_response_code = $tableau[18];
$complementary_code = $tableau[19];
$complementary_info = $tableau[20];
$return_context = $tableau[21];
$caddie = $tableau[22];
$receipt_complement = $tableau[23];
$merchant_language = $tableau[24];
$language = $tableau[25];
$customer_id = $tableau[26];
$order_id = (strpos($tableau[27], '_')) ? substr($tableau[27], 0, strpos($tableau[27], '_')) : $tableau[27];
$customer_email = $tableau[28];
$customer_ip_address = $tableau[29];
$capture_day = $tableau[30];
$capture_mode = $tableau[31];
$data = $tableau[32];
$pp_response = array();
if (($code == "") && ($error == "")) {
print ("