class Bfwd::Invoice

An invoice encapsulates the cumulative charges of a subscription's pricing-components and their respective pricing-component-values for a specific period of time.

Attributes

account_id[RW]

{ "description" : "", "verbs":["GET"] }

changed_by[RW]

{ "description" : "ID of the user who last updated the entity.", "verbs":[] }

charges[RW]
children[RW]
cost_excluding_tax[RW]

{ "description" : "Cost of the invoice exclusive of tax.", "verbs":["GET"] }

created[RW]

{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }

credit_rolled_over[RW]

{ "description" : "The amount of credit to be returned to the pool.", "verbs":["GET"] }

credit_rolled_over_excluding_tax[RW]

{ "description" : "The amount of credit to be returned to the pool excluding tax.", "verbs":["GET"] }

crm_id[RW]

{ "description" : "CRM identifier of the invoice.", "verbs":["PUT","GET"] }

currency[RW]

{ "description" : "Currency of the invoice specified by a three character ISO 4217 currency code.", "verbs":["GET"] }

deleted[RW]

{ "description" : "Indicates if an invoice has been retired. If an invoice has been retired it can still be retrieved using the appropriate flag on API requests. Generally invoices will not be retired.", "verbs":[] }

description[RW]

{ "description" : "The description of the invoice", "verbs":[] }

discount_amount[RW]

{ "description" : "The amount of discounts for the invoice.", "verbs":["GET"] }

discount_amount_excluding_tax[RW]

{ "description" : "The amount of discounts for the invoice excluding tax.", "verbs":["GET"] }

due[RW]

{ "description" : "Date this invoice is due, UTC DateTime.", "verbs":["GET"] }

final_execution_attempt[RW]

{ "description" : "UTC DateTime of the invoice's final execution attempt. The final execution attempt. This may be less than the next execution attempt if the next execution attempt never occurred.", "verbs":["GET"] }

id[RW]

{ "description" : "Unique identifier for the invoice.", "verbs":["GET"] }

initial_invoice[RW]

{ "description" : "Is this an initial invoice. An initial invoice is the first invoice generated for a subscription. Initial invoices will not have dunning applied to them and as such will only have a single payment attempt. For trial periods, the trial invoice is the initial invoice.", "verbs":["GET"] }

invoice_cost[RW]

{ "description" : "Cost of the invoice inclusive of tax.", "verbs":["GET"] }

invoice_credit_notes[RW]

{ "description" : "Credit Notes associated with this invoice. Multiple credit notes may be associated with the invoice.", "verbs":["GET"] }

invoice_lines[RW]

{ "description" : "The collection of invoice-lines associated with the invoice.", "verbs":["GET"] }

invoice_paid[RW]

{ "description" : "Total amount of the invoice currently paid for. As the invoice may be paid by multiple payments, for example partly paid for by a voucher and then paid for by a card, this indicates the current paid amount of the invoice.", "verbs":["GET"] }

invoice_payments[RW]

{ "description" : "Payments used for this invoice. Multiple payments may be associated with the invoice.", "verbs":["GET"] }

invoice_refunded[RW]

{ "description" : "Total amount of the invoice refunded.", "verbs":["GET"] }

invoice_refunds[RW]

{ "description" : "Refunds associated with this invoice. Multiple refunds may be associated with the invoice.", "verbs":["GET"] }

issued[RW]

{ "description" : "The UTC DateTime when the invoice was first issued.", "verbs":["GET"] }

last_execution_attempt[RW]

{ "description" : "UTC DateTime of the invoice's last execution attempt. This was the last time an attempt was made to take payment for this invoice.", "verbs":["GET"] }

locked[RW]

{ "description" : "If the subscription is locked, it will not be processed by the system", "verbs":[] }

managed_by[RW]

{ "description" : "Which system is responsible for managing the subscription.", "verbs":[] }

name[RW]

{ "description" : "The name of the invoice", "verbs":[] }

next_execution_attempt[RW]

{ "description" : "UTC DateTime of the invoice's next execution attempt. If the next execution attempt is greater than the period end for this invoice, the invoice will not receive another automatic execution attempt.", "verbs":["GET"] }

