public function execute() { $this->checkDefaultApp($this->aid); $result = Api_Bo_Payments::createPlan($this->aid, $this->plan_name, $this->price, $this->num_friends, null, $this->description); $response = array(); $response['result'] = $result !== false ? '1' : '0'; return $response; }
public function execute() { $this->checkDefaultApp($this->aid); $result = Api_Bo_Payments::deletePlan($this->planid); $response = array(); $response['result'] = $result > 0 ? '1' : '0'; return $response; }
public function execute() { $response = array(); $result = Api_Bo_Payments::getSubscriptionsByUidNid($this->uid, $this->nid); if (count($result) == 0) { $response['result'] = ''; } else { $response['subscriptions'] = $result; } return $response; }
/** * Gets the payment gateway information, if it exists in the database. * * @return Array[user][id] * @throws Exception */ public function execute() { //make sure calling application is a default application $this->checkDefaultApp(); if (!Api_Bo_Users::isUserAdmin($this->getUserId())) { throw new OpenFBAPIException('Only the admin user may set a payment gateway.'); } $response = array(); $result = Api_Bo_Payments::getGateway(); $response['gateway'] = $result; return $response; }
public function execute() { $results = Api_Bo_Payments::getSubscriptionsByUidAndNidAndAid($this->uid, $this->nid, $this->aid); // If one or more plans were specified, make sure the user is subscribed to one of those plans if (isset($this->plan) && !empty($this->plan)) { return $this->planMatches($results); } // Check if the user's subscription has been paid for by a friend if (count($results) == 0) { $friendresults = Api_Bo_Payments::getFriendSubscriptionsByUidAndNidAndAid($this->uid, $this->nid, $this->aid); if (isset($this->plan) && !empty($this->plan)) { return $this->planMatches($friendresults); } return count($friendresults) == 0 ? false : true; } return count($results) == 0 ? false : true; }
/** * Creates the user if it's not in the DB. Throws an exception if the user already exists! * * @return Array[user][id] * @throws Exception */ public function execute() { if (!Api_Bo_Users::isUserAdmin($this->getUserId())) { throw new OpenFBAPIException('Only the admin user may set a payment gateway.'); } $response = array(); $result = Api_Bo_Payments::getGateway(); if (count($result) == 0) { Api_Bo_Payments::createGateway($this->type, $this->subject, $this->password); $response['gateway'] = array(); $response['gateway']['type'] = $this->type; $response['gateway']['subject'] = $this->subject; $response['gateway']['password'] = $this->password; } else { throw new OpenFBAPIException('Payment gateway' . $this->type . ' already exists! Only one payment gateway may be provisioned.'); } return $response; }