Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
ceb6884c
Y
yii2_fecshop
项目概览
OpenDocCN
/
yii2_fecshop
通知
18
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,发现更多精彩内容 >>
提交
ceb6884c
编写于
2月 18, 2017
作者:
R
root
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
paypal standard payment
上级
11d53bf1
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
346 addition
and
48 deletion
+346
-48
app/appfront/modules/Payment/block/paypal/standard/Start.php
app/appfront/modules/Payment/block/paypal/standard/Start.php
+100
-26
app/appfront/modules/Payment/controllers/paypal/StandardController.php
...modules/Payment/controllers/paypal/StandardController.php
+1
-0
app/appfront/theme/base/front/layouts/blank.php
app/appfront/theme/base/front/layouts/blank.php
+10
-0
app/appfront/theme/base/front/payment/paypal/standard/start.php
...pfront/theme/base/front/payment/paypal/standard/start.php
+15
-15
config/services/Payment.php
config/services/Payment.php
+73
-2
services/Order.php
services/Order.php
+30
-0
services/Payment.php
services/Payment.php
+116
-4
services/Shipping.php
services/Shipping.php
+1
-1
未找到文件。
app/appfront/modules/Payment/block/paypal/standard/Start.php
浏览文件 @
ceb6884c
...
...
@@ -18,42 +18,116 @@ use yii\base\InvalidValueException;
class
Start
{
public
function
getLastData
(){
$increment_id
=
Yii
::
$service
->
order
->
getSessionIncrementId
();
$loaderImg
=
Yii
::
$service
->
image
->
getImgUrl
(
'images/loader.gif'
,
'appfront'
);
$paypalLogoImg
=
Yii
::
$service
->
image
->
getImgUrl
(
'custom/logo.png'
,
'appfront'
);
/*
$store_name = Store::getCurrentStoreLabel();
$paypal = Config::param("payment_method");
$submitAction = $paypal['paypal']['payments_standard']['redirect_url'];
$paypal_account = $paypal['paypal']['payments_standard']['user'];
$order_increment_id = $this->_order['increment_id'];
$order_currency = $this->_order['order_currency_code'];
$paymentaction = "sale";
$cmd = '_cart';
$upload = 1;
$increment_id
=
Yii
::
$service
->
order
->
getSessionIncrementId
();
$order
=
Yii
::
$service
->
order
->
getInfoByIncrementId
(
$increment_id
);
//var_dump($order);
//exit;
Yii
::
$service
->
payment
->
setPaymentMethod
(
$order
[
'payment_method'
]);
$success_redirect_url
=
Yii
::
$service
->
payment
->
getStandardSuccessRedirectUrl
();
$cancel_url
=
Yii
::
$service
->
payment
->
getStandardCancelUrl
();
$ipn_url
=
Yii
::
$service
->
payment
->
getStandardIpnUrl
();
$store_name
=
Yii
::
$service
->
store
->
currentStore
;
$return_url = Url::getUrl('paypal/standard/success');
$cancel_url = Url::getUrl('paypal/standard/cancel');
$notify_url = Url::getUrl('paypal/ipn');
$payment_action
=
"sale"
;
$cmd
=
'_cart'
;
$upload
=
1
;
$tax
=
0.00
;
$tax_cart
=
0.00
;
$
tax = 0.00
;
$
tax_cart = 0.00
;
$
payment_url
=
Yii
::
$service
->
payment
->
getStandardPaymentUrl
()
;
$
account
=
Yii
::
$service
->
payment
->
getStandardAccount
()
;
$amount = $this->_order['grand_total'];
$shipping = $this->_order['shipping_total'];
$discount_amount = $this->_order['subtotal_with_discount'];
$discount_amount_cart = $discount_amount;
*/
return
[
'loaderImg'
=>
$loaderImg
,
'paypalLogoImg'
=>
$paypalLogoImg
,
'loader_img'
=>
$loaderImg
,
'paypal_logo_img'
=>
$paypalLogoImg
,
'order'
=>
$order
,
'success_redirect_url'
=>
$success_redirect_url
,
'cancel_url'
=>
$cancel_url
,
'ipn_url'
=>
$ipn_url
,
'store_name'
=>
$store_name
,
'payment_action'
=>
$payment_action
,
'cmd'
=>
$cmd
,
'upload'
=>
$upload
,
'tax'
=>
$tax
,
'tax_cart'
=>
$tax_cart
,
'payment_url'
=>
$payment_url
,
'account'
=>
$account
,
'product_items_and_shipping'
=>
$this
->
getProductItemsAndShipping
(
$order
),
'address_html'
=>
$this
->
getAddressHtml
(
$order
),
];
}
public
function
getAddressHtml
(
$order
){
$stateCode
=
$order
[
'customer_address_state'
];
$countryCode
=
$order
[
'customer_address_country'
];
$country
=
Yii
::
$service
->
helper
->
country
->
getCountryNameByKey
(
$countryCode
);
$state
=
Yii
::
$service
->
helper
->
country
->
getStateByContryCode
(
$countryCode
,
$stateCode
);
$str
=
'
<input id="city" name="city" value="'
.
$order
[
'customer_address_city'
]
.
'" type="hidden"/>
<input id="country" name="country" value="'
.
$countryCode
.
'" type="hidden"/>
<input id="email" name="email" value="'
.
$order
[
'customer_email'
]
.
'" type="hidden"/>
<input id="first_name" name="first_name" value="'
.
$order
[
'customer_firstname'
]
.
'" type="hidden"/>
<input id="last_name" name="last_name" value="'
.
$order
[
'customer_lastname'
]
.
'" type="hidden"/>
<input id="zip" name="zip" value="'
.
$order
[
'customer_address_zip'
]
.
'" type="hidden"/>
<input id="state" name="state" value="'
.
$state
.
'" type="hidden"/>
<input id="address1" name="address1" value="'
.
$order
[
'customer_address_street1'
]
.
'" type="hidden"/>
<input id="address2" name="address2" value="'
.
$order
[
'customer_address_street2'
]
.
'" type="hidden"/>
<input id="address_override" name="address_override" value="0" type="hidden"/>
'
;
return
$str
;
}
public
function
getProductItemsAndShipping
(
$order
){
$items
=
$order
[
'items'
];
$str
=
''
;
$i
=
1
;
foreach
(
$items
as
$item
){
$sku
=
isset
(
$item
[
'sku'
])
?
$item
[
'sku'
]
:
''
;
$name
=
isset
(
$item
[
'name'
])
?
$item
[
'name'
]
:
''
;
$qty
=
isset
(
$item
[
'qty'
])
?
$item
[
'qty'
]
:
''
;
$price
=
isset
(
$item
[
'price'
])
?
$item
[
'price'
]
:
''
;
$custom_option_info
=
isset
(
$item
[
'custom_option_info'
])
?
$item
[
'custom_option_info'
]
:
''
;
if
(
$sku
&&
$qty
&&
$price
){
$str
.
=
'
<input id="item_number_'
.
$i
.
'" name="item_number_'
.
$i
.
'" value="'
.
$sku
.
'" type="hidden"/>
<input id="item_name_'
.
$i
.
'" name="item_name_'
.
$i
.
'" value="'
.
$name
.
'" type="hidden"/>
<input id="quantity_'
.
$i
.
'" name="quantity_'
.
$i
.
'" value="'
.
$qty
.
'" type="hidden"/>
<input id="amount_'
.
$i
.
'" name="amount_'
.
$i
.
'" value="'
.
$price
.
'" type="hidden"/>
'
;
if
(
is_array
(
$custom_option_info
)
&&
!
empty
(
$custom_option_info
)){
$j
=
0
;
foreach
(
$custom_option_info
as
$co_label
=>
$co_value
){
$str
.
=
'
<input id="on'
.
$j
.
'_'
.
$i
.
'" name="on'
.
$j
.
'_'
.
$i
.
'" type="hidden" value="'
.
$co_label
.
'" />
<input id="os'
.
$j
.
'_'
.
$i
.
'" name="os'
.
$j
.
'_'
.
$i
.
'" type="hidden" value="'
.
$co_value
.
'" />
'
;
$j
++
;
}
}
}
$i
++
;
}
$shipping_total
=
$order
[
'shipping_total'
];
$shipping_method
=
$order
[
'shipping_method'
];
$shipping_label
=
Yii
::
$service
->
shipping
->
getShippingLabelByMethod
(
$shipping_method
);
$str
.
=
'
<input id="item_number_'
.
$i
.
'" name="item_number_'
.
$i
.
'" value="'
.
$shipping_label
.
'" type="hidden"/>
<input id="item_name_'
.
$i
.
'" name="item_name_'
.
$i
.
'" value="'
.
$shipping_method
.
'" type="hidden"/>
<input id="quantity_'
.
$i
.
'" name="quantity_'
.
$i
.
'" value="1" type="hidden"/>
<input id="amount_'
.
$i
.
'" name="amount_'
.
$i
.
'" value="'
.
$shipping_total
.
'" type="hidden"/>
'
;
return
$str
;
}
}
\ No newline at end of file
app/appfront/modules/Payment/controllers/paypal/StandardController.php
浏览文件 @
ceb6884c
...
...
@@ -20,6 +20,7 @@ class StandardController extends AppfrontController
public
$enableCsrfValidation
=
true
;
public
function
actionStart
(){
Yii
::
$service
->
page
->
theme
->
layoutFile
=
'blank.php'
;
$data
=
$this
->
getBlock
()
->
getLastData
();
return
$this
->
render
(
$this
->
action
->
id
,
$data
);
}
...
...
app/appfront/theme/base/front/layouts/blank.php
0 → 100644
浏览文件 @
ceb6884c
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
?><?=
$content
;
?>
\ No newline at end of file
app/appfront/theme/base/front/payment/paypal/standard/start.php
浏览文件 @
ceb6884c
<html>
<body>
You will be redirected to the PayPal website in a few seconds
<img
src=
"
<?=
$loader
I
mg
?>
"
/>
<img
src=
"
<?=
$loader
_i
mg
?>
"
/>
<?php
// https://www.paypal.com/cgi-bin/webscr ?>
<
form
action
=
"<?=
$
submitAction
?>"
id
=
"paypal_standard_checkout"
name
=
"paypal_standard_checkout"
method
=
"POST"
>
<
input
id
=
"business"
name
=
"business"
value
=
"<?=
$
paypal_
account
?>"
type
=
"hidden"
/>
<
form
action
=
"<?=
$
payment_url
?>"
id
=
"paypal_standard_checkout"
name
=
"paypal_standard_checkout"
method
=
"POST"
>
<
input
id
=
"business"
name
=
"business"
value
=
"<?=
$account
?>"
type
=
"hidden"
/>
<
input
id
=
"invoice"
name
=
"invoice"
value
=
"<?=
$order
_increment_id
?>"
type
=
"hidden"
/>
<
input
id
=
"currency_code"
name
=
"currency_code"
value
=
"<?=
$order
_currency
?>"
type
=
"hidden"
/>
<
input
id
=
"paymentaction"
name
=
"paymentaction"
value
=
"<?=
$paymentaction
?>"
type
=
"hidden"
/>
<
input
id
=
"return"
name
=
"return"
value
=
"<?=
$
return
_url
?>"
type
=
"hidden"
/>
<
input
id
=
"invoice"
name
=
"invoice"
value
=
"<?=
$order
['increment_id']
?>"
type
=
"hidden"
/>
<
input
id
=
"currency_code"
name
=
"currency_code"
value
=
"<?=
$order
['order_currency_code']
?>"
type
=
"hidden"
/>
<
input
id
=
"paymentaction"
name
=
"paymentaction"
value
=
"<?=
$payment
_
action
?>"
type
=
"hidden"
/>
<
input
id
=
"return"
name
=
"return"
value
=
"<?=
$
success_redirect
_url
?>"
type
=
"hidden"
/>
<
input
id
=
"cancel_return"
name
=
"cancel_return"
value
=
"<?=
$cancel_url
?>"
type
=
"hidden"
/>
<
input
id
=
"notify_url"
name
=
"notify_url"
value
=
"<?=
$
notify
_url
?>"
type
=
"hidden"
/>
<
input
id
=
"notify_url"
name
=
"notify_url"
value
=
"<?=
$
ipn
_url
?>"
type
=
"hidden"
/>
<
input
id
=
"cpp_header_image"
name
=
"cpp_header_image"
value
=
"<?=
$paypal_logo_img
?>"
type
=
"hidden"
/>
<
input
id
=
"item_name"
name
=
"item_name"
value
=
"<?=
$store_name
?>"
type
=
"hidden"
/>
<
input
id
=
"charset"
name
=
"charset"
value
=
"utf-8"
type
=
"hidden"
/>
<
input
id
=
"amount"
name
=
"amount"
value
=
"<?=
$
amount
?>"
type
=
"hidden"
/>
<
input
id
=
"amount"
name
=
"amount"
value
=
"<?=
$
order['grand_total']
?>"
type
=
"hidden"
/>
<
input
id
=
"tax"
name
=
"tax"
value
=
"<?=
$tax
?>"
type
=
"hidden"
/>
<
input
id
=
"shipping"
name
=
"shipping"
value
=
"<?=
$
shipping
?>"
type
=
"hidden"
/>
<
input
id
=
"discount_amount"
name
=
"discount_amount"
value
=
"<?=
$
discount_amount
?>"
type
=
"hidden"
/>
<?=
$product_items
?>
<
input
id
=
"shipping"
name
=
"shipping"
value
=
"<?=
$
order['shipping_total']
?
$order['shipping_total']
: 0
?>"
type
=
"hidden"
/>
<
input
id
=
"discount_amount"
name
=
"discount_amount"
value
=
"<?=
$
order['subtotal_with_discount']
?
$order['subtotal_with_discount']
: 0
?>"
type
=
"hidden"
/>
<?=
$product_items
_and_shipping
?>
<input
id=
"cmd"
name=
"cmd"
value=
"
<?=
$cmd
?>
"
type=
"hidden"
/>
<input
id=
"upload"
name=
"upload"
value=
"
<?=
$upload
?>
"
type=
"hidden"
/>
<input
id=
"tax_cart"
name=
"tax_cart"
value=
"
<?=
$tax_cart
?>
"
type=
"hidden"
/>
<input
id=
"discount_amount_cart"
name=
"discount_amount_cart"
value=
"
<?=
$
discount_amount_cart
?>
"
type=
"hidden"
/>
<?=
$address_html
?>
.'
<input
id=
"discount_amount_cart"
name=
"discount_amount_cart"
value=
"
<?=
$
order
[
'subtotal_with_discount'
]
?
$order
[
'subtotal_with_discount'
]
:
0
?>
"
type=
"hidden"
/>
<?=
$address_html
?>
<span
class=
"field-row"
>
<input
id=
"submit_to_paypal_button
_ffe6e6319afa1dc2e9e4d822e58ca9ca"
name=
""
value=
"'.Translate::__("
Click
here
if
you
are
not
redirected
within
10
seconds
").'
..."
type=
"submit"
class=
" submit"
/>
<input
id=
"submit_to_paypal_button
"
name=
""
value=
"Click here if you are not redirected within 10 seconds
..."
type=
"submit"
class=
" submit"
/>
</span>
</form>
<script
type=
"text/javascript"
>
...
...
config/services/Payment.php
浏览文件 @
ceb6884c
...
...
@@ -22,16 +22,87 @@ return [
'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/paypal/standard/success'
,
# 进入paypal支付页面,点击取消进入网站的页面。
'cancel_url'
=>
'@homeUrl/payment/paypal/standard/cancel'
,
# 第三方支付网站的url
'payment_url'
=>
'https://www.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',
//],
],
],
'express'
=>
[
'paypal_express'
=>
[
'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'
,
'enable'
=>
1
,
'label'
=>
'PayPal Express Payments'
,
],
],
]
]
];
\ No newline at end of file
];
/*
'payment_method'=>[
'merchant_country' => 'US',
'paypal'=>[
'payments_standard'=>[
'title'=>'PayPal Website Payments Standard',
'enable'=> 1,
'user' => 'zqy234api1-facilitator@126.com',
'redirect_url'=>'https://www.sandbox.paypal.com/cgi-bin/webscr',
'account'=> 'zqy234api1-facilitator@126.com',
'password'=>'HF4TNTTXUD6YQREH',
'signature'=>'An5ns1Kso7MWUdW4ErQKJJJ4qi4-ANB-xrkMmTHpTszFaUx2v4EHqknV',
'label'=>'PayPal Website Payments Standard',
'description'=>'You will be redirected to the PayPal website when you place an order.',
'image'=> 'images/hm.png',
],
'express_checkout' =>[
'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',
'enable'=> 1,
'label'=>'PayPal Express Payments',
],
],
],
*/
\ No newline at end of file
services/Order.php
浏览文件 @
ceb6884c
...
...
@@ -210,9 +210,37 @@ class Order extends Service
$primaryKey
=
$this
->
getPrimaryKey
();
if
(
$one
[
$primaryKey
]){
return
$one
;
}
else
{
return
false
;
}
}
/**
* @property $increment_id | String , 订单号
* @return Object (MyOrder),返回 MyOrder model
* 通过订单号,得到订单以及订单产品信息。
*/
protected
function
actionGetInfoByIncrementId
(
$increment_id
){
//echo 1;exit;
$order
=
$this
->
getByIncrementId
(
$increment_id
);
$orderInfo
=
[];
if
(
$order
){
$primaryKey
=
$this
->
getPrimaryKey
();
$order_id
=
$order
[
$primaryKey
];
$items
=
Yii
::
$service
->
order
->
item
->
getByOrderId
(
$order_id
);
foreach
(
$order
as
$k
=>
$v
){
$orderInfo
[
$k
]
=
$v
;
}
$orderInfo
[
'items'
]
=
$items
;
return
$orderInfo
;
}
else
{
return
;
}
}
/**
* @property $address | Array 货运地址
* @property $shipping_method | String 货运快递方式
...
...
@@ -321,6 +349,8 @@ class Order extends Service
return
$increment_id
;
}
/**
* get order list by customer account id.
*/
...
...
services/Payment.php
浏览文件 @
ceb6884c
...
...
@@ -19,18 +19,26 @@ use fec\helpers\CUrl;
*/
class
Payment
extends
Service
{
public
$paymentConfig
;
protected
$_currentPaymentMethod
;
/**
* @property $payment_method | string
* 设置当前的支付方式
*/
public
function
setPaymentMethod
(
$payment_method
){
$this
->
_currentPaymentMethod
=
$payment_method
;
}
/**
* @return $payment_method | string
* 得到当前的支付方式
*/
public
function
getPaymentMethod
(){
return
$this
->
_currentPaymentMethod
;
}
/**
* @property $payment_method | String 支付方式。
* @return 返回提交订单信息跳转到的第三方支付url,也就是第三方支付的url。
* #从配置信息中获取
*/
public
function
getStandardStartUrl
(
$payment_method
=
''
){
if
(
!
$payment_method
){
...
...
@@ -48,6 +56,7 @@ class Payment extends Service
/**
* @property $payment_method | String 支付方式。
* @return 第三方支付成功后,返回到网站的url
* #从配置信息中获取
*/
public
function
getStandardSuccessRedirectUrl
(
$payment_method
=
''
){
if
(
!
$payment_method
){
...
...
@@ -65,6 +74,7 @@ class Payment extends Service
/**
* @property $payment_method | String 支付方式。
* @return 第三方网站发送ipn消息,告诉网站支付成功的url。
* #从配置信息中获取
*/
public
function
getStandardIpnUrl
(
$payment_method
=
''
){
if
(
!
$payment_method
){
...
...
@@ -80,6 +90,106 @@ class Payment extends Service
}
}
/**
* @property $payment_method | String 支付方式。
* @return String 支付取消的url。
* #从配置信息中获取
*/
public
function
getStandardCancelUrl
(
$payment_method
=
''
){
if
(
!
$payment_method
){
$payment_method
=
$this
->
getPaymentMethod
();
}
if
(
$payment_method
){
$paymentConfig
=
$this
->
paymentConfig
;
if
(
isset
(
$paymentConfig
[
'standard'
][
$payment_method
][
'cancel_url'
])){
if
(
!
empty
(
$paymentConfig
[
'standard'
][
$payment_method
][
'cancel_url'
])){
return
$this
->
getUrl
(
$paymentConfig
[
'standard'
][
$payment_method
][
'cancel_url'
]);
}
}
}
}
/**
* @property $payment_method | String 支付方式。
* @return String 得到跳转到第三方支付的url。
* #从配置信息中获取
*/
public
function
getStandardPaymentUrl
(
$payment_method
=
''
){
if
(
!
$payment_method
){
$payment_method
=
$this
->
getPaymentMethod
();
}
if
(
$payment_method
){
$paymentConfig
=
$this
->
paymentConfig
;
if
(
isset
(
$paymentConfig
[
'standard'
][
$payment_method
][
'payment_url'
])){
if
(
!
empty
(
$paymentConfig
[
'standard'
][
$payment_method
][
'payment_url'
])){
return
$paymentConfig
[
'standard'
][
$payment_method
][
'payment_url'
];
}
}
}
}
/**
* @property $payment_method | String 支付方式。
* @return String 用户名
* #从配置信息中获取
*/
public
function
getStandardAccount
(
$payment_method
=
''
){
if
(
!
$payment_method
){
$payment_method
=
$this
->
getPaymentMethod
();
}
if
(
$payment_method
){
$paymentConfig
=
$this
->
paymentConfig
;
if
(
isset
(
$paymentConfig
[
'standard'
][
$payment_method
][
'account'
])){
if
(
!
empty
(
$paymentConfig
[
'standard'
][
$payment_method
][
'account'
])){
return
$paymentConfig
[
'standard'
][
$payment_method
][
'account'
];
}
}
}
}
/**
* @property $payment_method | String 支付方式。
* @return String Password
* #从配置信息中获取
*/
public
function
getStandardPassword
(
$payment_method
=
''
){
if
(
!
$payment_method
){
$payment_method
=
$this
->
getPaymentMethod
();
}
if
(
$payment_method
){
$paymentConfig
=
$this
->
paymentConfig
;
if
(
isset
(
$paymentConfig
[
'standard'
][
$payment_method
][
'password'
])){
if
(
!
empty
(
$paymentConfig
[
'standard'
][
$payment_method
][
'password'
])){
return
$paymentConfig
[
'standard'
][
$payment_method
][
'password'
];
}
}
}
}
/**
* @property $payment_method | String 支付方式。
* @return String Signature
* #从配置信息中获取
*/
public
function
getStandardSignature
(
$payment_method
=
''
){
if
(
!
$payment_method
){
$payment_method
=
$this
->
getPaymentMethod
();
}
if
(
$payment_method
){
$paymentConfig
=
$this
->
paymentConfig
;
if
(
isset
(
$paymentConfig
[
'standard'
][
$payment_method
][
'signature'
])){
if
(
!
empty
(
$paymentConfig
[
'standard'
][
$payment_method
][
'signature'
])){
return
$paymentConfig
[
'standard'
][
$payment_method
][
'signature'
];
}
}
}
}
/**
* @property $url | String url的字符串
* @return String 根据传递的字符串格式,得到相应的url
*/
protected
function
getUrl
(
$url
){
$homeUrl
=
Yii
::
$service
->
url
->
homeUrl
();
$url
=
str_replace
(
'@homeUrl'
,
$homeUrl
,
$url
);
...
...
@@ -87,7 +197,7 @@ class Payment extends Service
}
/**
* @return Array 得到所有支付的数组。
* @return Array 得到所有支付的数组
,数组含有三个字段
。
*/
public
function
getStandardPaymentArr
(){
$arr
=
[];
...
...
@@ -116,8 +226,8 @@ class Payment extends Service
}
/**
* @property $
shipping_method | String
* @return boolean
发货方式
* @property $
payment_method | String , 支付方式
* @return boolean
判断传递的支付方式,是否在配置中存在,如果存在返回true。
*/
protected
function
actionIfIsCorrectStandard
(
$payment_method
){
$paymentConfig
=
$this
->
paymentConfig
;
...
...
@@ -129,4 +239,6 @@ class Payment extends Service
}
}
}
\ No newline at end of file
services/Shipping.php
浏览文件 @
ceb6884c
...
...
@@ -145,7 +145,7 @@ class Shipping extends Service
* @property $shipping_method | String
* @return 得到货运方式的名字
*/
protected
static
function
actionGetShippingLabelByMethod
(
$shipping_method
){
protected
function
actionGetShippingLabelByMethod
(
$shipping_method
){
$s
=
$this
->
getShippingMethod
(
$shipping_method
);
return
$s
[
'label'
];
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录