Class: Orb::Models::CreditNote::LineItem

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/orb/models/credit_note.rb

Defined Under Namespace

Classes: Discount

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id: , created_at: , credit_note_number: , credit_note_pdf: , customer: , invoice_id: , line_items: , maximum_amount_adjustment: , memo: , minimum_amount_refunded: , reason: , subtotal: , total: , type: , voided_at: , discounts: nil) ⇒ Object

The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been applied to a particular invoice.

Parameters:

  • id (String) (defaults to: )

    The Orb id of this credit note.

  • created_at (Time) (defaults to: )

    The creation time of the resource in Orb.

  • credit_note_number (String) (defaults to: )

    The unique identifier for credit notes.

  • credit_note_pdf (String, nil) (defaults to: )

    A URL to a PDF of the credit note.

  • customer (Orb::Models::CustomerMinified) (defaults to: )
  • invoice_id (String) (defaults to: )

    The id of the invoice resource that this credit note is applied to.

  • line_items (Array<Orb::Models::CreditNote::LineItem>) (defaults to: )

    All of the line items associated with this credit note.

  • maximum_amount_adjustment (Orb::Models::CreditNote::MaximumAmountAdjustment, nil) (defaults to: )

    The maximum amount applied on the original invoice

  • memo (String, nil) (defaults to: )

    An optional memo supplied on the credit note.

  • minimum_amount_refunded (String, nil) (defaults to: )

    Any credited amount from the applied minimum on the invoice.

  • reason (Symbol, Orb::Models::CreditNote::Reason, nil) (defaults to: )
  • subtotal (String) (defaults to: )

    The total prior to any creditable invoice-level discounts or minimums.

  • total (String) (defaults to: )

    The total including creditable invoice-level discounts or minimums, and tax.

  • type (Symbol, Orb::Models::CreditNote::Type) (defaults to: )
  • voided_at (Time, nil) (defaults to: )

    The time at which the credit note was voided in Orb, if applicable.

  • discounts (Array<Orb::Models::CreditNote::Discount>) (defaults to: nil)

    Any discounts applied on the original invoice.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/orb/models/credit_note.rb', line 135

