本文整理匯總了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);
}
}
}
}
}