inttegro 8.0.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/lib/inttegro/balance_transaction/allocation.rb +18 -0
  4. data/lib/inttegro/balance_transaction/allocation_base.rb +66 -0
  5. data/lib/inttegro/balance_transaction/allocation_base_type.rb +28 -0
  6. data/lib/inttegro/balance_transaction/allocation_status.rb +28 -0
  7. data/lib/inttegro/balance_transaction/available_amount.rb +34 -0
  8. data/lib/inttegro/balance_transaction/balance_transaction.rb +66 -4
  9. data/lib/inttegro/balance_transaction/payout_allocation.rb +74 -0
  10. data/lib/inttegro/balance_transaction/payout_allocation_payout.rb +35 -0
  11. data/lib/inttegro/balance_transaction/payout_allocation_type.rb +25 -0
  12. data/lib/inttegro/balance_transaction/pending_amount.rb +35 -0
  13. data/lib/inttegro/balance_transaction/refund_allocation.rb +74 -0
  14. data/lib/inttegro/balance_transaction/refund_allocation_refund.rb +35 -0
  15. data/lib/inttegro/balance_transaction/refund_allocation_type.rb +25 -0
  16. data/lib/inttegro/balance_transaction/response.rb +4 -1
  17. data/lib/inttegro/balance_transaction/spent_amount.rb +35 -0
  18. data/lib/inttegro/checkout/invoice_view.rb +8 -0
  19. data/lib/inttegro/checkout/order_line_item_group.rb +23 -0
  20. data/lib/inttegro/chime/send_request.rb +9 -0
  21. data/lib/inttegro/chime/send_request_cooldown.rb +35 -0
  22. data/lib/inttegro/chime/transport.rb +2 -1
  23. data/lib/inttegro/generated/enums.rb +16 -1
  24. data/lib/inttegro/generated/models.rb +36 -0
  25. data/lib/inttegro/generated/operations.rb +18 -3
  26. data/lib/inttegro/http_client.rb +1 -1
  27. data/lib/inttegro/order/create_existing_customer.rb +23 -0
  28. data/lib/inttegro/order/create_new_customer.rb +23 -0
  29. data/lib/inttegro/order/document_delivery_attempt.rb +7 -0
  30. data/lib/inttegro/order/document_delivery_channel_summary.rb +34 -0
  31. data/lib/inttegro/order/document_delivery_summary.rb +43 -0
  32. data/lib/inttegro/order/document_delivery_summary_channels.rb +36 -0
  33. data/lib/inttegro/order/invoice.rb +8 -0
  34. data/lib/inttegro/order/invoice_format.rb +3 -2
  35. data/lib/inttegro/order/line_item_group.rb +25 -0
  36. data/lib/inttegro/order/receipt_document_format.rb +35 -0
  37. data/lib/inttegro/order/update_request.rb +23 -0
  38. data/lib/inttegro/otp/initiate_request.rb +35 -8
  39. data/lib/inttegro/otp/purpose.rb +62 -0
  40. data/lib/inttegro/otp/transmission.rb +4 -4
  41. data/lib/inttegro/otp/transmission_status.rb +9 -0
  42. data/lib/inttegro/otp/verify_request.rb +2 -1
  43. data/lib/inttegro/payment/payment.rb +4 -1
  44. data/lib/inttegro/payout/balance_transaction.rb +42 -0
  45. data/lib/inttegro/payout/payout.rb +7 -3
  46. data/lib/inttegro/refund/line_item.rb +31 -1
  47. data/lib/inttegro/refund/order_fee_line_item.rb +43 -0
  48. data/lib/inttegro/refund/order_fee_line_item_fee.rb +34 -0
  49. data/lib/inttegro/{otp/transmission_sent_via.rb → refund/order_fee_line_item_type.rb} +7 -6
  50. data/lib/inttegro/refund/order_line_item.rb +20 -0
  51. data/lib/inttegro/refund/order_product_line_item.rb +50 -0
  52. data/lib/inttegro/refund/order_product_line_item_product.rb +34 -0
  53. data/lib/inttegro/refund/order_product_line_item_type.rb +25 -0
  54. data/lib/inttegro/refund/order_shipping_line_item.rb +43 -0
  55. data/lib/inttegro/refund/order_shipping_line_item_shipping.rb +34 -0
  56. data/lib/inttegro/refund/order_shipping_line_item_type.rb +25 -0
  57. data/lib/inttegro/refund/payment_method_settlement.rb +18 -0
  58. data/lib/inttegro/refund/refund.rb +18 -0
  59. data/lib/inttegro/resources/customers.rb +8 -0
  60. data/lib/inttegro/resources/financial_accounts.rb +12 -0
  61. data/lib/inttegro/resources/orders.rb +8 -0
  62. data/lib/inttegro/resources/payouts.rb +8 -0
  63. data/lib/inttegro/resources/products.rb +8 -0
  64. data/lib/inttegro/search/base.rb +17 -0
  65. data/lib/inttegro/search/facet.rb +34 -0
  66. data/lib/inttegro/search/facet_bucket.rb +34 -0
  67. data/lib/inttegro/search/facet_result.rb +35 -0
  68. data/lib/inttegro/search/filter.rb +42 -0
  69. data/lib/inttegro/search/filter_operator.rb +27 -0
  70. data/lib/inttegro/search/freshness.rb +43 -0
  71. data/lib/inttegro/search/freshness_state.rb +36 -0
  72. data/lib/inttegro/search/page.rb +104 -0
  73. data/lib/inttegro/search/request.rb +68 -0
  74. data/lib/inttegro/search/resource_freshness.rb +50 -0
  75. data/lib/inttegro/search/resource_freshness_state.rb +37 -0
  76. data/lib/inttegro/search/resource_reference.rb +35 -0
  77. data/lib/inttegro/search/resource_total.rb +43 -0
  78. data/lib/inttegro/search/resource_total_relation.rb +28 -0
  79. data/lib/inttegro/search/response.rb +28 -0
  80. data/lib/inttegro/search/result.rb +78 -0
  81. data/lib/inttegro/search/sort.rb +36 -0
  82. data/lib/inttegro/search/sort_direction.rb +27 -0
  83. data/lib/inttegro/search/sort_field.rb +30 -0
  84. data/lib/inttegro/search/total.rb +35 -0
  85. data/lib/inttegro/search/total_relation.rb +27 -0
  86. data/lib/inttegro/search/type.rb +36 -0
  87. data/lib/inttegro/telemetry.rb +1 -1
  88. data/lib/inttegro/version.rb +1 -1
  89. data/rbi/inttegro/generated.rbi +15 -0
  90. metadata +55 -3
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
+
6
+ require_relative "base"
7
+ require_relative "document_delivery_summary"
8
+
9
+ module Inttegro
10
+ class Order
11
+ # Typed representation of the receipt document format object in the Inttegro API.
12
+ #
13
+ # This generated model is immutable. Construct it with `.new`, or decode a string-keyed API
14
+ # payload with `.from_hash`. `#serialize` produces a string-keyed hash using the original wire
15
+ # field names and serialized enum values.
16
+ #
17
+ # @api public
18
+ #
19
+ # @!attribute [r] delivery_summary
20
+ # Bounded aggregate of Chime-accepted sends for one generated order document.
21
+ #
22
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `delivery_summary`.
23
+ # @return [Inttegro::Order::DocumentDeliverySummary, nil]
24
+ #
25
+ # @!attribute [r] url
26
+ # Value of the `url` field in the Inttegro API payload.
27
+ #
28
+ # Required in the API payload. Wire name: `url`.
29
+ # @return [String]
30
+ class ReceiptDocumentFormat < T::Struct
31
+ const :delivery_summary, T.nilable(Inttegro::Order::DocumentDeliverySummary), default: nil
32
+ const :url, String
33
+ end
34
+ end
35
+ end
@@ -113,6 +113,29 @@ module Inttegro
113
113
  const :payment_method_id, T.nilable(String), default: nil
