Пример #1
0
function payeer_add_admin_notification(BASE_CLASS_EventCollector $coll)
{
    $billingService = BOL_BillingService::getInstance();
    if (!mb_strlen($billingService->getGatewayConfigValue(BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY, 'm_key')) && !mb_strlen($billingService->getGatewayConfigValue(BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY, 'm_shop'))) {
        $coll->add(OW::getLanguage()->text('billingpayeer', 'plugin_configuration_notice', array('url' => OW::getRouter()->urlForRoute('billing_payeer_admin'))));
    }
}
Пример #2
0
 public function __construct($affiliateId)
 {
     parent::__construct();
     $service = OCSAFFILIATES_BOL_Service::getInstance();
     $affiliate = $service->findAffiliateById($affiliateId);
     if (!$affiliate) {
         $this->setVisible(false);
         return;
     }
     $billingService = BOL_BillingService::getInstance();
     $this->assign('currency', $billingService->getActiveCurrency());
     $clicksCount = $service->countClicksForAffiliate($affiliateId);
     $this->assign('clicksCount', $clicksCount);
     $signupCount = $service->countRegistrationsForAffiliate($affiliateId);
     $this->assign('signupCount', $signupCount);
     $salesCount = $service->countSalesForAffiliate($affiliateId);
     $this->assign('salesCount', $salesCount);
     $clicksSum = $service->getClicksSumForAffiliate($affiliateId);
     $this->assign('clicksSum', $clicksSum);
     $signupSum = $service->getRegistrationsSumForAffiliate($affiliateId);
     $this->assign('signupSum', $signupSum);
     $salesSum = $service->getSalesSumForAffiliate($affiliateId);
     $this->assign('salesSum', $salesSum);
     $earnings = $clicksSum + $signupSum + $salesSum;
     $this->assign('earnings', $earnings);
     $payouts = $service->getPayoutSum($affiliateId);
     $this->assign('payouts', $payouts);
     $balance = $earnings - $payouts;
     $this->assign('balance', $balance);
     $this->assign('affiliate', $affiliate);
 }
Пример #3
0
 /**
  * Finance list page controller
  *
  * @param array $params
  */
 public function index(array $params)
 {
     $service = BOL_BillingService::getInstance();
     $lang = OW::getLanguage();
     $page = isset($_GET['page']) ? $_GET['page'] : 1;
     $onPage = 20;
     $list = $service->getFinanceList($page, $onPage);
     $userIdList = array();
     foreach ($list as $sale) {
         if (isset($sale['userId']) && !in_array($sale['userId'], $userIdList)) {
             array_push($userIdList, $sale['userId']);
         }
     }
     $displayNames = BOL_UserService::getInstance()->getDisplayNamesForList($userIdList);
     $userNames = BOL_UserService::getInstance()->getUserNamesForList($userIdList);
     $this->assign('list', $list);
     $this->assign('displayNames', $displayNames);
     $this->assign('userNames', $userNames);
     $total = $service->countSales();
     // Paging
     $pages = (int) ceil($total / $onPage);
     $paging = new BASE_CMP_Paging($page, $pages, 10);
     $this->assign('paging', $paging->render());
     $this->assign('total', $total);
     $stats = $service->getTotalIncome();
     $this->assign('stats', $stats);
     OW::getDocument()->setHeading($lang->text('admin', 'page_title_finance'));
     OW::getDocument()->setHeadingIconClass('ow_ic_app');
 }
Пример #4
0
 public function addAdminNotification(BASE_CLASS_EventCollector $coll)
 {
     $billingService = BOL_BillingService::getInstance();
     if (!mb_strlen($billingService->getGatewayConfigValue(BILLINGPAYPAL_CLASS_PaypalAdapter::GATEWAY_KEY, 'business'))) {
         $coll->add(OW::getLanguage()->text('billingpaypal', 'plugin_configuration_notice', array('url' => OW::getRouter()->urlForRoute('billing_paypal_admin'))));
     }
 }
