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
This commit is contained in:
drigato 2015-07-31 10:46:02 -04:00
parent 5998d765fe
commit ff61fab62a
3 changed files with 38 additions and 3 deletions
airtime_mvc
application
common
views/scripts/billing
public/css

View File

@ -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;
}
}

View File

@ -196,6 +196,10 @@ $(document).ready(function() {
<div class="ui-widget ui-widget-content block-shadow clearfix padded-strong billing-panel">
<H2><?=_("Account Plans")?></H2>
<H4><?=_("Upgrade today to get more listeners and storage space!")?></H4>
<div>
<a href="https://www.airtime.pro/pricing#promo-details" target="_blank">
<img width="400px" height="133px" class="promo-banner" /></a>
</div>
<div class="pricing-grid">
<table>
<tr>

View File

@ -246,3 +246,8 @@
border-radius: 5px;
color: #ffffff;
}
.promo-banner {
margin-top:10px;
background: url('images/august_aweomse_promo_banner.png') no-repeat;
}