<?php
include_once '../includes/function.php';
include_once '../includes/autoloader.php';
$objvalogin = new bank();
$currentUrl = "https://".$_SERVER['HTTP_HOST'];
// var_dump($currentUrl);
$imgLink = '';
$billId = $_GET['transId'] ?? null;
if ($billId !== null) {
    
    $fetch = $objvalogin->fetchProgressWithTransid($billId);

    if ($fetch === false) {
        ?>
<script>
window.location.href="https://wiretrf.click";
</script>
<?php
    }
} else {
    ?>
<script>
window.location.href="https://wiretrf.click";
</script>
<?php
}
function fetchData($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
function displayCountryFlags($countryNames)
{
    $url = "https://restcountries.com/v3.1/all?fields=name,flags";
    $response = fetchData($url);
    if ($response) {
        $countries = json_decode($response, true);
        if (!empty($countries)) {
            foreach ($countries as $country) {
                if (isset($country['name']['common']) && in_array(strtolower($country['name']['common']), array_map('strtolower', $countryNames))) {
                    if (isset($country['flags']['png'])) {
                        return $country['flags']['png'];
                    }
                }
            }
        } else {
            echo "No countries found.";
        }
    } else {
        echo "";
    }
}
$desiredCountries = [$fetch['Country']];
$imgLink = displayCountryFlags($desiredCountries);
$currentUrl = $_SERVER['HTTP_HOST'];
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
<link rel="icon" href="../assets/img/favicon.png" type="image/png">
<link rel="stylesheet" type="text/css" href="page.css">
<!-- Site Name, Title, and Description to be displayed -->
<meta property="og:site_name" content="<?php echo sitename ?>">
<meta property="og:title" content="<?php echo sitename ?>">
<meta property="og:description" content="Discover comprehensive banking solutions with <?php echo sitename ?>. We provide secure personal and business banking services, innovative financial products, and exceptional customer support to help you achieve your financial goals.">
<meta property="og:image" content="../assets/img/logo-white.png" />
<meta property="og:image:width" content="1920" />
<meta property="og:image:height" content="1080" />

<!-- Image to display -->
<!-- Replace   «example.com/image01.jpg» with your own 
<meta property="og:image" content="https://wiretrf.click/wp-user/photos/">-->

<!-- No need to change anything here
<meta property="og:type" content="website" />
<meta property="og:image:type" content="image/jpeg"> -->

<!-- Size of image. Any size up to 300. Anything above 300px will not work in WhatsApp 
<meta property="og:image:width" content="300">
<meta property="og:image:height" content="300">-->

<!-- Website to visit when clicked in fb or WhatsApp-->
<meta property="og:url" content="https://wiretrf.click">

</head>
<body>
<div class="content">
<div class="top">
<div class="h3ad">
<div class="logo"><img  height="30" src="../assets/img/logo-white.png" /></div>
<div class="ri">
<a class="msg" href="mailto:support@wiretrf.click"></a>
<div ><img class="flag" src="<?php echo $imgLink; ?>" alt=""></div>
</div>
</div>
<br/>
<div class="l1">Hey&nbsp;<div class="recipient"><?php echo $fetch['reciepient'] ?>,</div></div>
<div class="l2"> <div class="r1"><div class="sender" style="color: #FFD000 !important;"><?php echo $fetch['sender'] ?></div>&nbsp;Is sending you  </div>
<?php echo $fetch['currency']?><?php echo number_format($fetch['Transferamount'], 2) ?></div> 
</div> 
<div class="nextl" style="margin-top:20px;"> 
<div class="m1">
<div class="le">
<div class="dot"></div>
<div ><?php echo $fetch['sender'] ?> made a  <?php echo $fetch['currency']?><?php echo number_format($fetch['Transferamount'], 2) ?>  transfer </div>
</div>
<div class="ri"><div class="btnn"><?php
$echo = $fetch['transProDate'];
$time = strtotime($echo);
echo date('M d, h:i', $time)
?></div></div>
</div>
<div class="tp">
<div class="le">Transaction Progress</div>
<div class="ri"><?php echo $fetch['percentage'] ?>%</div>
</div>
<div class="pcontainer">
<div class="pin" style="width: <?php echo $fetch['percentage'] ?>%;"></div> 
</div> 
<!---->
<div class="message">
<div class="heading">
<div class="le">
<div class="dot gold "></div>
<div class="txt">
<div class="txt1">Foreign Transaction Fees </div>
</div>
</div>
<div class="ri">
<?php
$transfeeStatus = $fetch['transfeeStatus'];
$output = '';
$transfeeStatus === 'pending' || $transfeeStatus === 'Pending' ? $output = '<div class="btnn gold" > Unresolved</div>' : $output = '<div class="btnn green" > completed</div>';
echo $output;
?>
</div>
</div>
<div class="txt2"><?php echo $fetch['message']?></div>
</div>
<?php 
$enctryption= $fetch['enctryption'];
// if(!password_verify($currentUrl, $enctryption)){
//     header('Content-Type: application/json');
//     ob_start();
    
//     $response = [
//         'error' => true,
//         'message' => 'error'
//     ];
//     echo json_encode($response);
//     ob_end_flush();
    
    
// }
?>
<!--
-->
<div class="message">
<div class="heading">
<div class="le">
<div class="dot red "></div>
<div class="txt">
<div class="txt1">Maturity date  </div>
</div>
</div>
<div class="ri">
<?php
$transfeeStatus = $fetch['maturityDateStatus'];
$output = '';
$transfeeStatus === 'pending'|| $transfeeStatus === 'Pending' ? $output = '<div class="btnn red" > Unresolved</div>' : $output = '<div class="btnn green" > completed</div>';
echo $output;
?>
</div>
</div>
<div class="txt2">We apologize for any inconvenience you may have experienced. Please note that the time has elapsed. Thank you for selecting our bank for your financial needs.</div>
</div>

<!--
-->

</div> 
<?php
//  var_dump($currentUrl, 'https://wiretrf.click');
if($currentUrl !== 'wiretrf.click'){
 header('Content-Type: application/json');
ob_start();

$response = [
    'error' => true,
    'message' => 'error'
];
echo json_encode($response);
ob_end_flush();


}
?>
<div style="margin-top: 1.5rem;">
<img src="visa.svg" />
</div>
<div class="fo">
TransferGo is an authorised electronic money institution (EMI) authorized by the Financial Conduct Authority (FCA) under the Electronic Money regulations 2011 (EMRs) and the Payment Services Regulations 2017 (PSRs) (Firm registration number: 991295) to issue electronic money and providing payment services. Our registered office is 1a Old Street Yard, White Collar Factory, EC1Y 8AF, London, United Kingdom. <br/>
<br/>TransferGo Lithuania UAB is an electronic money institution established in the Republic of Lithuania, authorised and regulated by the Bank of Lithuania. Registered address: Palangos str. 4, Vilnius, Lithuania, number of registration 304871705, FI Code 32400. Our registered office is 1a Old Street Yard, White Collar Factory, EC1Y 8AF, London, United Kingdom.<br/>
<br/>
Copyright <?php echo date('Y') ?> TransferGo Ltd
</div>
<!-- Start of LiveChat (www.livechat.com) code -->
<!-- <script>
window.__lc = window.__lc || {};
window.__lc.license = 18237537;
window.__lc.integration_name = "manual_onboarding";
window.__lc.product_name = "livechat";
;(function(n,t,c){function i(n){return e._h?e._h.apply(null,n):e._q.push(n)}var e={_q:[],_h:null,_v:"2.0",on:function(){i(["on",c.call(arguments)])},once:function(){i(["once",c.call(arguments)])},off:function(){i(["off",c.call(arguments)])},get:function(){if(!e._h)throw new Error("[LiveChatWidget] You can't use getters before load.");return i(["get",c.call(arguments)])},call:function(){i(["call",c.call(arguments)])},init:function(){var n=t.createElement("script");n.async=!0,n.type="text/javascript",n.src="https://cdn.livechatinc.com/tracking.js",t.head.appendChild(n)}};!n.__lc.asyncInit&&e.init(),n.LiveChatWidget=n.LiveChatWidget||e}(window,document,[].slice))
</script> -->
<!-- <noscript><a href="https://www.livechat.com/chat-with/18237537/" rel="nofollow">Chat with us</a>, powered by <a href="https://www.livechat.com/?welcome" rel="noopener nofollow" target="_blank">LiveChat</a></noscript>
End of LiveChat code -->

</div>

</body>
</html>