public function execute() { $templateProcessor = SJB_System::getTemplateProcessor(); $errors = array(); $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $gateway_id = isset($_REQUEST['gateway']) ? $_REQUEST['gateway'] : null; $formSubmitted = SJB_Request::getVar('submit'); $gateway_sid = SJB_PaymentGatewayManager::getSIDByID($gateway_id); if ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty($action)) { if ($action == 'deactivate') { SJB_PaymentGatewayManager::deactivateByID($gateway_id); } elseif ($action == 'activate') { SJB_PaymentGatewayManager::activateByID($gateway_id); } } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $gateway = SJB_PaymentGatewayManager::createObjectByID($gateway_id, $_REQUEST); $gateway->dontSaveProperty('id'); $gateway->dontSaveProperty('caption'); $gateway->setSID($gateway_sid); if ($gateway->isValid()) { if (SJB_PaymentGatewayManager::saveGateway($gateway) !== false) { $templateProcessor->assign('gatewaySaved', true); if ($formSubmitted == 'save_gateway') { $siteUrl = SJB_System::getSystemsettings('SITE_URL') . '/system/payment/gateways/?gatewaySaved=1'; SJB_HelperFunctions::redirect($siteUrl); } } else { $errors['SETTINGS_SAVED_WITH_PROBLEMS'] = 1; } } else { $errors = $gateway->getErrors(); } } $gateway = SJB_PaymentGatewayManager::getObjectByID($gateway_id); $gateway_form = new SJB_Form($gateway); $gateway_form->registerTags($templateProcessor); $gateway_form->makeDisabled('id'); $gateway_form->makeDisabled('caption'); $countryCode = $gateway->getPropertyValue('country'); if (empty($countryCode)) { $countryValue = SJB_CountriesManager::getCountrySIDByCountryCode('US'); $gateway->setPropertyValue('country', $countryValue); } if (empty($gateway)) { $errors['GATEWAY_NOT_FOUND'] = 1; $templateProcessor->assign('errors', $errors); $templateProcessor->display('configure_gateway.tpl'); return; } $gateway_info = SJB_PaymentGatewayManager::getInfoBySID($gateway_sid); $form_fields = $gateway_form->getFormFieldsInfo(); $templateProcessor->assign('gateway', $gateway_info); $templateProcessor->assign('form_fields', $form_fields); $templateProcessor->assign('errors', $errors); $templateProcessor->display('configure_gateway.tpl'); }
public function execute() { $request_uri = $_SERVER['REQUEST_URI']; $template_processor = SJB_System::getTemplateProcessor(); $callback_page_uri = ''; preg_match('#.*/system/payment/callback/([^/?]+)#', $request_uri, $mm); if (!empty($mm)) { $gateway_id = $mm[1]; $redirectPage = $callback_page_uri . $gateway_id . "/"; preg_match("(.*{$redirectPage}([^/]*)/?)", $request_uri, $invoice_sid); $invoice_sid = !empty($invoice_sid[1]) ? $invoice_sid[1] : ''; $redirectPage = $callback_page_uri . $gateway_id . "/" . $invoice_sid; preg_match("(.*{$redirectPage}([^/]*)/?)", $request_uri, $tt); $redirectPage = !empty($tt[1]) ? $tt[1] : ''; $invoice = SJB_InvoiceManager::getObjectBySID($invoice_sid); if (!empty($invoice) && $invoice->getStatus() == SJB_Invoice::INVOICE_STATUS_PAID) { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/payment-completed/"); } $gateway = SJB_PaymentGatewayManager::getObjectByID($gateway_id); $gateway_caption = $gateway->getPropertyValue('caption'); $invoice = $gateway->getPaymentFromCallbackData($_REQUEST); SJB_PaymentLogManager::recordPaymentLog($gateway->getPaymentStatusFromCallbackData($_REQUEST), $gateway_caption, $_REQUEST); if (is_null($invoice)) { $errors = $gateway->getErrors(); $template_processor->assign('errors', $errors); $template_processor->display('callback_payment_page.tpl'); } else { $status = $invoice->getStatus(); if ($status == SJB_Invoice::INVOICE_STATUS_VERIFIED) { SJB_Statistics::addStatisticsFromInvoice($invoice); $success_url = $invoice->getSuccessPageURL(); $page = empty($redirectPage) ? '' : '&' . $redirectPage; SJB_HelperFunctions::redirect($success_url . '?invoice_sid=' . $invoice->getSID() . $page); } elseif ($status == SJB_Invoice::INVOICE_STATUS_PENDING) { $template_processor->assign('message', 'INVOICE_WAITING'); $template_processor->display('callback_payment_page.tpl'); } else { SJB_InvoiceManager::markUnPaidInvoiceBySID($invoice_sid); $payment_error = 1; if ($gateway_id == 'paypal_pro') { $httpPostResponse = SJB_Request::getVar('http_post_response', false); if (!empty($httpPostResponse['L_SHORTMESSAGE0']) && urldecode($httpPostResponse['L_SHORTMESSAGE0']) == 'Authentication/Authorization Failed') { $payment_error = 2; } } SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/view-invoice/?sid=" . $invoice_sid . "&payment_error=" . $payment_error . "&payment_gateway=" . $gateway_id); } } } else { $errors['INVOICE_ID_IS_NOT_SET'] = 1; $template_processor->assign('errors', $errors); $template_processor->display('callback_payment_page.tpl'); } }
public static function getPaymentForms($invoice) { $activeGateways = SJB_PaymentGatewayManager::getActivePaymentGatewaysList(); $gatewaysFormInfo = array(); foreach ($activeGateways as $gatewayInfo) { if ($invoice->isRecurring() && empty($gatewayInfo['recurrable'])) { continue; } $gateway = SJB_PaymentGatewayManager::getObjectByID($gatewayInfo['id'], $invoice->isRecurring()); $gatewaysFormInfo[$gateway->getPropertyValue('id')] = $gateway->buildTransactionForm($invoice); } return $gatewaysFormInfo; }
public static function deleteAllContractsByUserSID($user_sid) { $userContracts = SJB_DB::query("SELECT `id`, `gateway_id`, `recurring_id` FROM `contracts` WHERE `user_sid` = ?n", $user_sid); foreach ($userContracts as $contract) { // 'paypal_standard' != $contract['gateway_id'] - redirect on paypal // cancel recurring if (!empty($contract['gateway_id']) && !empty($contract['recurring_id']) && 'paypal_standard' != $contract['gateway_id'] && ($gateway = SJB_PaymentGatewayManager::getObjectByID($contract['gateway_id'], true))) { $gateway->cancelSubscription($contract['recurring_id']); } SJB_ContractManager::deleteContractIDFromNotificationSended($contract['id']); } return SJB_DB::query("DELETE FROM `contracts` WHERE `user_sid`=?n", $user_sid); }
public function execute() { if (!preg_match("(.*/system/payment/notifications/([^/]+)/?)", $_SERVER['REQUEST_URI'], $matches)) { echo '<p class="error">Gateway parameter is missing</p>'; exit; } $gateway_id = $matches[1]; $gateway = SJB_PaymentGatewayManager::getObjectByID($gateway_id, true); if (!$gateway) { echo '<p class="error">Invalid gateway</p>'; exit; } $gateway->handleRecurringNotification($_REQUEST); $gateway_caption = $gateway->getPropertyValue('caption'); SJB_PaymentLogManager::recordPaymentLog($gateway->getPaymentStatusFromCallbackData($_REQUEST), $gateway_caption, $_REQUEST); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $gateway = SJB_PaymentGatewayManager::getObjectByID(SJB_Request::getVar('gateway'), true); if (!empty($gateway)) { $invoiceID = SJB_Request::getVar('invoiceID', false); $cancelSubscriptionResult = $gateway->cancelSubscription(SJB_Request::getVar('subscriptionId'), $invoiceID); $errors = array(); if ($cancelSubscriptionResult !== true) { $errors = $cancelSubscriptionResult; } else { SJB_ContractManager::removeSubscriptionId(SJB_Request::getVar('subscriptionId')); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/my-products/?cancelRecurringContract=' . SJB_Request::getVar('contractId')); } $tp->assign('errors', $errors); $tp->display('cancel_recurring.tpl'); } }
public function execute() { $template_processor = SJB_System::getTemplateProcessor(); $errors = array(); $action = SJB_Request::getVar('action', null); $gateway_id = SJB_Request::getVar('gateway', null); if (!empty($action) && !empty($gateway_id)) { if ($action == 'deactivate') { SJB_PaymentGatewayManager::deactivateByID($gateway_id); } elseif ($action == 'activate') { SJB_PaymentGatewayManager::activateByID($gateway_id); } } $list_of_gateways = SJB_PaymentGatewayManager::getPaymentGatewaysList(); $template_processor->assign('gatewaySaved', SJB_Request::getVar('gatewaySaved', false)); $template_processor->assign('gateways', $list_of_gateways); $template_processor->assign('errors', $errors); $template_processor->display('payment_gateways_list.tpl'); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $errors = array(); $gatewayId = SJB_Request::getVar('gatewayId', 'cash_gateway'); $gateway = SJB_PaymentGatewayManager::getObjectByID($gatewayId); if (isset($gateway) && in_array($gatewayId, array('cash_gateway', 'wire_transfer'))) { $invoiceSid = SJB_Request::getVar('invoice_sid'); $invoice = SJB_InvoiceManager::getObjectBySID($invoiceSid); if (isset($invoice)) { $currentUser = SJB_UserManager::getCurrentUserInfo(); if ($currentUser['sid'] == $invoice->getPropertyValue('user_sid')) { if ($invoice->getStatus() == SJB_Invoice::INVOICE_STATUS_UNPAID) { $tp->assign('invoice_sid', $invoiceSid); $tp->assign('item_name', $invoice->getProductNames()); $tp->assign('amount', $invoice->getPropertyValue('total')); $tp->assign('user', $currentUser); SJB_InvoiceManager::saveInvoice($invoice); SJB_ShoppingCart::deleteItemsFromCartByUserSID($currentUser['sid']); } else { $errors['INVOICE_IS_NOT_UNPAID'] = true; } } else { $errors['NOT_OWNER'] = true; } } else { $errors['INVALID_INVOICE_ID'] = true; } $template = $gateway->getTemplate(); $tp->assign('errors', $errors); } else { $errors['INVALID_GATEWAY'] = true; $tp->assign('ERRORS', $errors); $template = 'errors.tpl'; } $tp->display($template); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $displayForm = new SJB_Form(); $displayForm->registerTags($tp); $invoiceSid = SJB_Request::getVar('sid', false); if (SJB_Request::getVar('error', false)) { SJB_FlashMessages::getInstance()->addWarning('TCPDF_ERROR'); } $action = SJB_Request::getVar('action', false); $paymentGateway = SJB_Request::getVar('payment_gateway', false); $template = 'print_invoice.tpl'; $currentUserSID = SJB_UserManager::getCurrentUserSID(); $invoiceInfo = SJB_InvoiceManager::getInvoiceInfoBySID($invoiceSid); if ($invoiceInfo) { if ($currentUserSID == $invoiceInfo['user_sid']) { $taxInfo = SJB_TaxesManager::getTaxInfoBySID($invoiceInfo['tax_info']['sid']); $invoiceInfo = array_merge($invoiceInfo, $_REQUEST); if (is_array($taxInfo)) { $taxInfo = array_merge($invoiceInfo['tax_info'], $taxInfo); } else { $taxInfo = $invoiceInfo['tax_info']; } $invoice = new SJB_Invoice($invoiceInfo); $invoice->setSID($invoiceSid); $userInfo = SJB_UserManager::getUserInfoBySID($currentUserSID); $username = $userInfo['CompanyName'] . ' ' . $userInfo['FirstName'] . ' ' . $userInfo['LastName']; $user = SJB_UserManager::getObjectBySID($currentUserSID); $productsSIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($userInfo['user_group_sid']); $products = array(); foreach ($productsSIDs as $key => $productSID) { $product = SJB_ProductsManager::getProductInfoBySID($productSID); $products[$key] = $product; } $displayForm = new SJB_Form($invoice); $displayForm->registerTags($tp); $show = true; if ($action == 'download_pdf_version' || $action == 'print') { $show = false; } $tp->assign('show', $show); $tp->assign('products', $products); $tp->assign('invoice_sid', $invoiceSid); $tp->assign('invoice_status', $invoiceInfo['status']); $tp->assign('username', trim($username)); $tp->assign('user_sid', $currentUserSID); $tp->assign('tax', $taxInfo); $userStructure = SJB_UserManager::createTemplateStructureForUser($user); $tp->assign('user', $userStructure); $tp->assign('include_tax', $invoiceInfo['include_tax']); if ($action == 'download_pdf_version') { $template = 'invoice_to_pdf.tpl'; $filename = 'invoice_' . $invoiceSid . '.pdf'; try { SJB_HelperFunctions::html2pdf($tp->fetch($template), $filename); exit; } catch (Exception $e) { SJB_Error::writeToLog($e->getMessage()); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/print-invoice/?sid=' . $invoiceSid . '&action=print&error=TCPDF_ERROR'); } } } else { SJB_FlashMessages::getInstance()->addError('NOT_OWNER'); } } else { SJB_FlashMessages::getInstance()->addError('WRONG_INVOICE_ID_SPECIFIED'); } if ($paymentGateway) { $gatewaySID = SJB_PaymentGatewayManager::getSIDByID($paymentGateway); $gatewayInfo = SJB_PaymentGatewayManager::getInfoBySID($gatewaySID); $tp->assign('gatewayInfo', $gatewayInfo); } $tp->assign('paymentError', SJB_Request::getVar('payment_error', false)); $tp->display($template); }
public static function getPaymentGatewaysList() { $gateways_info = array(); $gateways = SJB_DB::query('SELECT `sid` FROM `payment_gateways`'); foreach ($gateways as $gateway) { $gateways_info[$gateway['sid']] = SJB_PaymentGatewayManager::getInfoBySID($gateway['sid']); } return $gateways_info; }
public function execute() { $invoiceSID = SJB_Request::getVar('invoice_sid', null, 'default', 'int'); $tp = SJB_System::getTemplateProcessor(); $action = SJB_Request::getVar('action', false); $checkPaymentErrors = array(); $currentUser = SJB_UserManager::getCurrentUser(); if ($action == 'pay_for_products') { $subscribe = SJB_Request::getVar('subscribe', false); $subTotalPrice = SJB_Request::getVar('sub_total_price', 0); $products = SJB_ShoppingCart::getAllProductsByUserSID($currentUser->getSID()); $codeInfo = array(); $index = 1; $items = array(); foreach ($products as $product) { $product_info = unserialize($product['product_info']); $items['products'][$index] = $product_info['sid']; $qty = !empty($product_info['number_of_listings']) ? $product_info['number_of_listings'] : null; if ($qty > 0) { $items['price'][$index] = round($product_info['price'] / $qty, 2); } else { $items['price'][$index] = round($product_info['price'], 2); } $items['amount'][$index] = $product_info['price']; $items['custom_item'][$index] = ""; $items['qty'][$index] = $qty; $items['custom_info'][$index]['shoppingCartRecord'] = $product['sid']; if ($product_info['product_type'] == 'banners' && !empty($product_info['banner_info'])) { $items['custom_info'][$index]['banner_info'] = $product_info['banner_info']; } $index++; SJB_PromotionsManager::preparePromoCodeInfoByProductPromoCodeInfo($product_info, $codeInfo); } $userSID = $currentUser->getSID(); $invoiceSID = SJB_InvoiceManager::generateInvoice($items, $userSID, $subTotalPrice, SJB_System::getSystemSettings('SITE_URL') . "/create-contract/", (bool) $subscribe); SJB_PromotionsManager::addCodeToHistory($codeInfo, $invoiceSID, $userSID); } $gatewayId = SJB_Request::getVar('gw', false); if (SJB_Request::$method == SJB_Request::METHOD_POST && !$action && $gatewayId == 'authnet_sim') { if (isset($_REQUEST['submit'])) { $gateway = SJB_PaymentGatewayManager::getObjectByID($gatewayId, true); $subscriptionResult = $gateway->createSubscription($_REQUEST); if ($subscriptionResult !== true) { $tp->assign('form_submit_url', $_SERVER['REQUEST_URI']); $tp->assign('form_data_source', $_REQUEST); $tp->assign('errors', $subscriptionResult); $tp->display('recurring_payment_page.tpl'); } else { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/my-products/?subscriptionComplete=true'); } } else { $tp->assign('form_submit_url', $_SERVER['REQUEST_URI']); $tp->assign('form_data_source', $_REQUEST); $tp->display('recurring_payment_page.tpl'); } } else { if (!is_null($invoiceSID)) { $invoice_info = SJB_InvoiceManager::getInvoiceInfoBySID($invoiceSID); $invoice = new SJB_Invoice($invoice_info); if (SJB_PromotionsManager::isPromoCodeExpired($invoiceSID)) { $checkPaymentErrors['PROMOTION_TOO_MANY_USES'] = true; } else { $invoice->setSID($invoiceSID); if (count($invoice->isValid($invoiceSID)) == 0) { $invoiceUserSID = $invoice->getPropertyValue('user_sid'); $currentUserSID = SJB_UserManager::getCurrentUserSID(); if ($invoiceUserSID === $currentUserSID) { $payment_gateway_forms = SJB_InvoiceManager::getPaymentForms($invoice); $tp->assign('productsNames', $invoice->getProductNames()); $tp->assign('gateways', $payment_gateway_forms); $tp->assign('invoice_info', $invoice_info); } else { $checkPaymentErrors['NOT_OWNER'] = true; } } else { $checkPaymentErrors['WRONG_INVOICE_PARAMETERS'] = true; } } $tp->assign('checkPaymentErrors', $checkPaymentErrors); $tp->display('invoice_payment_page.tpl'); } else { $tp->display('recurring_payment_page.tpl'); } } }
public static function getDetails() { return array(array('id' => 'user_sid', 'caption' => 'Customer', 'type' => 'id', 'length' => '20', 'table_name' => 'invoices', 'is_required' => true, 'is_system' => true), array('id' => 'subuser_sid', 'caption' => 'Subuser sid', 'type' => 'id', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true), array('id' => 'status', 'caption' => 'Invoice Status', 'type' => 'list', 'table_name' => 'invoices', 'is_required' => true, 'is_system' => true, 'list_values' => array(array('id' => 'Paid', 'caption' => 'Paid'), array('id' => 'Unpaid', 'caption' => 'Unpaid'), array('id' => 'Pending', 'caption' => 'Pending'))), array('id' => 'date', 'caption' => 'Invoice Date', 'type' => 'date', 'length' => '20', 'table_name' => 'invoices', 'is_required' => true, 'is_system' => true), array('id' => 'payment_method', 'caption' => 'Payment method', 'type' => 'list', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'list_values' => SJB_PaymentGatewayManager::getActivePaymentGatewaysCaptions()), array('id' => 'items', 'caption' => 'Items', 'type' => 'complex', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'fields' => array(array('id' => 'products', 'caption' => 'Items', 'type' => 'list', 'list_values' => array(), 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'qty', 'caption' => 'Qty', 'type' => 'integer', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => 2, 'minimum' => 1), array('id' => 'price', 'caption' => 'Price', 'type' => 'float', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => 3, 'minimum' => 0), array('id' => 'amount', 'caption' => 'Amount', 'type' => 'float', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => 4, 'minimum' => 0), array('id' => 'custom_item', 'caption' => 'Custom item', 'type' => 'string', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => 5), array('id' => 'custom_info', 'caption' => 'Custom info', 'type' => 'list', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => 5))), array('id' => 'sub_total', 'caption' => 'Sub Total', 'type' => 'float', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'minimum' => 0), array('id' => 'tax_info', 'caption' => 'Tax Info', 'type' => 'complex', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'fields' => array(array('id' => 'sid', 'caption' => 'Tax SID', 'type' => 'id', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'tax_name', 'caption' => 'Tax Name', 'type' => 'string', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'order' => 2), array('id' => 'tax_amount', 'caption' => 'Tax Amount', 'type' => 'float', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'order' => 3, 'minimum' => 0), array('id' => 'price_includes_tax', 'caption' => 'Price Includes Tax', 'type' => 'boolean', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'order' => 4), array('id' => 'tax_rate', 'caption' => 'Tax Rate', 'type' => 'float', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'order' => 5, 'minimum' => 0))), array('id' => 'total', 'caption' => 'Total', 'type' => 'float', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true, 'minimum' => 0), array('id' => 'include_tax', 'caption' => 'Include Tax', 'type' => 'boolean', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true), array('id' => 'success_page_url', 'caption' => 'success_page_url', 'type' => 'text', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true), array('id' => 'callback_data', 'caption' => 'callback_data', 'type' => 'text', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true), array('id' => 'verification_response', 'caption' => 'verification_response', 'type' => 'text', 'length' => '20', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true), array('id' => 'is_recurring', 'caption' => 'Is Recurring', 'type' => 'boolean', 'table_name' => 'invoices', 'is_required' => false, 'is_system' => true)); }
public static function getDetails() { return array(array('id' => 'invoice_sid', 'caption' => 'Invoice #', 'type' => 'string', 'length' => '20', 'table_name' => 'transactions', 'is_required' => true, 'is_system' => true), array('id' => 'user_sid', 'caption' => 'User sid', 'type' => 'id', 'length' => '20', 'table_name' => 'transactions', 'is_required' => true, 'is_system' => true), array('id' => 'transaction_id', 'caption' => 'Transaction ID', 'type' => 'text', 'length' => '20', 'table_name' => 'transactions', 'is_required' => true, 'is_system' => true), array('id' => 'date', 'caption' => 'Date', 'type' => 'date', 'length' => '20', 'table_name' => 'transactions', 'is_required' => true, 'is_system' => true), array('id' => 'amount', 'caption' => 'Amount', 'type' => 'float', 'length' => '20', 'table_name' => 'transactions', 'is_required' => false, 'is_system' => true), array('id' => 'payment_method', 'caption' => 'Payment method', 'type' => 'list', 'table_name' => 'transactions', 'is_required' => false, 'is_system' => true, 'list_values' => SJB_PaymentGatewayManager::getActivePaymentGatewaysList())); }
private function assignIcons() { $payPalPro = SJB_PaymentGatewayManager::getObjectByID(self::GATEWAY_ID, false); $countrySID = $payPalPro->getPropertyValue('country'); $country = SJB_CountriesManager::getCountryInfoBySID($countrySID); $creditCards = array(); if ($country) { switch ($country['country_code']) { case 'US': $creditCards = array("visa", "mastercard", "discovery", "amex"); break; case 'CA': $creditCards = array("visa", "mastercard"); break; case 'UK': $creditCards = array("visa", "mastercard", "maestro"); break; } $this->getTemplateProcessor()->assign('creditCards', $creditCards); } }