class LineItem < Orb::Internal::Type::BaseModel
  # @!attribute id
  #   The Orb id of this resource.
  #
  #   @return [String]
  required :id, String

  # @!attribute amount
  #   The amount of the line item, including any line item minimums and discounts.
  #
  #   @return [String]
  required :amount, String

  # @!attribute item_id
  #   The id of the item associated with this line item.
  #
  #   @return [String]
  required :item_id, String

  # @!attribute name
  #   The name of the corresponding invoice line item.
  #
  #   @return [String]
  required :name, String

  # @!attribute quantity
  #   An optional quantity credited.
  #
  #   @return [Float, nil]
  required :quantity, Float, nil?: true

  # @!attribute subtotal
  #   The amount of the line item, excluding any line item minimums and discounts.
  #
  #   @return [String]
  required :subtotal, String

  # @!attribute tax_amounts
  #   Any tax amounts applied onto the line item.
  #
  #   @return [Array<Orb::Models::TaxAmount>]
  required :tax_amounts, -> { Orb::Internal::Type::ArrayOf[Orb::TaxAmount] }

  # @!attribute discounts
  #   Any line item discounts from the invoice's line item.
  #
  #   @return [Array<Orb::Models::CreditNote::LineItem::Discount>, nil]
  optional :discounts, -> { Orb::Internal::Type::ArrayOf[Orb::CreditNote::LineItem::Discount] }

  # @!attribute end_time_exclusive
  #   The end time of the service period for this credit note line item.
  #
  #   @return [Time, nil]
  optional :end_time_exclusive, Time, nil?: true

  # @!attribute start_time_inclusive
  #   The start time of the service period for this credit note line item.
  #
  #   @return [Time, nil]
  optional :start_time_inclusive, Time, nil?: true

  # @!method initialize(id:, amount:, item_id:, name:, quantity:, subtotal:, tax_amounts:, discounts: nil, end_time_exclusive: nil, start_time_inclusive: nil)
  #   @param id [String] The Orb id of this resource.
  #
  #   @param amount [String] The amount of the line item, including any line item minimums and discounts.
  #
  #   @param item_id [String] The id of the item associated with this line item.
  #
  #   @param name [String] The name of the corresponding invoice line item.
  #
  #   @param quantity [Float, nil] An optional quantity credited.
  #
  #   @param subtotal [String] The amount of the line item, excluding any line item minimums and discounts.
  #
  #   @param tax_amounts [Array<Orb::Models::TaxAmount>] Any tax amounts applied onto the line item.
  #
  #   @param discounts [Array<Orb::Models::CreditNote::LineItem::Discount>] Any line item discounts from the invoice's line item.
  #
  #   @param end_time_exclusive [Time, nil] The end time of the service period for this credit note line item.
  #
  #   @param start_time_inclusive [Time, nil] The start time of the service period for this credit note line item.

  class Discount < Orb::Internal::Type::BaseModel
    # @!attribute id
    #
    #   @return [String]
    required :id, String

    # @!attribute amount_applied
    #
    #   @return [String]
    required :amount_applied, String

    # @!attribute applies_to_price_ids
    #
    #   @return [Array<String>]
    required :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String]

    # @!attribute discount_type
    #
    #   @return [Symbol, Orb::Models::CreditNote::LineItem::Discount::DiscountType]
    required :discount_type, enum: -> { Orb::CreditNote::LineItem::Discount::DiscountType }

    # @!attribute percentage_discount
    #
    #   @return [Float]
    required :percentage_discount, Float

    # @!attribute amount_discount
    #
    #   @return [String, nil]
    optional :amount_discount, String, nil?: true

    # @!attribute reason
    #
    #   @return [String, nil]
    optional :reason, String, nil?: true

    # @!method initialize(id:, amount_applied:, applies_to_price_ids:, discount_type:, percentage_discount:, amount_discount: nil, reason: nil)
    #   @param id [String]
    #   @param amount_applied [String]
    #   @param applies_to_price_ids [Array<String>]
    #   @param discount_type [Symbol, Orb::Models::CreditNote::LineItem::Discount::DiscountType]
    #   @param percentage_discount [Float]
    #   @param amount_discount [String, nil]
    #   @param reason [String, nil]

    # @see Orb::Models::CreditNote::LineItem::Discount#discount_type
    module DiscountType
      extend Orb::Internal::Type::Enum

      PERCENTAGE = :percentage
      AMOUNT = :amount

      # @!method self.values
      #   @return [Array<Symbol>]
    end
  end
end

Instance Attribute Details

#amountString

The amount of the line item, including any line item minimums and discounts.

Returns:

  • (String)


146
# File 'lib/orb/models/credit_note.rb', line 146

required :amount, String

#discountsArray<Orb::Models::CreditNote::LineItem::Discount>?

Any line item discounts from the invoice’s line item.



182
# File 'lib/orb/models/credit_note.rb', line 182

optional :discounts, -> { Orb::Internal::Type::ArrayOf[Orb::CreditNote::LineItem::Discount] }

#end_time_exclusiveTime?

The end time of the service period for this credit note line item.

Returns:

  • (Time, nil)


188
# File 'lib/orb/models/credit_note.rb', line 188

optional :end_time_exclusive, Time, nil?: true

#idString

The Orb id of this resource.

Returns:

  • (String)


140
# File 'lib/orb/models/credit_note.rb', line 140

required :id, String

#item_idString

The id of the item associated with this line item.

Returns:

  • (String)


152
# File 'lib/orb/models/credit_note.rb', line 152

required :item_id, String

#nameString

The name of the corresponding invoice line item.

Returns:

  • (String)


158
# File 'lib/orb/models/credit_note.rb', line 158

required :name, String

#quantityFloat?

An optional quantity credited.

Returns:

  • (Float, nil)


164
# File 'lib/orb/models/credit_note.rb', line 164

required :quantity, Float, nil?: true

#start_time_inclusiveTime?

The start time of the service period for this credit note line item.

Returns:

  • (Time, nil)


194
# File 'lib/orb/models/credit_note.rb', line 194

optional :start_time_inclusive, Time, nil?: true

#subtotalString

The amount of the line item, excluding any line item minimums and discounts.

Returns:

  • (String)


170
# File 'lib/orb/models/credit_note.rb', line 170

required :subtotal, String

#tax_amountsArray<Orb::Models::TaxAmount>

Any tax amounts applied onto the line item.

Returns:



176
# File 'lib/orb/models/credit_note.rb', line 176

required :tax_amounts, -> { Orb::Internal::Type::ArrayOf[Orb::TaxAmount] }