Update: 2026-06-11 18:22:57
This commit is contained in:
44
walletintaleq.intaleq.xyz/v2/main/ride/ecash/ecash_config.php
Executable file
44
walletintaleq.intaleq.xyz/v2/main/ride/ecash/ecash_config.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
// --- ecash_config.php ---
|
||||
// Central configuration file for ecash, loading from a .env file.
|
||||
|
||||
// This assumes you have a function or a library (like Dotenv) to load the .env file.
|
||||
|
||||
|
||||
// --- IMPORTANT ---
|
||||
// Define the path to your .env file. Adjust if necessary.
|
||||
//$env_file_path = '/home/tripz-egypt-wl/env/.env'; // Or use realpath(__DIR__ . '/../.env');
|
||||
//loadEnvironment($env_file_path);
|
||||
require "../../connect.php";
|
||||
// --- Load ecash Credentials from Environment Variables ---
|
||||
define('ECASH_MERCHANT_ID', getenv('ECASH_MERCHANT_ID'));
|
||||
define('ECASH_MERCHANT_SECRET', getenv('ECASH_MERCHANT_SECRET'));
|
||||
define('ECASH_TERMINAL_KEY', getenv('ECASH_TERMINAL_KEY'));
|
||||
|
||||
// --- Set Mode (Staging/Live) from Environment Variable ---
|
||||
// Add ECASH_STAGING_MODE=true to your .env for testing
|
||||
$is_staging = getenv('ECASH_STAGING_MODE') === 'false';
|
||||
define('ECASH_STAGING_MODE', $is_staging);
|
||||
|
||||
// --- URLs (Automatically switch based on mode) ---
|
||||
$checkout_base_url = ECASH_STAGING_MODE ? 'https://checkout.ecash-pay.co' : 'https://checkout.ecash-pay.com';
|
||||
define('ECASH_CHECKOUT_URL', $checkout_base_url);
|
||||
|
||||
// --- Your Application URLs (Load from .env or define here) ---
|
||||
// It's best practice to also put these in your .env file.
|
||||
define('APP_BASE_URL', getenv('APP_BASE_URL')); // e.g., https://yourdomain.com/api
|
||||
define('APP_REDIRECT_URL_SUCCESS', APP_BASE_URL . '/success.php');
|
||||
define('APP_CALLBACK_URL', APP_BASE_URL . '/webhook_ecash.php'); // Use a specific webhook for ecash
|
||||
|
||||
// --- Other Settings ---
|
||||
define('ECASH_CURRENCY', 'SYP');
|
||||
define('ECASH_LANG', 'EN'); // 'EN' for English, 'AR' for Arabic
|
||||
|
||||
// --- Basic Validation ---
|
||||
if (!ECASH_MERCHANT_ID || !ECASH_MERCHANT_SECRET || !ECASH_TERMINAL_KEY) {
|
||||
http_response_code(500);
|
||||
error_log("ecash config: Missing one or more required ecash environment variables.");
|
||||
echo json_encode(['status' => 'error', 'message' => 'Payment gateway not configured correctly.']);
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user