13 $GLOBALS[
"APPLICATION"]->ThrowException(
"Empty user field",
"EMPTY_USER_ID");
18 $GLOBALS[
"APPLICATION"]->ThrowException(
"Empty pay system field",
"EMPTY_PAY_SYSTEM_ACTION_ID");
23 $GLOBALS[
"APPLICATION"]->ThrowException(
"Empty card type field",
"EMPTY_CARD_TYPE");
28 $GLOBALS[
"APPLICATION"]->ThrowException(
"Empty card number field",
"EMPTY_CARD_NUM");
33 $GLOBALS[
"APPLICATION"]->ThrowException(
"Empty card expiration month field",
"EMPTY_CARD_EXP_MONTH");
38 $GLOBALS[
"APPLICATION"]->ThrowException(
"Empty card expiration year field",
"EMPTY_CARD_EXP_YEAR");
68 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SKGUC_NO_CURRENCY"),
"EMPTY_SUM_CURRENCY");
73 $arUserCard = CSaleUserCard::GetByID(
$ID);
74 if ($arUserCard[
"SUM_CURRENCY"] ==
'')
76 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SKGUC_NO_CURRENCY"),
"EMPTY_SUM_CURRENCY");
96 $dbUser = CUser::GetByID(
$arFields[
"USER_ID"]);
97 if (!$dbUser->Fetch())
99 $GLOBALS[
"APPLICATION"]->ThrowException(str_replace(
"#ID#",
$arFields[
"USER_ID"],
GetMessage(
"SKGUC_NO_USER")),
"ERROR_NO_USER_ID");
108 $GLOBALS[
"APPLICATION"]->ThrowException(str_replace(
"#ID#",
$arFields[
"PAY_SYSTEM_ACTION_ID"],
GetMessage(
"SKGUC_NO_PS")),
"ERROR_NO_PAY_SYSTEM_ACTION");
116 $arFields[
'~TIMESTAMP_X'] = $helper->getCurrentDateTimeFunction();
129 return $DB->Query(
"DELETE FROM b_sale_user_cards WHERE ID = ".
$ID.
" ",
true);
135 $UserID = intval($UserID);
137 return $DB->Query(
"DELETE FROM b_sale_user_cards WHERE USER_ID = ".$UserID.
" ",
true);
142 $strFileName = COption::GetOptionString(
"sale",
"sale_data_file",
"");
145 if (file_exists($strFileName))
146 include($strFileName);
148 if ($pwdString ==
'')
150 $GLOBALS[
"APPLICATION"]->ThrowException(
"Please enter valid password on Sale module global settings page",
"EMPTY_PASSWORD");
165 $strFileName = COption::GetOptionString(
"sale",
"sale_data_file",
"");
167 if (file_exists($strFileName))
168 include($strFileName);
170 if ($pwdString ==
'')
172 $GLOBALS[
"APPLICATION"]->ThrowException(
"Please enter valid password on Sale module global settings page",
"EMPTY_PASSWORD");
177 $cryptAlgorithm = COption::GetOptionString(
"sale",
"crypt_algorithm",
"RC4");
179 if (($cryptAlgorithm ==
"AES" || $cryptAlgorithm ==
"3DES") && extension_loaded(
"mcrypt"))
181 if ($cryptAlgorithm ==
"AES")
182 $rEncModule = mcrypt_module_open(
'rijndael-256',
'',
'ofb',
'');
184 $rEncModule = mcrypt_module_open(MCRYPT_3DES,
'', MCRYPT_MODE_ECB,
'');
188 $randomSource = preg_match(
"/^WIN/i", PHP_OS)? MCRYPT_RAND: MCRYPT_DEV_RANDOM;
189 $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($rEncModule), $randomSource);
194 $iv = urldecode($iv);
198 $keySize = mcrypt_enc_get_key_size($rEncModule);
199 $keyString = mb_substr(md5($pwdString), 0, $keySize);
201 mcrypt_generic_init($rEncModule, $keyString, $iv);
204 $res_data = mcrypt_generic($rEncModule,
$data);
206 $res_data = mdecrypt_generic($rEncModule,
$data);
208 mcrypt_generic_deinit($rEncModule);
210 mcrypt_module_close($rEncModule);
213 $res_data = urlencode($iv).
" ".urlencode($res_data);
223 $pwdLength = mb_strlen($pwdString);
225 for (
$i = 0;
$i <= 255;
$i++)
227 $key[
$i] = ord(mb_substr($pwdString, (
$i % $pwdLength), 1));
232 for (
$i = 0;
$i <= 255;
$i++)
234 $x = ($x + $box[
$i] +
$key[
$i]) % 256;
235 $temp_swap = $box[
$i];
237 $box[$x] = $temp_swap;
245 $countData = mb_strlen(
$data);
246 for (
$i = 0;
$i < $countData;
$i++)
249 $j = ($j + $box[
$a]) % 256;
253 $k = $box[(($box[
$a] + $box[$j]) % 256)];
254 $cipherby = ord(mb_substr(
$data,
$i, 1)) ^
$k;
255 $cipher .= chr($cipherby);
259 $res_data = urldecode(urlencode($cipher));
261 $res_data = urlencode($cipher);
270 $ccNum = preg_replace(
'/[^0-9]+/',
'', $ccNum);
272 if (preg_match(
'/^4(.{12}|.{15})$/', $ccNum))
275 elseif (preg_match(
'/^5[1-5].{14}$/', $ccNum))
278 elseif (preg_match(
'/^3[47].{13}$/', $ccNum))
282 elseif (preg_match(
'/^3(0[0-5].{11}|[68].{12})$/', $ccNum))
285 elseif (preg_match(
'/^6011.{12}$/', $ccNum))
289 elseif (preg_match(
'/^3.{15}|(2131|1800).{11}$/', $ccNum))
292 elseif (preg_match(
'/^2(014|149).{11}$/', $ccNum))
310 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SKGUC_EMPTY_CURRENCY"),
"EMPTY_SUM_CURRENCY");
326 $GLOBALS[
"APPLICATION"]->ThrowException(str_replace(
"#ID#",
$ID,
GetMessage(
"SKGUC_NO_RECID")),
"NO_RECORD");
346 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SKGUC_EMPTY_CURRENCY"),
"EMPTY_SUM_CURRENCY");
350 if (!is_array($arUserCard) ||
count($arUserCard) <= 0)
352 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SKGUC_NO_PARAMS"),
"EMPTY_CARD_ARRAY");
358 if (DoubleVal($arUserCard[
"SUM_MAX"]) > 0)
371 $GLOBALS[
"APPLICATION"]->ThrowException(str_replace(
"#ID#", $arUserCard[
"PAY_SYSTEM_ACTION_ID"],
GetMessage(
"SKGUC_NO_ACTION")),
"NO_PAY_SYSTEM_ACTION");
375 $psActionPath =
$_SERVER[
"DOCUMENT_ROOT"].$arPSAction[
"ACTION_FILE"];
376 if (!file_exists($psActionPath))
378 $GLOBALS[
"APPLICATION"]->ThrowException(str_replace(
"#FILE#", $arPSAction[
"ACTION_FILE"],
GetMessage(
"SKGUC_NO_PATH")),
"NO_PS_PATH");
382 if (is_file($psActionPath))
383 $psActionPath = dirname($psActionPath);
385 if (!file_exists($psActionPath.
"/action.php"))
387 $GLOBALS[
"APPLICATION"]->ThrowException(str_replace(
"#FILE#", $psActionPath.
"/action.php",
GetMessage(
"SKGUC_NO_SCRIPT")),
"NO_PS_SCRIPT");
391 $INPUT_CARD_TYPE = $arUserCard[
"CARD_TYPE"];
397 if (DoubleVal($arUserCard[
"SUM_MIN"]) > 0)
407 $dbUser = CUser::GetByID(intval($arUserCard[
"USER_ID"]));
408 if ($arUser = $dbUser->Fetch())
409 $GLOBALS[
"SALE_INPUT_PARAMS"][
"USER"] = $arUser;
413 if ($arOrder = CSaleOrder::GetByID(
$orderID))
415 $GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"] = $arOrder;
416 $GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"SHOULD_PAY"] = DoubleVal($arOrder[
"PRICE"]) - DoubleVal($arOrder[
"SUM_PAID"]);
418 $arDateInsert = explode(
" ", $arOrder[
"DATE_INSERT"]);
419 if (is_array($arDateInsert) &&
count($arDateInsert) > 0)
420 $GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"DATE_INSERT_DATE"] = $arDateInsert[0];
422 $GLOBALS[
"SALE_INPUT_PARAMS"][
"ORDER"][
"DATE_INSERT_DATE"] = $arOrder[
"DATE_INSERT"];
425 $arCurOrderProps =
array();
431 array(
"ID",
"CODE",
"VALUE",
"ORDER_PROPS_ID",
"PROP_TYPE")
433 while ($arOrderPropVals = $dbOrderPropVals->Fetch())
436 $arOrderPropVals[
"ORDER_PROPS_ID"],
437 $arOrderPropVals[
"CODE"],
438 $arOrderPropVals[
"PROP_TYPE"],
439 $arOrderPropVals[
"VALUE"],
442 foreach ($arCurOrderPropsTmp as
$key => $value)
444 $arCurOrderProps[
$key] = $value;
448 if (
count($arCurOrderProps) > 0)
449 $GLOBALS[
"SALE_INPUT_PARAMS"][
"PROPERTY"] = $arCurOrderProps;
454 include($psActionPath.
"/action.php");
464 "LAST_STATUS" => $OUTPUT_STATUS,
465 "LAST_STATUS_CODE" => $OUTPUT_STATUS_CODE,
466 "LAST_STATUS_DESCRIPTION" => $OUTPUT_STATUS_DESCRIPTION,
467 "LAST_STATUS_MESSAGE" => $OUTPUT_STATUS_MESSAGE,
468 "LAST_SUM" => $OUTPUT_SUM,
469 "LAST_CURRENCY" => $OUTPUT_CURRENCY,
470 "LAST_DATE" => Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat(
"FULL", LANG)))
474 if ($OUTPUT_STATUS ==
"Y")
476 $OUTPUT_SUM = str_replace(
",",
".", $OUTPUT_SUM);
477 $OUTPUT_SUM = DoubleVal($OUTPUT_SUM);
485 $GLOBALS[
"APPLICATION"]->ThrowException($OUTPUT_STATUS_DESCRIPTION,
"ERROR_PAY");
static ConvertCurrency($valSum, $curFrom, $curTo, $valDate="")
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static UnSerializeParams($strParams)
static IdentifyCardType($ccNum)
static WithdrawByID($sum, $currency, $ID, $orderID=0)
static OnUserDelete($UserID)
static Withdraw($sum, $currency, $arUserCard, $orderID=0)
static CheckFields($ACTION, &$arFields, $ID=0)
static CryptData($data, $type)
static GetRealValue($propertyID, $propertyCode, $propertyType, $value, $lang=false)
static Update($ID, $arFields)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$_SERVER["DOCUMENT_ROOT"]
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
$arPaySysAction["ENCODING"]
SaleFormatCurrency($fSum, $strCurrency, $OnlyValue=false, $withoutFormat=false)
const SALE_VALUE_PRECISION
$GLOBALS['_____370096793']