114
114
  const :statement_descriptor, T.nilable(String), default: nil
115
115
  const :statement_descriptor_prefix, T.nilable(String), default: nil
116
+
117
+ extend T::Sig
118
+
119
+ sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
120
+ def self.from_hash(hash, strict = false)
121
+ data = hash.dup
122
+ if (line_items_value = data["line_items"]).is_a?(Array)
123
+ data["line_items"] = line_items_value.map do |item|
124
+ next item unless item.is_a?(Hash)
125
+ case item["type"]
126
+ when "product"
127
+ Inttegro::Product::LineItem.from_hash(item)
128
+ when "fee"
129
+ Inttegro::Shared::FeeLineItem.from_hash(item)
130
+ when "shipping"
131
+ Inttegro::Shared::ShippingLineItem.from_hash(item)
132
+ else
133
+ item
134
+ end
135
+ end
136
+ end
137
+ super(data, strict)
138
+ end
116
139
  end
117
140
  end
118
141
  end
@@ -4,7 +4,9 @@
4
4
  # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
5
 
6
6
  require_relative "base"
7
+ require_relative "../chime/transport"
7
8
  require_relative "alphabet_type"
9
+ require_relative "purpose"
8
10
 
9
11
  module Inttegro
10
12
  module OTP
@@ -17,31 +19,47 @@ module Inttegro
17
19
  # @api public
