modifying pos
This commit is contained in:
parent
4f4b85539c
commit
6be2e6d02b
@ -9,6 +9,7 @@ require_once __DIR__ . '/../includes/WablasService.php';
|
|||||||
$input = file_get_contents('php://input');
|
$input = file_get_contents('php://input');
|
||||||
$data = json_decode($input, true);
|
$data = json_decode($input, true);
|
||||||
|
|
||||||
|
|
||||||
if (!$data) {
|
if (!$data) {
|
||||||
echo json_encode(['success' => false, 'error' => 'No data provided']);
|
echo json_encode(['success' => false, 'error' => 'No data provided']);
|
||||||
exit;
|
exit;
|
||||||
@ -417,7 +418,11 @@ You've earned *{points_earned} points* with this order.
|
|||||||
];
|
];
|
||||||
|
|
||||||
$msg = str_replace(array_keys($replacements), array_values($replacements), $template);
|
$msg = str_replace(array_keys($replacements), array_values($replacements), $template);
|
||||||
$wablas->sendMessage($customer_phone, $msg);
|
$customer_phone = trim((string)$customer_phone);
|
||||||
|
$res = $wablas->sendMessage($customer_phone, $msg);
|
||||||
|
if (empty($res['success'])) {
|
||||||
|
error_log("Wablas Order Send Failed for {$customer_phone}: " . ($res['message'] ?? 'Unknown'));
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception $w) {
|
} catch (Exception $w) {
|
||||||
error_log("Wablas Exception: " . $w->getMessage());
|
error_log("Wablas Exception: " . $w->getMessage());
|
||||||
|
|||||||
@ -21,9 +21,9 @@ class WablasService {
|
|||||||
$settings[$r['setting_key']] = $r['setting_value'];
|
$settings[$r['setting_key']] = $r['setting_value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->domain = $settings['domain'] ?? '';
|
$this->domain = trim($settings['domain'] ?? '');
|
||||||
$this->token = $settings['token'] ?? '';
|
$this->token = trim($settings['token'] ?? '');
|
||||||
$this->secret_key = $settings['secret_key'] ?? '';
|
$this->secret_key = trim($settings['secret_key'] ?? '');
|
||||||
$this->is_enabled = ($settings['is_enabled'] ?? '0') === '1';
|
$this->is_enabled = ($settings['is_enabled'] ?? '0') === '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +38,7 @@ class WablasService {
|
|||||||
$ch = curl_init($url);
|
$ch = curl_init($url);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||||
|
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
@ -105,10 +106,11 @@ class WablasService {
|
|||||||
"Content-Type: application/json"
|
"Content-Type: application/json"
|
||||||
]);
|
]);
|
||||||
curl_setopt($ch, CURLOPT_POST, true);
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload, JSON_UNESCAPED_UNICODE));
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Added 10 second timeout
|
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Added 10 second timeout
|
||||||
|
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||||
|
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
$curlError = curl_error($ch);
|
$curlError = curl_error($ch);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user