Пример #5
0
 public function __construct($params = array())
 {
     parent::__construct();
     $service = BOL_BillingService::getInstance();
     $gateway = $service->findGatewayByKey($params['gateway']);
     if (!$gateway || $gateway->dynamic) {
         $this->setVisible(false);
         return;
     }
     $event = new BASE_CLASS_EventCollector('base.billing_add_gateway_product');
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     $eventProducts = array();
     if ($data) {
         foreach ($data as $plugin) {
             foreach ($plugin as $product) {
                 $id = $service->addGatewayProduct($gateway->id, $product['pluginKey'], $product['entityType'], $product['entityId']);
                 $product['id'] = $id;
                 $eventProducts[] = $product;
             }
         }
     }
     $products = $service->findGatewayProductList($gateway->id);
     foreach ($eventProducts as &$prod) {
         $prod['productId'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['dto']->productId : null;
         $prod['plugin'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['plugin'] : null;
     }
     $this->assign('products', $eventProducts);
     $this->assign('actionUrl', OW::getRouter()->urlFor('BASE_CTRL_Billing', 'saveGatewayProduct'));
     $this->assign('backUrl', urlencode(OW::getRouter()->getBaseUrl() . OW::getRouter()->getUri()));
 }
Пример #6
0
 public function index()
 {
     $language = OW::getLanguage();
     $billingService = BOL_BillingService::getInstance();
     $adminForm = new Form('adminForm');
     $element = new TextField('creditValue');
     $element->setRequired(true);
     $element->setLabel($language->text('billingcredits', 'admin_usd_credit_value'));
     $element->setDescription($language->text('billingcredits', 'admin_usd_credit_value_desc'));
     $element->setValue($billingService->getGatewayConfigValue('billingcredits', 'creditValue'));
     $validator = new FloatValidator(0.1);
     $validator->setErrorMessage($language->text('billingcredits', 'invalid_numeric_format'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue($language->text('billingcredits', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $billingService->setGatewayConfigValue('billingcredits', 'creditValue', $values['creditValue']);
             OW::getFeedback()->info($language->text('billingcredits', 'user_save_success'));
         }
     }
     $this->addForm($adminForm);
     $this->setPageHeading(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
     $this->setPageTitle(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
     $this->setPageHeadingIconClass('ow_ic_app');
 }
Пример #7
0
    public function index()
    {
        $this->addComponent('menu', $this->getMenu('list'));
        $lang = OW::getLanguage();
        $limit = 20;
        $page = !empty($_GET['page']) ? abs((int) $_GET['page']) : 1;
        $offset = ($page - 1) * $limit;
        $sortFields = $this->service->getSortFields();
        $sortBy = !empty($_GET['sort']) && in_array($_GET['sort'], $sortFields) ? $_GET['sort'] : 'registerStamp';
        $sortOrder = !empty($_GET['order']) && in_array($_GET['order'], array('asc', 'desc')) ? $_GET['order'] : 'desc';
        $sortUrls = array();
        $baseUrl = OW::getRouter()->urlForRoute('ocsaffiliates.admin') . '/?';
        foreach ($sortFields as $field) {
            $sortUrls[$field] = $baseUrl . 'sort=' . $field . '&order=' . ($sortBy != $field ? 'desc' : ($sortOrder == 'desc' ? 'asc' : 'desc'));
        }
        $this->assign('sortUrls', $sortUrls);
        $list = $this->service->getAffiliateList($offset, $limit, $sortBy, $sortOrder);
        $this->assign('list', $list);
        $total = $this->service->countAffiliates();
        $unverified = $this->service->countUnverifiedAffiliates();
        $this->assign('unverified', $unverified);
        // Paging
        $pages = (int) ceil($total / $limit);
        $paging = new BASE_CMP_Paging($page, $pages, $limit);
        $this->assign('paging', $paging->render());
        $billingService = BOL_BillingService::getInstance();
        $this->assign('currency', $billingService->getActiveCurrency());
        $logo = OW::getPluginManager()->getPlugin('ocsaffiliates')->getStaticUrl() . 'img/oxwallcandystore-logo.jpg';
        $this->assign('logo', $logo);
        $script = '$(".action_delete").click(function(){

            if ( !confirm(' . json_encode($lang->text('ocsaffiliates', 'delete_confirm')) . ') )
            {
                return false;
            }
            var affId = $(this).attr("affid");
            $.ajax({
                url: ' . json_encode(OW::getRouter()->urlForRoute('ocsaffiliates.action_delete')) . ',
                type: "POST",
                data: { affiliateId: affId },
                dataType: "json",
                success: function(data)
                {
                    if ( data.result == true )
                    {
                        document.location.reload();
                    }
                    else if ( data.error != undefined )
                    {
                        OW.warning(data.error);
                    }
                }
            });
        });';
        OW::getDocument()->addOnloadScript($script);
        // TODO: remove this code when a sale event is available
        $this->service->processUntrackedSales();
        OW::getDocument()->setHeading($lang->text('ocsaffiliates', 'admin_page_heading'));
    }
Пример #8
0
 public function process()
 {
     $values = $this->getValues();
     $billingService = BOL_BillingService::getInstance();
     $gwKey = OCSBILLINGICEPAY_CLASS_IcepayAdapter::GATEWAY_KEY;
     $billingService->setGatewayConfigValue($gwKey, 'merchantId', $values['merchantId']);
     $billingService->setGatewayConfigValue($gwKey, 'encryptionCode', $values['encryptionCode']);
 }
Пример #9
0
function ocsbillingicepay_add_admin_notification(BASE_CLASS_EventCollector $coll)
{
    $billingService = BOL_BillingService::getInstance();
    $gwKey = OCSBILLINGICEPAY_CLASS_IcepayAdapter::GATEWAY_KEY;
    if (!mb_strlen($billingService->getGatewayConfigValue($gwKey, 'merchantId')) || !mb_strlen($billingService->getGatewayConfigValue($gwKey, 'encryptionCode'))) {
        $coll->add(OW::getLanguage()->text('ocsbillingicepay', 'plugin_configuration_notice', array('url' => OW::getRouter()->urlForRoute('ocsbillingicepay.admin'))));
    }
}
Пример #10
0
 public function process()
 {
     $values = $this->getValues();
     $billingService = BOL_BillingService::getInstance();
     $gwKey = BILLINGPAYPAL_CLASS_PaypalAdapter::GATEWAY_KEY;
     $billingService->setGatewayConfigValue($gwKey, 'business', $values['business']);
     $billingService->setGatewayConfigValue($gwKey, 'sandboxMode', $values['sandboxMode']);
 }
Пример #11
0
function ocsbillingmoneybookers_add_admin_notification(BASE_CLASS_EventCollector $coll)
{
    $billingService = BOL_BillingService::getInstance();
    $gwKey = OCSBILLINGMONEYBOOKERS_CLASS_MoneybookersAdapter::GATEWAY_KEY;
    if (!mb_strlen($billingService->getGatewayConfigValue($gwKey, 'merchantId')) || !mb_strlen($billingService->getGatewayConfigValue($gwKey, 'merchantEmail')) || !mb_strlen($billingService->getGatewayConfigValue($gwKey, 'secret'))) {
        $coll->add(OW::getLanguage()->text('ocsbillingmoneybookers', 'plugin_configuration_notice', array('url' => OW::getRouter()->urlForRoute('ocsbillingmoneybookers.admin'))));
    }
}
Пример #12
0
 public function process()
 {
     $values = $this->getValues();
     $billingService = BOL_BillingService::getInstance();
     $gwKey = BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY;
     $billingService->setGatewayConfigValue($gwKey, 'm_key', $values['m_key']);
     $billingService->setGatewayConfigValue($gwKey, 'm_shop', $values['m_shop']);
     $billingService->setGatewayConfigValue($gwKey, 'm_curr', $values['m_curr']);
     $billingService->setGatewayConfigValue($gwKey, 'lang', $values['lang']);
     $billingService->setGatewayConfigValue($gwKey, 'tabNum', $values['tabNum']);
 }
Пример #13
0
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $goalId = $params->customParamList['goal'];
     $service = OCSFUNDRAISING_BOL_Service::getInstance();
     if ($goalId) {
         $goal = $service->getGoalById($goalId);
         if (!$goal) {
             $this->assign('error', OW::getLanguage()->text('ocsfundraising', 'goal_not_found'));
             return;
         }
         $goal['dto']->description = mb_substr($goal['dto']->description, 0, 250) . (mb_strlen($goal['dto']->description) > 250 ? '...' : '');
         $this->assign('goal', $goal);
     } else {
         $this->assign('goal', null);
         return;
     }
     $userIdList = array();
     $showTop = $params->customParamList['show_top'];
     if ($showTop) {
         $top = $service->getDonationList($goalId, 'top', 1, 3);
         if ($top) {
             foreach ($top as $d) {
                 if ($d['dto']->userId && !in_array($d['dto']->userId, $userIdList)) {
                     array_push($userIdList, $d['dto']->userId);
                 }
             }
         }
         $this->assign('top', $top);
     }
     $this->assign('showTop', $showTop);
     $showLatest = $params->customParamList['show_latest'];
     if ($showLatest) {
         $latest = $service->getDonationList($goalId, 'latest', 1, 3);
         if ($latest) {
             foreach ($latest as $d) {
                 if ($d['dto']->userId && !in_array($d['dto']->userId, $userIdList)) {
                     array_push($userIdList, $d['dto']->userId);
                 }
             }
         }
         $this->assign('latest', $latest);
     }
     $this->assign('showLatest', $showLatest);
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIdList);
     $this->assign('avatars', $avatars);
     $this->assign('currency', BOL_BillingService::getInstance()->getActiveCurrency());
     $this->assign('donators', (int) $service->countGoalDonators($goalId));
     $image = $goal['dto']->image ? $service->generateImageUrl($goal['dto']->image, true) : null;
     $this->assign('image', $image);
     $js = UTIL_JsGenerator::newInstance()->jQueryEvent('.btn-donate-goal-' . $goal['dto']->id, 'click', 'document.location.href = e.data.href', array('e'), array('href' => OW::getRouter()->urlForRoute('ocsfundraising.donate', array('goalId' => $goal['dto']->id))))->jQueryEvent('.btn-details-goal-' . $goal['dto']->id, 'click', 'document.location.href = e.data.href', array('e'), array('href' => OW::getRouter()->urlForRoute('ocsfundraising.project', array('id' => $goal['dto']->id))));
     OW::getDocument()->addOnloadScript($js);
 }
Пример #14
0
 public function index()
 {
     if (!OW::getUser()->isAuthenticated()) {
         throw new AuthenticateException();
     }
     $form = new BuyCreditsForm();
     $this->addForm($form);
     $creditService = USERCREDITS_BOL_CreditsService::getInstance();
     if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
         $values = $form->getValues();
         $lang = OW::getLanguage();
         $userId = OW::getUser()->getId();
         $billingService = BOL_BillingService::getInstance();
         if (empty($values['gateway']['url']) || empty($values['gateway']['key']) || !($gateway = $billingService->findGatewayByKey($values['gateway']['key']) || !$gateway->active)) {
             OW::getFeedback()->error($lang->text('base', 'billing_gateway_not_found'));
             $this->redirect();
         }
         if (!($pack = $creditService->findPackById($values['pack']))) {
             OW::getFeedback()->error($lang->text('usercredits', 'pack_not_found'));
             $this->redirect();
         }
         // create pack product adapter object
         $productAdapter = new USERCREDITS_CLASS_UserCreditsPackProductAdapter();
         // sale object
         $sale = new BOL_BillingSale();
         $sale->pluginKey = 'usercredits';
         $sale->entityDescription = strip_tags($creditService->getPackTitle($pack->price, $pack->credits));
         $sale->entityKey = $productAdapter->getProductKey();
         $sale->entityId = $pack->id;
         $sale->price = floatval($pack->price);
         $sale->period = 30;
         $sale->userId = $userId ? $userId : 0;
         $sale->recurring = 0;
         $saleId = $billingService->initSale($sale, $values['gateway']['key']);
         if ($saleId) {
             // sale Id is temporarily stored in session
             $billingService->storeSaleInSession($saleId);
             $billingService->setSessionBackUrl($productAdapter->getProductOrderUrl());
             // redirect to gateway form page
             OW::getApplication()->redirect($values['gateway']['url']);
         }
     }
     $lang = OW::getLanguage();
     $accountTypeId = $creditService->getUserAccountTypeId(OW::getUser()->getId());
     $packs = $creditService->getPackList($accountTypeId);
     $this->assign('packs', $packs);
     $this->setPageHeading($lang->text('usercredits', 'buy_credits_page_heading'));
     $this->setPageHeadingIconClass('ow_ic_user');
     OW::getDocument()->setTitle($lang->text('usercredits', 'meta_title_buy_credits'));
     OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'base', 'dashboard');
 }
