From ff61fab62ac7440c5dafcaf3067246f76139beea Mon Sep 17 00:00:00 2001 From: drigato Date: Fri, 31 Jul 2015 10:46:02 -0400 Subject: [PATCH] SAAS-973: Airtime Billing page - Add support for August promotion plans Fix to not allow current promo plans to downgrade to another promo plan Added promo banner to billing page --- airtime_mvc/application/common/Billing.php | 32 +++++++++++++++++-- .../views/scripts/billing/upgrade.phtml | 4 +++ airtime_mvc/public/css/billing.css | 5 +++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/common/Billing.php b/airtime_mvc/application/common/Billing.php index 30be5ff3b..0baa56104 100644 --- a/airtime_mvc/application/common/Billing.php +++ b/airtime_mvc/application/common/Billing.php @@ -419,12 +419,25 @@ class Billing $currentPlanProductId = $currentPlanProduct["pid"]; $currentPlanBillingCycle = strtolower($currentPlanProduct["billingcycle"]); + if (self::isClientOnAwesomeAugustPromoPlan($currentPlanProductId)) { + + $newEligiblePromoId = self::getEligibleAwesomeAugustPromoPlanId( + self::getProductName($newProductId) + ); + + if ($newProductBillingCycle == "annually" || $newEligiblePromoId > $currentPlanProductId) { + return true; + } else { + return false; + } + } + // if client is on trial plan, YES if ($currentPlanProductId == AIRTIME_PRO_FREE_TRIAL_PLAN_ID) { return true; } - // if client is currently on monthly or annually or old plan AND (upgrading OR upgrading/downgrading to annual plan), YES + // if client is currently on monthly or annually or old/free plan AND (upgrading OR upgrading/downgrading to annual plan), YES if ($currentPlanBillingCycle == "monthly" || $currentPlanBillingCycle == "free account" || $currentPlanBillingCycle == "annually") { // is the client changing billing cycle to annual? @@ -433,8 +446,8 @@ class Billing } // Is the client staying on monthly and upgrading? - // This won't hold true if the client is on an old plan because the old - // plan ids are higher than the current plan ids. + // This won't hold true if the client is on an old/free plan because the + // old/free plan ids are higher than the current paid plan ids. if ($newProductBillingCycle == "monthly" && $newProductId > $currentPlanProductId) { return true; } @@ -449,4 +462,17 @@ class Billing return false; } + public static function isClientOnAwesomeAugustPromoPlan($currentPlanId) + { + $promoPlans = self::getAwesomeAugustPromoProducts(); + + foreach ($promoPlans as $k => $p) { + if ($p["pid"] == $currentPlanId) { + return true; + } + } + + return false; + } + } diff --git a/airtime_mvc/application/views/scripts/billing/upgrade.phtml b/airtime_mvc/application/views/scripts/billing/upgrade.phtml index d956ed363..5d583f245 100644 --- a/airtime_mvc/application/views/scripts/billing/upgrade.phtml +++ b/airtime_mvc/application/views/scripts/billing/upgrade.phtml @@ -196,6 +196,10 @@ $(document).ready(function() {

+
+ + +
diff --git a/airtime_mvc/public/css/billing.css b/airtime_mvc/public/css/billing.css index 834b43a24..33cbe006c 100644 --- a/airtime_mvc/public/css/billing.css +++ b/airtime_mvc/public/css/billing.css @@ -246,3 +246,8 @@ border-radius: 5px; color: #ffffff; } + +.promo-banner { + margin-top:10px; + background: url('images/august_aweomse_promo_banner.png') no-repeat; +}