<?php

require_once '../../../../init.php';
require ROOTDIR . "/includes/orderfunctions.php";

$country = $_POST['country'];
$state = $_POST['state'];
$currency = getCurrency(WHMCS\Session::get("uid"), WHMCS\Session::get("currency"));

if (isset($country) && !empty($country)){
    $_SESSION["cart"]["user"]["state"] = $state;
    $_SESSION["cart"]["user"]["country"] = $country;
    
    $response = new WHMCS\Http\JsonResponse();
    $response->setData(calcCartTotals(null, false, $currency));
    $response->send();
    WHMCS\Terminus::getInstance()->doExit();
}