Пример #15
0
 public function index(array $params)
 {
     if (!($goalId = $params['goalId'])) {
         throw new Redirect404Exception();
     }
     $fundraisingService = OCSFUNDRAISING_BOL_Service::getInstance();
     $billingService = BOL_BillingService::getInstance();
     $this->assign('currency', $billingService->getActiveCurrency());
     if (!($goal = $fundraisingService->getGoalById($goalId))) {
         throw new Redirect404Exception();
     }
     $this->assign('goal', $goal);
     $lang = OW::getLanguage();
     $userId = OW::getUser()->getId();
     $this->assign('userId', $userId);
     $form = new DonateForm($userId);
     $this->addForm($form);
     $form->getElement('amount')->setValue(floatval($goal['dto']->amountMin));
     if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
         $values = $form->getValues();
         if (empty($values['gateway']['url']) || empty($values['gateway']['key']) || !($gateway = $billingService->findGatewayByKey($values['gateway']['key']) || !$gateway->active)) {
             OW::getFeedback()->error($lang->text('base', 'billing_gateway_not_found'));
             $this->redirectToAction('index');
         }
         // create donation product adapter object
         $productAdapter = new OCSFUNDRAISING_CLASS_DonationProductAdapter();
         // sale object
         $sale = new BOL_BillingSale();
         $sale->pluginKey = 'ocsfundraising';
         $sale->entityDescription = $goal['dto']->name;
         $sale->entityKey = $productAdapter->getProductKey();
         $sale->entityId = $goalId;
         $sale->price = floatval($values['amount']);
         $sale->userId = $userId ? $userId : 0;
         $sale->recurring = false;
         if (!$userId && !empty($values['username'])) {
             $sale->setExtraData(array('username' => $values['username']));
         }
         $saleId = $billingService->initSale($sale, $values['gateway']['key']);
         if ($saleId) {
             // sale Id is temporarily stored in session
             $billingService->storeSaleInSession($saleId);
             $billingService->setSessionBackUrl(OW::getRouter()->urlForRoute(OCSFUNDRAISING_CLASS_DonationProductAdapter::RETURN_ROUTE, array('goalId' => $goalId)));
             // redirect to gateway form page
             $this->redirect($values['gateway']['url']);
         }
     }
     $this->setPageHeading($goal['dto']->name);
     $this->setPageHeadingIconClass('ow_ic_user');
 }