18
20
  #
19
21
  # @!attribute [r] async_delivery
20
- # Return after accepting the transaction while SMS delivery continues asynchronously.
22
+ # Return after accepting the transaction while delivery continues asynchronously.
21
23
  #
22
24
  # Optional in the API payload; omitted values default to `nil`. Wire name: `async_delivery`.
23
25
  # @return [Boolean, nil]
24
26
  #
25
27
  # @!attribute [r] message_template
26
- # SMS text containing the required `{token}` placeholder and optional `{service}` placeholder.
28
+ # SMS body or email copy containing the required `{token}` placeholder and optional
29
+ # `{service}` placeholder. Email templates must contain `{token}` exactly once. A custom
30
+ # template replaces the purpose-specific default body, while `purpose` still controls the
31
+ # email subject and heading. Email sends this as the plain-text fallback and renders the copy
32
+ # around a prominent code in the HTML version. Defaults are transport-specific.
27
33
  #
28
34
  # Optional in the API payload; omitted values default to `nil`. Wire name: `message_template`.
29
35
  # @return [String, nil]
30
36
  #
31
- # @!attribute [r] purpose
32
- # Your label for the verification flow.
37
+ # @!attribute [r] preferred_gateway
38
+ # Optional SMS gateway; not valid for email OTP delivery. Email uses the configured default
39
+ # provider.
33
40
  #
34
- # Optional in the API payload; omitted values default to `nil`. Wire name: `purpose`.
41
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `preferred_gateway`.
35
42
  # @return [String, nil]
36
43
  #
44
+ # @!attribute [r] purpose
45
+ # Customer action protected by the OTP. Controls safe, purpose-specific default email copy.
46
+ # Unknown values are rejected; use `unspecified` explicitly for a general verification
47
+ # request.
48
+ #
49
+ # Required in the API payload. Wire name: `purpose`.
50
+ # @return [Inttegro::OTP::Purpose]
51
+ #
37
52
  # @!attribute [r] recipient
38
- # Phone number in international format (E.164)
53
+ # Phone number in international format (E.164) or bare email address. Transport is inferred
54
+ # from the address unless specified.
39
55
  #
40
56
  # Required in the API payload. Wire name: `recipient`.
41
57
  # @return [String]
42
58
  #
43
59
  # @!attribute [r] sender
44
- # Optional sender identifier shown to the recipient (3-12 characters).
60
+ # Optional SMS sender identifier (3-12 characters). Email OTP always uses `{service_name}
61
+ # <noreply@inttegro.com>`; omit this field for email or supply exactly the bare
62
+ # `noreply@inttegro.com` address.
45
63
  #
46
64
  # Optional in the API payload; omitted values default to `nil`. Wire name: `sender`.
47
65
  # @return [String, nil]
@@ -70,6 +88,13 @@ module Inttegro
70
88
  # Required in the API payload. Wire name: `token_size`.
71
89
  # @return [Integer]
72
90
  #
91
+ # @!attribute [r] transport
92
+ # Optional delivery transport. When omitted, an email address selects email and a phone number
93
+ # selects SMS.
94
+ #
95
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `transport`.
96
+ # @return [Inttegro::Chime::Transport, nil]
97
+ #
73
98
  # @!attribute [r] validity_duration_in_minutes
74
99
  # How long the token remains valid (3-10080 minutes)
