1<?
if (!defined(
"B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !==
true)
die();?><?
3include(dirname(__FILE__).
"/common.php");
34 $strPostQueryString =
"x_version=3.1";
37 $strPostQueryString .=
"&x_test_request=".(CSalePaySystemAction::GetParamValue(
"TEST_TRANSACTION") ?
"TRUE" :
"FALSE").
"";
40 $strPostQueryString .=
"&x_delim_data=True";
41 $strPostQueryString .=
"&x_relay_response=False";
42 $strPostQueryString .=
"&x_delim_char=,";
43 $strPostQueryString .=
"&x_encap_char=|";
45 $arTmp =
array(
"x_first_name" =>
"FIRST_NAME",
"x_last_name" =>
"LAST_NAME",
46 "x_company" =>
"COMPANY",
"x_address" =>
"ADDRESS",
"x_city" =>
"CITY",
47 "x_state" =>
"STATE",
"x_zip" =>
"ZIP",
"x_country" =>
"COUNTRY",
48 "x_phone" =>
"PHONE",
"x_fax" =>
"FAX"
53 $strPostQueryString .=
"&".$key.
"=".urlencode(
$val);
57 $strPostQueryString .=
"&x_cust_id=".urlencode(
$GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"USER_ID"]);
59 $strPostQueryString .=
"&x_customer_ip=".urlencode(
$val);
63 $strPostQueryString .=
"&x_email=".urlencode(
$val);
65 $strPostQueryString .=
"&x_email_customer=FALSE";
66 $strPostQueryString .=
"&x_merchant_email=".urlencode(COption::GetOptionString(
"sale",
"order_email",
""));
69 $strPostQueryString .=
"&x_invoice_num=".urlencode(
$GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"ID"]);
70 $strPostQueryString .=
"&x_description=".urlencode(
$GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"DATE_INSERT"]);
73 $arTmp =
array(
"x_ship_to_first_name" =>
"SHIP_FIRST_NAME",
74 "x_ship_to_last_name" =>
"SHIP_LAST_NAME",
"x_ship_to_company" =>
"SHIP_COMPANY",
75 "x_ship_to_address" =>
"SHIP_ADDRESS",
"x_ship_to_city" =>
"SHIP_CITY",
76 "x_ship_to_state" =>
"SHIP_STATE",
"x_ship_to_zip" =>
"SHIP_ZIP",
77 "x_ship_to_country" =>
"SHIP_COUNTRY"
82 $strPostQueryString .=
"&".$key.
"=".urlencode(
$val);
86 $strPostQueryString .=
"&x_amount=".urlencode(
$GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"SHOULD_PAY"]);
87 $strPostQueryString .=
"&x_currency_code=".urlencode(
$GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"CURRENCY"]);
88 $strPostQueryString .=
"&x_method=CC";
89 $strPostQueryString .=
"&x_type=AUTH_CAPTURE";
90 $strPostQueryString .=
"&x_recurring_billing=NO";
96 $strPostQueryString .=
"&x_tax=".urlencode(
$GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"TAX_VALUE"]);
97 $strPostQueryString .=
"&x_freight=".urlencode(
$GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"PRICE_DELIVERY"]);
100 $strResult =
QueryGetData(
"secure.authorize.net", 443,
"/gateway/transact.dll", $strPostQueryString, $errno, $errstr,
"POST",
"ssl://");
102 $mass = explode(
"|,|",
"|,".$strResult);
105 if ($strHashValue <>
'')
107 if (md5($strHashValue.(CSalePaySystemAction::GetParamValue(
"PS_LOGIN")).$mass[7].sprintf(
"%.2f",
$GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"SHOULD_PAY"])) != mb_strtolower($mass[38]))
111 $mass[4] =
"MD5 transaction signature is incorrect!";
117 $strPS_STATUS = ((intval($mass[1])==1) ?
"Y" :
"N");
118 $strPS_STATUS_CODE = $mass[3];
119 if ($strPS_STATUS ==
"Y")
120 $strPS_STATUS_DESCRIPTION =
"Approval Code: ".$mass[5].(!empty($mass[7]) ?
"; Transaction ID: ".$mass[7] :
"");
123 $strPS_STATUS_DESCRIPTION = (intval($mass[1])==2 ?
"Declined" :
"Error").
": ".$mass[4].
" (Reason Code ".$mass[3].
" / Sub ".$mass[2].
")";
124 $strPaySysError .= (intval($mass[1])==2 ?
"Transaction was declined" :
"Error while processing transaction").
": ".$mass[4].
" (".$mass[3].
"/".$mass[2].
")";
127 $strPS_STATUS_MESSAGE =
"";
128 if (!empty($mass[6]))
129 $strPS_STATUS_MESSAGE .=
"\nAVS Result: [".$mass[6].
"] ".
$arAVSErr[$mass[6]].
";";
131 if (!empty($mass[39]))
132 $strPS_STATUS_MESSAGE .=
"\nCard Code Result: [".$mass[39].
"] ".
$arCVVErr[$mass[39]].
";";
134 if (!empty($mass[40]))
135 $strPS_STATUS_MESSAGE .=
"\nCAVV: [".$mass[40].
"] ".
$arCAVVErr[$mass[40]].
";";
137 $strPS_SUM = $mass[10];
139 $arPaySysResult =
array(
140 "PS_STATUS" => $strPS_STATUS,
141 "PS_STATUS_CODE" => $strPS_STATUS_CODE,
142 "PS_STATUS_DESCRIPTION" => $strPS_STATUS_DESCRIPTION,
143 "PS_STATUS_MESSAGE" => $strPS_STATUS_MESSAGE,
144 "PS_SUM" => $strPS_SUM,
145 "PS_CURRENCY" =>
$GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"CURRENCY"],
146 "PS_RESPONSE_DATE" => Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat(
"FULL",
SITE_ID))),
147 "USER_CARD_TYPE" =>
false,
158 <table border=
"0" cellpadding=
"3" cellspacing=
"0" width=
"100%">
160 <td
align=
"right" width=
"40%" class=
"tablebody">
161 <font
class=
"tablebodytext">
165 <td
class=
"tablebody" width=
"60%">
166 <input type=
"text" class=
"inputtext" name=
"ccard_num" size=
"30" value=
"<?= htmlspecialcharsbx($_REQUEST["ccard_num
"]) ?>">
170 <td
align=
"right" class=
"tablebody" width=
"40%">
171 <font
class=
"tablebodytext">
175 <td
class=
"tablebody" width=
"60%">
176 <
select name=
"ccard_date1" class=
"inputselect">
178 <option value=
"<?= $i ?>"<?= ((
$i==
$_REQUEST[
"ccard_date1"]) ?
"selected" :
"") ?>><?=
$i ?></option>
182 <
select name=
"ccard_date2" class=
"inputselect">
184 <option value=
"<?= $i ?>"<?= ((
$i==
$_REQUEST[
"ccard_date2"]) ?
"selected" :
"") ?>><?=
$i ?></option>
190 <td
align=
"right" class=
"tablebody" width=
"40%">
191 <font
class=
"tablebodytext">
195 <td
class=
"tablebody" width=
"60%">
196 <input type=
"text" class=
"inputtext" name=
"ccard_code" size=
"5" value=
"<?= htmlspecialcharsbx($_REQUEST["ccard_code
"]) ?>">
static GetParamValue($key, $defaultValue=null)
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
QueryGetData($SITE, $PORT, $PATH, $QUERY_STR, &$errno, &$errstr, $sMethod="GET", $sProto="", $sContentType='N')
GetMessage($name, $aReplace=null)
GetLangFileName($before, $after, $lang=false)
if(intval($iTestTransaction) > 0) $arTmp
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
$GLOBALS['_____370096793']