From 28399b70ccad39c5c1215043e4d965359dab1e56 Mon Sep 17 00:00:00 2001 From: drigato Date: Fri, 19 Sep 2014 14:57:43 -0400 Subject: [PATCH 1/4] Make API on by default --- airtime_mvc/application/forms/GeneralPreferences.php | 1 + 1 file changed, 1 insertion(+) diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 34b60e704..1402814e8 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -91,6 +91,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm _("Enabled"))); $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); $third_party_api->setDecorators(array('ViewHelper')); + $third_party_api->setValue(true); $this->addElement($third_party_api); $locale = new Zend_Form_Element_Select("locale"); From 66b97158b79453785f069d3f05c57fea338ba761 Mon Sep 17 00:00:00 2001 From: drigato Date: Fri, 19 Sep 2014 15:30:06 -0400 Subject: [PATCH 2/4] Make API on by default - fix --- airtime_mvc/application/forms/GeneralPreferences.php | 1 - airtime_mvc/application/models/Preference.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 1402814e8..34b60e704 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -91,7 +91,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm _("Enabled"))); $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); $third_party_api->setDecorators(array('ViewHelper')); - $third_party_api->setValue(true); $this->addElement($third_party_api); $locale = new Zend_Form_Element_Select("locale"); diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index e73069f43..814b5e388 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -443,7 +443,7 @@ class Application_Model_Preference public static function GetAllow3rdPartyApi() { $val = self::getValue("third_party_api"); - return (strlen($val) == 0 ) ? "0" : $val; + return (strlen($val) == 0 ) ? "1" : $val; } public static function SetPhone($phone) From 3c797c044ae9f946db319f8f9533b038f3a36546 Mon Sep 17 00:00:00 2001 From: drigato Date: Fri, 19 Sep 2014 15:41:55 -0400 Subject: [PATCH 3/4] Undoing make API on by default for now. This needs to be done in the db --- airtime_mvc/application/models/Preference.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 814b5e388..e73069f43 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -443,7 +443,7 @@ class Application_Model_Preference public static function GetAllow3rdPartyApi() { $val = self::getValue("third_party_api"); - return (strlen($val) == 0 ) ? "1" : $val; + return (strlen($val) == 0 ) ? "0" : $val; } public static function SetPhone($phone) From 1bb17c56143b47f8d79dddeb9c8156337cd4199b Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 23 Sep 2014 16:01:28 -0400 Subject: [PATCH 4/4] Blacklist free products from upgrade page --- .../application/controllers/BillingController.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/BillingController.php b/airtime_mvc/application/controllers/BillingController.php index 47ef8fa14..ca2f7594d 100644 --- a/airtime_mvc/application/controllers/BillingController.php +++ b/airtime_mvc/application/controllers/BillingController.php @@ -456,7 +456,19 @@ class BillingController extends Zend_Controller_Action { foreach ($postfields AS $k=>$v) $query_string .= "$k=".urlencode($v)."&"; $result = self::makeRequest($credentials["url"], $query_string); - return $result["products"]["product"]; + //Logging::info($result["products"]["product"]); + $products = $result["products"]["product"]; + + //Blacklist all free plans + foreach ($products as $k => $p) { + Logging::info($p); + if ($p["paytype"] === "free") + { + unset($products[$k]); + } + } + + return $products; } public static function getProductPricesAndTypes()