diff --git a/plugin/buycourses/src/buycourses.ajax.php b/plugin/buycourses/src/buycourses.ajax.php index 936824efbe..23ac5bca7b 100644 --- a/plugin/buycourses/src/buycourses.ajax.php +++ b/plugin/buycourses/src/buycourses.ajax.php @@ -37,7 +37,6 @@ switch ($action) { } break; - case 'saleInfo': if (api_is_anonymous()) { break; @@ -75,9 +74,7 @@ switch ($action) { $html .= ''; echo $html; - break; - case 'stats': if (api_is_anonymous()) { break; @@ -114,7 +111,6 @@ switch ($action) { $stats['canceled_total_amount'] = number_format($stats['canceled_total_amount'], 2); } - $html = '
' . '

' . '

'; echo $html; - break; - case 'processPayout': if (api_is_anonymous()) { break; @@ -141,9 +135,11 @@ switch ($action) { $payouts = isset($_POST['payouts']) ? $_POST['payouts'] : ''; if (!$payouts) { - - echo Display::return_message(get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"), 'error', false); - + echo Display::return_message( + get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"), + 'error', + false + ); break; } @@ -157,9 +153,7 @@ switch ($action) { } $currentCurrency = $plugin->getSelectedCurrency(); - $isoCode = $currentCurrency['iso_code']; - $html .= '

'. get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin") .'

'; $html .= '' . '

' @@ -174,7 +168,6 @@ switch ($action) { echo $html; break; - case 'proceedPayout': if (api_is_anonymous()) { break; @@ -196,9 +189,7 @@ switch ($action) { $payouts = isset($_POST['payouts']) ? $_POST['payouts'] : ''; if (!$payouts) { - echo Display::return_message(get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"), 'error', false); - break; } @@ -207,23 +198,16 @@ switch ($action) { } $currentCurrency = $plugin->getSelectedCurrency(); - $isoCode = $currentCurrency['iso_code']; - - $result = MassPayment($allPayouts, $isoCode); - if ($result['ACK'] === 'Success') { foreach ($allPayouts as $payout) { $plugin->setStatusPayouts($payout['id'], BuyCoursesPlugin::PAYOUT_STATUS_COMPLETED); } echo Display::return_message(get_plugin_lang("PayoutSuccess", "BuyCoursesPlugin"), 'success', false); - } else { - echo Display::return_message(''.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].' - '.$result['L_SHORTMESSAGE0'].'

', 'error', false); - } break; @@ -241,7 +225,6 @@ switch ($action) { break; case 'culqi_cargo': - if (!$culqiEnable) { break; } @@ -270,7 +253,6 @@ switch ($action) { $culqi = new Culqi\Culqi(array('api_key' => $SECRET_API_KEY)); $environment = $culqiParams['integration']; - $environment = $environment ? BuyCoursesPlugin::CULQI_INTEGRATION_TYPE : BuyCoursesPlugin::CULQI_PRODUCTION_TYPE; $culqi->setEnv($environment); @@ -296,7 +278,6 @@ switch ($action) { )); if (is_object($cargo)) { - $saleIsCompleted = $plugin->completeSale($sale['id']); if ($saleIsCompleted) { @@ -310,15 +291,10 @@ switch ($action) { } echo json_encode($cargo); - - } catch(Exception $e) { - + } catch (Exception $e) { $cargo = json_decode($e->getMessage(), true); - $plugin->cancelSale($sale['id']); - unset($_SESSION['bc_sale_id']); - if (is_array($cargo)) { Display::addFlash( Display::return_message( @@ -337,11 +313,8 @@ switch ($action) { ); } } - break; - case 'culqi_cargo_service': - if (!$culqiEnable) { break; } @@ -370,11 +343,9 @@ switch ($action) { $culqi = new Culqi\Culqi(array('api_key' => $SECRET_API_KEY)); $environment = $culqiParams['integration']; - $environment = $environment ? BuyCoursesPlugin::CULQI_INTEGRATION_TYPE : BuyCoursesPlugin::CULQI_PRODUCTION_TYPE; $culqi->setEnv($environment); - $user = api_get_user_info(); try { @@ -395,9 +366,7 @@ switch ($action) { )); if (is_object($cargo)) { - $saleIsCompleted = $plugin->completeServiceSale($serviceSale['id']); - if ($saleIsCompleted) { Display::addFlash( Display::return_message( @@ -409,11 +378,8 @@ switch ($action) { } echo json_encode($cargo); - - } catch(Exception $e) { - + } catch (Exception $e) { $cargo = json_decode($e->getMessage(), true); - $plugin->cancelServiceSale($serviceSale['id']); unset($_SESSION['bc_sale_id']); @@ -436,22 +402,16 @@ switch ($action) { ); } } - break; - case 'service_sale_info': - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; $serviceSale = $plugin->getServiceSale($id); - $isAdmin = api_is_platform_admin(); - if (!$serviceSale) { break; } $ajaxCallFile = $plugin->getPath('SRC') . 'buycourses.ajax.php'; - $serviceImg = $plugin->getPath('SERVICE_IMAGES') . $serviceSale['service']['image']; $html = ""; $html .= "
"; @@ -539,12 +499,9 @@ switch ($action) { $html .= ""; echo $html; - break; case 'service_sale_confirm': - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; - $serviceSale = $plugin->getServiceSale($id); $response = $plugin->completeServiceSale($id); $html = ""; @@ -566,17 +523,14 @@ switch ($action) { $html .= "location.reload();"; $html .= "});"; $html .= ""; - echo $html; - break; case 'service_sale_cancel': - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; $serviceSale = $plugin->getServiceSale($id); $response = $plugin->cancelServiceSale($id); - $html = ""; + $html = ''; $html .= "
"; if ($response) { @@ -595,8 +549,6 @@ switch ($action) { $html .= "location.reload();"; $html .= "});"; $html .= ""; - echo $html; - break; } diff --git a/plugin/buycourses/src/configure_course.php b/plugin/buycourses/src/configure_course.php index 04a6c25b15..16fca99a3a 100644 --- a/plugin/buycourses/src/configure_course.php +++ b/plugin/buycourses/src/configure_course.php @@ -1,12 +1,11 @@ getPlatformCommission(); - $form->addHtml( '' + $form->addHtml('' . '
' . '