/** * Reads payment plans from database. * * @return array of payment plans [ plan_id, name, price, description ] */ public function execute() { $response = array(); $result = Api_Dao_Payments::getPlansByAid($this->aid); if (count($result) == 0) { $response['result'] = ''; } else { $plans = array(); foreach ($result as $key => $row) { $plan = array(); $plan['plan_id'] = $row['id']; $plan['aid'] = $row['aid']; $plan['network_id'] = $row['network_id']; $plan['name'] = $row['name']; $plan['length'] = $row['length']; $plan['unit'] = $row['unit']; $plan['price'] = $row['price']; $plan['description'] = $row['description']; $plan['num_friends'] = $row['num_friends']; $plans[] = $plan; } $response['plans'] = $plans; } // error_log( 'SubscriptionsGetAppPlans response: ' . print_r( $response, true ) ); return $response; }
public static function getSubscriptionsByUidNid($uid, $nid) { return Api_Dao_Payments::getSubscriptionsByUidNid($uid, $nid); }
private static function calculateAmount($planid) { $plan = Api_Dao_Payments::getPlanByPlanid($planid); $price = $plan[0]['price']; return $price; }