<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Flutter Wave Library for CodeIgniter 3.X.X
 *
 * Library for Flutter Wave payment gateway. It helps to integrate Flutter Wave payment gateway's Standard Method
 * in the CodeIgniter application.
 *
 * It requires Flutterwave configuration file and it should be placed in the config directory.
 *
 * @package     CodeIgniter
 * @category    Libraries
 * @author      Jaydeep Goswami
 * @link        https://infinitietech.com
 * @GITHUB link https://github.com/jaydeepgiri/Flutterwave-Payments-CodeIgniter-3.X.X-Library
 * @license     https://github.com/jaydeepgiri/Flutterwave-Payments-CodeIgniter-3.X.X-Library/blob/master/LICENSE
 * @version     1.0
 */


// ------------------------------------------------------------------------
// Flutter Wave library configuration
// ------------------------------------------------------------------------

// Flutter Wave environment, Sandbox or Live
$settings = get_setting();
$flutterwave = !empty($settings['flutterwave_config'])?json_decode($settings['flutterwave_config']):'';
$config['sandbox'] = isset($flutterwave->is_flutterwave_live) && $flutterwave->is_flutterwave_live==1?FALSE :TRUE; //TRUE for Sandbox - FALSE for live environment

// Flutter Wave API endpoints for Sandbox & Live
$config['payment_endpoint'] = ($config['sandbox']) ? 'https://ravesandboxapi.flutterwave.com/flwv3-pug/getpaidx/api/v2/hosted/pay' : 'https://api.ravepay.co/flwv3-pug/getpaidx/api/v2/hosted/pay';
$config['verify_endpoint'] = ($config['sandbox']) ? 'https://ravesandboxapi.flutterwave.com/flwv3-pug/getpaidx/api/v2/verify' : 'https://api.ravepay.co/flwv3-pug/getpaidx/api/v2/verify';

/* Configuration stars from here */
// Flutter Wave Credentials 
$config['PBFPubKey'] = ($config['sandbox']) ? $flutterwave->fw_public_key : $flutterwave->fw_public_key; /* Public Key for Sandbox : Live */
$config['SECKEY'] = ($config['sandbox']) ? $flutterwave->fw_secret_key : $flutterwave->fw_secret_key; /* Secret Key for Sandbox : Live */
$config['encryption_key'] = ($config['sandbox']) ? $flutterwave->encryption_key : $flutterwave->encryption_key; /* Encryption Key for Sandbox : Live */

// Webhook Secret Hash 
$config['secret_hash'] = ($config['sandbox']) ? 'TEST_SECRET_HASH' : 'LIVE_SECRET_HASH$'; /* Secret HASH for Sandbox : Live */

// What is the default currency?
// $config['currency'] = 'USD';  /* Store Currency Code */
$config['currency'] = get_currency('currency_code');  /* Store Currency Code */

// Transaction Prefix if any
$config['txn_prefix'] = 'TXN_PREFIX';  /* Transaction ID Prefix if any */
