/** * Get JS files * * @return array */ public function getJSFiles() { $list = parent::getJSFiles(); $api = \XLite\Module\CDev\Paypal\Main::getRESTAPIInstance(); if ($api->isInContextSignUpAvailable()) { $list[] = 'modules/CDev/Paypal/settings/signup.js'; } return $list; }
/** * Get URL of referral page * * @param \XLite\Model\Payment\Method $method Payment method * * @return string */ public function getReferralPageURL(\XLite\Model\Payment\Method $method) { $api = \XLite\Module\CDev\Paypal\Main::getRESTAPIInstance(); $controller = \XLite::getController(); if ($api->isInContextSignUpAvailable()) { $returnUrl = $controller->getShopURL($controller->buildURL('paypal_settings', 'update_credentials')); $url = $api->getSignUpUrl($returnUrl); } else { $url = parent::getReferralPageURL($method); } return $url; }
/** * Is In-Context Boarding SignUp available * * @return boolean */ public function isInContextSignUpAvailable() { $api = Paypal\Main::getRESTAPIInstance(); return $api->isInContextSignUpAvailable(); }
/** * Get default attributes * * @return array */ protected function getDefaultAttributes() { $params = array('target' => 'PPFrame', 'data-paypal-button' => 'true'); $api = \XLite\Module\CDev\Paypal\Main::getRESTAPIInstance(); return $api->isInContextSignUpAvailable() ? $params : array(); }