inttegro 8.0.0 → 8.1.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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/lib/inttegro/checkout/invoice_view.rb +8 -0
  4. data/lib/inttegro/checkout/order_line_item_group.rb +23 -0
  5. data/lib/inttegro/chime/send_request.rb +9 -0
  6. data/lib/inttegro/chime/send_request_cooldown.rb +35 -0
  7. data/lib/inttegro/chime/transport.rb +2 -1
  8. data/lib/inttegro/generated/enums.rb +12 -1
  9. data/lib/inttegro/generated/models.rb +26 -0
  10. data/lib/inttegro/generated/operations.rb +18 -3
  11. data/lib/inttegro/http_client.rb +1 -1
  12. data/lib/inttegro/order/create_existing_customer.rb +23 -0
  13. data/lib/inttegro/order/create_new_customer.rb +23 -0
  14. data/lib/inttegro/order/document_delivery_attempt.rb +7 -0
  15. data/lib/inttegro/order/document_delivery_channel_summary.rb +34 -0
  16. data/lib/inttegro/order/document_delivery_summary.rb +43 -0
  17. data/lib/inttegro/order/document_delivery_summary_channels.rb +36 -0
  18. data/lib/inttegro/order/invoice.rb +8 -0
  19. data/lib/inttegro/order/invoice_format.rb +3 -2
  20. data/lib/inttegro/order/line_item_group.rb +25 -0
  21. data/lib/inttegro/order/receipt_document_format.rb +35 -0
  22. data/lib/inttegro/order/update_request.rb +23 -0
  23. data/lib/inttegro/otp/initiate_request.rb +35 -8
  24. data/lib/inttegro/otp/purpose.rb +62 -0
  25. data/lib/inttegro/otp/transmission.rb +4 -4
  26. data/lib/inttegro/otp/transmission_status.rb +9 -0
  27. data/lib/inttegro/otp/verify_request.rb +2 -1
  28. data/lib/inttegro/refund/line_item.rb +31 -1
  29. data/lib/inttegro/refund/order_fee_line_item.rb +43 -0
  30. data/lib/inttegro/refund/order_fee_line_item_fee.rb +34 -0
  31. data/lib/inttegro/{otp/transmission_sent_via.rb → refund/order_fee_line_item_type.rb} +7 -6
  32. data/lib/inttegro/refund/order_line_item.rb +20 -0
  33. data/lib/inttegro/refund/order_product_line_item.rb +50 -0
  34. data/lib/inttegro/refund/order_product_line_item_product.rb +34 -0
  35. data/lib/inttegro/refund/order_product_line_item_type.rb +25 -0
  36. data/lib/inttegro/refund/order_shipping_line_item.rb +43 -0
  37. data/lib/inttegro/refund/order_shipping_line_item_shipping.rb +34 -0
  38. data/lib/inttegro/refund/order_shipping_line_item_type.rb +25 -0
  39. data/lib/inttegro/refund/payment_method_settlement.rb +18 -0
  40. data/lib/inttegro/refund/refund.rb +18 -0
  41. data/lib/inttegro/resources/customers.rb +8 -0
  42. data/lib/inttegro/resources/financial_accounts.rb +12 -0
  43. data/lib/inttegro/resources/orders.rb +8 -0
  44. data/lib/inttegro/resources/payouts.rb +8 -0
  45. data/lib/inttegro/resources/products.rb +8 -0
  46. data/lib/inttegro/search/base.rb +17 -0
  47. data/lib/inttegro/search/facet.rb +34 -0
  48. data/lib/inttegro/search/facet_bucket.rb +34 -0
  49. data/lib/inttegro/search/facet_result.rb +35 -0
  50. data/lib/inttegro/search/filter.rb +42 -0
  51. data/lib/inttegro/search/filter_operator.rb +27 -0
  52. data/lib/inttegro/search/freshness.rb +43 -0
  53. data/lib/inttegro/search/freshness_state.rb +36 -0
  54. data/lib/inttegro/search/page.rb +104 -0
  55. data/lib/inttegro/search/request.rb +68 -0
  56. data/lib/inttegro/search/resource_freshness.rb +50 -0
  57. data/lib/inttegro/search/resource_freshness_state.rb +37 -0
  58. data/lib/inttegro/search/resource_reference.rb +35 -0
  59. data/lib/inttegro/search/resource_total.rb +43 -0
  60. data/lib/inttegro/search/resource_total_relation.rb +28 -0
  61. data/lib/inttegro/search/response.rb +28 -0
  62. data/lib/inttegro/search/result.rb +78 -0
  63. data/lib/inttegro/search/sort.rb +36 -0
  64. data/lib/inttegro/search/sort_direction.rb +27 -0
  65. data/lib/inttegro/search/sort_field.rb +30 -0
  66. data/lib/inttegro/search/total.rb +35 -0
  67. data/lib/inttegro/search/total_relation.rb +27 -0
  68. data/lib/inttegro/search/type.rb +36 -0
  69. data/lib/inttegro/telemetry.rb +1 -1
  70. data/lib/inttegro/version.rb +1 -1
  71. data/rbi/inttegro/generated.rbi +15 -0
  72. metadata +41 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2305c5215117569a70513f2a50edb305bac527c0818ee25cf2a1b27cd8ee15f1
