2017-06-22 37 views
0

我正在使用Angell EYE PayPal自適應付款CodeIgniter庫。它給我一個錯誤在庫paypal_adaptiveCodeigniter中的PayPal_Adaptive缺少參數

Missing argument 1 for PayPal_Adaptive::__construct() 

Undefined variable: DataArray 

我加入在配置文件中所有詳細數據低於

 $config['Sandbox'] = TRUE; 
    $config['APIVersion'] = '123.0'; 
    $config['APIUsername'] = $config['Sandbox'] ? 'paypaltest-facilitator_api1.gmail.com' : 'PRODUCTION_USERNAME_GOES_HERE'; 
    $config['APIPassword'] = $config['Sandbox'] ? 'JRGZPXDNRRL6LJNQE' : 'PRODUCTION_PASSWORD_GOES_HERE'; 
    $config['APISignature'] = $config['Sandbox'] ? 'AFcWxV21C7fd0v3bYYYRCpSSRl31A7uQi7GAsii.0uB9g5iAxqvN9Fzm' : 'PRODUCTION_SIGNATURE_GOES_HERE'; 
    $config['PayFlowUsername'] = $config['Sandbox'] ? 'SANDBOX_USERNAME_GOES_HERE' : 'PRODUCTION_USERNAME_GOGES_HERE'; 
    $config['PayFlowPassword'] = $config['Sandbox'] ? 'SANDBOX_PASSWORD_GOES_HERE' : 'PRODUCTION_PASSWORD_GOES_HERE'; 
    $config['PayFlowVendor'] = $config['Sandbox'] ? 'SANDBOX_VENDOR_GOES_HERE' : 'PRODUCTION_VENDOR_GOES_HERE'; 
    $config['PayFlowPartner'] = $config['Sandbox'] ? 'SANDBOX_PARTNER_GOES_HERE' : 'PRODUCTION_PARTNER_GOES_HERE'; 

    $config['ApplicationID'] = $config['Sandbox'] ? 'APP-80W284485P519543T' : 'PRODUCTION_APP_ID_GOES_HERE'; 
    $config['DeveloperEmailAccount'] = '[email protected]'; 

,現在下面是我的文庫開始獲得有關DataArray中我不」的錯誤代碼知道哪裏這個變量來自它不是寫在任何文件......

class PayPal_Adaptive extends PayPal_Pro 
{ 
    var $DeveloperAccountEmail = ''; 
    var $XMLNamespace = ''; 
    var $ApplicationID = ''; 
    var $IPAddress = ''; 
    var $DetailLevel = ''; 
    var $ErrorLanguage = ''; 

    function __construct($DataArray) 
    { 
     parent::__construct($DataArray); 
     $this->XMLNamespace = 'http://svcs.paypal.com/types/ap'; 
     $this->IPAddress = isset($DataArray['IPAddress']) ? $DataArray['IPAddress'] : $_SERVER['REMOTE_ADDR']; 
     $this->DetailLevel = isset($DataArray['DetailLevel']) ? $DataArray['DetailLevel'] : 'ReturnAll'; 
     $this->ErrorLanguage = isset($DataArray['ErrorLanguage']) ? $DataArray['ErrorLanguage'] : 'en_US'; 
     $this->APISubject = isset($DataArray['APISubject']) ? $DataArray['APISubject'] : ''; 
     $this->DeveloperAccountEmail = isset($DataArray['DeveloperAccountEmail']) ? $DataArray['DeveloperAccountEmail'] : ''; 
     exit; 

和我的控制器代碼如下

 class Adaptive_payments extends CI_Controller 
    { 
     function __construct() 
     { 
      parent::__construct(); 

      // Load helpers 
      $this->load->helper('url'); 

      // Load PayPal library 
      $this->config->load('paypal'); 

      $this->load->library('paypal/Paypal_adaptive'); 
      $this->load->library('paypal/Paypal_payflow'); 
      $this->load->library('paypal/Paypal_pro'); 

      $config = array(
       'Sandbox' => $this->config->item('Sandbox'),   // Sandbox/testing mode option. 
       'APIUsername' => $this->config->item('APIUsername'), // PayPal API username of the API caller 
       'APIPassword' => $this->config->item('APIPassword'), // PayPal API password of the API caller 
       'APISignature' => $this->config->item('APISignature'), // PayPal API signature of the API caller 
       'APISubject' => '',          // PayPal API subject (email address of 3rd party user that has granted API permission for your app) 
       'APIVersion' => $this->config->item('APIVersion'),  // API version you'd like to use for your call. You can set a default version in the class and leave this blank if you want. 
       'ApplicationID' => $this->config->item('ApplicationID'), 
       'DeveloperEmailAccount' => $this->config->item('DeveloperEmailAccount') 
      ); 

      if($config['Sandbox']) 
      { 
       error_reporting(E_ALL); 
       ini_set('display_errors', '1'); 
      } 

      $this->load->library('paypal/Paypal_adaptive', $config);  
     } 


     function index() 
     { 
      $this->load->view('paypal/samples/adaptive_payments'); 
     } 

告訴我如何解決售後服務這個問題...

+0

當在代碼中使用庫時提供'$ DataArray'到庫。 – Tpojka

+0

我已經這樣做了,但沒有工作... – StackOverflow

+0

編輯你的問題,並顯示控制器代碼如何使用庫以及如何傳遞'$ DataArray'。 – Tpojka

回答

0

如前所述,你似乎是加載的所有庫沒有$配置陣列包括作爲第二個參數。然後你設置$ config並重新加載自適應庫。刪除沒有$ config的庫的加載,它應該適合你。試試這個爲你的控制器:

class Adaptive_payments extends CI_Controller 
{ 
    function __construct() 
    { 
     parent::__construct(); 

     // Load helpers 
     $this->load->helper('url'); 

     // Load PayPal library 
     $this->config->load('paypal'); 

     $config = array(
      'Sandbox' => $this->config->item('Sandbox'),   // Sandbox/testing mode option. 
      'APIUsername' => $this->config->item('APIUsername'), // PayPal API username of the API caller 
      'APIPassword' => $this->config->item('APIPassword'), // PayPal API password of the API caller 
      'APISignature' => $this->config->item('APISignature'), // PayPal API signature of the API caller 
      'APISubject' => '',          // PayPal API subject (email address of 3rd party user that has granted API permission for your app) 
      'APIVersion' => $this->config->item('APIVersion'),  // API version you'd like to use for your call. You can set a default version in the class and leave this blank if you want. 
      'ApplicationID' => $this->config->item('ApplicationID'), 
      'DeveloperEmailAccount' => $this->config->item('DeveloperEmailAccount') 
     ); 

     if($config['Sandbox']) 
     { 
      error_reporting(E_ALL); 
      ini_set('display_errors', '1'); 
     } 

     $this->load->library('paypal/Paypal_adaptive', $config);  
    } 


    function index() 
    { 
     $this->load->view('paypal/samples/adaptive_payments'); 
    }