Файл: billing/online_egold.php
Строк: 69
<?php
require_once( "./_rootconfig.php" );
$PAYEE_ACCOUNT = $HTTP_POST_VARS['PAYEE_ACCOUNT'];
$PAYMENT_ID = $HTTP_POST_VARS['PAYMENT_ID'];
$PAYMENT_AMOUNT = $HTTP_POST_VARS['PAYMENT_AMOUNT'];
$PAYMENT_UNITS = $HTTP_POST_VARS['PAYMENT_UNITS'];
$PAYMENT_METAL_ID = $HTTP_POST_VARS['PAYMENT_METAL_ID'];
$PAYMENT_BATCH_NUM = $HTTP_POST_VARS['PAYMENT_BATCH_NUM'];
$PAYER_ACCOUNT = $HTTP_POST_VARS['PAYER_ACCOUNT'];
$handshake_hash = $HTTP_POST_VARS['HANDSHAKE_HASH'];
$ACTUAL_PAYMENT_OUNCES = $HTTP_POST_VARS['ACTUAL_PAYMENT_OUNCES'];
$USD_PER_OUNCE = $HTTP_POST_VARS['USD_PER_OUNCE'];
$FEEWEIGHT = $HTTP_POST_VARS['FEEWEIGHT'];
$TIMESTAMPGMT = $HTTP_POST_VARS['TIMESTAMPGMT'];
$V2_HASH = $HTTP_POST_VARS['V2_HASH'];
if ( $PAYEE_ACCOUNT )
{
mconnect( );
$manager_email = getsetting( "manager_email" );
if ( !$PAYMENT_ID )
{
$error_msg = "Отсутствует номер счета биллинг-системы.";
}
else
{
$bill = getbillbyid( $PAYMENT_ID );
$billMoney = $bill->money_host + $bill->money_domain + $bill->money_addons;
$AlternateMerchantPassphraseHash = strtoupper( md5( getsetting( "egold_pass" ) ) );
$string = $PAYMENT_ID.":".$PAYEE_ACCOUNT.":".$PAYMENT_AMOUNT.":".$PAYMENT_UNITS.":".$PAYMENT_METAL_ID.":".$PAYMENT_BATCH_NUM.":".$PAYER_ACCOUNT.":".$AlternateMerchantPassphraseHash.":".$ACTUAL_PAYMENT_OUNCES.":".$USD_PER_OUNCE.":".$FEEWEIGHT.":".$TIMESTAMPGMT;
if ( $V2_HASH != strtoupper( md5( $string ) ) )
{
$error_msg = "Не правильная контрольная подпись.";
}
else if ( $PAYMENT_AMOUNT != $billMoney )
{
$error_msg = "Не правильная сумма оплаты.";
}
else if ( $PAYEE_ACCOUNT != getsetting( "egold" ) )
{
$error_msg = "Не правильный кошелек продавца.";
}
else
{
makebillpayed( $PAYMENT_ID );
$user = getuserbyid( $bill->uid );
$sid = sprintf( "%04d", $PAYMENT_ID );
$company_name = getsetting( "company_name" );
$company_url = getsetting( "company_url" );
$template = gettpl( "pay_bill" );
$template = str_replace( "{company_name}", $company_name, $template );
$template = str_replace( "{company_url}", $company_url, $template );
$template = str_replace( "{schet}", $sid, $template );
$template = str_replace( "{bill_date}", mydate( $bill->created ), $template );
$template = str_replace( "{pay_method}", "E-Gold Merchant", $template );
sendmail( $user->email, $manager_email, "Оплата счета № {$sid}", $template );
sendmail( $manager_email, $user->email, "Duplicate: Оплата счета № {$sid}", $template );
adduserlog( "{$user->id}", "pay", "Bill № {$sid} via E-Gold Merchant" );
mclose( );
exit( );
}
}
$msg = "Автоматическая оплата через E-Gold Merchant отклонена биллинг-системой по причине:nn{$error_msg}nnPAYMENT_ID {$PAYMENT_ID}nPAYEE_ACCOUNT {$PAYEE_ACCOUNT}nPAYMENT_AMOUNT {$PAYMENT_AMOUNT}nPAYMENT_UNITS {$PAYMENT_UNITS}nPAYMENT_METAL_ID {$PAYMENT_METAL_ID}nPAYMENT_BATCH_NUM {$PAYMENT_BATCH_NUM}nPAYER_ACCOUNT {$PAYER_ACCOUNT}nAlternateMerchantPassphraseHash {$AlternateMerchantPassphraseHash}nACTUAL_PAYMENT_OUNCES {$ACTUAL_PAYMENT_OUNCES}nUSD_PER_OUNCE {$USD_PER_OUNCE}nFEEWEIGHT {$FEEWEIGHT}nTIMESTAMPGMT {$TIMESTAMPGMT}nV2_HASH {$V2_HASH}";
sendmail( $manager_email, $manager_email, "Ошибка автоматической оплаты [E-Gold]", $msg );
mclose( );
}
?>