Пример #16
0
 public function __construct($affiliateId, $adminMode = false)
 {
     parent::__construct();
     $service = OCSAFFILIATES_BOL_Service::getInstance();
     $affiliate = $service->findAffiliateById($affiliateId);
     if (!$affiliate) {
         $this->setVisible(false);
         return;
     }
     $this->assign('payoutList', $service->getPayoutListForAffiliate($affiliateId));
     $billingService = BOL_BillingService::getInstance();
     $this->assign('currency', $billingService->getActiveCurrency());
     $this->assign('adminMode', $adminMode);
 }
Пример #17
0
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $userId = $params->additionalParamList['entityId'];
     $service = OCSFUNDRAISING_BOL_Service::getInstance();
     $projects = $service->getUserGoalsList($userId, 1, 2);
     $this->assign('projects', $projects);
     $this->assign('currency', BOL_BillingService::getInstance()->getActiveCurrency());
     /*$js = UTIL_JsGenerator::newInstance()
                 ->jQueryEvent('.btn-donate-goal-'.$goal['dto']->id, 'click', 'document.location.href = e.data.href', array('e'),
                     array('href' => OW::getRouter()->urlForRoute('ocsfundraising.donate', array('goalId' => $goal['dto']->id))
                 ));
     
             OW::getDocument()->addOnloadScript($js);*/
 }
