Class: Inttegro::Refund::LineItem

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/inttegro/refund/line_item.rb

Overview

Typed representation of the line item object in the Inttegro API.

This generated model is immutable. Construct it with .new, or decode a string-keyed API payload with .from_hash. #serialize produces a string-keyed hash using the original wire field names and serialized enum values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#id ⇒ String (readonly)

Server-generated refund line-item identifier.

Required in the API payload. Wire name: id.

Returns:

  • (String)


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/inttegro/refund/line_item.rb', line 64

class LineItem < T::Struct
  const :id, String
  const :order_line_item_id, String
  const :order_line_item, T.nilable(Inttegro::Refund::OrderLineItem), default: nil
  const :original_amount_paid, Inttegro::Money::Amount
  const :reason, T.nilable(Inttegro::Refund::Reason), default: nil
  const :reason_details, T.nilable(String), default: nil
  const :refund_amount, Inttegro::Money::Amount

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (order_line_item_value = data["order_line_item"]).is_a?(Hash)
      data["order_line_item"] = case order_line_item_value["type"]
      when "product"
        Inttegro::Refund::OrderProductLineItem.from_hash(order_line_item_value)
      when "fee"
        Inttegro::Refund::OrderFeeLineItem.from_hash(order_line_item_value)
      when "shipping"
        Inttegro::Refund::OrderShippingLineItem.from_hash(order_line_item_value)
      else
        order_line_item_value
      end
    end
    super(data, strict)
  end
end

#order_line_item ⇒ Inttegro::Refund::OrderLineItem? (readonly)

Immutable display snapshot of the refunded order line. Omitted when the originating order cannot be resolved.

Optional in the API payload; omitted values default to nil. Wire name: order_line_item.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/inttegro/refund/line_item.rb', line 64

class LineItem < T::Struct
  const :id, String
  const :order_line_item_id, String
  const :order_line_item, T.nilable(Inttegro::Refund::OrderLineItem), default: nil
  const :original_amount_paid, Inttegro::Money::Amount
  const :reason, T.nilable(Inttegro::Refund::Reason), default: nil
  const :reason_details, T.nilable(String), default: nil
  const :refund_amount, Inttegro::Money::Amount

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (order_line_item_value = data["order_line_item"]).is_a?(Hash)
      data["order_line_item"] = case order_line_item_value["type"]
      when "product"
        Inttegro::Refund::OrderProductLineItem.from_hash(order_line_item_value)
      when "fee"
        Inttegro::Refund::OrderFeeLineItem.from_hash(order_line_item_value)
      when "shipping"
        Inttegro::Refund::OrderShippingLineItem.from_hash(order_line_item_value)
      else
        order_line_item_value
      end
    end
    super(data, strict)
  end
end

#order_line_item_id ⇒ String (readonly)

Deprecated compatibility identifier. Use order_line_item.id when order_line_item is present.

Required in the API payload. Wire name: order_line_item_id.

Returns:

  • (String)


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/inttegro/refund/line_item.rb', line 64

class LineItem < T::Struct
  const :id, String
  const :order_line_item_id, String
  const :order_line_item, T.nilable(Inttegro::Refund::OrderLineItem), default: nil
  const :original_amount_paid, Inttegro::Money::Amount
  const :reason, T.nilable(Inttegro::Refund::Reason), default: nil
  const :reason_details, T.nilable(String), default: nil
  const :refund_amount, Inttegro::Money::Amount

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (order_line_item_value = data["order_line_item"]).is_a?(Hash)
      data["order_line_item"] = case order_line_item_value["type"]
      when "product"
        Inttegro::Refund::OrderProductLineItem.from_hash(order_line_item_value)
      when "fee"
        Inttegro::Refund::OrderFeeLineItem.from_hash(order_line_item_value)
      when "shipping"
        Inttegro::Refund::OrderShippingLineItem.from_hash(order_line_item_value)
      else
        order_line_item_value
      end
    end
    super(data, strict)
  end
end

#original_amount_paid ⇒ Inttegro::Money::Amount (readonly)

Value of the original_amount_paid field in the Inttegro API payload.

Required in the API payload. Wire name: original_amount_paid.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/inttegro/refund/line_item.rb', line 64