non_discounted_cost[RW]

Cost of the invoice before discounts, inclusive of tax.

non_discounted_cost_excluding_tax[RW]

Cost of the invoice before discounts, inclusive of tax.

organization_id[RW]

{ "description" : "", "verbs":[] }

parent_invoice_id[RW]

{ "description" : "", "verbs":[] }

payment_received[RW]

{ "description" : "UTC DateTime specifying when payment was received for the invoice.", "verbs":["GET"] }

payment_terms[RW]
period_end[RW]

{ "description" : "End of the period being billed by this invoice, UTC DateTime.", "verbs":["GET"] }

period_start[RW]

{ "description" : "Start of the period being billed by this invoice, UTC DateTime", "verbs":["GET"] }

processing[RW]

{ "processing" : "If true, the invoice is processing.", "verbs":[] }

purchase_order[RW]

{ "description" : "Purchase order associated with the subscription. If specified this is copied to any invoices issued for this subscription.", "verbs":["GET","PUT","POST"] }

state[RW]

{ "description" : "Initially an invoice is set as unpaid. Once payment for the full value of the invoice has been received it is marked as paid. An invoice may be paid from various sources including cards, coupons or manual payments.", "verbs":["GET"] }

subscription_id[RW]

{ "description" : "", "verbs":["GET"] }

subscription_version_id[RW]

{ "description" : "", "verbs":["GET"] }

tax_lines[RW]
total_execution_attempts[RW]

{ "description" : "Number of payment attempts for this invoice. This includes any manual execution attempts.", "verbs":["GET"] }

type[RW]

{ "description" : "The type of the invoice. A subscription invoice is raised every time a subscription recurs. An amendment is created for intra-contract changes. An Adhoc invoice is created for payment that is taken out-of-band of a subscription. Finally the invoice generated for a trial period is marked as Trial.", "verbs":["GET"] }

updated[RW]

{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }

version_id[RW]

{ "description" : "Version identifier of the invoice.", "verbs":["GET"] }

version_number[RW]

