本文整理汇总了PHP中BOL_BillingService类的典型用法代码示例。如果您正苦于以下问题:PHP BOL_BillingService类的具体用法?PHP BOL_BillingService怎么用?PHP BOL_BillingService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BOL_BillingService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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);
}
示例2: index
/**
* 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');
}
示例3: payeer_add_admin_notification
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'))));
}
}
示例4: addAdminNotification
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: __construct
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: getInstance
/**
* Singleton instance.
*
* @return BOL_BillingService
*/
public static function getInstance()
{
if (self::$classInstance === null) {
self::$classInstance = new self();
}
return self::$classInstance;
}
示例7: index
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');
}
示例8: index
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'));
}
示例9: process
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']);
}
示例10: ocsbillingmoneybookers_add_admin_notification
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'))));
}
}
示例11: process
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']);
}
示例12: ocsbillingicepay_add_admin_notification
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'))));
}
}
示例13: process
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']);
}
示例14: __construct
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);
}
示例15: index
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');
}