Exemplo n.º 1
0
function DoDpTrade($cfg, $user_id, $pTrdAmt, $post_url)
{
    $merchant_id = $cfg['merchant_id'];
    $terminal_id = $cfg['terminal_id'];
    $key = $cfg['key'];
    $iv = $cfg['iv'];
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Baofoo&class_act=DoDpTrade&from=" . $_REQUEST['from'];
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Baofoo&class_act=DoDpTrade&from=" . $_REQUEST['from'];
    //s2s方式返回
    $user = array();
    $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    $data = array();
    $data['merchant_id'] = $merchant_id;
    //商户号
    $data['terminal_id'] = $terminal_id;
    //终端号
    $data['order_id'] = 0;
    //订单号 (唯一不可重复)
    $data['user_id'] = $user_id;
    $data['amount'] = $pTrdAmt;
    //充值金额,单位:元
    $data['mer_fee'] = 0;
    //商户收取的手续费
    $data['fee_taken_on'] = '1';
    //费用承担方(宝付收取的费用),1平台2用户自担
    $data['additional_info'] = '';
    //其它信息
    $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_recharge", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $data_update = array();
    $data_update['order_id'] = $id;
    $data['order_id'] = $id;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_recharge", $data_update, 'UPDATE', 'id=' . $id);
    $strxml = DoDpTradeXml($data, $pWebUrl, $pS2SUrl);
    $pSign = md5($strxml . "~|~" . $key);
    //$aes=new MyAES();
    //$requestParams=$aes->encrypt($strxml,$key,$iv); //加密
    $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body>
		<form name="form1" id="form1" method="post" action="' . $post_url . 'custody/recharge.do" target="_self">		
			
				merchant_id:<input type="hidden" name="merchant_id" value="' . $merchant_id . '" /><br>
				terminal_id:<input type="hidden" name="terminal_id" value="' . $terminal_id . '" /><br>
				sign:<input type="hidden" name="sign" value="' . $pSign . '" /><br>					
				requestParams:<textarea name="requestParams" cols="100" rows="5">' . $strxml . '</textarea>	<br>	
				<input type="submit" value="提交"></input>
		</form>
		</body></html>
		<script language="javascript">document.form1.submit();</script>';
    //echo $html; exit;
    $baofoo_log = array();
    $baofoo_log['code'] = 'recharge';
    $baofoo_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
    $baofoo_log['strxml'] = $strxml;
    $baofoo_log['html'] = $html;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_log", $baofoo_log);
    return $html;
}
Exemplo n.º 2
0
function DoDpTrade($user_id, $platformNo, $pTrdAmt, $post_url)
{
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=DoDpTrade&from=" . $_REQUEST['from'];
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=DoDpTrade&from=" . $_REQUEST['from'];
    //s2s方式返回
    $user = array();
    $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    //手续费
    $fee = 0;
    //getCarryFee($pTrdAmt,$user);
    $yeepay_log = array();
    $yeepay_log['code'] = 'toRecharge';
    $yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
    $requestNo = $GLOBALS['db']->insert_id();
    $data = array();
    $data['requestNo'] = $requestNo;
    //请求流水号
    $data['platformUserNo'] = $user_id;
    //
    $data['platformNo'] = $platformNo;
    // 商户编号
    $data['amount'] = $pTrdAmt - $fee;
    $data['fee'] = $fee;
    $data['feeMode'] = 'PLATFORM';
    //费率模式PLATFORM
    $data['create_time'] = TIME_UTC;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_recharge", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $strxml = DoDpTradeXml($data, $pWebUrl, $pS2SUrl);
    $pSign = "signdata";
    $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body>
		<form name="form1" id="form1" method="post" action="' . $post_url . '/bha/toRecharge" target="_self">		
		<input type="text" name="sign" value="' . $pSign . '" />		
				<textarea name="req" cols="100" rows="5">' . $strxml . '</textarea>
						 <input type="submit" value="提交"></input>
		</form>
		</body></html>
		<script language="javascript">document.form1.submit();</script>';
    //echo $html; exit;
    $yeepay_log = array();
    $yeepay_log['strxml'] = $strxml;
    $yeepay_log['html'] = $html;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log, 'UPDATE', 'id=' . $requestNo);
    return $html;
}
Exemplo n.º 3
0
function DoDpTrade($user_id, $platformNo, $pTrdAmt, $post_url, $sys = 'pc')
{
    if ($sys == 'pc') {
        $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=DoDpTrade&from=" . $_REQUEST['from'];
        //web方式返回
    } elseif ($sys == 'mobile') {
        $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=DoDpTrade&from=wap";
        //web方式返回
    }
    //$pWebUrl= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=DoDpTrade&from=".$_REQUEST['from'];//web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=DoDpTrade&from=" . $_REQUEST['from'];
    //s2s方式返回
    $user = array();
    $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    //手续费
    //$fee = getCarryFee($pTrdAmt,$user);
    $fee = 0;
    $yeepay_log = array();
    $yeepay_log['code'] = 'toRecharge';
    $yeepay_log['create_date'] = to_date(NOW_TIME, 'Y-m-d H:i:s');
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
    $requestNo = $GLOBALS['db']->insert_id();
    $data = array();
    $data['requestNo'] = $requestNo;
    //请求流水号
    $data['platformUserNo'] = $user_id;
    //
    $data['platformNo'] = $platformNo;
    // 商户编号
    $data['amount'] = $pTrdAmt - $fee;
    //$data['feeMode'] = 'PLATFORM';//费率模式PLATFORM
    $collocation_item = $GLOBALS['db']->getRow("select config from " . DB_PREFIX . "collocation where class_name='Yeepay'");
    $collocation_cfg = unserialize($collocation_item['config']);
    $data['feeMode'] = $collocation_cfg['feeMode'] ? $collocation_cfg['feeMode'] : 'USER';
    //费率模式PLATFORM PLATFORM 收取商户手续费 USER 收取用户手续费
    $data['fee'] = $fee;
    $data['create_time'] = NOW_TIME;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_recharge", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $strxml = DoDpTradeXml($data, $pWebUrl, $pS2SUrl);
    $pSign = cfca($strxml);
    if ($sys == 'pc') {
        $act = 'bha';
    } elseif ($sys == 'mobile') {
        $act = 'bhawireless';
    }
    $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body>
		<form name="form1" id="form1" method="post" action="' . $post_url . '/' . $act . '/toRecharge" target="_self">		
		<input type="hidden" name="sign" value="' . $pSign . '" />		
		<textarea name="req" cols="100" rows="5" style="display:none">' . $strxml . '</textarea>
	 	<input type="hidden" value="提交"></input>
	 	<div style="width:100%;text-align:center;padding:50px 0;"><img src="' . APP_ROOT . '/app/Tpl/' . app_conf("TEMPLATE") . '/images/loading.gif" />页面正在跳转,请稍后...</div>
		</form>
		</body></html>
		<script language="javascript">document.form1.submit();</script>';
    //echo $html; exit;
    $yeepay_log = array();
    $yeepay_log['strxml'] = $strxml;
    $yeepay_log['html'] = $html;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log, 'UPDATE', 'id=' . $requestNo);
    return $html;
}
Exemplo n.º 4
0
/**
 * 充值
 * @param int $user_id
 * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id
 * @param float $pTrdAmt 充值金额
 * @param string $pTrdBnkCode 银行编号
 * @param unknown_type $MerCode
 * @param unknown_type $cert_md5
 * @param unknown_type $post_url
 * @return string
 */