75
100
  #
@@ -78,13 +103,15 @@ module Inttegro
78
103
  class InitiateRequest < T::Struct
79
104
  const :async_delivery, T.nilable(T::Boolean), default: nil
80
105
  const :message_template, T.nilable(String), default: nil
81
- const :purpose, T.nilable(String), default: nil
106
+ const :preferred_gateway, T.nilable(String), default: nil
107
+ const :purpose, Inttegro::OTP::Purpose
82
108
  const :recipient, String
83
109
  const :sender, T.nilable(String), default: nil
84
110
  const :service_name, String
85
111
  const :token_alphabet, T.nilable(String), default: nil
86
112
  const :token_alphabet_type, T.nilable(Inttegro::OTP::AlphabetType), default: nil
87
113
  const :token_size, Integer
114
+ const :transport, T.nilable(Inttegro::Chime::Transport), default: nil
88
115
  const :validity_duration_in_minutes, T.nilable(Integer), default: nil
89
116
  end
90
117
  end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
+
6
+ require_relative "base"
7
+
8
+ module Inttegro
9
+ module OTP
10
+ # Customer action protected by the OTP. Controls safe, purpose-specific default email copy.
11
+ # Unknown values are rejected; use `unspecified` explicitly for a general verification
12
+ # request.
13
+ #
14
+ # Use the constants below when constructing a request. `#serialize` returns the documented
15
+ # string wire value received from or sent to the API.
16
+ #
17
+ # @api public
18
+ class Purpose < T::Enum
19
+ enums do
20
+ # Serialized wire value: `account_creation`.
21
+ # @return [Inttegro::OTP::Purpose]
22
+ ACCOUNT_CREATION = new("account_creation")
23
+ # Serialized wire value: `account_recovery`.
24
+ # @return [Inttegro::OTP::Purpose]
25
+ ACCOUNT_RECOVERY = new("account_recovery")
26
+ # Serialized wire value: `email_verification`.
27
+ # @return [Inttegro::OTP::Purpose]
28
+ EMAIL_VERIFICATION = new("email_verification")
29
+ # Serialized wire value: `financial_account_verification`.
30
+ # @return [Inttegro::OTP::Purpose]
31
+ FINANCIAL_ACCOUNT_VERIFICATION = new("financial_account_verification")
32
+ # Serialized wire value: `password_reset`.
33
+ # @return [Inttegro::OTP::Purpose]
34
+ PASSWORD_RESET = new("password_reset")
35
+ # Serialized wire value: `payment_confirmation`.
36
+ # @return [Inttegro::OTP::Purpose]
37
+ PAYMENT_CONFIRMATION = new("payment_confirmation")
38
+ # Serialized wire value: `payment_method_verification`.
39
+ # @return [Inttegro::OTP::Purpose]
40
+ PAYMENT_METHOD_VERIFICATION = new("payment_method_verification")
41
+ # Serialized wire value: `payout_confirmation`.
42
+ # @return [Inttegro::OTP::Purpose]
43
+ PAYOUT_CONFIRMATION = new("payout_confirmation")
44
+ # Serialized wire value: `phone_verification`.
45
+ # @return [Inttegro::OTP::Purpose]
46
+ PHONE_VERIFICATION = new("phone_verification")
47
+ # Serialized wire value: `sensitive_action`.
48
+ # @return [Inttegro::OTP::Purpose]
49
+ SENSITIVE_ACTION = new("sensitive_action")
50
+ # Serialized wire value: `sign_in`.
51
+ # @return [Inttegro::OTP::Purpose]
52
+ SIGN_IN = new("sign_in")
53
+ # Serialized wire value: `transaction_confirmation`.
54
+ # @return [Inttegro::OTP::Purpose]
55
+ TRANSACTION_CONFIRMATION = new("transaction_confirmation")
56
+ # Serialized wire value: `unspecified`.
57
+ # @return [Inttegro::OTP::Purpose]
58
+ UNSPECIFIED = new("unspecified")
59
+ end
60
+ end
61
+ end
62
+ end
@@ -4,7 +4,7 @@
4
4
  # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
5
 
6
6
  require_relative "base"
7
- require_relative "transmission_sent_via"
7
+ require_relative "../chime/transport"
8
8
  require_relative "transmission_status"
