本文整理汇总了PHP中Payment::getPaymentById方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::getPaymentById方法的具体用法?PHP Payment::getPaymentById怎么用?PHP Payment::getPaymentById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::getPaymentById方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callback
/**
* @see paymentplugin::callback()
*/
public function callback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
{
$UserName = Payment::getPaymentById($paymentId, 'partner_id');
$IDcode = Payment::getPaymentById($paymentId, 'partner_key');
$return = array();
$return['business'] = urldecode($UserName);
$return['item_number'] = urldecode($callbackData['item_number']);
$return['amount'] = urldecode($callbackData['amt']);
$return['return'] = urldecode($this->callbackUrl);
$return['notify_url'] = urldecode($this->serverCallbackUrl);
$md5Code = $this->createMD5($return, $IDcode);
//校验md5码 防止篡改数据
if (urldecode($callbackData['cm']) == $md5Code) {
switch ($callbackData['st']) {
case 'Completed':
$orderNo = $callbackData['item_number'];
$money = $callbackData['amt'];
return true;
break;
default:
return false;
break;
}
} else {
$message = '校验码不正确';
}
return false;
}
示例2: callback
/**
* @see paymentplugin::callback()
*/
public function callback($ExternalData, &$paymentId, &$money, &$message, &$orderNo)
{
$partnerKey = Payment::getPaymentById($paymentId, 'partner_key');
$user_id = ISafe::get('user_id');
ksort($ExternalData);
$temp = array();
foreach ($ExternalData as $k => $v) {
if ($k != 'sign') {
$temp[] = $k . '=' . urlencode($v);
}
}
$testStr = join('&', $temp) . '&' . $user_id . $partnerKey;
$orderNo = $ExternalData['order_no'];
$money = $ExternalData['total_fee'];
if ($ExternalData['sign'] == md5($testStr)) {
//支付单号
switch ($ExternalData['is_success']) {
case 'T':
$log = new AccountLog();
$config = array('user_id' => $user_id, 'event' => 'pay', 'note' => '通过余额支付方式进行商品购买', 'num' => '-' . $money, 'order_id' => $orderNo);
$log->write($config);
return true;
break;
case 'F':
return false;
break;
}
} else {
$message = '校验码不正确';
}
return false;
}
示例3: serverCallback
/**
* @see paymentplugin::serverCallback()
*/
public function serverCallback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
{
$key = Payment::getPaymentById($paymentId, 'partner_key');
$v_oid = trim($_POST['v_oid']);
$v_pmode = trim($_POST['v_pmode']);
$v_pstatus = trim($_POST['v_pstatus']);
$v_pstring = trim($_POST['v_pstring']);
$v_amount = trim($_POST['v_amount']);
$v_moneytype = trim($_POST['v_moneytype']);
$remark1 = trim($_POST['remark1']);
$remark2 = trim($_POST['remark2']);
$v_md5str = trim($_POST['v_md5str']);
//拼凑加密串
$md5string = strtoupper(md5($v_oid . $v_pstatus . $v_amount . $v_moneytype . $key));
if ($v_md5str == $md5string) {
if ($v_pstatus == "20") {
return true;
} else {
return false;
}
} else {
$message = '验证码核对不正确';
}
return false;
}
示例4: getConf
/**
* @brief 获取支付插件配置详细信息
* @param $paymentId int 支付方式id值
* @param $key string 插件配置项
*/
public function getConf($paymentId, $key = '')
{
if (empty($this->_config)) {
$payment = new Payment();
$payment_cfg = $payment->getPaymentById($paymentId);
$this->_config = unserialize($payment_cfg['config']);
}
if ($key != '' && isset($this->_config[$key])) {
return $this->_config[$key];
} else {
return $this->_config;
}
}
示例5: serverCallback
/**
* @see paymentplugin::serverCallback()
*/
public function serverCallback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
{
//除去待签名参数数组中的空值和签名参数
$para_filter = $this->paraFilter($callbackData);
//对待签名参数数组排序
$para_sort = $this->argSort($para_filter);
//生成签名结果
$mysign = $this->buildMysign($para_sort, Payment::getPaymentById($paymentId, 'partner_key'));
if ($callbackData['sign'] == $mysign) {
//回传数据
$orderNo = $callbackData['out_trade_no'];
$money = $callbackData['total_fee'];
if ($callbackData['trade_status'] == 'TRADE_FINISHED' || $callbackData['trade_status'] == 'TRADE_SUCCESS') {
return true;
}
}
return false;
}
示例6: serverCallback
/**
* @see paymentplugin::serverCallback()
*/
public function serverCallback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
{
//除去待签名参数数组中的空值和签名参数
$para_filter = $this->paraFilter($callbackData);
//对待签名参数数组排序
$para_sort = $this->argSort($para_filter);
//生成签名结果
$mysign = $this->buildMysign($para_sort, Payment::getPaymentById($paymentId, 'partner_key'));
if ($callbackData['sign'] == strtoupper($mysign)) {
//回传数据
$orderNo = $callbackData['out_trade_no'];
$money = $callbackData['total_fee'] / 100;
$message = isset($callbackData['pay_info']) ? $callbackData['pay_info'] : '';
if ($message == '' && $callbackData['trade_state'] == '0') {
return true;
}
}
return false;
}
示例7: doPay
/**
* @brief 支付方法
*/
public static function doPay()
{
//获得payment_id 获得相关参数
$payment_id = intval(IReq::get('id'));
$order_id = intval(IReq::get('order_id'));
$recharge = IReq::get('recharge');
//检查支付方式可用性
$paymentObj = new Payment();
$paymentRow = $paymentObj->getPaymentById($payment_id);
if (empty($paymentRow)) {
IError::show(403, '支付方式不存在');
}
//载入支付接口文件
$payObj = $paymentObj->loadMethod($paymentRow['file_path']);
if (isset($payObj->head_charset)) {
header("Content-Type: text/html;charset=" . $payObj->head_charset);
}
$html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-US\" lang=\"en-US\" dir=\"ltr\">\n <head>\n</header><body><div>Redirecting...</div>";
//在线充值
if ($recharge !== null) {
$reData = array('account' => $recharge, 'payment_type' => $paymentRow['name']);
$toSubmit = $payObj->toSubmit($paymentObj->getPaymentInfo($payment_id, 'recharge', $reData));
} else {
if ($order_id != 0) {
$toSubmit = $payObj->toSubmit($paymentObj->getPaymentInfo($payment_id, 'order', $order_id));
} else {
IError::show(403, '发生支付错误');
}
}
//兼容站外站内的支付方式
if (strtolower(substr($payObj->submitUrl, 0, 4)) != 'http') {
$payObj->submitUrl = IUrl::creatUrl($payObj->submitUrl);
}
$html .= "<form id=\"payment\" action=\"" . $payObj->submitUrl . "\" method=\"" . $payObj->method . "\">";
$buffer = "";
foreach ($toSubmit as $k => $v) {
if ($k != "ikey") {
$html .= "<input type=\"hidden\" name=\"" . urldecode($k) . "\" value=\"" . htmlspecialchars($v) . "\" />";
$buffer .= $k . "=" . urlencode($v) . "&";
}
}
$html .= "\n</form>\n<script language=\"javascript\">\ndocument.getElementById('payment').submit();\n</script>\n</html>";
echo $html;
exit;
}
示例8: serverCallback
/**
* @see paymentplugin::serverCallback()
*/
public function serverCallback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
{
//获取人民币网关账户号
$merchantAcctId = trim($_REQUEST['merchantAcctId']);
//设置人民币网关密钥
///区分大小写
$key = Payment::getPaymentById($paymentId, 'partner_key');
//商户密钥
//获取网关版本.固定值
///快钱会根据版本号来调用对应的接口处理程序。
///本代码版本号固定为v2.0
$version = trim($_REQUEST['version']);
//获取语言种类.固定选择值。
///只能选择1、2、3
///1代表中文;2代表英文
///默认值为1
$language = trim($_REQUEST['language']);
//签名类型.固定值
///1代表MD5签名
///当前版本固定为1
$signType = trim($_REQUEST['signType']);
//获取支付方式
///值为:10、11、12、13、14
///00:组合支付(网关支付页面显示快钱支持的各种支付方式,推荐使用)10:银行卡支付(网关支付页面只显示银行卡支付).11:电话银行支付(网关支付页面只显示电话支付).12:快钱账户支付(网关支付页面只显示快钱账户支付).13:线下支付(网关支付页面只显示线下支付方式).14:B2B支付(网关支付页面只显示B2B支付,但需要向快钱申请开通才能使用)
$payType = trim($_REQUEST['payType']);
//获取银行代码
///参见银行代码列表
$bankId = trim($_REQUEST['bankId']);
//获取商户订单号
$orderId = trim($_REQUEST['orderId']);
//获取订单提交时间
///获取商户提交订单时的时间.14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
///如:20080101010101
$orderTime = trim($_REQUEST['orderTime']);
//获取原始订单金额
///订单提交到快钱时的金额,单位为分。
///比方2 ,代表0.02元
$orderAmount = trim($_REQUEST['orderAmount']);
//获取快钱交易号
///获取该交易在快钱的交易号
$dealId = trim($_REQUEST['dealId']);
//获取银行交易号
///如果使用银行卡支付时,在银行的交易号。如不是通过银行支付,则为空
$bankDealId = trim($_REQUEST['bankDealId']);
//获取在快钱交易时间
///14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
///如;20080101010101
$dealTime = trim($_REQUEST['dealTime']);
//获取实际支付金额
///单位为分
///比方 2 ,代表0.02元
$payAmount = trim($_REQUEST['payAmount']);
//获取交易手续费
///单位为分
///比方 2 ,代表0.02元
$fee = trim($_REQUEST['fee']);
//获取扩展字段1
$ext1 = trim($_REQUEST['ext1']);
//获取扩展字段2
$ext2 = trim($_REQUEST['ext2']);
//获取处理结果
///10代表 成功; 11代表 失败
$payResult = trim($_REQUEST['payResult']);
//获取错误代码
///详细见文档错误代码列表
$errCode = trim($_REQUEST['errCode']);
//获取加密签名串
$signMsg = trim($_REQUEST['signMsg']);
//生成加密串。必须保持如下顺序。
$merchantSignMsgVal = '';
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "merchantAcctId", $merchantAcctId);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "version", $version);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "language", $language);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "signType", $signType);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "payType", $payType);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "bankId", $bankId);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "orderId", $orderId);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "orderTime", $orderTime);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "orderAmount", $orderAmount);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "dealId", $dealId);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "bankDealId", $bankDealId);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "dealTime", $dealTime);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "payAmount", $payAmount);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "fee", $fee);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "ext1", $ext1);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "ext2", $ext2);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "payResult", $payResult);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "errCode", $errCode);
$merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "key", $key);
$merchantSignMsg = md5($merchantSignMsgVal);
if (strtoupper($signMsg) == strtoupper($merchantSignMsg)) {
$money = $orderAmount / 100;
$orderNo = $orderId;
$message = $payResult;
//支付单号
switch ($payResult) {
case '10':
//.........这里部分代码省略.........
示例9: doPay
/**
* @brief 【重要】进行支付支付方法
*/
public function doPay()
{
//获得相关参数
$order_id = IFilter::act(IReq::get('order_id'), 'int');
$recharge = IReq::get('recharge');
$payment_id = IFilter::act(IReq::get('payment_id'), 'int');
if ($order_id) {
//获取订单信息
$orderDB = new IModel('order');
$orderRow = $orderDB->getObj('id = ' . $order_id);
if (empty($orderRow)) {
IError::show(403, '要支付的订单信息不存在');
}
$payment_id = $orderRow['pay_type'];
}
//获取支付方式类库
$paymentInstance = Payment::createPaymentInstance($payment_id);
//在线充值
if ($recharge !== null) {
$recharge = IFilter::act($recharge, 'float');
$paymentRow = Payment::getPaymentById($payment_id);
//account:充值金额; paymentName:支付方式名字
$reData = array('account' => $recharge, 'paymentName' => $paymentRow['name']);
$sendData = $paymentInstance->getSendData(Payment::getPaymentInfo($payment_id, 'recharge', $reData));
} else {
if ($order_id != 0) {
$sendData = $paymentInstance->getSendData(Payment::getPaymentInfo($payment_id, 'order', $order_id));
} else {
IError::show(403, '发生支付错误');
}
}
$this->paymentInstance = $paymentInstance;
$this->sendData = $sendData;
$this->redirect('hidden_form', false);
}