protected function doUnserialize(array $json) { // consult parent for further unserialization parent::doUnserialize($json); $this->unserializeArrayEntities('subscriptions', Bf_Subscription::getClassName(), $json); $this->unserializeArrayEntities('invoices', Bf_Invoice::getClassName(), $json); }
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); }
/** * Gets this Bf_SubscriptionCharge's associated Bf_Invoice. * @return Bf_Invoice */ public function getInvoice() { if (!$this->invoice) { if (!$this->invoiceID) { throw new Bf_PreconditionFailedException("This Bf_SubscriptionCharge has neither an 'invoice' specified, nor a 'invoiceID' by which to obtain said productRatePlan."); } $this->invoice = Bf_Invoice::getByID($this->invoiceID); } return $this->invoice; }
public static function initStatics() { self::$_resourcePath = new Bf_ResourcePath('invoices', 'invoice'); }
/** * Fetches Bf_Invoices for this Bf_Account. * @return Bf_Invoice[] */ public function getInvoices($options = NULL, $customClient = NULL) { return Bf_Invoice::getForAccount($this->id, $options, $customClient); }
/** * Synchronously generates invoices for outstanding charges on the subscription. * @param array $invoicingOptions (Default: All keys set to their respective default values) Encapsulates the following optional parameters: * * @param boolean (Default: false) $..['includeAggregated'] * * @param boolean (Default: false) $..['includeInvoicedChargesOnly'] * * @param union[NULL | string_ENUM['Paid', 'Unpaid', 'Pending', 'Voided'] (Default: NULL) $..['invoiceState']] * @return Bf_Invoice[] The generated invoices. */ public function invoiceOutstandingCharges(array $invoicingOptions = array('includeAggregated' => false, 'includeInvoicedChargesOnly' => false, 'invoiceState' => NULL)) { $inputOptions = $invoicingOptions; $subscriptionID = Bf_Subscription::getIdentifier($this); $stateParams = static::mergeUserArgsOverNonNullDefaults(__METHOD__, array(), $inputOptions); $requestEntity = new Bf_SubscriptionReviveRequest($stateParams); $subscriptionID = Bf_Subscription::getIdentifier($this); $endpoint = sprintf("%s/invoice-charges", rawurlencode($subscriptionID)); $responseEntity = Bf_Invoice::getClassName(); $constructedEntities = static::postEntityAndGrabCollection($endpoint, $requestEntity, $responseEntity); return $constructedEntities; }
/** * Gets Bf_CreditNotes for a given Bf_Invoice * @param union[string | Bf_Invoice] $invoice Reference to invoice <string>: $id of the Bf_Invoice. <Bf_Invoice>: The Bf_Invoice entity. * @return Bf_CreditNote[] */ public static function getForInvoice($invoice, $options = NULL, $customClient = NULL) { $invoiceID = Bf_Invoice::getIdentifier($invoice); $endpoint = sprintf("invoice/%s", rawurlencode($invoiceID)); return static::getCollection($endpoint, $options, $customClient); }