コード例 #1
0
ファイル: paypal.php プロジェクト: tareqy/Caracal
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // register backend
     if (class_exists('backend') && class_exists('shop')) {
         $backend = backend::getInstance();
         $method_menu = $backend->getMenu('shop_payment_methods');
         $recurring_menu = $backend->getMenu('shop_recurring_plans');
         // add menu entry for payment methods
         if (!is_null($method_menu)) {
             $method_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_paypal'), url_GetFromFilePath($this->path . 'images/icon.svg'), window_Open('paypal', 400, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings')), $level = 5));
         }
         if (!is_null($recurring_menu)) {
             $recurring_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_paypal'), url_GetFromFilePath($this->path . 'images/icon.svg'), window_Open('paypal_recurring_plans', 400, $this->getLanguageConstant('title_recurring_plans'), true, true, backend_UrlMake($this->name, 'recurring_plans')), $level = 5));
         }
     }
     // register payment method
     if (class_exists('shop')) {
         require_once 'units/express_payment_method.php';
         require_once 'units/direct_payment_method.php';
         // set helped in debug mode if specified
         PayPal_Helper::setSandbox(shop::getInstance()->isDebug());
         PayPal_Helper::setCredentials($this->settings['api_username'], $this->settings['api_password'], $this->settings['api_signature']);
         // create payment methods
         if ($this->settings['express_enabled'] == 1) {
             $this->express_method = PayPal_Express::getInstance($this);
         }
         if ($this->settings['direct_enabled'] == 1) {
             $this->direct_method = PayPal_Direct::getInstance($this);
         }
     }
 }
コード例 #2
0
 /**
  * Public function that creates a single instance
  */
 public static function getInstance($parent)
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self($parent);
     }
     return self::$_instance;
 }
コード例 #3
0
 /**
  * Get list of plans for recurring payments.
  * @return array
  */
 public function get_recurring_plans()
 {
     $method = PayPal_Express::getInstance($this->parent);
     return $method->get_recurring_plans();
 }