{ "description" : "The version number of the Invoice. The first version of an Invoice is version number 1", "verbs":["GET"] }

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/bf_ruby2/models/invoice.rb, line 187
def self.attribute_map
  {
    :'created' => :'created',
    :'changed_by' => :'changedBy',
    :'updated' => :'updated',
    :'version_id' => :'versionID',
    :'id' => :'id',
    :'crm_id' => :'crmID',
    :'subscription_id' => :'subscriptionID',
    :'subscription_version_id' => :'subscriptionVersionID',
    :'account_id' => :'accountID',
    :'organization_id' => :'organizationID',
    :'parent_invoice_id' => :'parentInvoiceID',
    :'name' => :'name',
    :'description' => :'description',
    :'state' => :'state',
    :'issued' => :'issued',
    :'period_start' => :'periodStart',
    :'period_end' => :'periodEnd',
    :'due' => :'due',
    :'deleted' => :'deleted',
    :'total_execution_attempts' => :'totalExecutionAttempts',
    :'last_execution_attempt' => :'lastExecutionAttempt',
    :'next_execution_attempt' => :'nextExecutionAttempt',
    :'final_execution_attempt' => :'finalExecutionAttempt',
    :'payment_received' => :'paymentReceived',
    :'currency' => :'currency',
    :'cost_excluding_tax' => :'costExcludingTax',
    :'invoice_cost' => :'invoiceCost',
    :'non_discounted_cost' => :'nonDiscountedCost',
    :'non_discounted_cost_excluding_tax' => :'nonDiscountedCostExcludingTax',
    :'invoice_paid' => :'invoicePaid',
    :'discount_amount' => :'discountAmount',
    :'discount_amount_excluding_tax' => :'discountAmountExcludingTax',
    :'invoice_refunded' => :'invoiceRefunded',
    :'credit_rolled_over' => :'creditRolledOver',
    :'credit_rolled_over_excluding_tax' => :'creditRolledOverExcludingTax',
    :'type' => :'type',
    :'locked' => :'locked',
    :'managed_by' => :'managedBy',
    :'initial_invoice' => :'initialInvoice',
    :'processing' => :'processing',
    :'payment_terms' => :'paymentTerms',
    :'purchase_order' => :'purchaseOrder',
    :'version_number' => :'versionNumber',
    :'invoice_lines' => :'invoiceLines',
    :'tax_lines' => :'taxLines',
    :'invoice_payments' => :'invoicePayments',
    :'invoice_refunds' => :'invoiceRefunds',
    :'invoice_credit_notes' => :'invoiceCreditNotes',
    :'charges' => :'charges',
    :'children' => :'children'
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/bf_ruby2/models/invoice.rb, line 300
def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'created')
    self.created = attributes[:'created']
  end

  if attributes.has_key?(:'changedBy')
    self.changed_by = attributes[:'changedBy']
  end

  if attributes.has_key?(:'updated')
    self.updated = attributes[:'updated']
  end

  if attributes.has_key?(:'versionID')
    self.version_id = attributes[:'versionID']
  end

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'crmID')
    self.crm_id = attributes[:'crmID']
  end

  if attributes.has_key?(:'subscriptionID')
    self.subscription_id = attributes[:'subscriptionID']
  end

  if attributes.has_key?(:'subscriptionVersionID')
    self.subscription_version_id = attributes[:'subscriptionVersionID']
  end

  if attributes.has_key?(:'accountID')
    self.account_id = attributes[:'accountID']
  end

  if attributes.has_key?(:'organizationID')
    self.organization_id = attributes[:'organizationID']
  end

  if attributes.has_key?(:'parentInvoiceID')
    self.parent_invoice_id = attributes[:'parentInvoiceID']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.has_key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.has_key?(:'issued')
    self.issued = attributes[:'issued']
  end

  if attributes.has_key?(:'periodStart')
    self.period_start = attributes[:'periodStart']
  end

  if attributes.has_key?(:'periodEnd')
    self.period_end = attributes[:'periodEnd']
  end

  if attributes.has_key?(:'due')
    self.due = attributes[:'due']
  end

  if attributes.has_key?(:'deleted')
    self.deleted = attributes[:'deleted']
  else
    self.deleted = false
  end

  if attributes.has_key?(:'totalExecutionAttempts')
    self.total_execution_attempts = attributes[:'totalExecutionAttempts']
  end

  if attributes.has_key?(:'lastExecutionAttempt')
    self.last_execution_attempt = attributes[:'lastExecutionAttempt']
  end

  if attributes.has_key?(:'nextExecutionAttempt')
    self.next_execution_attempt = attributes[:'nextExecutionAttempt']
  end

  if attributes.has_key?(:'finalExecutionAttempt')
    self.final_execution_attempt = attributes[:'finalExecutionAttempt']
  end

  if attributes.has_key?(:'paymentReceived')
    self.payment_received = attributes[:'paymentReceived']
  end

  if attributes.has_key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.has_key?(:'costExcludingTax')
    self.cost_excluding_tax = attributes[:'costExcludingTax']
  end

  if attributes.has_key?(:'invoiceCost')
    self.invoice_cost = attributes[:'invoiceCost']
  end

  if attributes.has_key?(:'nonDiscountedCost')
    self.non_discounted_cost = attributes[:'nonDiscountedCost']
  end

  if attributes.has_key?(:'nonDiscountedCostExcludingTax')
    self.non_discounted_cost_excluding_tax = attributes[:'nonDiscountedCostExcludingTax']
  end

  if attributes.has_key?(:'invoicePaid')
    self.invoice_paid = attributes[:'invoicePaid']
  end

  if attributes.has_key?(:'discountAmount')
    self.discount_amount = attributes[:'discountAmount']
  end

  if attributes.has_key?(:'discountAmountExcludingTax')
    self.discount_amount_excluding_tax = attributes[:'discountAmountExcludingTax']
  end

  if attributes.has_key?(:'invoiceRefunded')
    self.invoice_refunded = attributes[:'invoiceRefunded']
  end

  if attributes.has_key?(:'creditRolledOver')
    self.credit_rolled_over = attributes[:'creditRolledOver']
  end

  if attributes.has_key?(:'creditRolledOverExcludingTax')
    self.credit_rolled_over_excluding_tax = attributes[:'creditRolledOverExcludingTax']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'locked')
    self.locked = attributes[:'locked']
  end

  if attributes.has_key?(:'managedBy')
    self.managed_by = attributes[:'managedBy']
  end

  if attributes.has_key?(:'initialInvoice')
    self.initial_invoice = attributes[:'initialInvoice']
  else
    self.initial_invoice = false
  end

  if attributes.has_key?(:'processing')
    self.processing = attributes[:'processing']
  else
    self.processing = false
  end

  if attributes.has_key?(:'paymentTerms')
    self.payment_terms = attributes[:'paymentTerms']
  end

  if attributes.has_key?(:'purchaseOrder')
    self.purchase_order = attributes[:'purchaseOrder']
  end

  if attributes.has_key?(:'versionNumber')
    self.version_number = attributes[:'versionNumber']
  end

  if attributes.has_key?(:'invoiceLines')
    if (value = attributes[:'invoiceLines']).is_a?(Array)
      self.invoice_lines = value
    end
  end

  if attributes.has_key?(:'taxLines')
    if (value = attributes[:'taxLines']).is_a?(Array)
      self.tax_lines = value
    end
  end

  if attributes.has_key?(:'invoicePayments')
    if (value = attributes[:'invoicePayments']).is_a?(Array)
      self.invoice_payments = value
    end
  end

  if attributes.has_key?(:'invoiceRefunds')
    if (value = attributes[:'invoiceRefunds']).is_a?(Array)
      self.invoice_refunds = value
    end
  end

  if attributes.has_key?(:'invoiceCreditNotes')
    if (value = attributes[:'invoiceCreditNotes']).is_a?(Array)
      self.invoice_credit_notes = value
    end
  end

  if attributes.has_key?(:'charges')
    if (value = attributes[:'charges']).is_a?(Array)
      self.charges = value
    end
  end

  if attributes.has_key?(:'children')
    if (value = attributes[:'children']).is_a?(Array)
      self.children = value
    end
  end

