Skip to content

Commit a92fa87

Browse files
支付部分的一些问题处理
1 parent c6d94b6 commit a92fa87

File tree

4 files changed

+28
-8
lines changed
  • app
    • appfront
    • apphtml5

4 files changed

+28
-8
lines changed

app/appfront/modules/Payment/block/paypal/express/Review.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ public function ajaxChangecountry()
221221
* 本函数为从数据库中得到购物车中的数据,然后结合产品表
222222
* 在加入一些产品数据,最终补全所有需要的信息。
223223
*/
224-
public function getCartInfo($shipping_method, $country, $state)
224+
public function getCartInfo($activeProduct, $shipping_method, $country, $state)
225225
{
226226
if (!$this->_cart_info) {
227-
$cart_info = Yii::$service->cart->getCartInfo(true, $shipping_method, $country, $state);
227+
$cart_info = Yii::$service->cart->getCartInfo($activeProduct, $shipping_method, $country, $state);
228228
if (isset($cart_info['products']) && is_array($cart_info['products'])) {
229229
foreach ($cart_info['products'] as $k=>$product_one) {
230230
// 设置名字,得到当前store的语言名字。
@@ -436,6 +436,13 @@ public function setValue($getExpressCheckoutReturn)
436436
}
437437
if ($getExpressCheckoutReturn['SHIPTOCOUNTRYCODE']) {
438438
$this->_address['country'] = $getExpressCheckoutReturn['SHIPTOCOUNTRYCODE'];
439+
if ($this->_address['country'] == 'C2') {
440+
$this->_address['country'] = 'CN';
441+
}
442+
$this->_country = $this->_address['country'];
443+
if ($this->_address['country']) {
444+
$this->_address['country_name'] = Yii::$service->helper->country->getCountryNameByKey($this->_address['country']);
445+
}
439446
}
440447
if ($getExpressCheckoutReturn['SHIPTOSTATE']) {
441448
$this->_address['state'] = $getExpressCheckoutReturn['SHIPTOSTATE'];

app/appfront/theme/base/front/payment/paypal/express/review.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484

8585
<script>
8686
<?php $this->beginBlock('placeOrder') ?>
87+
csrfName = $(".thiscsrf").attr("name");
88+
csrfVal = $(".thiscsrf").val();
8789
function validateEmail(email) {
8890
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
8991
return re.test(email);
@@ -148,13 +150,14 @@ function ajaxreflush(){
148150
//alert("coupon can not empty!");
149151
}
150152
//coupon_url = $("#discount-coupon-form").attr("action");
151-
//alert(coupon_url);
153+
$data = {"coupon_code":coupon_code};
154+
$data[csrfName] = csrfVal;
152155
$.ajax({
153156
async:true,
154157
timeout: 6000,
155158
dataType: 'json',
156159
type:'post',
157-
data: {"coupon_code":coupon_code},
160+
data: $data,
158161
url:coupon_url,
159162
success:function(data, textStatus){
160163
if(data.status == 'success'){

app/apphtml5/modules/Payment/block/paypal/express/Review.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ public function ajaxChangecountry()
221221
* 本函数为从数据库中得到购物车中的数据,然后结合产品表
222222
* 在加入一些产品数据,最终补全所有需要的信息。
223223
*/
224-
public function getCartInfo($shipping_method, $country, $state)
224+
public function getCartInfo($activeProduct, $shipping_method, $country, $state)
225225
{
226226
if (!$this->_cart_info) {
227-
$cart_info = Yii::$service->cart->getCartInfo(true, $shipping_method, $country, $state);
227+
$cart_info = Yii::$service->cart->getCartInfo($activeProduct, $shipping_method, $country, $state);
228228
if (isset($cart_info['products']) && is_array($cart_info['products'])) {
229229
foreach ($cart_info['products'] as $k=>$product_one) {
230230
// 设置名字,得到当前store的语言名字。
@@ -436,6 +436,13 @@ public function setValue($getExpressCheckoutReturn)
436436
}
437437
if ($getExpressCheckoutReturn['SHIPTOCOUNTRYCODE']) {
438438
$this->_address['country'] = $getExpressCheckoutReturn['SHIPTOCOUNTRYCODE'];
439+
if ($this->_address['country'] == 'C2') {
440+
$this->_address['country'] = 'CN';
441+
}
442+
$this->_country = $this->_address['country'];
443+
if ($this->_address['country']) {
444+
$this->_address['country_name'] = Yii::$service->helper->country->getCountryNameByKey($this->_address['country']);
445+
}
439446
}
440447
if ($getExpressCheckoutReturn['SHIPTOSTATE']) {
441448
$this->_address['state'] = $getExpressCheckoutReturn['SHIPTOSTATE'];

app/apphtml5/theme/base/html5/payment/paypal/express/review.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383

8484
<script>
8585
<?php $this->beginBlock('placeOrder') ?>
86+
csrfName = $(".thiscsrf").attr("name");
87+
csrfVal = $(".thiscsrf").val();
8688
function validateEmail(email) {
8789
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
8890
return re.test(email);
@@ -149,13 +151,14 @@ function ajaxreflush(){
149151
//alert("coupon can not empty!");
150152
}
151153
//coupon_url = $("#discount-coupon-form").attr("action");
152-
//alert(coupon_url);
154+
$data = {"coupon_code":coupon_code};
155+
$data[csrfName] = csrfVal;
153156
$.ajax({
154157
async:true,
155158
timeout: 6000,
156159
dataType: 'json',
157160
type:'post',
158-
data: {"coupon_code":coupon_code},
161+
data: $data,
159162
url:coupon_url,
160163
success:function(data, textStatus){
161164
if(data.status == 'success'){

0 commit comments

Comments
 (0)