function DoDpTrade($user_id, $user_type, $pTrdAmt, $pTrdBnkCode, $MerCode, $cert_md5, $post_url)
{
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Ips&class_act=DoDpTrade";
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Ips&class_act=DoDpTrade";
    //s2s方式返回
    $user = array();
    if ($user_type == 0) {
        $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    } else {
        $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_agency where id = " . $user_id);
    }
    //print_r($data); exit;
    $data = array();
    $data['user_type'] = $user_type;
    $data['user_id'] = $user_id;
    $data['pMerCode'] = $MerCode;
    // '“平台”账号 否 由IPS颁发的商户号 ',
    $data['pMerBillNo'] = $user_id . 'DP' . get_gmtime();
    //商户充值订单号 否 商户系统唯一不重复,
    $data['pAcctType'] = 1;
    //账户类型 否 固定值为 1,表示为类型为IPS个人账户,
    $data['pIdentNo'] = $user['idno'];
    //'证件号码 否 真实身份证(个人)/IPS颁发的商户号(商户) 本期考虑个人,商户充值预留,下期增加
    $data['pRealName'] = $user['real_name'];
    //'姓名 否 真实姓名(中文) pIpsAcctNo 30 IPS托管账户号 否 账户类型为1时,IPS托管账户号(个人)
    $data['pIpsAcctNo'] = $user['ips_acct_no'];
    //IPS托管账户号 账户类型为1时,IPS托管账户号(个人)
    $data['pTrdDate'] = to_date(get_gmtime(), 'Ymd');
    //充值日期 否 格式:YYYYMMDD
    $data['pTrdAmt'] = str_replace(',', '', number_format($pTrdAmt, 2));
    //充值金额 否 金额单位:元,丌能为负,丌允许为0,保留2位小数; 格式:12.00
    $data['pChannelType'] = 1;
    //充值渠道种类 否 1#网银充值;2#代扣充值
    $data['pTrdBnkCode'] = $pTrdBnkCode;
    //充值银行 是/否 网银充值的银行列表由IPS提供,对应充值银行的CODE, 具体使用见接口 <<商户端获取银行列表查询(WS)>>, 获取pBankList内容项中“银行卡编号”字段; 代扣充值这里传空; ',
    $data['pMerFee'] = '0.00';
    //`pMerFee` decimal(11,2) default '0.00' COMMENT '平台手续费 否 这里是平台向用户收取的费用 金额单位:元,丌能为负,允许为0,保留2位小数; 格式:12.00 ',
    $data['pIpsFeeType'] = 2;
    //'谁付IPS手续费 否 这里是IPS向平台收取的费用 1:平台支付 2:用户支付 ',
    $GLOBALS['db']->autoExecute(DB_PREFIX . "ips_do_dp_trade", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $strxml = DoDpTradeXml($data, $pWebUrl, $pS2SUrl);
    //echo $strxml;exit;
    $Crypt3Des = new Crypt3Des();
    //new 3des class
    $p3DesXmlPara = $Crypt3Des->DESEncrypt($strxml);
    //3des 加密
    $str = $MerCode . $p3DesXmlPara . $cert_md5;
    //print_r($cert_md5); exit;
    $pSign = md5($str);
    $html = '
		<form name="form1" id="form1" method="post" action="' . $post_url . 'doDpTrade.aspx" target="_self">
		<input type="hidden" name="pMerCode" value="' . $MerCode . '" />
		<input type="hidden" name="p3DesXmlPara" value="' . $p3DesXmlPara . '" />
		<input type="hidden" name="pSign" value="' . $pSign . '" />
		</form>
		<script language="javascript">document.form1.submit();</script>';
    //echo $html; exit;
    return $html;
}