4
- data.tar.gz: c5696096aaec5c002b4639b5abeb2af8d0a53b9fc831389a47359afcf382bbcd
3
+ metadata.gz: f8bc4f0b5a2c207f948dfa48b29deeccac6c66ee93dbcbc4dd0c9cea2f139fd7
4
+ data.tar.gz: a4ea44719929147719cf297a3c59d0f33862c87650d50247afa752d0afe3b7b7
5
5
  SHA512:
6
- metadata.gz: de19b8f9eec5d03f7aa1a9e3a4a10151470e5af3978daea2fa77ba31adb5981b4c9a51b0b4d8e74d18f6e04afcfe7f2ffca61e0794335400bb8ea33c9f443acf
7
- data.tar.gz: 7bfcbd510c93d0dcbb207b047a135ccc7af3177e351648340a28691eda9359436626654e37c7536a1e783f32e2b60c24e4eac868d6dfa8da85a67b8dc4af27d0
6
+ metadata.gz: 36ceb907d2fce5b241b2773f4e77a4efaec24361bec49c27b1b853f1dd43a894db911394be30db76a756fd4ef3348f8dfbdb01000072cabddc95bdfa6542d4db
7
+ data.tar.gz: 1d8e7b18fb1183c87f8dea4f62e5c3256d1413c7d8396cc9a7a699fea6f1a09b4a1cc30d3cf46806c4063bb1b954f56378643951164f9f442120f875d87e12e9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [8.1.0] - 2026-09-21
4
+
5
+ - Added typed search across customers, financial accounts, orders, payouts, and
6
+ products, including filters, facets, sorting, cursor pagination, totals, and
7
+ freshness metadata.
8
+ - Added typed verification purposes for OTP initiation requests.
9
+
3
10
  ## [8.0.0] - 2026-09-16
4
11
 
5
12
  - Breaking: replaced generic custom-data hashes with immutable Sorbet-typed
@@ -4,6 +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 "../order/document_delivery_summary"
7
8
  require_relative "invoice_view_beneficiary"
8
9
  require_relative "invoice_view_format"
9
10
  require_relative "invoice_view_status"
@@ -18,6 +19,12 @@ module Inttegro
18
19
  #
19
20
  # @api public
20
21
  #
22
+ # @!attribute [r] delivery_summary
23
+ # Bounded aggregate of Chime-accepted sends for one generated order document.
24
+ #
25
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `delivery_summary`.
26
+ # @return [Inttegro::Order::DocumentDeliverySummary, nil]
27
+ #
21
28
  # @!attribute [r] id
22
29
  # Value of the `id` field in the Inttegro API payload.
23
30
  #
@@ -66,6 +73,7 @@ module Inttegro
66
73
  # Optional in the API payload; omitted values default to `nil`. Wire name: `beneficiary`.
67
74
  # @return [Inttegro::Checkout::InvoiceViewBeneficiary, nil]
68
75
  class InvoiceView < T::Struct
76
+ const :delivery_summary, T.nilable(Inttegro::Order::DocumentDeliverySummary), default: nil
69
77
  const :id, String
70
78
  const :application_id, T.nilable(String), default: nil
71
79
  const :number, T.nilable(String), default: nil
@@ -31,6 +31,29 @@ module Inttegro
31
31
  class OrderLineItemGroup < T::Struct
