/** * Gets Bf_SubscriptionCharges for this Bf_Invoice * @return Bf_SubscriptionCharge[] */ public function getCharges($options = NULL, $customClient = NULL) { $invoiceID = Bf_Invoice::getIdentifier($this); $endpoint = sprintf("%s/charges", rawurlencode($invoiceID)); $responseEntity = Bf_SubscriptionCharge::getClassName(); return static::getCollection($endpoint, $options, $customClient, $responseEntity); }
protected function doUnserialize(array $json) { // consult parent for further unserialization parent::doUnserialize($json); $this->unserializeEntity('request', Bf_AddChargeRequest::getClassName(), $json); $this->unserializeEntity('invoice', Bf_Invoice::getClassName(), $json); $this->unserializeArrayEntities('charges', Bf_SubscriptionCharge::getClassName(), $json); }
/** * Synchronously resumes the subscription. * @param array $resumptionOptions (Default: All keys set to their respective default values) Encapsulates the following optional parameters: * * @param boolean (Default: false) $..['dryRun'] Whether to forego persisting the effected changes. * * @param {@see self::parseTimeRequestFromTime(mixed)} $..['scheduleResumption'] Schedules the resumption to be actioned at some future time. * * @param {@see self::parseTimeRequestFromTime(mixed)} $..['newSubscriptionStart'] The start date to which the subscription will be advanced, upon resumption. * * @param string_ENUM['Trial', 'Provisioned', 'Paid', 'AwaitingPayment', 'Cancelled', 'Failed', 'Expired'] $..['newSubscriptionState'] The state to which the subscription will be moved, upon resumption. * @return Bf_Subscription The frozen subscription. */ public function resume(array $resumptionOptions = array('dryRun' => false, 'scheduleResumption' => NULL, 'newSubscriptionStart' => NULL, 'newSubscriptionState' => NULL)) { $inputOptions = $resumptionOptions; $subscriptionID = Bf_Subscription::getIdentifier($this); $stateParams = static::mergeUserArgsOverNonNullDefaults(__METHOD__, array(), $inputOptions); static::renameKey($stateParams, 'scheduleResumption', 'resume'); $requestEntity = new Bf_ResumeRequest($stateParams); $endpoint = sprintf("%s/resume", rawurlencode($subscriptionID)); $responseEntity = Bf_SubscriptionCharge::getClassName(); $constructedEntity = static::postEntityAndGrabFirst($endpoint, $requestEntity, $responseEntity); return $constructedEntity; }