error-paybox :
Vérification du panier avant paiement "
This commit is contained in:
parent
b400200d64
commit
8a1ff8a221
@ -57,6 +57,31 @@ class PayboxController extends ApiBaseController {
|
||||
* Returns num question for paybox
|
||||
*/
|
||||
public function getQuestion(Request $request) {
|
||||
|
||||
|
||||
$cart = $this->getCart();
|
||||
if ($cart->getNbProducts($cart->id) <= 0) {
|
||||
$date_add = \Db::getInstance()->executeS('
|
||||
SELECT `date_add`
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE `id_customer` = '.(int)$request->user()->id.'
|
||||
AND `valid` = 1
|
||||
ORDER BY date_add DESC LIMIT 1
|
||||
');
|
||||
|
||||
/* CHECK LAST ORDER DATE */
|
||||
if ($date_add && isset($date_add[0]['date_add'])) {
|
||||
$date_add = $date_add[0]['date_add'];
|
||||
if (strtotime('now') - strtotime($date_add) <= 60 * 3) {
|
||||
throw new HttpBadRequestException('Votre panier est vide. Il semblerai que vous ayez passer une commande il y a ' . (strtotime('now') - strtotime($date_add)) . ' secondes. Merci de vérifier vos commandes.');
|
||||
} else {
|
||||
throw new HttpBadRequestException('Veuillez vérifier votre panier. Il semblerai qu\'il soit vide');
|
||||
}
|
||||
}
|
||||
throw new HttpBadRequestException('Veuillez vérifier votre panier. Il semblerai qu\'il soit vide');
|
||||
}
|
||||
|
||||
|
||||
$numquestion = (int)ApiConfiguration::get('NUM_QUESTION_PAYBOX') + 1;
|
||||
(int)ApiConfiguration::updateValue('NUM_QUESTION_PAYBOX', $numquestion);
|
||||
|
||||
@ -101,7 +126,7 @@ class PayboxController extends ApiBaseController {
|
||||
$fp = fopen(__DIR__. '/../../../../log_payment'.date('Y-m-d').'.txt', 'a+');
|
||||
|
||||
$str = var_export($_SERVER['REMOTE_ADDR'], true) . " " .
|
||||
var_export($user->email, true) . " " .
|
||||
var_export($user->email, true) . " " .
|
||||
var_export($response, true) . " " .
|
||||
var_export($input_data, true) . " " .
|
||||
var_export($create_order, true) . " " .
|
||||
|
Loading…
Reference in New Issue
Block a user