class LineItem < T::Struct
  const :id, String
  const :order_line_item_id, String
  const :order_line_item, T.nilable(Inttegro::Refund::OrderLineItem), default: nil
  const :original_amount_paid, Inttegro::Money::Amount
  const :reason, T.nilable(Inttegro::Refund::Reason), default: nil
  const :reason_details, T.nilable(String), default: nil
  const :refund_amount, Inttegro::Money::Amount

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (order_line_item_value = data["order_line_item"]).is_a?(Hash)
      data["order_line_item"] = case order_line_item_value["type"]
      when "product"
        Inttegro::Refund::OrderProductLineItem.from_hash(order_line_item_value)
      when "fee"
        Inttegro::Refund::OrderFeeLineItem.from_hash(order_line_item_value)
      when "shipping"
        Inttegro::Refund::OrderShippingLineItem.from_hash(order_line_item_value)
      else
        order_line_item_value
      end
    end
    super(data, strict)
  end
end

#reason ⇒ Inttegro::Refund::Reason? (readonly)

Value of the reason field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: reason.

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/inttegro/refund/line_item.rb', line 64

class LineItem < T::Struct
  const :id, String
  const :order_line_item_id, String
  const :order_line_item, T.nilable(Inttegro::Refund::OrderLineItem), default: nil
  const :original_amount_paid, Inttegro::Money::Amount
  const :reason, T.nilable(Inttegro::Refund::Reason), default: nil
  const :reason_details, T.nilable(String), default: nil
  const :refund_amount, Inttegro::Money::Amount

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (order_line_item_value = data["order_line_item"]).is_a?(Hash)
      data["order_line_item"] = case order_line_item_value["type"]
      when "product"
        Inttegro::Refund::OrderProductLineItem.from_hash(order_line_item_value)
      when "fee"
        Inttegro::Refund::OrderFeeLineItem.from_hash(order_line_item_value)
      when "shipping"
        Inttegro::Refund::OrderShippingLineItem.from_hash(order_line_item_value)
      else
        order_line_item_value
      end
    end
    super(data, strict)
  end
end

#reason_details ⇒ String? (readonly)

Value of the reason_details field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: reason_details.

Returns:

  • (String, nil)


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/inttegro/refund/line_item.rb', line 64

class LineItem < T::Struct
  const :id, String
  const :order_line_item_id, String
  const :order_line_item, T.nilable(Inttegro::Refund::OrderLineItem), default: nil
  const :original_amount_paid, Inttegro::Money::Amount
  const :reason, T.nilable(Inttegro::Refund::Reason), default: nil
  const :reason_details, T.nilable(String), default: nil
  const :refund_amount, Inttegro::Money::Amount

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (order_line_item_value = data["order_line_item"]).is_a?(Hash)
      data["order_line_item"] = case order_line_item_value["type"]
      when "product"
        Inttegro::Refund::OrderProductLineItem.from_hash(order_line_item_value)
      when "fee"
        Inttegro::Refund::OrderFeeLineItem.from_hash(order_line_item_value)
      when "shipping"
        Inttegro::Refund::OrderShippingLineItem.from_hash(order_line_item_value)
      else
        order_line_item_value
      end
    end
    super(data, strict)
  end
end

#refund_amount ⇒ Inttegro::Money::Amount (readonly)

Value of the refund_amount field in the Inttegro API payload.

Required in the API payload. Wire name: refund_amount.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/inttegro/refund/line_item.rb', line 64

class LineItem < T::Struct
  const :id, String
  const :order_line_item_id, String
  const :order_line_item, T.nilable(Inttegro::Refund::OrderLineItem), default: nil
  const :original_amount_paid, Inttegro::Money::Amount
  const :reason, T.nilable(Inttegro::Refund::Reason), default: nil
  const :reason_details, T.nilable(String), default: nil
  const :refund_amount, Inttegro::Money::Amount

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (order_line_item_value = data["order_line_item"]).is_a?(Hash)
      data["order_line_item"] = case order_line_item_value["type"]
      when "product"
        Inttegro::Refund::OrderProductLineItem.from_hash(order_line_item_value)
      when "fee"
        Inttegro::Refund::OrderFeeLineItem.from_hash(order_line_item_value)
      when "shipping"
        Inttegro::Refund::OrderShippingLineItem.from_hash(order_line_item_value)
      else
        order_line_item_value
      end
    end
    super(data, strict)
  end
end

Class Method Details

.from_hash(hash, strict = false) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/inttegro/refund/line_item.rb', line 76

def self.from_hash(hash, strict = false)
  data = hash.dup
  if (order_line_item_value = data["order_line_item"]).is_a?(Hash)
    data["order_line_item"] = case order_line_item_value["type"]
    when "product"
      Inttegro::Refund::OrderProductLineItem.from_hash(order_line_item_value)
    when "fee"
      Inttegro::Refund::OrderFeeLineItem.from_hash(order_line_item_value)
    when "shipping"
      Inttegro::Refund::OrderShippingLineItem.from_hash(order_line_item_value)
    else
      order_line_item_value
    end
  end
  super(data, strict)
end