Fix OTC order date validation
This commit is contained in:
1 parent
4a5ce4f5c6
commit
a814fbafcc
1 file changed
+5
-1
@@ -53,7 +53,11 @@ if ($totalPrice === null || $totalPrice <= 0) {
|
||||
|
||||
$orderDateTime = DateTimeImmutable::createFromFormat('!Y-m-d', $orderDate);
|
||||
$orderDateErrors = DateTimeImmutable::getLastErrors();
|
||||
if ($orderDateTime === false || $orderDateErrors === false || $orderDateErrors['warning_count'] > 0 || $orderDateErrors['error_count'] > 0) {
|
||||
if ($orderDateTime === false) {
|
||||
json_response(422, ['ok' => false, 'error' => 'Invalid order date']);
|
||||
}
|
||||
|
||||
if (is_array($orderDateErrors) && (($orderDateErrors['warning_count'] ?? 0) > 0 || ($orderDateErrors['error_count'] ?? 0) > 0)) {
|
||||
json_response(422, ['ok' => false, 'error' => 'Invalid order date']);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user