9
9
 
10
10
  module Inttegro
@@ -24,7 +24,7 @@ module Inttegro
24
24
  # @return [String]
25
25
  #
26
26
  # @!attribute [r] sender_id
27
- # Value of the `sender_id` field in the Inttegro API payload.
27
+ # SMS sender identifier or approved email From address.
28
28
  #
29
29
  # Required in the API payload. Wire name: `sender_id`.
30
30
  # @return [String]
@@ -39,7 +39,7 @@ module Inttegro
39
39
  # Value of the `sent_via` field in the Inttegro API payload.
40
40
  #
41
41
  # Optional in the API payload; omitted values default to `nil`. Wire name: `sent_via`.
42
- # @return [Inttegro::OTP::TransmissionSentVia, nil]
42
+ # @return [Inttegro::Chime::Transport, nil]
43
43
  #
44
44
  # @!attribute [r] status
45
45
  # Value of the `status` field in the Inttegro API payload.
@@ -50,7 +50,7 @@ module Inttegro
50
50
  const :recipient, String
51
51
  const :sender_id, String
52
52
  const :sent_at, T.nilable(Time), default: nil
53
- const :sent_via, T.nilable(Inttegro::OTP::TransmissionSentVia), default: nil
53
+ const :sent_via, T.nilable(Inttegro::Chime::Transport), default: nil
54
54
  const :status, T.nilable(Inttegro::OTP::TransmissionStatus), default: nil
55
55
  end
56
56
  end
@@ -15,12 +15,21 @@ module Inttegro
15
15
  # @api public
16
16
  class TransmissionStatus < T::Enum
17
17
  enums do
18
+ # Serialized wire value: `accepted`.
19
+ # @return [Inttegro::OTP::TransmissionStatus]
20
+ ACCEPTED = new("accepted")
18
21
  # Serialized wire value: `delivered`.
19
22
  # @return [Inttegro::OTP::TransmissionStatus]
20
23
  DELIVERED = new("delivered")
21
24
  # Serialized wire value: `failed`.
22
25
  # @return [Inttegro::OTP::TransmissionStatus]
23
26
  FAILED = new("failed")
27
+ # Serialized wire value: `queued`.
28
+ # @return [Inttegro::OTP::TransmissionStatus]
29
+ QUEUED = new("queued")
30
+ # Serialized wire value: `sent`.
31
+ # @return [Inttegro::OTP::TransmissionStatus]
32
+ SENT = new("sent")
24
33
  # Serialized wire value: `submitted`.
25
34
  # @return [Inttegro::OTP::TransmissionStatus]
26
35
  SUBMITTED = new("submitted")
@@ -22,7 +22,8 @@ module Inttegro
22
22
  # @return [String]
23
23
  #
24
24
  # @!attribute [r] recipient
25
- # Phone number that received the OTP
25
+ # Phone number or bare email address that received the OTP; must match the stored transaction
26
+ # transport.
26
27
  #
27
28
  # Required in the API payload. Wire name: `recipient`.
28
29
  # @return [String]
@@ -51,7 +51,10 @@ module Inttegro
51
51
  # @!attribute [r] balance_transaction
52
52
  # Merchant balance entry caused by a payment or refund. `type` describes the semantic source,
53
53
  # not direction. A payment transaction contains `payment_id`; a refund transaction contains
54
- # `refund_id`. Exactly one matching reference is present.
54
+ # `refund_id`. Exactly one matching reference is present. Payment transactions also expose
55
+ # their complete current allocation state and disjoint available, pending, and spent amounts.
56
+ # Allocation fields are omitted from refund transactions because refund transactions are
57
+ # consumers rather than sources.
55
58
  #
56
59
  # Optional in the API payload; omitted values default to `nil`. Wire name: `balance_transaction`.
