Compare commits

...

6 Commits

Author SHA1 Message Date
Christophe LATOUR
8a1ff8a221 error-paybox :
Vérification du panier avant paiement
"
2018-01-22 16:06:29 +01:00
Christophe LATOUR
b400200d64 Merge branch 'master' of gitlab.antadis.net:mobile-antadis/api-bbb 2018-01-22 15:40:17 +01:00
root
28b16c3e4a fix 2018-01-22 15:07:28 +01:00
root
63ec80f713 Merge branch 'master' of https://gitlab.antadis.net/mobile-antadis/api-bbb 2018-01-22 14:24:30 +01:00
root
e16a4232d4 Merge branch 'master' of https://gitlab.antadis.net/mobile-antadis/api-bbb
Conflicts:
	app/Web/Controllers/Payments/PayboxController.php
2018-01-22 14:24:18 +01:00
root
2a706c75e4 adding ip client in logs 2018-01-22 11:57:07 +01:00

View File

@ -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);