diff --git a/airtime_mvc/application/common/Billing.php b/airtime_mvc/application/common/Billing.php index 7b4905905..5d45ed357 100644 --- a/airtime_mvc/application/common/Billing.php +++ b/airtime_mvc/application/common/Billing.php @@ -5,6 +5,43 @@ define("WHMCS_AIRTIME_GROUP_ID", 15); class Billing { + // TODO: remove this once all existing customers have bandwidth limits set + public static $PLAN_TYPE_DEFAULTS = array( + "hobbyist" => array( + "bandwidth_limit" => 1099511627776 + ), + "starter" => array( + "bandwidth_limit" => 3298534883328 + ), + "starter2" => array( + "bandwidth_limit" => 3298534883328 + ), + "plus" => array( + "bandwidth_limit" => 10995116277760 + ), + "plus2" => array( + "bandwidth_limit" => 10995116277760 + ), + "premium" => array( + "bandwidth_limit" => 43980465111040 + ), + "premium2" => array( + "bandwidth_limit" => 43980465111040 + ), + "enterprise" => array( + "bandwidth_limit" => 164926744166400 + ), + "complimentary" => array( + "bandwidth_limit" => 32985348833280 + ), + "sida" => array( + "bandwidth_limit" => 32985348833280 + ), + "custom" => array( + "bandwidth_limit" => 10995116277760 + ), + ); + public static function getAPICredentials() { return array( diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 1b7319313..d0880140e 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -1591,7 +1591,14 @@ class Application_Model_Preference public static function getBandwidthLimit() { $val = self::getValue("bandwidth_limit"); - return empty($val) ? 0 : $val; + if (empty($val)) { + // Set and return the plan defaults + // TODO: remove this once all existing customers have this pref set + $planType = self::GetPlanLevel(); + $val = Billing::$PLAN_TYPE_DEFAULTS[$planType]["bandwidth_limit"]; + self::setBandwidthLimit($val); + } + return $val; } public static function setBandwidthLimit($value) {