<?PHP
require_once($_SERVER['DOCUMENT_ROOT']."/merchant/payment_config.php");
$desc_en = "Payment basket user id:$id_user";
$desc_rur = "Оплата корзины от пользователя: $id_user";
$desc_utf8 = iconv("CP1251", "UTF-8", $desc_rur);
if($merch == 1) {
if($merchant == 1){
echo "<form method='POST' action='https://merchant.webmoney.ru/lmi/payment.asp'>";
echo "<input type='hidden' name='LMI_PAYMENT_AMOUNT' value='".round($summ,2)."'>";
echo '<input type="hidden" name="LMI_PAYMENT_DESC_BASE64" value="'.base64_encode(iconv("CP1251", "UTF-8", $desc_rur)).'">';
echo "<input type='hidden' name='LMI_PAYMENT_NO' value='$id_user'>";
echo "<input type='hidden' name='LMI_PAYEE_PURSE' value='$sitepurse'>";
echo "<input type='submit' class='btn-blue' style='height:26px;' value='Оплатить'>";
}else{
echo "<a href='wmk:payto?Purse={$sitepurse}&Amount={$summ}&Desc={$desc_rur}&BringToFront=Y'><input type='button' class='btn-blue' style='height:26px;' value='Оплатить'></a>";
}
}elseif($merch == 2){ 
echo '<form action="https://w.qiwi.com/order/external/create.action" accept-charset="windows-1251" method="post">';
echo '<input type="hidden" name="from" value="'.QW_LOGIN.'" />';
echo '<input type="hidden" name="to" value="" />';
echo '<input type="hidden" name="summ" value="'.$summ.'" />';
echo '<input type="hidden" name="currency" value="RUB" />';
echo '<input type="hidden" name="com" value="'.$desc_en.'" />';
echo '<input type="hidden" name="txn_id" value="'.$id_user.'" />';
echo '<input type="hidden" name="order" value="'.$id_user.'" />';
echo '<input type="hidden" name="lifetime" value="24" />';
echo '<input type="hidden" name="check_agt" value="true" />';
echo "<input type='submit' class='btn-blue' style='height:26px;' value='Оплатить'>";
echo '</form>';
}elseif($merch == 3){
echo '<form name="payform" method="post" action="https://money.yandex.ru/quickpay/confirm.xml">';
echo '<input type="hidden" name="receiver" value="'.YM_CLIENT_PURSE.'" />';
echo '<input type="hidden" name="formcomment" value="'.$desc_rur.'" />';
echo '<input type="hidden" name="short-dest" value="'.$desc_rur.'" />';
echo '<input type="hidden" name="writable-targets" value="false" />';
echo '<input type="hidden" name="comment-needed" value="false" />';
echo '<input type="hidden" name="label" value="'.$id_user.'" />';
echo '<input type="hidden" name="quickpay-form" value="shop" />';
echo '<input type="hidden" name="targets" value="'.$desc_rur.'" />';
echo '<input type="hidden" name="sum" value="'.$summ.'" data-type="number" />';
echo '<input type="hidden" name="fio" value="0" />';
echo '<input type="hidden" name="mail" value="0" />';
echo '<input type="hidden" name="phone" value="0" />';
echo '<input type="hidden" name="address" value="0" />';
echo "<input type='submit' class='btn-blue' style='height:26px;' value='Оплатить'>";
echo '</form>';
}elseif($merch == 4){
require_once($_SERVER['DOCUMENT_ROOT']."/merchant/liqpay/lp_class.php");
$order_id = array(0 => time(), 1 => $id_user);
$order_id = implode('~', $order_id);
$liqpay = new LiqPay(LP_MERCH_ID, LP_PRIVAT_KEY);
$html = $liqpay->cnb_form(array(
  'amount'         => $summ,
  'currency'       => LP_CURR,
  'description'    => $desc_en,
  'order_id'       => $order_id,
  'type'           => LP_TYPE,
  'sandbox'        => LP_SENDBOX
));
echo $html;
}elseif($merch == 5){
if(!isset($money_add_usd)) {
@require_once("".$_SERVER['DOCUMENT_ROOT']."/curs/curs.php");
$money_add_usd = number_format(round(($summ/$CURS_USD),2),2,".","");
}
$V2_HASH = strtoupper(md5($id_user.':'.PM_MEMBER_USD.':'.$money_add_usd.':'.PM_PAYMENT_UNITS.':'.strtoupper(md5(PM_PHRASE_HASH)).':'.PM_TIMESTAMPGMT));

echo '<form action="https://perfectmoney.is/api/step1.asp" method="POST">';
echo '<input type="hidden" name="PAYEE_ACCOUNT" value="'.PM_MEMBER_USD.'" />';
echo '<input type="hidden" name="PAYEE_NAME" value="'.$desc_en.'" />';
echo '<input type="hidden" name="PAYMENT_ID" value="'.$id_user.'" />';
echo '<input type="hidden" name="PAYMENT_AMOUNT" value="'.$money_add_usd.'" />';
echo '<input type="hidden" name="PAYMENT_UNITS" value="'.PM_PAYMENT_UNITS.'" />';
echo '<input type="hidden" name="STATUS_URL" value="http://'.HTTP_HOST.'/merchant/perfectmoney/pm_payresult.php" />';
echo '<input type="hidden" name="PAYMENT_URL" value="http://'.HTTP_HOST.'/payok.php" />';
echo '<input type="hidden" name="NOPAYMENT_URL" value="http://'.HTTP_HOST.'/payfail.php" />';
echo '<input type="hidden" name="PAYMENT_BATCH_NUM" value="1" />';
echo '<input type="hidden" name="V2_HASH" value="'.$V2_HASH.'" />';
echo '<input type="submit" value="Оплатить" class="btn-blue" style="height:26px;">';
echo '</form>';
}elseif($merch == 6){
$m_desc = base64_encode($desc_utf8);
$arHash = array(PY_M_SHOP,$id_user,$summ,PY_M_CURR,$m_desc,PY_M_KEY);
$sign = strtoupper(hash('sha256', implode(":", $arHash)));
echo '<form method="GET" action="//payeer.com/merchant/">';
echo '<input type="hidden" name="m_shop" value="'.PY_M_SHOP.'">';
echo '<input type="hidden" name="m_orderid" value="'.$id_user.'">';
echo '<input type="hidden" name="m_amount" value="'.$summ.'">';
echo '<input type="hidden" name="m_curr" value="'.PY_M_CURR.'">';
echo '<input type="hidden" name="m_desc" value="'.$m_desc.'">';
echo '<input type="hidden" name="m_sign" value="'.$sign.'">';
echo '<input type="submit" name="m_process" value="Оплатить" class="btn-blue" style="height:26px;">';
echo '</form>';
}elseif($merch == 7){
$crc  = md5(RK_LOGIN.":".floatval($summ).":$id_user:".RK_PASS1);
echo '<form action="https://merchant.roboxchange.com/Index.aspx" method="POST">';
echo '<input type="hidden" name="MrchLogin" value="'.RK_LOGIN.'">';
echo '<input type="hidden" name="OutSum" value="'.floatval($summ).'">';
echo '<input type="hidden" name="InvId" value="'.$id_user.'">';
echo '<input type="hidden" name="Desc" value="'.$desc_rur.'">';
echo '<input type="hidden" name="SignatureValue" value="'.$crc.'">';
echo '<input type="hidden" name="IncCurrLabel" value="'.RK_CURR.'">';
echo '<input type="hidden" name="Culture" value="'.RK_CULTURE.'">';
echo '<input type="submit" class="btn-blue" style="height:26px;" value="Оплатить">';
echo '</form>';
}elseif($merch == 8){
$ik_sign = "$summ:".IK_SHOP_ID.":".IK_CURR.":$desc_en:".IK_ENC.":".IK_LOC.":$id_user:".IK_SECRET_KEY;
$ik_sign = md5($ik_sign, true);
$ik_sign = base64_encode($ik_sign);
echo '<form name="payment" method="post" action="https://sci.interkassa.com/" accept-charset="UTF-8">';
echo '<input type="hidden" name="ik_am" value="'.$summ.'" />';
echo '<input type="hidden" name="ik_co_id" value="'.IK_SHOP_ID.'" />';
echo '<input type="hidden" name="ik_cur" value="'.IK_CURR.'" />';
echo '<input type="hidden" name="ik_desc" value="'.$desc_en.'" />';
echo '<input type="hidden" name="ik_enc" value="'.IK_ENC.'" />';
echo '<input type="hidden" name="ik_loc" value="'.IK_LOC.'" />';
echo '<input type="hidden" name="ik_pm_no" value="'.$id_user.'" />';
echo '<input type="hidden" name="ik_sign" value="'.$ik_sign.'" />';
echo '<input type="submit" name="process" value="Оплатить" class="btn-blue" style="height:26px;">';
echo '</form>';
}elseif($merch == 9){
$ZP_SIGN = md5(ZP_ID_SHOP.$id_user.$summ.ZP_SECRET_KEY);
echo '<form id="pay" name="pay" method="post" action="https://z-payment.com/merchant.php">';
echo '<input name="LMI_PAYMENT_NO" type="hidden" value="'.$id_user.'" size="10" maxlength="10">';
echo '<input name="LMI_PAYMENT_AMOUNT" type="hidden" value="'.$summ.'" size="10" maxlength="10">';
echo '<input name="LMI_PAYMENT_DESC" type="hidden" value="'.$desc_rur.'" size="35" maxlength="255">';
echo '<input name="LMI_PAYEE_PURSE" type="hidden" value="'.ZP_ID_SHOP.'">';
echo '<input type=hidden name=ZP_SIGN value="'.$ZP_SIGN.'">';
echo '<input type="submit" class="btn-blue" style="height:26px;" value="Оплатить">';
echo '</form>';
}elseif($merch == 10){
$fields = array(); 
$fields["WMI_MERCHANT_ID"] = WO_LOGIN;
$fields["WMI_PAYMENT_AMOUNT"] = round($summ,2);
$fields["WMI_CURRENCY_ID"] = WO_CURRENCY_ID;
$fields["WMI_PAYMENT_NO"] = $id_user;
$fields["WMI_DESCRIPTION"] = "BASE64:".base64_encode($desc_en);
$fields["WMI_PTENABLED"] = WO_PTENABLED;
$fields["WMI_SUCCESS_URL"] = "http://".HTTP_HOST."/payok.php";
$fields["WMI_FAIL_URL"] = "http://".HTTP_HOST."/payfail.php";
foreach($fields as $name => $val){
if(is_array($val)){
usort($val, "strcasecmp");
$fields[$name] = $val;
}
}
uksort($fields, "strcasecmp");
$fieldValues = "";
foreach($fields as $value){
if(is_array($value))
foreach($value as $v){
$fieldValues .= $v;
}else{
$fieldValues .= $value;
}
}
$wo_sign = base64_encode(pack("H*", md5($fieldValues . WO_SECRET_KEY)));
echo '<form method="post" action="https://www.walletone.com/checkout/default.aspx" accept-charset="UTF-8">';
echo '<input name="WMI_MERCHANT_ID" type="hidden" value="'.WO_LOGIN.'"/>';
echo '<input name="WMI_PAYMENT_AMOUNT" type="hidden" value="'.round($summ,2).'"/>';
echo '<input name="WMI_CURRENCY_ID" type="hidden" value="'.WO_CURRENCY_ID.'"/>';
echo '<input name="WMI_PAYMENT_NO" type="hidden" value="'.$id_user.'"/>';
echo '<input name="WMI_DESCRIPTION" type="hidden" value="BASE64:'.base64_encode($desc_en).'"/>';
echo '<input name="WMI_PTENABLED" type="hidden" value="'.WO_PTENABLED.'"/>';
echo '<input name="WMI_SUCCESS_URL" type="hidden" value="http://'.HTTP_HOST.'/payok.php"/>';
echo '<input name="WMI_FAIL_URL" type="hidden" value="http://'.HTTP_HOST.'/payfail.php"/>';
echo '<input name="WMI_SIGNATURE" type="hidden" value="'.$wo_sign.'"/>';
echo '<input type="submit" class="btn-blue" style="height:26px;" value="Оплатить">';
echo '</form>';
}else{ exit(); }
?>