57
60
  # @return [Inttegro::BalanceTransaction, nil]
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
+
6
+ require_relative "base"
7
+ require_relative "../money/amount"
8
+
9
+ module Inttegro
10
+ class Payout
11
+ # A sparse view of one balance transaction's contribution to a payout.
12
+ #
13
+ # This generated model is immutable. Construct it with `.new`, or decode a string-keyed API
14
+ # payload with `.from_hash`. `#serialize` produces a string-keyed hash using the original wire
15
+ # field names and serialized enum values.
16
+ #
17
+ # @api public
18
+ #
19
+ # @!attribute [r] allocated_amount
20
+ # Value of the `allocated_amount` field in the Inttegro API payload.
21
+ #
22
+ # Required in the API payload. Wire name: `allocated_amount`.
23
+ # @return [Inttegro::Money::Amount]
24
+ #
25
+ # @!attribute [r] amount
26
+ # Value of the `amount` field in the Inttegro API payload.
27
+ #
28
+ # Required in the API payload. Wire name: `amount`.
29
+ # @return [Inttegro::Money::Amount]
30
+ #
31
+ # @!attribute [r] id
32
+ # Unique balance transaction identifier.
33
+ #
34
+ # Required in the API payload. Wire name: `id`.
35
+ # @return [String]
36
+ class BalanceTransaction < T::Struct
37
+ const :allocated_amount, Inttegro::Money::Amount
38
+ const :amount, Inttegro::Money::Amount
39
+ const :id, String
40
+ end
41
+ end
42
+ end
@@ -6,6 +6,7 @@
6
6
  require_relative "base"
7
7
  require_relative "../custom_data"
8
8
  require_relative "../money/amount"
9
+ require_relative "balance_transaction"
9
10
  require_relative "error"
10
11
  require_relative "status"
11
12
 
@@ -25,10 +26,13 @@ module Inttegro
25
26
  # @return [Inttegro::Money::Amount, nil]
26
27
  #
27
28
  # @!attribute [r] balance_transactions
28
- # Balance transaction IDs linked to this payout
29
+ # Balance transactions that contributed to this payout. Each item includes the source
30
+ # transaction's original amount and the exact portion allocated to this payout. The difference
31
+ # between those two amounts is not necessarily still available because refunds or other
32
+ # payouts may also consume the source.
29
33
  #
30
34
  # Optional in the API payload; omitted values default to `nil`. Wire name: `balance_transactions`.
31
- # @return [Array<String>, nil]
35
+ # @return [Array<Inttegro::Payout::BalanceTransaction>, nil]
32
36
  #
33
37
  # @!attribute [r] canceled_at
34
38
  # When the payout was canceled
@@ -152,7 +156,7 @@ module Inttegro
152
156
  # @return [Time, nil]
153
157
  class Payout
154
158
  const :amount, T.nilable(Inttegro::Money::Amount), default: nil
155
- const :balance_transactions, T.nilable(T::Array[String]), default: nil
159
+ const :balance_transactions, T.nilable(T::Array[Inttegro::Payout::BalanceTransaction]), default: nil
156
160
  const :canceled_at, T.nilable(Time), default: nil
157
161
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
158
162
  const :destination_id, String
@@ -5,6 +5,7 @@
5
5
 
6
6
  require_relative "base"
7
7
  require_relative "../money/amount"
8
+ require_relative "order_line_item"
8
9
  require_relative "reason"
9
10
 
10
11
  module Inttegro
@@ -24,11 +25,19 @@ module Inttegro
24
25
  # @return [String]
25
26
  #
26
27
  # @!attribute [r] order_line_item_id
27
- # Value of the `order_line_item_id` field in the Inttegro API payload.
28
+ # Deprecated compatibility identifier. Use `order_line_item.id` when `order_line_item` is
29
+ # present.
28
30
  #
29
31
  # Required in the API payload. Wire name: `order_line_item_id`.
30
32
  # @return [String]
31
33
  #
34
+ # @!attribute [r] order_line_item
35
+ # Immutable display snapshot of the refunded order line. Omitted when the originating order
36
+ # cannot be resolved.
37
+ #
38
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `order_line_item`.
39
+ # @return [Inttegro::Refund::OrderLineItem, nil]
40
+ #
32
41
  # @!attribute [r] original_amount_paid
33
42
  # Value of the `original_amount_paid` field in the Inttegro API payload.
34
43
  #
@@ -55,10 +64,31 @@ module Inttegro
55
64
  class LineItem < T::Struct
56
65
  const :id, String
57
66
  const :order_line_item_id, String
67
+ const :order_line_item, T.nilable(Inttegro::Refund::OrderLineItem), default: nil
58
68
  const :original_amount_paid, Inttegro::Money::Amount
