Example #1
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if ($this->payment_params->type == 'hosted') {
         $address = trim($order->cart->shipping_address->address_street . ' ' . $order->cart->billing_address->address_city);
         $customerName = trim($order->cart->billing_address->address_firstname . ' ' . $order->cart->billing_address->address_lastname);
         $redirectUrl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&tmpl=component&orderid=' . $order->order_id;
         $callbackUrl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id;
         $fields = array('merchantID' => $this->payment_params->merchantid, 'action' => 'SALE', 'type' => 1, 'amount' => round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100, 'countryCode' => $this->payment_params->country_code, 'currencyCode' => $this->payment_params->currency_code, 'redirectURL' => $redirectUrl, 'callbackURL' => $callbackUrl, 'transactionUnique' => $order->order_id . '-' . date('Y-m-d'), 'orderRef' => $order->order_id, 'customerName' => $customerName, 'customerAddress' => $address, 'customerPostCode' => $order->cart->shipping_address->address_post_code, 'customerPhone' => $order->cart->shipping_address->address_telephone, 'customerEmail' => $this->user->user_email);
         $fields['signature'] = createSignature($fields, $this->payment_params->secret);
         $this->fields = $fields;
         return $this->showPage('end');
     }
     if ($this->payment_params->type == 'direct') {
     }
 }
Example #2
0
////////////////////////////////////////////////////////////////////////////////////
$sig = 'Color19Trust35Actor';
function createSignature(array $data, $sig)
{
    //echo $sig;
    //  Sort by field name
    ksort($data);
    //  Create the URL encoded signature string
    $ret = http_build_query($data, '', '&');
    //  Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A)
    $ret = str_replace(array('%0D%0A', '%0A%0D', '%0D'), '%0A', $ret);
    //  Hash the signature string and the key together
    return hash('SHA512', $ret . $sig);
}
$req = array('currencyCode' => 826);
$mysend = createSignature($req, $sig);
echo $mysend;
//$myresult = createSignature($mysend, $sig);
//print_r($myresult);
////////////////////////////////////////////////////////////////////////////////////
define('ENCRYPTION_KEY', 'd0a7e7997b6d5fcd55f4b5c32611b87cd923e88837b63bf2941ef819dc8ca282');
// Encrypt Function
function mc_encrypt($encrypt, $key)
{
    $encrypt = serialize($encrypt);
    $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM);
    $key = pack('H*', $key);
    $mac = hash_hmac('sha256', $encrypt, substr(bin2hex($key), -32));
    $passcrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $encrypt . $mac, MCRYPT_MODE_CBC, $iv);
    $encoded = base64_encode($passcrypt) . '|' . base64_encode($iv);
    return $encoded;
Example #3
0
    }
}
$key = 'Broken38Output22Corner';
if (isset($_POST['redirectURL'])) {
    $res = $_POST;
    // updateCreditCardAmount( $res['amount'] ,  $resultCardRequest);
    $ccobj = $res;
    $insert_data['resultCardRequest'] = json_encode($res);
    $insert_data['EmpNum'] = $_SESSION["user"]->EmpNum;
    $insert_data['amount'] = intval(substr($res["amount"], -strlen($res["amount"]), strlen($res["amount"]) - 2));
    $signature = null;
    if (isset($res['signature'])) {
        $signature = $res['signature'];
        unset($res['signature']);
    }
    if (!$signature || $signature !== createSignature($res, $key)) {
        die('Sorry, the signature check failed');
    }
    if ($_SESSION["thank_you"] === true) {
        if ($res['responseCode'] === "0") {
            $card_message = "<p>Thank you for your payment.</p>";
            $total_price = 0;
            $basket = getBasket($_SESSION["user"]->EmpNum);
            if (is_array($basket)) {
                foreach ($basket as $pr_b) {
                    $total_price += $pr_b['aPrice'];
                }
                $insert_data["date"] = date("Y-m-d h:i:s");
                $insert_data["totalPrice"] = $total_price;
                $insert_data["postcode"] = intval($_SESSION['cardForm']["postcode"]);
                $order_insert_id = addBasketOrders($insert_data);
Example #4
0
}
$basket = getBasket($_SESSION["user"]->EmpNum);
$total_price = 0;
foreach ($basket as $pr_b) {
    $total_price += $pr_b['aPrice'];
}
$sum_all = getAvailable($_SESSION['user']->EmpNum);
$sum_credit_card = getCreditCard($_SESSION['user']->EmpNum);
$sum_orders = getEmpBasketOrdersSum($_SESSION['user']->EmpNum);
$remaining_amount = $sum_all + $sum_credit_card - $sum_orders;
$currect_amount = $total_price - $remaining_amount;
// set the correct amount. You only use the amount short. so if basket = £25 and you have £20 then amount is £5
if (!isset($_POST['responseCode'])) {
    $req = array('merchantID' => '104141', 'action' => 'SALE', 'type' => 1, 'amount' => intval($currect_amount . '00'), 'countryCode' => 826, 'currencyCode' => 826, 'transactionUnique' => md5(uniqid(rand(), true)), 'redirectURL' => HTTP_PATH . 'redeem/checkout.php?menu_id=&checkout=true');
    // print_r($req);
    $req['signature'] = createSignature($req, $key);
}
if (isset($_GET["menu_id"])) {
    $menu_id = $_GET["menu_id"];
}
$val = $_SESSION['user']->administrator;
?>

<?php 
echo '<form action="' . htmlentities($url) . '" method="post" name="ccresponse">' . PHP_EOL;
foreach ($req as $field => $value) {
    ?>
		<input type="hidden" name="<?php 
    echo $field;
    ?>
" value="<?php