Merge branch 'saas' into saas-dev

Conflicts:
	airtime_mvc/application/views/scripts/billing/upgrade.phtml
	airtime_mvc/public/css/billing.css
This commit is contained in:
Albert Santoni 2015-09-02 10:47:37 -04:00
commit a17001a90a
5 changed files with 14 additions and 258 deletions

View file

@ -10,7 +10,6 @@ class BillingController extends Zend_Controller_Action {
//Two of the actions in this controller return JSON because they're used for AJAX:
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('vat-validator', 'json')
->addActionContext('promo-eligibility-check', 'json')
->addActionContext('is-country-in-eu', 'json')
->initContext();
}
@ -20,33 +19,6 @@ class BillingController extends Zend_Controller_Action {
$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();
$current_namespace = new Zend_Session_Namespace('csrf_namespace');
$observed_csrf_token = $this->_getParam('csrf_token');
$expected_csrf_token = $current_namespace->authtoken;
if($observed_csrf_token == $expected_csrf_token) {
$eligible = Billing::isClientEligibleForPromo(
$data["newproductid"], $data["newproductbillingcycle"]);
//Set the return JSON value
$this->_helper->json(array("result"=>$eligible));
} else {
$this->getResponse()->setHttpResponseCode(403);
$this->_helper->json(array("result"=>false, "error"=>"CSRF token did not match."));
}
}
public function upgradeAction()
{
@ -66,14 +38,6 @@ class BillingController extends Zend_Controller_Action {
if ($form->isValid($formData)) {
// Check if client is eligible for promo and update the new product id if so
$eligibleForPromo = Billing::isClientEligibleForPromo(
$formData["newproductid"], $formData["newproductbillingcycle"]);
if ($eligibleForPromo) {
$newProductName = Billing::getProductName($formData["newproductid"]);
$formData["newproductid"] = Billing::getEligibleAwesomeAugustPromoPlanId($newProductName);
}
$credentials = Billing::getAPICredentials();
//Check if VAT should be applied or not to this invoice.