59
69
  const :reason, T.nilable(Inttegro::Refund::Reason), default: nil
60
70
  const :reason_details, T.nilable(String), default: nil
61
71
  const :refund_amount, Inttegro::Money::Amount
72
+
73
+ extend T::Sig
74
+
75
+ sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
76
+ def self.from_hash(hash, strict = false)
77
+ data = hash.dup
78
+ if (order_line_item_value = data["order_line_item"]).is_a?(Hash)
79
+ data["order_line_item"] = case order_line_item_value["type"]
80
+ when "product"
81
+ Inttegro::Refund::OrderProductLineItem.from_hash(order_line_item_value)
82
+ when "fee"
83
+ Inttegro::Refund::OrderFeeLineItem.from_hash(order_line_item_value)
84
+ when "shipping"
85
+ Inttegro::Refund::OrderShippingLineItem.from_hash(order_line_item_value)
86
+ else
87
+ order_line_item_value
88
+ end
89
+ end
90
+ super(data, strict)
91
+ end
62
92
  end
63
93
  end
64
94
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
+
6
+ require_relative "base"
7
+ require_relative "order_fee_line_item_fee"
8
+ require_relative "order_fee_line_item_type"
9
+
10
+ module Inttegro
11
+ class Refund
12
+ # Typed representation of the order fee line item object in the Inttegro API.
13
+ #
14
+ # This generated model is immutable. Construct it with `.new`, or decode a string-keyed API
15
+ # payload with `.from_hash`. `#serialize` produces a string-keyed hash using the original wire
16
+ # field names and serialized enum values.
17
+ #
18
+ # @api public
19
+ #
20
+ # @!attribute [r] id
21
+ # Immutable order-line identifier with the `oli_` prefix.
22
+ #
23
+ # Required in the API payload. Wire name: `id`.
24
+ # @return [String]
25
+ #
26
+ # @!attribute [r] type
27
+ # Value of the `type` field in the Inttegro API payload.
28
+ #
29
+ # Required in the API payload. Wire name: `type`.
30
+ # @return [Inttegro::Refund::OrderFeeLineItemType]
31
+ #
32
+ # @!attribute [r] fee
33
+ # Value of the `fee` field in the Inttegro API payload.
34
+ #
35
+ # Required in the API payload. Wire name: `fee`.
36
+ # @return [Inttegro::Refund::OrderFeeLineItemFee]
37
+ class OrderFeeLineItem < T::Struct
38
+ const :id, String
39
+ const :type, Inttegro::Refund::OrderFeeLineItemType
40
+ const :fee, Inttegro::Refund::OrderFeeLineItemFee
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
+
6
+ require_relative "base"
7
+
8
+ module Inttegro
9
+ class Refund
10
+ # Typed representation of the order fee line item fee object in the Inttegro API.
11
+ #
12
+ # This generated model is immutable. Construct it with `.new`, or decode a string-keyed API
13
+ # payload with `.from_hash`. `#serialize` produces a string-keyed hash using the original wire
14
+ # field names and serialized enum values.
15
+ #
16
+ # @api public
17
+ #
18
+ # @!attribute [r] label
19
+ # Value of the `label` field in the Inttegro API payload.
20
+ #
21
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `label`.
22
+ # @return [String, nil]
23
+ #
24
+ # @!attribute [r] description
25
+ # Value of the `description` field in the Inttegro API payload.
26
+ #
27
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `description`.
28
+ # @return [String, nil]
29
+ class OrderFeeLineItemFee < T::Struct
30
+ const :label, T.nilable(String), default: nil
31
+ const :description, T.nilable(String), default: nil
32
+ end
33
+ end
34
+ end
@@ -6,18 +6,19 @@
6
6
  require_relative "base"
7
7
 
8
8
  module Inttegro
9
- module OTP
10
- # String-backed values accepted by the Inttegro API for Inttegro::OTP::TransmissionSentVia.
9
+ class Refund
10
+ # String-backed values accepted by the Inttegro API for
11
+ # Inttegro::Refund::OrderFeeLineItemType.
11
12
  #
12
13
  # Use the constants below when constructing a request. `#serialize` returns the documented
13
14
  # string wire value received from or sent to the API.
