示例#1
0
 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);
 }
示例#2
0
 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);
 }
示例#3
0
 /**
  * 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;
 }
示例#4
0
 public static function initStatics()
 {
     self::$_resourcePath = new Bf_ResourcePath('invoices', 'invoice');
 }
示例#5
0
 /**
  * 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);
 }
示例#6
0
 /**
  * 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;
 }
示例#7
0
 /**
  * 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);
 }