Пример #18
0
 public function __construct()
 {
     parent::__construct('moneybookers-config-form');
     $language = OW::getLanguage();
     $billingService = BOL_BillingService::getInstance();
     $gwKey = OCSBILLINGMONEYBOOKERS_CLASS_MoneybookersAdapter::GATEWAY_KEY;
     $merchantId = new TextField('merchantId');
     $merchantId->setValue($billingService->getGatewayConfigValue($gwKey, 'merchantId'));
     $merchantId->setRequired(true);
     $merchantId->setLabel($language->text('ocsbillingmoneybookers', 'merchant_id'));
     $this->addElement($merchantId);
     $merchantEmail = new TextField('merchantEmail');
     $merchantEmail->setValue($billingService->getGatewayConfigValue($gwKey, 'merchantEmail'));
     $merchantEmail->setRequired(true);
     $merchantEmail->setLabel($language->text('ocsbillingmoneybookers', 'merchant_email'));
     $this->addElement($merchantEmail);
     $secret = new TextField('secret');
     $secret->setValue($billingService->getGatewayConfigValue($gwKey, 'secret'));
     $secret->setRequired(true);
     $secret->setLabel($language->text('ocsbillingmoneybookers', 'secret'));
     $this->addElement($secret);
     $sandboxMode = new CheckboxField('sandboxMode');
     $sandboxMode->setValue($billingService->getGatewayConfigValue($gwKey, 'sandboxMode'));
     $sandboxMode->setLabel($language->text('ocsbillingmoneybookers', 'sandbox_mode'));
     $this->addElement($sandboxMode);
     $desc = new TextField('recipientDescription');
     $desc->setValue($billingService->getGatewayConfigValue($gwKey, 'recipientDescription'));
     $desc->setLabel($language->text('ocsbillingmoneybookers', 'recipient_description'));
     $this->addElement($desc);
     $lang = new Selectbox('language');
     $lang->setLabel($language->text('ocsbillingmoneybookers', 'language'));
     $lang->addOptions(array('EN' => 'EN', 'DE' => 'DE', 'ES' => 'ES', 'FR' => 'FR', 'IT' => 'IT', 'PL' => 'PL', 'GR' => 'GR', 'RO' => 'PO', 'RU' => 'RU', 'TR' => 'TR', 'CN' => 'CN', 'CZ' => 'CZ', 'NL' => 'NL', 'DA' => 'DA', 'SV' => 'SV', 'FI' => 'FI'));
     $lang->setRequired(true);
     $lang->setValue($billingService->getGatewayConfigValue($gwKey, 'language'));
     $this->addElement($lang);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('ocsbillingmoneybookers', 'btn_save'));
     $this->addElement($submit);
 }
