提交 85c9708d 编写于 作者: T Terry

一些小更改

上级 362a53d3
......@@ -43,20 +43,20 @@ class Index
$this->initState();
$shippings = $this->getShippings();
$last_cart_info = $this->getCartInfo($this->_shipping_method, $this->_country, $this->_state);
return [
'payments' => $this->getPayment(),
'payments' => $this->getPayment(),
'shippings' => $shippings,
'current_payment_method' => $this->_payment_method,
'current_payment_method' => $this->_payment_method,
'cart_info' => $last_cart_info,
'currency_info' => $currency_info,
'address_view_file' => $this->_address_view_file,
'cart_address' => $this->_address,
'cart_address_id' => $this->_address_id,
'address_list' => $this->_address_list,
'country_select' => $this->_countrySelect,
//'state_select' => $this->_stateSelect,
'state_html' => $this->_stateHtml,
'cart_address' => $this->_address,
'cart_address_id' => $this->_address_id,
'address_list' => $this->_address_list,
'country_select' => $this->_countrySelect,
//'state_select' => $this->_stateSelect,
'state_html' => $this->_stateHtml,
];
}
......
......@@ -50,10 +50,12 @@
<em></em>
</div>
<div class="o-detail" style="float:center">
<!--
<a onclick="javascript:" href="javascript:;">
订单详情
<i></i>
</a>
-->
</div>
</div>
<!-- 订单金额 end -->
......
......@@ -23,42 +23,21 @@ return [
'success_redirect_url' => '@homeUrl/payment/success',
],
'paypal_standard' => [
'label' => 'PayPal Website Payments Standard',
'image' => ['images/paypal_standard.png','common'], # 支付页面显示的图片。
'supplement' => 'You will be redirected to the PayPal website when you place an order. ', # 补充
# 选择支付后,进入到相应支付页面的start页面。
'start_url' => '@homeUrl/payment/paypal/standard/start',
# 接收IPN消息的页面。
'IPN_url' => '@homeUrl/payment/paypal/standard/ipn',
# 在第三方支付成功后,跳转到网站的页面
'success_redirect_url' => '@homeUrl/payment/success',
# 进入paypal支付页面,点击取消进入网站的页面。
'cancel_url' => '@homeUrl/payment/paypal/standard/cancel',
# 第三方支付网站的url
'payment_url'=>'https://www.sandbox.paypal.com/cgi-bin/webscr',
//'ipn_url' => 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'
# 用户名
'user' => 'zqy234api1-facilitator@126.com',
# 账号
'account'=> 'zqy234api1-facilitator@126.com',
# 密码
'password'=>'HF4TNTTXUD6YQREH',
# 签名
'signature'=>'An5ns1Kso7MWUdW4ErQKJJJ4qi4-ANB-xrkMmTHpTszFaUx2v4EHqknV',
//'info' => [
//'title'=>'PayPal Website Payments Standard',
//'enable'=> 1,
//'label'=>'PayPal Website Payments Standard',
//'description'=>'You will be redirected to the PayPal website when you place an order.',
//'image'=> 'images/hm.png',
//],
'start_url' => '@homeUrl/payment/paypal/standard/start',
'nvp_url' => 'https://api-3t.sandbox.paypal.com/nvp',
'api_url' => 'https://www.sandbox.paypal.com/cgi-bin/webscr',
'account' => 'zqy234api1-facilitator_api1.126.com',
'password' => 'HF4TNTTXUD6YQREH',
'signature'=> 'An5ns1Kso7MWUdW4ErQKJJJ4qi4-ANB-xrkMmTHpTszFaUx2v4EHqknV',
'label'=> 'PayPal Express Payments',
// 跳转到paypal确认后,返回fecshop的url
'return_url' => '@homeUrl/payment/paypal/standard/review',
// 取消支付后,返回fecshop的url
'cancel_url' => '@homeUrl/payment/paypal/standard/cancel',
// 支付成功后,返回fecshop的url
'success_redirect_url' => '@homeUrl/payment/success',
// IPN地址
'ipn_url' => '@homeUrl/payment/paypal/standard/ipn',
],
],
......
......@@ -24,7 +24,7 @@ class Wxpay extends Service
{
public $devide;
public $configFile;
public $subjectMaxLength = 80;
public $subjectMaxLength = 30;
public $tradeType;
public $scanCodeBody = '微信支付';
public $deviceInfo = 'WEB';
......@@ -59,7 +59,7 @@ class Wxpay extends Service
//MICROPAY--刷卡支付,刷卡支付有单独的支付接口,不调用统一下单接口
if($this->devide == 'wap'){
$this->tradeType = 'APP';
$this->tradeType = 'MWEB';
}else if($this->devide == 'pc'){
$this->tradeType = "NATIVE";
}else{
......@@ -160,7 +160,23 @@ class Wxpay extends Service
$input->SetTrade_type($this->tradeType);
$input->SetProduct_id($trade_info['product_ids']); //此为二维码中包含的商品ID
$result = $notify->GetPayUrl($input);
//var_dump($result);
//var_dump($result);exit;
/**
* var_dump($result);
* array(11) {
* ["appid"]=> string(18) "wx426b3015555a46be"
* ["code_url"]=> string(35) "weixin://wxpay/bizpayurl?pr=Pnu1DAZ"
* ["device_info"]=> string(3) "WEB"
* ["mch_id"]=> string(10) "1900009851"
* ["nonce_str"]=> string(16) "4L2t8gFjJ5qjXE0L"
* ["prepay_id"]=> string(36) "wx201711070845443ca4736bb20972889642"
* ["result_code"]=> string(7) "SUCCESS"
* ["return_code"]=> string(7) "SUCCESS"
* ["return_msg"]=> string(2) "OK"
* ["sign"]=> string(32) "07BCF5B7B1D06DBF8E676EEBA6512082"
* ["trade_type"]=> string(6) "NATIVE"
* }
**/
//商户根据实际情况处理流程
if ($result['return_code'] == "FAIL"){
Yii::$service->helper->errors->add('api error:' . $result['return_msg'] );
......@@ -188,6 +204,8 @@ class Wxpay extends Service
];
}
public function scanCodeCheckTradeIsSuccess($out_trade_no){
$result = Yii::$service->payment->wxpay->queryOrderByOut($out_trade_no);
if(is_array($result) && !empty($result)){
......@@ -236,17 +254,19 @@ class Wxpay extends Service
$subject = implode(',', $subject_arr);
// 字符串太长会出问题,这里将产品的name链接起来,在截图一下
if(strlen($subject) > $this->subjectMaxLength) {
$subject = substr($subject,0,$this->subjectMaxLength).'...';
$subject = mb_substr($subject,0,$this->subjectMaxLength);
}
//echo $subject;
$increment_id = $currentOrderInfo['increment_id'];
$base_grand_total = $currentOrderInfo['base_grand_total'];
$total_amount = Yii::$service->page->currency->getCurrencyPrice($base_grand_total, 'CNY');
Yii::$service->payment->setPaymentMethod($currentOrderInfo['payment_method']);
$products = $currentOrderInfo['products'];
$productIds = [];
$productIds = '';
if(is_array($products)){
foreach($products as $product){
$productIds[] = $product['product_id'];
$productIds = $product['product_id'];
break;
}
}
return [
......@@ -254,7 +274,7 @@ class Wxpay extends Service
'total_amount' => $total_amount,
'subject' => $subject,
'coupon_code' => $currentOrderInfo['coupon_code'],
'product_ids' => implode(',',$productIds),
'product_ids' => $productIds,
];
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册