SAAS-973: Airtime Billing page - Add support for August promotion plans
created promo-eligibility-check endpoint
This commit is contained in:
parent
bda6a4585c
commit
4d9fb27554
|
@ -10,6 +10,7 @@ class BillingController extends Zend_Controller_Action {
|
||||||
//Two of the actions in this controller return JSON because they're used for AJAX:
|
//Two of the actions in this controller return JSON because they're used for AJAX:
|
||||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||||
$ajaxContext->addActionContext('vat-validator', 'json')
|
$ajaxContext->addActionContext('vat-validator', 'json')
|
||||||
|
->addActionContext('promo-eligibility-check', 'json')
|
||||||
->addActionContext('is-country-in-eu', 'json')
|
->addActionContext('is-country-in-eu', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
@ -19,6 +20,22 @@ class BillingController extends Zend_Controller_Action {
|
||||||
$this->_redirect('billing/upgrade');
|
$this->_redirect('billing/upgrade');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function promoEligibilityCheckAction()
|
||||||
|
{
|
||||||
|
$this->view->layout()->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
if (!$request->isPost()) {
|
||||||
|
throw new Exception("Must POST data to promoEligibilityCheckAction.");
|
||||||
|
}
|
||||||
|
$data = $request->getPost();
|
||||||
|
Logging::info($data);
|
||||||
|
|
||||||
|
//Set the return JSON value
|
||||||
|
$this->_helper->json(array("result"=>"ok"));
|
||||||
|
}
|
||||||
|
|
||||||
public function upgradeAction()
|
public function upgradeAction()
|
||||||
{
|
{
|
||||||
$CC_CONFIG = Config::getConfig();
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
@ -29,9 +46,13 @@ class BillingController extends Zend_Controller_Action {
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$form = new Application_Form_BillingUpgradeDowngrade();
|
$form = new Application_Form_BillingUpgradeDowngrade();
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
|
$doUpgrade = false;
|
||||||
|
|
||||||
$formData = $request->getPost();
|
$formData = $request->getPost();
|
||||||
if ($form->isValid($formData)) {
|
Logging::info($formData);
|
||||||
|
if ($doUpgrade && $form->isValid($formData)) {
|
||||||
|
Logging::info("---upgrading----");
|
||||||
|
|
||||||
$credentials = Billing::getAPICredentials();
|
$credentials = Billing::getAPICredentials();
|
||||||
|
|
||||||
//Check if VAT should be applied or not to this invoice.
|
//Check if VAT should be applied or not to this invoice.
|
||||||
|
|
|
@ -120,6 +120,19 @@ function configureByCountry(countryCode)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function promoEligibilityCheck()
|
||||||
|
{
|
||||||
|
var newproductid = $("input[type='radio'][name='newproductid']:checked");
|
||||||
|
var newproductbillingcycle = $("input[type='radio'][name='newproductbillingcycle']:checked");
|
||||||
|
console.log(newproductid.val());
|
||||||
|
console.log(newproductbillingcycle.val());
|
||||||
|
$.post("/billing/promo-eligibility-check", {"newproductid": newproductid,
|
||||||
|
"newproductbillingcycle": newproductbillingcycle})
|
||||||
|
.success(function(data) {
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
configureByCountry($("#country").val());
|
configureByCountry($("#country").val());
|
||||||
|
@ -128,9 +141,11 @@ $(document).ready(function() {
|
||||||
$("input[name='newproductid']").change(function() {
|
$("input[name='newproductid']").change(function() {
|
||||||
validatePlan();
|
validatePlan();
|
||||||
recalculateTotals();
|
recalculateTotals();
|
||||||
|
promoEligibilityCheck();
|
||||||
});
|
});
|
||||||
$("input[name='newproductbillingcycle']").change(function() {
|
$("input[name='newproductbillingcycle']").change(function() {
|
||||||
recalculateTotals();
|
recalculateTotals();
|
||||||
|
promoEligibilityCheck();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#country").change(function() {
|
$("#country").change(function() {
|
||||||
|
|
Loading…
Reference in New Issue