Пример #19
0
<?php

/**
 * This software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ and is a proprietary licensed product. 
 * For more information see License.txt in the plugin folder.
 * ---
 * Copyright (c) 2013, Purusothaman Ramanujam
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without modification, are not permitted provided.
 * This plugin should be bought from the developer by paying money to PayPal account (purushoth.r@gmail.com).
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
BOL_BillingService::getInstance()->deleteGateway('billingcredits');
Пример #20
0
 public function buybycredits()
 {
     $billingService = BOL_BillingService::getInstance();
     if (!isset($_POST['amount'])) {
         $this->redirect($billingService->getOrderFailedPageUrl());
     }
     $userId = OW::getUser()->getId();
     $itemName = $_POST['itemName'];
     $amount = (double) $_POST['amount'];
     $currency = $_POST['currency'];
     $availableCredits = USERCREDITS_BOL_CreditsService::getInstance()->getCreditsBalance($userId);
     $creditValue = $billingService->getGatewayConfigValue('billingcredits', 'creditValue');
     $totalCreditsRequired = round($amount * $creditValue);
     if ($availableCredits < $totalCreditsRequired) {
         $this->assign('formUrl', $billingService->getOrderCancelledPageUrl());
     } else {
         $this->assign('formUrl', OW::getRouter()->urlFor('BILLINGCREDITS_CTRL_Order', 'purchase'));
     }
     $this->assign('itemName', $itemName);
     $this->assign('amount', $amount);
     $this->assign('currency', $currency);
     $this->assign('availableCredits', $availableCredits);
     $this->assign('totalCreditsRequired', $totalCreditsRequired);
     $this->assign('buyingUser', $userId);
     $this->assign('custom', $_POST['custom']);
     $this->assign('transId', $_POST['transId']);
 }
Пример #21
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $name = $this->getName();
     $billingService = BOL_BillingService::getInstance();
     $gateways = $billingService->getActiveGatewaysList();
     $paymentOptions = array();
     if ($gateways) {
         foreach ($gateways as $gateway) {
             /* @var $adapter OW_BillingAdapter */
             if ($adapter = new $gateway->adapterClassName()) {
                 $paymentOptions[$gateway->gatewayKey]['dto'] = $gateway;
                 $paymentOptions[$gateway->gatewayKey]['orderUrl'] = $adapter->getOrderFormUrl();
                 $paymentOptions[$gateway->gatewayKey]['logoUrl'] = $adapter->getLogoUrl();
             }
         }
         $gatewaysNumber = count($paymentOptions);
         $id = UTIL_HtmlTag::generateAutoId('input');
         $urlFieldAttrs = array('type' => 'hidden', 'id' => 'url-' . $id, 'value' => '', 'name' => $name . '[url]');
         $renderedString = UTIL_HtmlTag::generateTag('input', $urlFieldAttrs);
         $cont_id = $id . '-cont';
         $renderedString .= '<ul class="ow_billing_gateways clearfix" id="' . $cont_id . '">';
         $i = 0;
         foreach ($paymentOptions as $option) {
             $this->addAttributes(array('type' => 'radio', 'rel' => $option['orderUrl'], 'value' => $option['dto']->gatewayKey, 'name' => $name . '[key]'));
             if ($i == 0) {
                 $url = $option['orderUrl'];
                 $this->addAttribute(self::ATTR_CHECKED, 'checked');
             }
             if ($gatewaysNumber == 1) {
                 $renderedString .= '<li style="display: inline-block; padding-right: 20px;">' . OW::getLanguage()->text('base', 'billing_pay_with') . '</li>';
                 $field = UTIL_HtmlTag::generateTag('input', array('type' => 'hidden', 'id' => 'url-' . $id, 'value' => $option['dto']->gatewayKey, 'name' => $name . '[key]'));
             } else {
                 $field = UTIL_HtmlTag::generateTag('input', $this->attributes);
             }
             $renderedString .= '<li style="display: inline-block;">
                 <label>' . $field . '<img src="' . $option['logoUrl'] . '" alt="' . $option['dto']->gatewayKey . '" /></label>
             </li>';
             $i++;
             $this->removeAttribute(self::ATTR_CHECKED);
         }
         $renderedString .= '</ul>';
         $js = 'var $url_field = $("#url-' . $id . '");
             $url_field.val("' . $url . '");
             $("ul#' . $cont_id . ' input").change(function(){
                 $url_field.val($(this).attr("rel"));
             });';
         OW::getDocument()->addOnloadScript($js);
     } else {
         $renderedString = OW::getLanguage()->text('base', 'billing_no_gateways');
     }
     return $renderedString;
 }
