Class: AdvancedBilling::IssueInvoiceRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/issue_invoice_request.rb

Overview

IssueInvoiceRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(on_failed_payment = FailedPaymentAction::LEAVE_OPEN_INVOICE) ⇒ IssueInvoiceRequest

Returns a new instance of IssueInvoiceRequest.



47
48
49
# File 'lib/advanced_billing/models/issue_invoice_request.rb', line 47

def initialize(on_failed_payment = FailedPaymentAction::LEAVE_OPEN_INVOICE)
  @on_failed_payment = on_failed_payment unless on_failed_payment == SKIP
end

Instance Attribute Details

#on_failed_paymentFailedPaymentAction

Action taken when payment for an invoice fails:

  • ‘leave_open_invoice` - prepayments and credits applied to invoice;

invoice status set to “open”; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history. This is the default option.

  • ‘rollback_to_pending` - prepayments and credits not applied; invoice

remains in “pending” status; no email sent to the customer; payment failure recorded in the invoice history.

  • ‘initiate_dunning` - prepayments and credits applied to the invoice;

invoice status set to “open”; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history; subscription will most likely go into “past_due” or “canceled” state (depending upon net terms and dunning settings).

Returns:



26
27
28
# File 'lib/advanced_billing/models/issue_invoice_request.rb', line 26

def on_failed_payment
  @on_failed_payment
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



52
53
54
55
56
57
58
59
60
61
# File 'lib/advanced_billing/models/issue_invoice_request.rb', line 52

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  on_failed_payment =
    hash['on_failed_payment'] ||= FailedPaymentAction::LEAVE_OPEN_INVOICE

  # Create object from extracted values.
  IssueInvoiceRequest.new(on_failed_payment)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
# File 'lib/advanced_billing/models/issue_invoice_request.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['on_failed_payment'] = 'on_failed_payment'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/advanced_billing/models/issue_invoice_request.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
39
40
# File 'lib/advanced_billing/models/issue_invoice_request.rb', line 36

def self.optionals
  %w[
    on_failed_payment
  ]
end