end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/bf_ruby2/models/invoice.rb, line 243
def self.swagger_types
  {
    :'created' => :'DateTime',
    :'changed_by' => :'String',
    :'updated' => :'DateTime',
    :'version_id' => :'String',
    :'id' => :'String',
    :'crm_id' => :'String',
    :'subscription_id' => :'String',
    :'subscription_version_id' => :'String',
    :'account_id' => :'String',
    :'organization_id' => :'String',
    :'parent_invoice_id' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'state' => :'String',
    :'issued' => :'DateTime',
    :'period_start' => :'DateTime',
    :'period_end' => :'DateTime',
    :'due' => :'DateTime',
    :'deleted' => :'BOOLEAN',
    :'total_execution_attempts' => :'Integer',
    :'last_execution_attempt' => :'DateTime',
    :'next_execution_attempt' => :'DateTime',
    :'final_execution_attempt' => :'DateTime',
    :'payment_received' => :'DateTime',
    :'currency' => :'String',
    :'cost_excluding_tax' => :'Float',
    :'invoice_cost' => :'Float',
    :'non_discounted_cost' => :'Float',
    :'non_discounted_cost_excluding_tax' => :'Float',
    :'invoice_paid' => :'Float',
    :'discount_amount' => :'Float',
    :'discount_amount_excluding_tax' => :'Float',
    :'invoice_refunded' => :'Float',
    :'credit_rolled_over' => :'Float',
    :'credit_rolled_over_excluding_tax' => :'Float',
    :'type' => :'String',
    :'locked' => :'String',
    :'managed_by' => :'String',
    :'initial_invoice' => :'BOOLEAN',
    :'processing' => :'BOOLEAN',
    :'payment_terms' => :'Integer',
    :'purchase_order' => :'String',
    :'version_number' => :'Integer',
    :'invoice_lines' => :'Array<InvoiceLine>',
    :'tax_lines' => :'Array<InsertableBillingEntity>',
    :'invoice_payments' => :'Array<InvoicePayment>',
    :'invoice_refunds' => :'Array<Refund>',
    :'invoice_credit_notes' => :'Array<CreditNote>',
    :'charges' => :'Array<SubscriptionCharge>',
    :'children' => :'Array<Invoice>'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/bf_ruby2/models/invoice.rb, line 649
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created == o.created &&
      changed_by == o.changed_by &&
      updated == o.updated &&
      version_id == o.version_id &&
      id == o.id &&
      crm_id == o.crm_id &&
      subscription_id == o.subscription_id &&
      subscription_version_id == o.subscription_version_id &&
      account_id == o.account_id &&
      organization_id == o.organization_id &&
      parent_invoice_id == o.parent_invoice_id &&
      name == o.name &&
      description == o.description &&
      state == o.state &&
      issued == o.issued &&
      period_start == o.period_start &&
      period_end == o.period_end &&
      due == o.due &&
      deleted == o.deleted &&
      total_execution_attempts == o.total_execution_attempts &&
      last_execution_attempt == o.last_execution_attempt &&
      next_execution_attempt == o.next_execution_attempt &&
      final_execution_attempt == o.final_execution_attempt &&
      payment_received == o.payment_received &&
      currency == o.currency &&
      cost_excluding_tax == o.cost_excluding_tax &&
      invoice_cost == o.invoice_cost &&
      non_discounted_cost == o.non_discounted_cost &&
      non_discounted_cost_excluding_tax == o.non_discounted_cost_excluding_tax &&
      invoice_paid == o.invoice_paid &&
      discount_amount == o.discount_amount &&
      discount_amount_excluding_tax == o.discount_amount_excluding_tax &&
      invoice_refunded == o.invoice_refunded &&
      credit_rolled_over == o.credit_rolled_over &&
      credit_rolled_over_excluding_tax == o.credit_rolled_over_excluding_tax &&
      type == o.type &&
      locked == o.locked &&
      managed_by == o.managed_by &&
      initial_invoice == o.initial_invoice &&
      processing == o.processing &&
      payment_terms == o.payment_terms &&
      purchase_order == o.purchase_order &&
      version_number == o.version_number &&
      invoice_lines == o.invoice_lines &&
      tax_lines == o.tax_lines &&
      invoice_payments == o.invoice_payments &&
      invoice_refunds == o.invoice_refunds &&
      invoice_credit_notes == o.invoice_credit_notes &&
      charges == o.charges &&
      children == o.children
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/bf_ruby2/models/invoice.rb, line 740
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = Bfwd.const_get(type).new
    temp_model.build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/bf_ruby2/models/invoice.rb, line 806
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/bf_ruby2/models/invoice.rb, line 719
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/bf_ruby2/models/invoice.rb, line 706
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/bf_ruby2/models/invoice.rb, line 712
def hash
  [created, changed_by, updated, version_id, id, crm_id, subscription_id, subscription_version_id, account_id, organization_id, parent_invoice_id, name, description, state, issued, period_start, period_end, due, deleted, total_execution_attempts, last_execution_attempt, next_execution_attempt, final_execution_attempt, payment_received, currency, cost_excluding_tax, invoice_cost, non_discounted_cost, non_discounted_cost_excluding_tax, invoice_paid, discount_amount, discount_amount_excluding_tax, invoice_refunded, credit_rolled_over, credit_rolled_over_excluding_tax, type, locked, managed_by, initial_invoice, processing, payment_terms, purchase_order, version_number, invoice_lines, tax_lines, invoice_payments, invoice_refunds, invoice_credit_notes, charges, children].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons

# File lib/bf_ruby2/models/invoice.rb, line 530
def list_invalid_properties
  invalid_properties = Array.new
  if @subscription_version_id.nil?
    invalid_properties.push("invalid value for 'subscription_version_id', subscription_version_id cannot be nil.")
  end

  if @account_id.nil?
    invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.")
  end

  if @organization_id.nil?
    invalid_properties.push("invalid value for 'organization_id', organization_id cannot be nil.")
  end

  if @state.nil?
    invalid_properties.push("invalid value for 'state', state cannot be nil.")
  end

  if @deleted.nil?
    invalid_properties.push("invalid value for 'deleted', deleted cannot be nil.")
  end

  if @currency.nil?
    invalid_properties.push("invalid value for 'currency', currency cannot be nil.")
  end

  if @cost_excluding_tax.nil?
    invalid_properties.push("invalid value for 'cost_excluding_tax', cost_excluding_tax cannot be nil.")
  end

  if @invoice_cost.nil?
    invalid_properties.push("invalid value for 'invoice_cost', invoice_cost cannot be nil.")
  end

  if @non_discounted_cost.nil?
    invalid_properties.push("invalid value for 'non_discounted_cost', non_discounted_cost cannot be nil.")
  end

  if @non_discounted_cost_excluding_tax.nil?
    invalid_properties.push("invalid value for 'non_discounted_cost_excluding_tax', non_discounted_cost_excluding_tax cannot be nil.")
  end

  if @credit_rolled_over.nil?
    invalid_properties.push("invalid value for 'credit_rolled_over', credit_rolled_over cannot be nil.")
  end

  if @type.nil?
    invalid_properties.push("invalid value for 'type', type cannot be nil.")
  end

  if @initial_invoice.nil?
    invalid_properties.push("invalid value for 'initial_invoice', initial_invoice cannot be nil.")
  end

  if @version_number.nil?
    invalid_properties.push("invalid value for 'version_number', version_number cannot be nil.")
  end

  return invalid_properties
end
managed_by=(managed_by) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] managed_by Object to be assigned

