25 lines
956 B
PHP
25 lines
956 B
PHP
<?php
|
|
// Thawani Gateway Configuration
|
|
require_once __DIR__ . '/config.php';
|
|
|
|
function get_thawani_settings() {
|
|
static $settings = null;
|
|
if ($settings === null) {
|
|
$pdo = db();
|
|
$stmt = $pdo->query("SELECT setting_key, setting_value FROM settings WHERE setting_key LIKE 'thawani_%'");
|
|
$settings = $stmt->fetchAll(PDO::FETCH_KEY_PAIR);
|
|
}
|
|
return $settings;
|
|
}
|
|
|
|
$th_settings = get_thawani_settings();
|
|
|
|
define('THAWANI_SECRET_KEY', $th_settings['thawani_secret_key'] ?: getenv('THAWANI_SECRET_KEY') ?: 'rRQ26GcsZ60u9Y9v9876543210');
|
|
define('THAWANI_PUBLISHABLE_KEY', $th_settings['thawani_publishable_key'] ?: getenv('THAWANI_PUBLISHABLE_KEY') ?: 'HGvT9876543210');
|
|
define('THAWANI_ENV', $th_settings['thawani_env'] ?: 'sandbox'); // sandbox or production
|
|
|
|
$thawani_url = (THAWANI_ENV === 'sandbox')
|
|
? 'https://uatapi.thawani.om/api/v1'
|
|
: 'https://api.thawani.om/api/v1';
|
|
|
|
define('THAWANI_API_URL', $thawani_url); |