32
32
  const :line_items, T.nilable(T::Array[Inttegro::Shared::LineItem]), default: nil
33
33
  const :total, T.nilable(Inttegro::Money::Amount), default: nil
34
+
35
+ extend T::Sig
36
+
37
+ sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
38
+ def self.from_hash(hash, strict = false)
39
+ data = hash.dup
40
+ if (line_items_value = data["line_items"]).is_a?(Array)
41
+ data["line_items"] = line_items_value.map do |item|
42
+ next item unless item.is_a?(Hash)
43
+ case item["type"]
44
+ when "product"
45
+ Inttegro::Product::LineItem.from_hash(item)
46
+ when "fee"
47
+ Inttegro::Shared::FeeLineItem.from_hash(item)
48
+ when "shipping"
49
+ Inttegro::Shared::ShippingLineItem.from_hash(item)
50
+ else
51
+ item
52
+ end
53
+ end
54
+ end
55
+ super(data, strict)
56
+ end
34
57
  end
35
58
  end
36
59
  end
@@ -8,6 +8,7 @@ require_relative "../custom_data"
8
8
  require_relative "../message_template/reference"
9
9
  require_relative "email_message_input"
10
10
  require_relative "recipient"
11
+ require_relative "send_request_cooldown"
11
12
  require_relative "send_request_request_meta"
12
13
 
13
14
  module Inttegro
@@ -57,6 +58,13 @@ module Inttegro
57
58
  # Optional in the API payload; omitted values default to `nil`. Wire name: `purpose`.
58
59
  # @return [String, nil]
59
60
  #
61
+ # @!attribute [r] cooldown
62
+ # Optional application-scoped delivery cooldown. A repeat send with the same key is rejected
63
+ # until the duration elapses.
64
+ #
65
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `cooldown`.
66
+ # @return [Inttegro::Chime::SendRequestCooldown, nil]
67
+ #
60
68
  # @!attribute [r] custom_data
61
69
  # Merchant-defined string values attached to a resource. SDKs expose this as a semantic
62
70
  # collection rather than a raw map.
@@ -76,6 +84,7 @@ module Inttegro
76
84
  const :message_template, T.nilable(Inttegro::MessageTemplate::Reference), default: nil
77
85
  const :sender_id, T.nilable(String), default: nil
78
86
  const :purpose, T.nilable(String), default: nil
87
+ const :cooldown, T.nilable(Inttegro::Chime::SendRequestCooldown), default: nil
79
88
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
80
89
  const :request_meta, T.nilable(Inttegro::Chime::SendRequestRequestMeta), default: nil
81
90
  end
@@ -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
+
8
+ module Inttegro
9
+ class Chime
10
+ # Optional application-scoped delivery cooldown. A repeat send with the same key is rejected
11
+ # until the duration elapses.
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] key
20
+ # Stable identifier for the notification being sent.
21
+ #
22
+ # Required in the API payload. Wire name: `key`.
23
+ # @return [String]
24
+ #
25
+ # @!attribute [r] duration_seconds
26
+ # Rolling cooldown from the first accepted send attempt.
27
+ #
28
+ # Required in the API payload. Wire name: `duration_seconds`.
29
+ # @return [Integer]
30
+ class SendRequestCooldown < T::Struct
31
+ const :key, String
32
+ const :duration_seconds, Integer
33
+ end
34
+ end
35
+ end
@@ -7,7 +7,8 @@ require_relative "base"
7
7
 
8
8
  module Inttegro
9
9
  class Chime
10
- # String-backed values accepted by the Inttegro API for Inttegro::Chime::Transport.
10
+ # Optional delivery transport. When omitted, an email address selects email and a phone number
11
+ # selects SMS.
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.
@@ -40,8 +40,8 @@ require_relative "../message_template/variable_item_type"
40
40
  require_relative "../message_template/variable_type"
41
41
  require_relative "../money/currency"
42
42
  require_relative "../otp/alphabet_type"
43
+ require_relative "../otp/purpose"
43
44
  require_relative "../otp/status"
44
- require_relative "../otp/transmission_sent_via"
45
45
  require_relative "../otp/transmission_status"
46
46
  require_relative "../otp/verification_verdict"
47
47
  require_relative "../order/created_from_resource_type"
