From d785d9295365e037a52c997dbb0edacc7ff77696 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Thu, 26 Jun 2014 17:44:53 -0400 Subject: [PATCH] VAT fixes --- airtime_mvc/application/controllers/BillingController.php | 8 ++++++-- .../application/views/scripts/billing/upgrade.phtml | 6 ++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/controllers/BillingController.php b/airtime_mvc/application/controllers/BillingController.php index e5feb47b6..b816c7e56 100644 --- a/airtime_mvc/application/controllers/BillingController.php +++ b/airtime_mvc/application/controllers/BillingController.php @@ -40,7 +40,11 @@ class BillingController extends Zend_Controller_Action { if ($form->isValid($formData)) { $credentials = self::getAPICredentials(); - $apply_vat = BillingController::checkIfVatShouldBeApplied($formData["customfields"]["7"], $formData["country"]); + if (in_array("7", $formData["customfields"])) { + $apply_vat = BillingController::checkIfVatShouldBeApplied($formData["customfields"]["7"], $formData["country"]); + } else { + $apply_vat = false; + } $postfields = array(); $postfields["username"] = $credentials["username"]; @@ -251,7 +255,7 @@ class BillingController extends Zend_Controller_Action { $postfields["action"] = "updateinvoice"; $postfields["invoiceid"] = $invoice_id; $postfields["tax"] = "$vat_amount"; - $postfields["taxrate"] = "$vat_rate"; + $postfields["taxrate"] = strval(VAT_RATE); $postfields["total"] = "$invoice_total"; $postfields["responsetype"] = "json"; diff --git a/airtime_mvc/application/views/scripts/billing/upgrade.phtml b/airtime_mvc/application/views/scripts/billing/upgrade.phtml index e0792d523..8eb573249 100644 --- a/airtime_mvc/application/views/scripts/billing/upgrade.phtml +++ b/airtime_mvc/application/views/scripts/billing/upgrade.phtml @@ -149,10 +149,8 @@ $(document).ready(function() { return; } vatFieldChangeTimer = setTimeout(function() { - //TODO: validate VAT number - validateVATNumber(); - recalculateTotals(); - }, 2000); + validateVATNumber(); //Validate and recalculate the totals + }, 1500); //Wait 1.5 seconds before validating the VAT number }); $("#hobbyist_grid_price").text("$" + products[0].pricing["USD"]["monthly"] + " / month");