adding log for payments

This commit is contained in:
Christophe LATOUR 2017-12-15 18:12:37 +01:00
parent 398d925c31
commit 982cbcf565

View File

@ -91,10 +91,20 @@ class PayboxController extends ApiBaseController {
protected function validateResponse(ApiUser $user, $response, $input_data = array(), $create_order = false, $save_card = false) {
$cart = $this->getCart();
$fp = fopen(__DIR__. '/../../../../log_payment'.date('Y-m-d').'.txt', 'a+');
$str = var_export($user->email, true) . "\n" .
var_export($response, true) . "\n" .
var_export($input_data, true) . "\n" .
var_export($create_order, true) . "\n" .
var_export($save_card) . "\n\n";
if ($response === false) {
fwrite($fp, 'FALSE : ' . $str);
return $this->server_error();
}
if (!isset($response['CODEREPONSE']) || $response['CODEREPONSE'] !== '00000') {
fwrite($fp, 'CODE RESPONSE : ' . $str);
return $this->handleError($response);
}
@ -128,6 +138,7 @@ class PayboxController extends ApiBaseController {
$paybox->validateOrder((int)$cart->id, _PS_OS_PAYMENT_, ((int)$input_data['MONTANT']) / 100, $paybox->displayName, $info, array(), NULL, false, $user->secure_key, $data);
$refabonne = isset($input_data['REFABONNE']) && !empty(trim($input_data['REFABONNE'])) ? $input_data['REFABONNE'] : null;
$paybox->saveInformationPaiement($data, false, $refabonne);
fwrite($fp, 'ORDER OK : ' . $str);
}
$cart::$_shouldRenderOrderId = true;
return $cart;