@@ -69,11 +69,22 @@ require_relative "../product/type"
69
69
  require_relative "../purchase_intent/status"
70
70
  require_relative "../refund/failure_reason"
71
71
  require_relative "../refund/offline_settlement_type"
72
+ require_relative "../refund/order_fee_line_item_type"
73
+ require_relative "../refund/order_product_line_item_type"
74
+ require_relative "../refund/order_shipping_line_item_type"
72
75
  require_relative "../refund/payment_method_settlement_type"
73
76
  require_relative "../refund/reason"
74
77
  require_relative "../refund/settlement_bank_account_payment_method_type"
75
78
  require_relative "../refund/settlement_mobile_money_payment_method_type"
76
79
  require_relative "../refund/status"
80
+ require_relative "../search/filter_operator"
81
+ require_relative "../search/freshness_state"
82
+ require_relative "../search/resource_freshness_state"
83
+ require_relative "../search/resource_total_relation"
84
+ require_relative "../search/sort_direction"
85
+ require_relative "../search/sort_field"
86
+ require_relative "../search/total_relation"
87
+ require_relative "../search/type"
77
88
  require_relative "../secret_key/auth_result"
78
89
  require_relative "../secret_key/status"
79
90
  require_relative "../secret_key/token_type"
@@ -94,6 +94,9 @@ require_relative "../product/catalog_with_price_reference"
94
94
  require_relative "../checkout/payment_address"
95
95
  require_relative "../checkout/billing_details"
96
96
  require_relative "../checkout/confirm_payment_request"
97
+ require_relative "../order/document_delivery_channel_summary"
98
+ require_relative "../order/document_delivery_summary_channels"
99
+ require_relative "../order/document_delivery_summary"
97
100
  require_relative "../checkout/invoice_view_format_web"
98
101
  require_relative "../checkout/invoice_view_format_pdf"
99
102
  require_relative "../checkout/invoice_view_format_receipt"
@@ -142,9 +145,17 @@ require_relative "../order/created_from"
142
145
  require_relative "../order/address"
143
146
  require_relative "../order/customer"
144
147
  require_relative "../order/document_format"
148
+ require_relative "../order/receipt_document_format"
145
149
  require_relative "../order/invoice_format"
146
150
  require_relative "../order/invoice"
147
151
  require_relative "../refund/failure"
152
+ require_relative "../refund/order_product_line_item_product"
153
+ require_relative "../refund/order_product_line_item"
154
+ require_relative "../refund/order_fee_line_item_fee"
155
+ require_relative "../refund/order_fee_line_item"
156
+ require_relative "../refund/order_shipping_line_item_shipping"
157
+ require_relative "../refund/order_shipping_line_item"
158
+ require_relative "../refund/order_line_item"
148
159
  require_relative "../refund/line_item"
149
160
  require_relative "../refund/offline_settlement"
150
161
  require_relative "../refund/settlement_mobile_money_payment_method_mobile_money"
@@ -483,6 +494,20 @@ require_relative "../refund/page_response"
483
494
  require_relative "../refund/response"
484
495
  require_relative "../message_template/render_preview_request"
485
496
  require_relative "../shared/request_confirmation_request"
497
+ require_relative "../search/facet"
498
+ require_relative "../search/facet_bucket"
499
+ require_relative "../search/facet_result"
500
+ require_relative "../search/filter"
501
+ require_relative "../search/resource_freshness"
502
+ require_relative "../search/freshness"
503
+ require_relative "../search/sort"
504
+ require_relative "../search/total"
505
+ require_relative "../search/resource_total"
506
+ require_relative "../search/resource_reference"
507
+ require_relative "../search/result"
508
+ require_relative "../search/page"
509
+ require_relative "../search/request"
510
+ require_relative "../search/response"
486
511
  require_relative "../shared/response_meta"
487
512
  require_relative "../upload_request/review_reason_input"
488
513
  require_relative "../upload_request/review_attempt_by_id_request"
@@ -503,6 +528,7 @@ require_relative "../secret_key/usage_row"
503
528
  require_relative "../secret_key/usage_page"
504
529
  require_relative "../secret_key/usage"
505
530
  require_relative "../secret_key/usage_request"
531
+ require_relative "../chime/send_request_cooldown"
506
532
  require_relative "../chime/send_request_request_meta"