# File lib/bf_ruby2/models/invoice.rb, line 639
def managed_by=(managed_by)
  validator = EnumAttributeValidator.new('String', ["BillForward", "Stripe"])
  unless validator.valid?(managed_by)
    fail ArgumentError, "invalid value for 'managed_by', must be one of #{validator.allowable_values}."
  end
  @managed_by = managed_by
end
state=(state) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] state Object to be assigned

# File lib/bf_ruby2/models/invoice.rb, line 619
def state=(state)
  validator = EnumAttributeValidator.new('String', ["Paid", "Unpaid", "Pending", "Voided"])
  unless validator.valid?(state)
    fail ArgumentError, "invalid value for 'state', must be one of #{validator.allowable_values}."
  end
  @state = state
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/bf_ruby2/models/invoice.rb, line 786
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/bf_ruby2/models/invoice.rb, line 792
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/bf_ruby2/models/invoice.rb, line 780
def to_s
  to_hash.to_s
end
type=(type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] type Object to be assigned

# File lib/bf_ruby2/models/invoice.rb, line 629
def type=(type)
  validator = EnumAttributeValidator.new('String', ["Subscription", "Trial", "Charge", "FinalArrears", "Amendment", "Aggregated"])
  unless validator.valid?(type)
    fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
  end
  @type = type
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/bf_ruby2/models/invoice.rb, line 593
def valid?
  return false if @subscription_version_id.nil?
  return false if @account_id.nil?
  return false if @organization_id.nil?
  return false if @state.nil?
  state_validator = EnumAttributeValidator.new('String', ["Paid", "Unpaid", "Pending", "Voided"])
  return false unless state_validator.valid?(@state)
  return false if @deleted.nil?
  return false if @currency.nil?
  return false if @cost_excluding_tax.nil?
  return false if @invoice_cost.nil?
  return false if @non_discounted_cost.nil?
  return false if @non_discounted_cost_excluding_tax.nil?
  return false if @credit_rolled_over.nil?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["Subscription", "Trial", "Charge", "FinalArrears", "Amendment", "Aggregated"])
  return false unless type_validator.valid?(@type)
  managed_by_validator = EnumAttributeValidator.new('String', ["BillForward", "Stripe"])
  return false unless managed_by_validator.valid?(@managed_by)
  return false if @initial_invoice.nil?
  return false if @version_number.nil?
  return true
end