Пример #22
0
 protected function getActiveGatewaysList()
 {
     return BOL_BillingService::getInstance()->getActiveGatewaysList(true);
 }
Пример #23
0
<?php

/**
 * EXHIBIT A. Common Public Attribution License Version 1.0
 * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy of the License at
 * http://opensource.org/licenses/CPAL-1.0. Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language
 * governing rights and limitations under the License.
 * The Initial Developer of the Original Code is Oxwall CandyStore (http://oxcandystore.com/).
 * All portions of the code written by Oxwall CandyStore are Copyright (c) 2013. All Rights Reserved.
 * EXHIBIT B. Attribution Information
 * Attribution Copyright Notice: Copyright 2013 Oxwall CandyStore. All rights reserved.
 * Attribution Phrase (not exceeding 10 words): Powered by Oxwall CandyStore
 * Attribution URL: http://oxcandystore.com/
 * Graphic Image as provided in the Covered Code.
 * Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work
 * which combines Covered Code or portions thereof with code not governed by the terms of the CPAL.
 */
/**
 * /uninstall.php
 *
 * @author Oxwall CandyStore <*****@*****.**>
 * @package ow.ow_plugins.ocs_billing_icepay
 * @since 1.5.1
 */
$billingService = BOL_BillingService::getInstance();
$billingService->deleteConfig('ocsbillingicepay', 'merchantId');
$billingService->deleteConfig('ocsbillingicepay', 'encryptionCode');
$billingService->deleteGateway('ocsbillingicepay');
Пример #24
0
<?php

/**
 * Copyright (c) 2009, Skalfa LLC
 * All rights reserved.
 * ATTENTION: This commercial software is intended for use with Oxwall Free Community Software http://www.oxwall.org/
 * and is licensed under Oxwall Store Commercial License.
 * Full text of this license can be found at http://www.oxwall.org/store/oscl
 */
BOL_BillingService::getInstance()->deactivateGateway('billingpaypal');
Пример #25
0
 public function canceled(array $params)
 {
     $hash = trim($params['custom']);
     $this->redirect(BOL_BillingService::getInstance()->getOrderCancelledPageUrl($hash));
 }
Пример #26
0
 public function expireUnverifiedSalesProcess()
 {
     BOL_BillingService::getInstance()->deleteExpiredSales();
 }