507
533
  require_relative "../chime/send_request"
508
534
  require_relative "../payout/set_destinations_request"
@@ -126,7 +126,12 @@ module Inttegro
126
126
  "/prices/activate" => Inttegro::Price::Response,
127
127
  "/prices/deactivate" => Inttegro::Price::Response,
128
128
  "/prices/archive" => Inttegro::Price::Response,
129
- "/spec/countries" => Inttegro::Shared::CountrySpecifications
129
+ "/spec/countries" => Inttegro::Shared::CountrySpecifications,
130
+ "/customers/search" => Inttegro::Search::Response,
131
+ "/financial_accounts/search" => Inttegro::Search::Response,
132
+ "/orders/search" => Inttegro::Search::Response,
133
+ "/payouts/search" => Inttegro::Search::Response,
134
+ "/products/search" => Inttegro::Search::Response
130
135
  }.freeze, T::Hash[String, T::Class[T::Struct]])
131
136
 
132
137
  REQUEST_TYPE_NAMES = T.let({
@@ -246,7 +251,12 @@ module Inttegro
246
251
  "/prices/activate" => "Inttegro::Price::ActionRequest",
247
252
  "/prices/deactivate" => "Inttegro::Price::ActionRequest",
248
253
  "/prices/archive" => "Inttegro::Price::ActionRequest",
249
- "/spec/countries" => "Inttegro::Shared::ListCountrySpecsRequest"
254
+ "/spec/countries" => "Inttegro::Shared::ListCountrySpecsRequest",
255
+ "/customers/search" => "Inttegro::Search::Request",
256
+ "/financial_accounts/search" => "Inttegro::Search::Request",
257
+ "/orders/search" => "Inttegro::Search::Request",
258
+ "/payouts/search" => "Inttegro::Search::Request",
259
+ "/products/search" => "Inttegro::Search::Request"
250
260
  }.freeze, T::Hash[String, String])
251
261
 
252
262
  OPERATION_IDS = T.let({
@@ -370,7 +380,12 @@ module Inttegro
370
380
  "/prices/activate" => "activatePrice",
371
381
  "/prices/deactivate" => "deactivatePrice",
372
382
  "/prices/archive" => "archivePrice",
373
- "/spec/countries" => "listCountrySpecs"
383
+ "/spec/countries" => "listCountrySpecs",
384
+ "/customers/search" => "searchCustomers",
385
+ "/financial_accounts/search" => "searchFinancialAccounts",
386
+ "/orders/search" => "searchOrders",
387
+ "/payouts/search" => "searchPayouts",
388
+ "/products/search" => "searchProducts"
374
389
  }.freeze, T::Hash[String, String])
375
390
 
376
391
  BINARY_PATHS = T.let(["/files/contents", "/file_links/open"].freeze, T::Array[String])
@@ -520,7 +520,7 @@ module Inttegro
520
520
  path_or_url
521
521
  end
522
522
  action = path.split("/").reject(&:empty?).last
523
- !["", nil, "lookup", "page", "settings", "countries", "contents", "balances", "render_preview"].include?(action)
523
+ !["", nil, "lookup", "page", "search", "settings", "countries", "contents", "balances", "render_preview"].include?(action)
524
524
  rescue URI::InvalidURIError
525
525
  false
526
526
  end
@@ -143,6 +143,29 @@ module Inttegro
143
143
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
144
144
  const :billing_details, T.nilable(Inttegro::Shared::BillingDetails), default: nil
145
145
  const :shipping, T.nilable(Inttegro::Shared::Shipping), default: nil
146
+
147
+ extend T::Sig
148
+
149
+ sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
150
+ def self.from_hash(hash, strict = false)
151
+ data = hash.dup
152
+ if (line_items_value = data["line_items"]).is_a?(Array)
153
+ data["line_items"] = line_items_value.map do |item|
154
+ next item unless item.is_a?(Hash)
155
+ case item["type"]
156
+ when "product"
157
+ Inttegro::Product::LineItem.from_hash(item)
158
+ when "fee"
159
+ Inttegro::Shared::FeeLineItem.from_hash(item)
160
+ when "shipping"
161
+ Inttegro::Shared::ShippingLineItem.from_hash(item)
162
+ else
163
+ item
164
+ end
165
+ end
166
+ end
167
+ super(data, strict)
168
+ end
146
169
  end