14
15
  #
15
16
  # @api public
16
- class TransmissionSentVia < T::Enum
17
+ class OrderFeeLineItemType < T::Enum
17
18
  enums do
18
- # Serialized wire value: `sms`.
19
- # @return [Inttegro::OTP::TransmissionSentVia]
20
- SMS = new("sms")
19
+ # Serialized wire value: `fee`.
20
+ # @return [Inttegro::Refund::OrderFeeLineItemType]
21
+ FEE = new("fee")
21
22
  end
22
23
  end
23
24
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
+
6
+ require_relative "base"
7
+ require_relative "order_fee_line_item"
8
+ require_relative "order_product_line_item"
9
+ require_relative "order_shipping_line_item"
10
+
11
+ module Inttegro
12
+ class Refund
13
+ # Immutable display snapshot of the refunded order line. Omitted when the originating order
14
+ # cannot be resolved.
15
+ #
16
+ # @api public
17
+ # @return [Inttegro::Refund::OrderProductLineItem, Inttegro::Refund::OrderFeeLineItem, Inttegro::Refund::OrderShippingLineItem]
18
+ OrderLineItem = T.type_alias { T.any(Inttegro::Refund::OrderProductLineItem, Inttegro::Refund::OrderFeeLineItem, Inttegro::Refund::OrderShippingLineItem) }
19
+ end
20
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
+
6
+ require_relative "base"
7
+ require_relative "order_product_line_item_product"
8
+ require_relative "order_product_line_item_type"
9
+
10
+ module Inttegro
11
+ class Refund
12
+ # Typed representation of the order product line item object in the Inttegro API.
13
+ #
14
+ # This generated model is immutable. Construct it with `.new`, or decode a string-keyed API
15
+ # payload with `.from_hash`. `#serialize` produces a string-keyed hash using the original wire
16
+ # field names and serialized enum values.
17
+ #
18
+ # @api public
19
+ #
20
+ # @!attribute [r] id
21
+ # Immutable order-line identifier with the `oli_` prefix.
22
+ #
23
+ # Required in the API payload. Wire name: `id`.
24
+ # @return [String]
25
+ #
26
+ # @!attribute [r] type
27
+ # Value of the `type` field in the Inttegro API payload.
28
+ #
29
+ # Required in the API payload. Wire name: `type`.
30
+ # @return [Inttegro::Refund::OrderProductLineItemType]
31
+ #
32
+ # @!attribute [r] quantity
33
+ # Value of the `quantity` field in the Inttegro API payload.
34
+ #
35
+ # Required in the API payload. Wire name: `quantity`.
36
+ # @return [Integer]
37
+ #
38
+ # @!attribute [r] product
39
+ # Value of the `product` field in the Inttegro API payload.
40
+ #
41
+ # Required in the API payload. Wire name: `product`.
42
+ # @return [Inttegro::Refund::OrderProductLineItemProduct]
43
+ class OrderProductLineItem < T::Struct
44
+ const :id, String
45
+ const :type, Inttegro::Refund::OrderProductLineItemType
46
+ const :quantity, Integer
47
+ const :product, Inttegro::Refund::OrderProductLineItemProduct
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ # Generated from openapi/commerce.yml by bin/generate-openapi-types. Do not edit.
5
+
6
+ require_relative "base"
7
+
8
+ module Inttegro
9
+ class Refund
10
+ # Typed representation of the order product line item product object in the Inttegro API.
11
+ #
12
+ # This generated model is immutable. Construct it with `.new`, or decode a string-keyed API
13
+ # payload with `.from_hash`. `#serialize` produces a string-keyed hash using the original wire
14
+ # field names and serialized enum values.
15
+ #
16
+ # @api public
17
+ #
18
+ # @!attribute [r] id
19
+ # Source catalog product identifier. Omitted for inline products.
20
+ #
21
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `id`.
22
+ # @return [String, nil]
23
+ #
24
+ # @!attribute [r] name
25
+ # Product name captured on the order.
26
+ #
27
+ # Required in the API payload. Wire name: `name`.
28
+ # @return [String]
29
+ class OrderProductLineItemProduct < T::Struct
30
+ const :id, T.nilable(String), default: nil
31
+ const :name, String
32
+ end
33
+ end
34
+ end