Files
2017-03-02 20:30:40 -06:00

54 lines
1.7 KiB
PHP

<?php
if (!defined('CC_INI_SET')) die("Access Denied");
require_once 'CallerService.php';
// Order is Express Checkkout Only
if($module['paymentAction'] == "Order") {
$module['paymentAction'] = "Authorization";
}
$paymentType = urlencode($module['paymentAction']);
$firstName = urlencode(trim($_POST['firstName']));
$lastName = urlencode(trim($_POST['lastName']));
$creditCardType = urlencode(trim($_POST['cardType']));
$creditCardNumber = urlencode(trim($_POST['cardNumber']));
$expDateMonth = urlencode(trim($_POST['expirationMonth']));
$expDateYear = urlencode(trim($_POST['expirationYear']));
$cvv2Number = urlencode(trim($_POST['cvc2']));
$address1 = urlencode(trim($_POST['addr1']));
$address2 = urlencode(trim($_POST['addr2']));
$city = urlencode(trim($_POST['city']));
$state = urlencode(trim($_POST['state']));
$zip = urlencode(trim($_POST['postalCode']));
$amount = urlencode(sprintf("%.2f",$orderSum['prod_total']));
$currencyCode = urlencode($config['defaultCurrency']);
$countryCode = urlencode(trim($_POST['country']));
$ipAddress = urlencode(trim(get_ip_address()));
$padDateMonth = str_pad($expDateMonth, 2, '0', STR_PAD_LEFT);
$nvpStr =
"&PAYMENTACTION=".$paymentType
."&AMT=".$amount
."&CREDITCARDTYPE=".$creditCardType
."&ACCT=".$creditCardNumber
."&EXPDATE=".$padDateMonth.$expDateYear
."&CVV2=".$cvv2Number
."&FIRSTNAME=".$firstName
."&LASTNAME=".$lastName
."&STREET=".$address1
."&CITY=".$city
."&STATE=".$state
."&ZIP=".$zip
."&COUNTRYCODE=".$countryCode
."&CURRENCYCODE=".$currencyCode
."&IPADDRESS=".$ipAddress
.="&BUTTONSOURCE=CubeCart_Cart_DP_US";
$resArray=hash_call("doDirectPayment",$nvpStr);
$ack = strtoupper($resArray["ACK"]);
$errorMsg['customer'] = $resArray["L_LONGMESSAGE0"];
?>