147
170
  end
148
171
  end
@@ -145,6 +145,29 @@ module Inttegro
145
145
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
146
146
  const :billing_details, T.nilable(Inttegro::Shared::BillingDetails), default: nil
147
147
  const :shipping, T.nilable(Inttegro::Shared::Shipping), default: nil
148
+
149
+ extend T::Sig
150
+
151
+ sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
152
+ def self.from_hash(hash, strict = false)
153
+ data = hash.dup
154
+ if (line_items_value = data["line_items"]).is_a?(Array)
155
+ data["line_items"] = line_items_value.map do |item|
156
+ next item unless item.is_a?(Hash)
157
+ case item["type"]
158
+ when "product"
159
+ Inttegro::Product::LineItem.from_hash(item)
160
+ when "fee"
161
+ Inttegro::Shared::FeeLineItem.from_hash(item)
162
+ when "shipping"
163
+ Inttegro::Shared::ShippingLineItem.from_hash(item)
164
+ else
165
+ item
166
+ end
167
+ end
168
+ end
169
+ super(data, strict)
170
+ end
148
171
  end
149
172
  end
150
173
  end
@@ -16,6 +16,12 @@ module Inttegro
16
16
  #
17
17
  # @api public
18
18
  #
19
+ # @!attribute [r] accepted_at
20
+ # Authoritative time at which Chime accepted this channel delivery.
21
+ #
22
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `accepted_at`.
23
+ # @return [Time, nil]
24
+ #
19
25
  # @!attribute [r] channel
20
26
  # Delivery channel.
21
27
  #
@@ -28,6 +34,7 @@ module Inttegro
28
34
  # Optional in the API payload; omitted values default to `nil`. Wire name: `chime_id`.
29
35
  # @return [String, nil]
30
36
  class DocumentDeliveryAttempt < T::Struct
37
+ const :accepted_at, T.nilable(Time), default: nil
31
38
  const :channel, T.nilable(Inttegro::Shared::DeliveryChannel), default: nil
32
39
  const :chime_id, T.nilable(String), default: nil
33
40
  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 Order
10
+ # Bounded aggregate of Chime-accepted sends through one channel.
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] count
19
+ # Number of deliveries accepted through this channel.
20
+ #
21
+ # Required in the API payload. Wire name: `count`.
22
+ # @return [Integer]
23
+ #
24
+ # @!attribute [r] latest_sent_at
25
+ # Latest authoritative Chime acceptance time for this channel.
26
+ #
27
+ # Required in the API payload. Wire name: `latest_sent_at`.
28
+ # @return [Time]
29
+ class DocumentDeliveryChannelSummary < T::Struct
30
+ const :count, Integer
31
+ const :latest_sent_at, Time
32
+ end
33
+ end
34
+ 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 "document_delivery_summary_channels"
8
+
9
+ module Inttegro
10
+ class Order
11
+ # Bounded aggregate of Chime-accepted sends for one generated order document.
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] channels
20
+ # Accepted send totals grouped by delivery channel. Channels with no accepted sends are
21
+ # omitted.
22
+ #
23
+ # Required in the API payload. Wire name: `channels`.
24
+ # @return [Inttegro::Order::DocumentDeliverySummaryChannels]
25
+ #
26
+ # @!attribute [r] latest_sent_at
27
+ # Latest authoritative Chime acceptance time across all channels.
28
+ #
29
+ # Required in the API payload. Wire name: `latest_sent_at`.
30
+ # @return [Time]
31
+ #
32
+ # @!attribute [r] total_count
33
+ # Total channel deliveries accepted for this document.
34
+ #
35
+ # Required in the API payload. Wire name: `total_count`.
36
+ # @return [Integer]
37
+ class DocumentDeliverySummary < T::Struct
38
+ const :channels, Inttegro::Order::DocumentDeliverySummaryChannels
39
+ const :latest_sent_at, Time
40
+ const :total_count, Integer
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,36 @@
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_channel_summary"
8
+
9
+ module Inttegro
10
+ class Order
11
+ # Accepted send totals grouped by delivery channel. Channels with no accepted sends are
12
+ # omitted.
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] email
21
+ # Bounded aggregate of Chime-accepted sends through one channel.
22
+ #
23
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `email`.
24
+ # @return [Inttegro::Order::DocumentDeliveryChannelSummary, nil]
25
+ #
26
+ # @!attribute [r] sms
27
+ # Bounded aggregate of Chime-accepted sends through one channel.
28
+ #
29
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `sms`.
30
+ # @return [Inttegro::Order::DocumentDeliveryChannelSummary, nil]
31
+ class DocumentDeliverySummaryChannels < T::Struct
32
+ const :email, T.nilable(Inttegro::Order::DocumentDeliveryChannelSummary), default: nil
33
+ const :sms, T.nilable(Inttegro::Order::DocumentDeliveryChannelSummary), default: nil
34
+ end
35
+ end
36
+ end
@@ -4,6 +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 "document_delivery_summary"
7
8
  require_relative "invoice_format"