Пример #27
0
 public function process()
 {
     $values = $this->getValues();
     $lang = OW::getLanguage();
     $userId = OW::getUser()->getId();
     $billingService = BOL_BillingService::getInstance();
     $membershipService = MEMBERSHIP_BOL_MembershipService::getInstance();
     $url = OW::getRouter()->urlForRoute('membership_subscribe');
     if (!($plan = $membershipService->findPlanById($values['plan']))) {
         OW::getFeedback()->error($lang->text('membership', 'plan_not_found'));
         OW::getApplication()->redirect($url);
     }
     if ($plan->price == 0) {
         // trial plan
         // check if trial plan used
         $used = $membershipService->isTrialUsedByUser($userId);
         if ($used) {
             OW::getFeedback()->error($lang->text('membership', 'trial_used_error'));
             OW::getApplication()->redirect($url);
         } else {
             // give trial plan
             $userMembership = new MEMBERSHIP_BOL_MembershipUser();
             $userMembership->userId = $userId;
             $userMembership->typeId = $plan->typeId;
             $userMembership->expirationStamp = time() + (int) $plan->period * 3600 * 24;
             $userMembership->recurring = 0;
             $userMembership->trial = 1;
             $membershipService->setUserMembership($userMembership);
             $membershipService->addTrialPlanUsage($userId, $plan->id, $plan->period);
             OW::getFeedback()->info($lang->text('membership', 'trial_granted', array('days' => $plan->period)));
             OW::getApplication()->redirect($url);
         }
     }
     if (empty($values['gateway']['url']) || empty($values['gateway']['key'])) {
         OW::getFeedback()->error($lang->text('base', 'billing_gateway_not_found'));
         OW::getApplication()->redirect($url);
     }
     $gateway = $billingService->findGatewayByKey($values['gateway']['key']);
     if (!$gateway || !$gateway->active) {
         OW::getFeedback()->error($lang->text('base', 'billing_gateway_not_found'));
         OW::getApplication()->redirect($url);
     }
     // create membership plan product adapter object
     $productAdapter = new MEMBERSHIP_CLASS_MembershipPlanProductAdapter();
     // sale object
     $sale = new BOL_BillingSale();
     $sale->pluginKey = 'membership';
     $sale->entityDescription = $membershipService->getFormattedPlan($plan->price, $plan->period, $plan->recurring);
     $sale->entityKey = $productAdapter->getProductKey();
     $sale->entityId = $plan->id;
     $sale->price = floatval($plan->price);
     $sale->period = $plan->period;
     $sale->userId = $userId ? $userId : 0;
     $sale->recurring = $plan->recurring;
     $saleId = $billingService->initSale($sale, $values['gateway']['key']);
     if ($saleId) {
         // sale Id is temporarily stored in session
         $billingService->storeSaleInSession($saleId);
         $billingService->setSessionBackUrl($productAdapter->getProductOrderUrl());
         // redirect to gateway form page
         OW::getApplication()->redirect($values['gateway']['url']);
     }
 }
Пример #28
0
<?php

/**
 * Copyright (c) 2009, Skalfa LLC
 * All rights reserved.
 * ATTENTION: This commercial software is intended for use with Oxwall Free Community Software http://www.oxwall.org/
 * and is licensed under Oxwall Store Commercial License.
 * Full text of this license can be found at http://www.oxwall.org/store/oscl
 */
BOL_BillingService::getInstance()->activateProduct('user_credits_pack');
Пример #29
0
<?php

/**
 * EXHIBIT A. Common Public Attribution License Version 1.0
 * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy of the License at
 * http://opensource.org/licenses/CPAL-1.0. Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language
 * governing rights and limitations under the License.
 * The Initial Developer of the Original Code is Oxwall CandyStore (http://oxcandystore.com/).
 * All portions of the code written by Oxwall CandyStore are Copyright (c) 2013. All Rights Reserved.
 * EXHIBIT B. Attribution Information
 * Attribution Copyright Notice: Copyright 2013 Oxwall CandyStore. All rights reserved.
 * Attribution Phrase (not exceeding 10 words): Powered by Oxwall CandyStore
 * Attribution URL: http://oxcandystore.com/
 * Graphic Image as provided in the Covered Code.
 * Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work
 * which combines Covered Code or portions thereof with code not governed by the terms of the CPAL.
 */
/**
 * /deactivate.php
 * 
 * @author Oxwall CandyStore <*****@*****.**>
 * @package ow.ow_plugins.ocs_billing_moneybookers
 * @since 1.2.6
 */
BOL_BillingService::getInstance()->deactivateGateway('ocsbillingmoneybookers');
Пример #30
0
 public function canceled()
 {
     $this->redirect(BOL_BillingService::getInstance()->getOrderCancelledPageUrl());
 }