protected function _ConstructPostData($postData)
 {
     $currency = GetDefaultCurrency();
     $currencycode = strtolower($currency['currencycode']);
     switch ($postData['cctype']) {
         case 'VISA':
             $cctype = '001';
             break;
         case 'MC':
             $cctype = '002';
             break;
         case 'AMEX':
             $cctype = '003';
             break;
         case 'DISCOVER':
             $cctype = '004';
             break;
         case 'DINERS':
             $cctype = '005';
             break;
         default:
             $cctype = '000';
             break;
     }
     $amount = $this->GetGatewayAmount();
     $billingDetails = $this->GetBillingDetails();
     $timestamp = getmicrotime();
     $transactionid = $this->GetCombinedOrderId();
     $signatureData = getMerchantID() . $amount . $currencycode . $timestamp . 'sale';
     $cybersourcePost['merchantID'] = getMerchantID();
     $cybersourcePost['billTo_firstName'] = htmlentities($billingDetails['ordbillfirstname']);
     $cybersourcePost['billTo_lastName'] = $billingDetails['ordbilllastname'];
     $cybersourcePost['billTo_street1'] = $billingDetails['ordbillstreet1'];
     $cybersourcePost['billTo_city'] = $billingDetails['ordbillsuburb'];
     $cybersourcePost['billTo_state'] = $billingDetails['ordbillstate'];
     $cybersourcePost['billTo_postalCode'] = $billingDetails['ordbillzip'];
     $cybersourcePost['billTo_country'] = $billingDetails['ordbillcountry'];
     $cybersourcePost['billTo_email'] = $billingDetails['ordbillemail'];
     $cybersourcePost['card_cardType'] = $cctype;
     $cybersourcePost['card_accountNumber'] = $postData['ccno'];
     $cybersourcePost['card_expirationMonth'] = $postData['ccexpm'];
     $cybersourcePost['card_expirationYear'] = '20' . $postData['ccexpy'];
     $cybersourcePost['orderPage_timestamp'] = $timestamp;
     $cybersourcePost['orderPage_signaturePublic'] = hopHash($signatureData, getPublicKey());
     $cybersourcePost['orderPage_serialNumber'] = getSerialNumber();
     $cybersourcePost['orderPage_version'] = '4';
     $cybersourcePost['orderPage_transactionType'] = 'sale';
     $cybersourcePost['amount'] = $amount;
     $cybersourcePost['currency'] = $currencycode;
     $cybersourcePost['hash'] = md5($this->GetValue("accessid") . $transactionid . $_COOKIE['SHOP_ORDER_TOKEN'] . $amount);
     $cybersourcePost['orderid'] = $transactionid;
     $cybersourcePost['iscsessionid'] = $_COOKIE['SHOP_ORDER_TOKEN'];
     return $cybersourcePost;
 }
Exemple #2
0
function VerifySignature($data, $signature)
{
    $pub = getPublicKey();
    $pub_digest = hopHash($data, $pub);
    return strcmp($pub_digest, $signature) == 0;
}