8
9
 
9
10
  module Inttegro
@@ -16,6 +17,12 @@ module Inttegro
16
17
  #
17
18
  # @api public
18
19
  #
20
+ # @!attribute [r] delivery_summary
21
+ # Bounded aggregate of Chime-accepted sends for one generated order document.
22
+ #
23
+ # Optional in the API payload; omitted values default to `nil`. Wire name: `delivery_summary`.
24
+ # @return [Inttegro::Order::DocumentDeliverySummary, nil]
25
+ #
19
26
  # @!attribute [r] number
20
27
  # Value of the `number` field in the Inttegro API payload.
21
28
  #
@@ -28,6 +35,7 @@ module Inttegro
28
35
  # Required in the API payload. Wire name: `format`.
29
36
  # @return [Inttegro::Order::InvoiceFormat]
30
37
  class Invoice < T::Struct
38
+ const :delivery_summary, T.nilable(Inttegro::Order::DocumentDeliverySummary), default: nil
31
39
  const :number, T.nilable(String), default: nil
32
40
  const :format_value, Inttegro::Order::InvoiceFormat, name: "format"
33
41
  end
@@ -5,6 +5,7 @@
5
5
 
6
6
  require_relative "base"
7
7
  require_relative "document_format"
8
+ require_relative "receipt_document_format"
8
9
 
9
10
  module Inttegro
10
11
  class Order
@@ -32,11 +33,11 @@ module Inttegro
32
33
  # Value of the `receipt` field in the Inttegro API payload.
33
34
  #
34
35
  # Optional in the API payload; omitted values default to `nil`. Wire name: `receipt`.
35
- # @return [Inttegro::Order::DocumentFormat, nil]
36
+ # @return [Inttegro::Order::ReceiptDocumentFormat, nil]
36
37
  class InvoiceFormat < T::Struct
37
38
  const :web, Inttegro::Order::DocumentFormat
38
39
  const :pdf, Inttegro::Order::DocumentFormat
39
- const :receipt, T.nilable(Inttegro::Order::DocumentFormat), default: nil
40
+ const :receipt, T.nilable(Inttegro::Order::ReceiptDocumentFormat), default: nil
40
41
  end
41
42
  end
42
43
  end
@@ -31,6 +31,31 @@ module Inttegro
31
31
  class LineItemGroup < T::Struct
32
32
  const :line_items, T::Array[Inttegro::Order::LineItem]
33
33
  const :total, Inttegro::Money::Amount
34
+
35
+ extend T::Sig
36
+
37
+ sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
38
+ def self.from_hash(hash, strict = false)
39
+ data = hash.dup
40
+ if (line_items_value = data["line_items"]).is_a?(Array)
41
+ data["line_items"] = line_items_value.map do |item|
42
+ next item unless item.is_a?(Hash)
43
+ case item["type"]
44
+ when "product"
45
+ Inttegro::Order::ProductLineItem.from_hash(item)
46
+ when "fee"
47
+ Inttegro::Order::FeeLineItem.from_hash(item)
48
+ when "shipping"
49
+ Inttegro::Order::ShippingLineItem.from_hash(item)
50
+ when "discount"
51
+ Inttegro::Order::DiscountLineItem.from_hash(item)
52
+ else
53
+ item
54
+ end
55
+ end
56
+ end
57
+ super(data, strict)
58
+ end
34
59
  end
35
60
  end
36
61
  end
@@ -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