Class: AdvancedBilling::IssueInvoiceRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::IssueInvoiceRequest
- Defined in:
- lib/advanced_billing/models/issue_invoice_request.rb
Overview
IssueInvoiceRequest Model.
Instance Attribute Summary collapse
-
#on_failed_payment ⇒ FailedPaymentAction
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.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(on_failed_payment: FailedPaymentAction::LEAVE_OPEN_INVOICE, additional_properties: {}) ⇒ IssueInvoiceRequest
constructor
A new instance of IssueInvoiceRequest.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(on_failed_payment: FailedPaymentAction::LEAVE_OPEN_INVOICE, additional_properties: {}) ⇒ IssueInvoiceRequest
Returns a new instance of IssueInvoiceRequest.
47 48 49 50 51 52 53 54 55 |
# File 'lib/advanced_billing/models/issue_invoice_request.rb', line 47 def initialize(on_failed_payment: FailedPaymentAction::LEAVE_OPEN_INVOICE, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @on_failed_payment = on_failed_payment unless on_failed_payment == SKIP end |
Instance Attribute Details
#on_failed_payment ⇒ FailedPaymentAction
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).
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.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/advanced_billing/models/issue_invoice_request.rb', line 58 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 # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. IssueInvoiceRequest.new(on_failed_payment: on_failed_payment, additional_properties: additional_properties) end |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/advanced_billing/models/issue_invoice_request.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
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 |