Beispiel #1
0
 public function index()
 {
     $billingService = BOL_BillingService::getInstance();
     $gwKey = OCSBILLINGMONEYBOOKERS_CLASS_MoneybookersAdapter::GATEWAY_KEY;
     $language = OW::getLanguage();
     $form = new MoneybookersConfigForm();
     $this->addForm($form);
     if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
         $values = $form->getValues();
         $billingService->setGatewayConfigValue($gwKey, 'merchantId', $values['merchantId']);
         $billingService->setGatewayConfigValue($gwKey, 'merchantEmail', $values['merchantEmail']);
         $billingService->setGatewayConfigValue($gwKey, 'secret', $values['secret']);
         $billingService->setGatewayConfigValue($gwKey, 'sandboxMode', $values['sandboxMode']);
         $billingService->setGatewayConfigValue($gwKey, 'recipientDescription', $values['recipientDescription']);
         $billingService->setGatewayConfigValue($gwKey, 'language', $values['language']);
         OW::getFeedback()->info($language->text('ocsbillingmoneybookers', 'settings_updated'));
         $this->redirect();
     }
     $adapter = new OCSBILLINGMONEYBOOKERS_CLASS_MoneybookersAdapter();
     $this->assign('logoUrl', $adapter->getLogoUrl());
     $gateway = $billingService->findGatewayByKey($gwKey);
     $this->assign('gateway', $gateway);
     $this->assign('activeCurrency', $billingService->getActiveCurrency());
     $supported = $billingService->currencyIsSupported($gateway->currencies);
     $this->assign('currSupported', $supported);
     $logo = OW::getPluginManager()->getPlugin('ocsbillingmoneybookers')->getStaticUrl() . 'img/oxwallcandystore-logo.jpg';
     $this->assign('logo', $logo);
     $this->setPageHeading(OW::getLanguage()->text('ocsbillingmoneybookers', 'config_page_heading'));
     $this->setPageHeadingIconClass('ow_ic_app');
 }
Beispiel #2
0
 public function form()
 {
     $billingService = BOL_BillingService::getInstance();
     $adapter = new OCSBILLINGMONEYBOOKERS_CLASS_MoneybookersAdapter();
     $lang = OW::getLanguage();
     $sale = $billingService->getSessionSale();
     if (!$sale) {
         $url = $billingService->getSessionBackUrl();
         if ($url != null) {
             OW::getFeedback()->warning($lang->text('base', 'billing_order_canceled'));
             $billingService->unsetSessionBackUrl();
             $this->redirect($url);
         } else {
             $this->redirect($billingService->getOrderFailedPageUrl());
         }
     }
     $formId = uniqid('order_form-');
     $this->assign('formId', $formId);
     $js = '$("#' . $formId . '").submit()';
     OW::getDocument()->addOnloadScript($js);
     $fields = $adapter->getFields(array('hash' => $sale->hash));
     $this->assign('fields', $fields);
     if ($billingService->prepareSale($adapter, $sale)) {
         $sale->totalAmount = floatval($sale->totalAmount);
         $this->assign('sale', $sale);
         $masterPageFileDir = OW::getThemeManager()->getMasterPageTemplate('blank');
         OW::getDocument()->getMasterPage()->setTemplate($masterPageFileDir);
         $billingService->unsetSessionSale();
     } else {
         $productAdapter = $billingService->getProductAdapter($sale->entityKey);
         if ($productAdapter) {
             $productUrl = $productAdapter->getProductOrderUrl();
         }
         OW::getFeedback()->warning($lang->text('base', 'billing_order_init_failed'));
         $url = isset($productUrl) ? $productUrl : $billingService->getOrderFailedPageUrl();
         $this->redirect($url);
     }
 }