Skip to content

Commit

Permalink
支付部分的一些问题处理
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyecommerce committed Aug 14, 2021
1 parent c6d94b6 commit a92fa87
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
11 changes: 9 additions & 2 deletions app/appfront/modules/Payment/block/paypal/express/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ public function ajaxChangecountry()
* 本函数为从数据库中得到购物车中的数据,然后结合产品表
* 在加入一些产品数据,最终补全所有需要的信息。
*/
public function getCartInfo($shipping_method, $country, $state)
public function getCartInfo($activeProduct, $shipping_method, $country, $state)
{
if (!$this->_cart_info) {
$cart_info = Yii::$service->cart->getCartInfo(true, $shipping_method, $country, $state);
$cart_info = Yii::$service->cart->getCartInfo($activeProduct, $shipping_method, $country, $state);
if (isset($cart_info['products']) && is_array($cart_info['products'])) {
foreach ($cart_info['products'] as $k=>$product_one) {
// 设置名字,得到当前store的语言名字。
Expand Down Expand Up @@ -436,6 +436,13 @@ public function setValue($getExpressCheckoutReturn)
}
if ($getExpressCheckoutReturn['SHIPTOCOUNTRYCODE']) {
$this->_address['country'] = $getExpressCheckoutReturn['SHIPTOCOUNTRYCODE'];
if ($this->_address['country'] == 'C2') {
$this->_address['country'] = 'CN';
}
$this->_country = $this->_address['country'];
if ($this->_address['country']) {
$this->_address['country_name'] = Yii::$service->helper->country->getCountryNameByKey($this->_address['country']);
}
}
if ($getExpressCheckoutReturn['SHIPTOSTATE']) {
$this->_address['state'] = $getExpressCheckoutReturn['SHIPTOSTATE'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@

<script>
<?php $this->beginBlock('placeOrder') ?>
csrfName = $(".thiscsrf").attr("name");
csrfVal = $(".thiscsrf").val();
function validateEmail(email) {
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,}))$/;
return re.test(email);
Expand Down Expand Up @@ -148,13 +150,14 @@ function ajaxreflush(){
//alert("coupon can not empty!");
}
//coupon_url = $("#discount-coupon-form").attr("action");
//alert(coupon_url);
$data = {"coupon_code":coupon_code};
$data[csrfName] = csrfVal;
$.ajax({
async:true,
timeout: 6000,
dataType: 'json',
type:'post',
data: {"coupon_code":coupon_code},
data: $data,
url:coupon_url,
success:function(data, textStatus){
if(data.status == 'success'){
Expand Down
11 changes: 9 additions & 2 deletions app/apphtml5/modules/Payment/block/paypal/express/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ public function ajaxChangecountry()
* 本函数为从数据库中得到购物车中的数据,然后结合产品表
* 在加入一些产品数据,最终补全所有需要的信息。
*/
public function getCartInfo($shipping_method, $country, $state)
public function getCartInfo($activeProduct, $shipping_method, $country, $state)
{
if (!$this->_cart_info) {
$cart_info = Yii::$service->cart->getCartInfo(true, $shipping_method, $country, $state);
$cart_info = Yii::$service->cart->getCartInfo($activeProduct, $shipping_method, $country, $state);
if (isset($cart_info['products']) && is_array($cart_info['products'])) {
foreach ($cart_info['products'] as $k=>$product_one) {
// 设置名字,得到当前store的语言名字。
Expand Down Expand Up @@ -436,6 +436,13 @@ public function setValue($getExpressCheckoutReturn)
}
if ($getExpressCheckoutReturn['SHIPTOCOUNTRYCODE']) {
$this->_address['country'] = $getExpressCheckoutReturn['SHIPTOCOUNTRYCODE'];
if ($this->_address['country'] == 'C2') {
$this->_address['country'] = 'CN';
}
$this->_country = $this->_address['country'];
if ($this->_address['country']) {
$this->_address['country_name'] = Yii::$service->helper->country->getCountryNameByKey($this->_address['country']);
}
}
if ($getExpressCheckoutReturn['SHIPTOSTATE']) {
$this->_address['state'] = $getExpressCheckoutReturn['SHIPTOSTATE'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@

<script>
<?php $this->beginBlock('placeOrder') ?>
csrfName = $(".thiscsrf").attr("name");
csrfVal = $(".thiscsrf").val();
function validateEmail(email) {
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,}))$/;
return re.test(email);
Expand Down Expand Up @@ -149,13 +151,14 @@ function ajaxreflush(){
//alert("coupon can not empty!");
}
//coupon_url = $("#discount-coupon-form").attr("action");
//alert(coupon_url);
$data = {"coupon_code":coupon_code};
$data[csrfName] = csrfVal;
$.ajax({
async:true,
timeout: 6000,
dataType: 'json',
type:'post',
data: {"coupon_code":coupon_code},
data: $data,
url:coupon_url,
success:function(data, textStatus){
if(data.status == 'success'){
Expand Down

0 comments on commit a92fa87

Please sign in to comment.