");
print ("
");
print ("");
print ("Test de l'API plug-in MERCANET
");
// Récupération de la variable cryptée DATA
$message="message=$_POST[DATA]";
// Initialisation du chemin du fichier pathfile (à modifier)
// ex :
// -> Windows : $pathfile="pathfile=c:/repertoire/pathfile";
// -> Unix : $pathfile="pathfile=/home/repertoire/pathfile";
$pathfile="pathfile=chemin_du_fichier_pathfile";
// Initialisation du chemin de l'executable response (à modifier)
// ex :
// -> Windows : $path_bin = "c:/repertoire/bin/response";
// -> Unix : $path_bin = "/home/repertoire/bin/response";
//
$path_bin = "chemin_du_fichier_response";
// Appel du binaire response
$message = escapeshellcmd($message);
$result=exec("$path_bin $pathfile $message");
// Sortie de la fonction : !code!error!v1!v2!v3!...!v29
// - code=0 : la fonction retourne les données de la transaction dans les variables v1, v2, ...
// : Ces variables sont décrites dans le GUIDE DU PROGRAMMEUR
// - code=-1 : La fonction retourne un message d'erreur dans la variable error
// on separe les differents champs et on les met dans une variable tableau
$tableau = explode ("!", $result);
// Récupération des données de la réponse
$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 = $tableau[27];
$customer_email = $tableau[28];
$customer_ip_address = $tableau[29];
$capture_day = $tableau[30];
$capture_mode = $tableau[31];
$data = $tableau[32];
$order_validity = $tableau[33];
$transaction_condition = $tableau[34];
$statement_reference = $tableau[35];
$card_validity = $tableau[36];
$score_value = $tableau[37];
$score_color = $tableau[38];
$score_info = $tableau[39];
$score_threshold = $tableau[40];
$score_profile = $tableau[41];
$threed_ls_code = $tableau[43];
$threed_relegation_code = $tableau[44];
// analyse du code retour
if (( $code == "" ) && ( $error == "" ) )
{
print ("
erreur appel response
");
print ("executable response non trouve $path_bin");
}
// Erreur, affiche le message d'erreur
else if ( $code != 0 ){
print ("Erreur appel API de paiement.
");
print ("
");
print (" message erreur : $error
");
}
// OK, affichage des champs de la réponse
else {
# OK, affichage du mode DEBUG si activé
print (" $error
");
print("\n");
print("Réponse manuelle du serveur MERCANET
\n");
print("\n");
print("\n");
print("
\n");
print("
merchant_id : $merchant_id\n");
print("
merchant_country : $merchant_country\n");
print("
amount : $amount\n");
print("
transaction_id : $transaction_id\n");
print("
transmission_date: $transmission_date\n");
print("
payment_means: $payment_means\n");
print("
payment_time : $payment_time\n");
print("
payment_date : $payment_date\n");
print("
response_code : $response_code\n");
print("
payment_certificate : $payment_certificate\n");
print("
authorisation_id : $authorisation_id\n");
print("
currency_code : $currency_code\n");
print("
card_number : $card_number\n");
print("
cvv_flag: $cvv_flag\n");
print("
cvv_response_code: $cvv_response_code\n");
print("
bank_response_code: $bank_response_code\n");
print("
complementary_code: $complementary_code\n");
print("
complementary_info: $complementary_info\n");
print("
return_context: $return_context\n");
print("
caddie : $caddie\n");
print("
receipt_complement: $receipt_complement\n");
print("
merchant_language: $merchant_language\n");
print("
language: $language\n");
print("
customer_id: $customer_id\n");
print("
order_id: $order_id\n");
print("
customer_email: $customer_email\n");
print("
customer_ip_address: $customer_ip_address\n");
print("
capture_day: $capture_day\n");
print("
capture_mode: $capture_mode\n");
print("
data: $data\n");
print("
order_validity: $order_validity\n");
print("
transaction_condition: $transaction_condition\n");
print("
statement_reference: $statement_reference\n");
print("
card_validity: $card_validity\n");
print("
score_value: $score_value\n");
print("
score_color: $score_color\n");
print("
score_info: $score_info\n");
print("
score_threshold: $score_threshold\n");
print("
score_profile: $score_profile\n");
print("
threed_ls_code: $threed_ls_code\n");
print("
threed_relegation_code: $threed_relegation_code\n");
print("
");
}
print ("