ecstore使用paypal支付显示不支持此支付

时间:2023-03-09 06:56:26
ecstore使用paypal支付显示不支持此支付

问题描述:

  ecstore使用paypal支付,下单结算时显示不支持此支付。

问题和代码分析:

  1、首先必须要保证默认货币是paypal支持的货币,paypal目前支付

    

["supportCurrency"]=>
array(17) {
["USD"]=>
string(3) "USD"
["CAD"]=>
string(3) "CAD"
["EUR"]=>
string(3) "EUR"
["GBP"]=>
string(3) "GBP"
["JPY"]=>
string(3) "JPY"
["AUD"]=>
string(3) "AUD"
["NZD"]=>
string(3) "NZD"
["CHF"]=>
string(3) "CHF"
["HKD"]=>
string(3) "HKD"
["SGD"]=>
string(3) "SGD"
["SEK"]=>
string(3) "SEK"
["DKK"]=>
string(3) "DKK"
["PLZ"]=>
string(3) "PLZ"
["NOK"]=>
string(3) "NOK"
["HUF"]=>
string(3) "HUF"
["CSK"]=>
string(3) "CSK"
["CNY"]=>
string(3) "CNY"
}

    2、跟踪代码发现支付逻辑是这样的,首先拿出已经开启的并且与当前支付货币无冲突支付方式,然后比对用户选择的支付方式。成功则跳转至选中支付方式的支付平台去支付。

      既然是酱紫,追溯这个思路。可能性有两种:

          a、程序判断支付方式的开启出现的问题;

          b、在处理用户选择支付方式当前默认支付货币无冲突时出现问题

    3、跟踪代码发现问题出现在:b、在处理用户选择支付方式当前默认支付货币无冲突时出现问题

      问题出现在:ectools\model\payment\cfgs.php中的getListByCode($cur_code='CNY',$platform=array('ispc','iscommon'))方法

      

    public function getListByCode($cur_code='CNY',$platform=array('ispc','iscommon'))
{
$arr_payments = $this->getList('*', array('status' => 'true','platform'=>$platform, 'is_frontend' => true));
$currency = $this->app->model('currency');
$arrDefCurrency = $currency->getDefault();
foreach ($arr_payments as $key=>$paymentinfo)
{
switch ($paymentinfo['support_cur'])
{
case '1':
if ($cur_code != 'CNY')
{
unset($arr_payments[$key]);
}
break;
case '2':
//if ($cur_code != 'CNY') /*此處會把paypal支付過濾掉,故將改條件關閉*/
if (false)
{
unset($arr_payments[$key]);
}
break;
case '3':
if ($arrDefCurrency['cur_code'] != $cur_code)
{
unset($arr_payments[$key]);
}
break;
case '4':
break;
default:
break;
}
} return $arr_payments;
}

      如您有更好的想欢迎交流。

      尊重原创,请保留链接:http://www.cnblogs.com/seafood/p/4229311.html