* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @copyright PayPal */ namespace PaypalAddons\classes\PUI; use Context; use PaypalAddons\classes\PuiMethodInterface; class SignUpLinkButton { protected $context; protected $method; protected $puiFunctionality; public function __construct(PuiMethodInterface $method) { $this->context = Context::getContext(); $this->method = $method; $this->puiFunctionality = new PuiFunctionality(); } public function render() { $this->context->smarty->assign('actionUrl', $this->getActionUrl()); $this->context->smarty->assign('paypalOnboardingLib', $this->getOnboardingLib()); $this->context->smarty->assign('isPuiAvailable', $this->isPuiAvailable()); return $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'paypal/views/templates/pui/signUpLinkButton.tpl'); } protected function getActionUrl() { return $this->initSignupLink()->get(); } protected function getOnboardingLib() { if ($this->method->isSandbox()) { return 'https://www.sandbox.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js'; } else { return 'https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js'; } } protected function initSignupLink() { return new SignupLink($this->method); } protected function isPuiAvailable() { return $this->puiFunctionality->isAvailable(); } }