Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
85c9708d
Y
yii2_fecshop
项目概览
OpenDocCN
/
yii2_fecshop
通知
17
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yii2_fecshop
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
85c9708d
编写于
11月 11, 2017
作者:
T
Terry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
一些小更改
上级
362a53d3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
53 addition
and
52 deletion
+53
-52
app/appfront/modules/Checkout/block/onepage/Index.php
app/appfront/modules/Checkout/block/onepage/Index.php
+9
-9
app/appfront/theme/base/front/payment/wxpay/standard/start.php
...ppfront/theme/base/front/payment/wxpay/standard/start.php
+2
-0
config/services/Payment.php
config/services/Payment.php
+15
-36
services/payment/Wxpay.php
services/payment/Wxpay.php
+27
-7
未找到文件。
app/appfront/modules/Checkout/block/onepage/Index.php
浏览文件 @
85c9708d
...
...
@@ -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
,
];
}
...
...
app/appfront/theme/base/front/payment/wxpay/standard/start.php
浏览文件 @
85c9708d
...
...
@@ -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 -->
...
...
config/services/Payment.php
浏览文件 @
85c9708d
...
...
@@ -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',
],
],
...
...
services/payment/Wxpay.php
浏览文件 @
85c9708d
...
...
@@ -24,7 +24,7 @@ class Wxpay extends Service
{
public
$devide
;
public
$configFile
;
public
$subjectMaxLength
=
8
0
;
public
$subjectMaxLength
=
3
0
;
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录