本文整理汇总了PHP中Payment::getConfigParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::getConfigParam方法的具体用法?PHP Payment::getConfigParam怎么用?PHP Payment::getConfigParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::getConfigParam方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* @brief 开始向接口发送数据
* @param $data array 订单和配送数据
*/
public function send($data)
{
require_once dirname(__FILE__) . "/lib/alipay_submit.class.php";
/* if(isset($data['seller_id']) && $data['seller_id'] > 0 ){
//获取商户的支付配置信息
$sellPay = new IModel("seller_payment");
$sellers = $sellPay->getObj("seller_id = ".$data['seller_id']);
if(empty($sellers)){
return false;
}
} */
$alipay_config = array('partner' => Payment::getConfigParam($data['pay_type'], 'M_PartnerId'), 'key' => Payment::getConfigParam($data['pay_type'], 'M_PartnerKey'), 'sign_type' => strtoupper('MD5'), 'input_charset' => strtolower('utf-8'), 'cacert' => getcwd() . '/cacert.pem', 'transport' => 'http');
//支付宝交易号
$trade_no = $data['trade_no'];
//必填
//物流公司名称
$logistics_name = $data['freight_type'];
//必填
//物流发货单号
$invoice_no = $data['delivery_code'];
//物流运输类型 三个值可选:POST(平邮)、EXPRESS(快递)、EMS(EMS)
$transport_type = 'EXPRESS';
//构造要请求的参数数组,无需改动
$parameter = array("service" => "send_goods_confirm_by_platform", "partner" => trim($alipay_config['partner']), "trade_no" => $trade_no, "logistics_name" => $logistics_name, "invoice_no" => $invoice_no, "transport_type" => $transport_type, "_input_charset" => trim(strtolower('utf-8')));
//建立请求
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($parameter);
}
示例2: callback
/**
* @see paymentplugin::callback()
*/
public function callback($ExternalData, &$paymentId, &$money, &$message, &$orderNo)
{
$partnerKey = Payment::getConfigParam($paymentId, 'M_PartnerKey');
$user_id = ISafe::get('user_id');
ksort($ExternalData);
$temp = array();
foreach ($ExternalData as $k => $v) {
if ($k != 'sign') {
$temp[] = $k . '=' . urlencode($v);
}
}
$encryptKey = isset(IWeb::$app->config['encryptKey']) ? IWeb::$app->config['encryptKey'] : 'iwebshop';
$testStr = join('&', $temp) . '&' . $user_id . $partnerKey . $encryptKey;
$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)
{
$UserName = Payment::getConfigParam($paymentId, 'M_PartnerId');
$IDcode = Payment::getConfigParam($paymentId, 'M_PartnerKey');
$return = array();
$return['business'] = urldecode($UserName);
$return['item_number'] = urldecode($callbackData['item_number']);
$return['amount'] = urldecode($callbackData['payment_gross']);
$return['return'] = urldecode($this->getCallbackUrl());
$return['notify_url'] = urldecode($this->serverCallbackUrl);
$md5Code = $this->createMD5($return, $IDcode);
//校验md5码 防止篡改数据
if (urldecode($callbackData['custom']) == $md5Code) {
switch ($callbackData['payment_status']) {
case 'Completed':
$orderNo = $callbackData['item_number'];
$money = $callbackData['payment_gross'];
return true;
break;
default:
return false;
break;
}
} else {
$message = '校验码不正确';
}
return false;
}
示例4: callback
/**
* @see paymentplugin::callback()
*/
public function callback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
{
//除去待签名参数数组中的空值和签名参数
$para_filter = $this->paraFilter($callbackData);
//对待签名参数数组排序
$para_sort = $this->argSort($para_filter);
//生成签名结果
$mysign = $this->buildMysign($para_sort, Payment::getConfigParam($paymentId, 'M_PartnerKey'));
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;
}
} else {
$message = '签名不正确';
}
return false;
}
示例5: callback
/**
* @see paymentplugin::callback()
*/
public function callback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
{
//除去待签名参数数组中的空值和签名参数
$para_filter = $this->paraFilter($callbackData);
//对待签名参数数组排序
$para_sort = $this->argSort($para_filter);
//生成签名结果
$mysign = $this->buildMysign($para_sort, Payment::getConfigParam($paymentId, 'M_PartnerKey'));
if ($callbackData['sign'] == $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;
}
} else {
$message = '数字签名不正确';
}
return false;
}
示例6: callback
/**
* @see paymentplugin::callback()
*/
public function callback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
{
$key = Payment::getConfigParam($paymentId, 'M_PartnerKey');
$v_oid = trim($_POST['v_oid']);
// 商户发送的v_oid定单编号
$v_pmode = trim($_POST['v_pmode']);
// 支付方式(字符串)
$v_pstatus = trim($_POST['v_pstatus']);
// 支付状态 :20(支付成功);30(支付失败)
$v_pstring = trim($_POST['v_pstring']);
// 支付结果信息 : 支付完成(当v_pstatus=20时);失败原因(当v_pstatus=30时,字符串);
$v_amount = trim($_POST['v_amount']);
// 订单实际支付金额
$v_moneytype = trim($_POST['v_moneytype']);
// 订单实际支付币种
$v_md5str = trim($_POST['v_md5str']);
// 拼凑后的MD5校验值
$md5string = strtoupper(md5($v_oid . $v_pstatus . $v_amount . $v_moneytype . $key));
if ($v_md5str == $md5string) {
$money = $v_amount;
$orderNo = $v_oid;
$message = $v_pstring;
//支付单号
switch ($v_pstatus) {
case '20':
return true;
break;
case '30':
return false;
break;
}
} else {
$message = '校验码不正确';
return false;
}
}
示例7: serverCallback
/**
* @see paymentplugin::serverCallback()
*/
public function serverCallback($callbackData, &$paymentId, &$money, &$message, &$orderNo)
{
//获取人民币网关账户号
$merchantAcctId = trim($_REQUEST['merchantAcctId']);
//设置人民币网关密钥
///区分大小写
$key = Payment::getConfigParam($paymentId, 'M_PartnerKey');
//商户密钥
//获取网关版本.固定值
///快钱会根据版本号来调用对应的接口处理程序。
///本代码版本号固定为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':
//.........这里部分代码省略.........
示例8: payment_balance
/**
* 余额付款
* T:支付失败;
* F:支付成功;
*/
function payment_balance()
{
$urlStr = '';
$user_id = intval($this->user['user_id']);
$return['attach'] = IReq::get('attach');
$return['total_fee'] = IReq::get('total_fee');
$return['order_no'] = IReq::get('order_no');
$return['return_url'] = IReq::get('return_url');
$sign = IReq::get('sign');
if (stripos($return['order_no'], 'recharge_') !== false) {
IError::show(403, '余额支付方式不能用于在线充值');
exit;
}
if (floatval($return['total_fee']) <= 0 || $return['order_no'] == '' || $return['return_url'] == '') {
IError::show(403, '支付参数不正确');
} else {
$paymentDB = new IModel('payment');
$paymentRow = $paymentDB->getObj('class_name = "balance" ');
$pkey = Payment::getConfigParam($paymentRow['id'], 'M_PartnerKey');
//md5校验
ksort($return);
foreach ($return as $key => $val) {
$urlStr .= $key . '=' . urlencode($val) . '&';
}
$urlStr .= $user_id . $pkey;
if ($sign != md5($urlStr)) {
IError::show(403, '数据校验不正确');
} else {
$memberObj = new IModel('member');
$memberRow = $memberObj->getObj('user_id = ' . $user_id);
if (empty($memberRow)) {
IError::show(403, '用户信息不存在');
exit;
} else {
if ($memberRow['balance'] < $return['total_fee']) {
IError::show(403, '账户余额不足');
exit;
} else {
$orderObj = new IModel('order');
$orderRow = $orderObj->getObj('order_no = "' . IFilter::act($return['order_no']) . '" and pay_status = 0 and user_id = ' . $user_id);
if (empty($orderRow)) {
IError::show(403, '订单已经被处理过,请查看订单状态');
exit;
}
$dataArray = array('balance' => 'balance - ' . IFilter::act($return['total_fee']));
$memberObj->setData($dataArray);
$is_success = $memberObj->update('user_id = ' . $user_id, 'balance');
if ($is_success) {
$return['is_success'] = 'T';
} else {
$return['is_success'] = 'F';
}
ksort($return);
//返还的URL地址
$responseUrl = '';
foreach ($return as $key => $val) {
$responseUrl .= $key . '=' . urlencode($val) . '&';
}
$nextUrl = urldecode($return['return_url']);
if (stripos($nextUrl, '?') === false) {
$return_url = $nextUrl . '?' . $responseUrl;
} else {
$return_url = $nextUrl . '&' . $responseUrl;
}
//计算要发送的md5校验
$urlStrMD5 = md5($responseUrl . $user_id . $pkey);
//拼接进返还的URL中
$return_url .= 'sign=' . $urlStrMD5;
header('location:' . $return_url);
}
}
}
}
}