yoomoney 0.2.0 → 0.3.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.
@@ -0,0 +1,185 @@
1
+ # typed: strong
2
+
3
+ module Yoomoney
4
+ module Models
5
+ class ReceiptDataItem < Yoomoney::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Yoomoney::ReceiptDataItem, Yoomoney::Internal::AnyHash)
9
+ end
10
+
11
+ # Сумма.
12
+ sig { returns(Yoomoney::MonetaryAmount) }
13
+ attr_reader :amount
14
+
15
+ sig { params(amount: Yoomoney::MonetaryAmount::OrHash).void }
16
+ attr_writer :amount
17
+
18
+ # Название товара.
19
+ sig { returns(String) }
20
+ attr_accessor :description
21
+
22
+ # Количество.
23
+ sig { returns(Float) }
24
+ attr_accessor :quantity
25
+
26
+ # Ставка НДС.
27
+ sig { returns(Integer) }
28
+ attr_accessor :vat_code
29
+
30
+ sig { returns(T.nilable(String)) }
31
+ attr_reader :country_of_origin_code
32
+
33
+ sig { params(country_of_origin_code: String).void }
34
+ attr_writer :country_of_origin_code
35
+
36
+ sig { returns(T.nilable(String)) }
37
+ attr_reader :customs_declaration_number
38
+
39
+ sig { params(customs_declaration_number: String).void }
40
+ attr_writer :customs_declaration_number
41
+
42
+ sig { returns(T.nilable(String)) }
43
+ attr_reader :excise
44
+
45
+ sig { params(excise: String).void }
46
+ attr_writer :excise
47
+
48
+ sig { returns(T.nilable(Yoomoney::MarkCodeInfo)) }
49
+ attr_reader :mark_code_info
50
+
51
+ sig { params(mark_code_info: Yoomoney::MarkCodeInfo::OrHash).void }
52
+ attr_writer :mark_code_info
53
+
54
+ sig { returns(T.nilable(String)) }
55
+ attr_reader :mark_mode
56
+
57
+ sig { params(mark_mode: String).void }
58
+ attr_writer :mark_mode
59
+
60
+ sig { returns(T.nilable(Yoomoney::MarkQuantity)) }
61
+ attr_reader :mark_quantity
62
+
63
+ sig { params(mark_quantity: Yoomoney::MarkQuantity::OrHash).void }
64
+ attr_writer :mark_quantity
65
+
66
+ sig { returns(T.nilable(Yoomoney::ReceiptItemMeasure::OrSymbol)) }
67
+ attr_reader :measure
68
+
69
+ sig { params(measure: Yoomoney::ReceiptItemMeasure::OrSymbol).void }
70
+ attr_writer :measure
71
+
72
+ sig { returns(T.nilable(Yoomoney::ReceiptItemPaymentMode::OrSymbol)) }
73
+ attr_reader :payment_mode
74
+
75
+ sig do
76
+ params(payment_mode: Yoomoney::ReceiptItemPaymentMode::OrSymbol).void
77
+ end
78
+ attr_writer :payment_mode
79
+
80
+ sig { returns(T.nilable(Yoomoney::ReceiptItemPaymentSubject::OrSymbol)) }
81
+ attr_reader :payment_subject
82
+
83
+ sig do
84
+ params(
85
+ payment_subject: Yoomoney::ReceiptItemPaymentSubject::OrSymbol
86
+ ).void
87
+ end
88
+ attr_writer :payment_subject
89
+
90
+ sig { returns(T.nilable(T::Array[Yoomoney::IndustryDetails])) }
91
+ attr_reader :payment_subject_industry_details
92
+
93
+ sig do
94
+ params(
95
+ payment_subject_industry_details:
96
+ T::Array[Yoomoney::IndustryDetails::OrHash]
97
+ ).void
98
+ end
99
+ attr_writer :payment_subject_industry_details
100
+
101
+ sig { returns(T.nilable(Integer)) }
102
+ attr_reader :planned_status
103
+
104
+ sig { params(planned_status: Integer).void }
105
+ attr_writer :planned_status
106
+
107
+ sig { returns(T.nilable(String)) }
108
+ attr_reader :product_code
109
+
110
+ sig { params(product_code: String).void }
111
+ attr_writer :product_code
112
+
113
+ sig do
114
+ params(
115
+ amount: Yoomoney::MonetaryAmount::OrHash,
116
+ description: String,
117
+ quantity: Float,
118
+ vat_code: Integer,
119
+ country_of_origin_code: String,
120
+ customs_declaration_number: String,
121
+ excise: String,
122
+ mark_code_info: Yoomoney::MarkCodeInfo::OrHash,
123
+ mark_mode: String,
124
+ mark_quantity: Yoomoney::MarkQuantity::OrHash,
125
+ measure: Yoomoney::ReceiptItemMeasure::OrSymbol,
126
+ payment_mode: Yoomoney::ReceiptItemPaymentMode::OrSymbol,
127
+ payment_subject: Yoomoney::ReceiptItemPaymentSubject::OrSymbol,
128
+ payment_subject_industry_details:
129
+ T::Array[Yoomoney::IndustryDetails::OrHash],
130
+ planned_status: Integer,
131
+ product_code: String
132
+ ).returns(T.attached_class)
133
+ end
134
+ def self.new(
135
+ # Сумма.
136
+ amount:,
137
+ # Название товара.
138
+ description:,
139
+ # Количество.
140
+ quantity:,
141
+ # Ставка НДС.
142
+ vat_code:,
143
+ country_of_origin_code: nil,
144
+ customs_declaration_number: nil,
145
+ excise: nil,
146
+ mark_code_info: nil,
147
+ mark_mode: nil,
148
+ mark_quantity: nil,
149
+ measure: nil,
150
+ payment_mode: nil,
151
+ payment_subject: nil,
152
+ payment_subject_industry_details: nil,
153
+ planned_status: nil,
154
+ product_code: nil
155
+ )
156
+ end
157
+
158
+ sig do
159
+ override.returns(
160
+ {
161
+ amount: Yoomoney::MonetaryAmount,
162
+ description: String,
163
+ quantity: Float,
164
+ vat_code: Integer,
165
+ country_of_origin_code: String,
166
+ customs_declaration_number: String,
167
+ excise: String,
168
+ mark_code_info: Yoomoney::MarkCodeInfo,
169
+ mark_mode: String,
170
+ mark_quantity: Yoomoney::MarkQuantity,
171
+ measure: Yoomoney::ReceiptItemMeasure::OrSymbol,
172
+ payment_mode: Yoomoney::ReceiptItemPaymentMode::OrSymbol,
173
+ payment_subject: Yoomoney::ReceiptItemPaymentSubject::OrSymbol,
174
+ payment_subject_industry_details:
175
+ T::Array[Yoomoney::IndustryDetails],
176
+ planned_status: Integer,
177
+ product_code: String
178
+ }
179
+ )
180
+ end
181
+ def to_hash
182
+ end
183
+ end
184
+ end
185
+ end
@@ -3,6 +3,10 @@
3
3
  module Yoomoney
4
4
  Airline = Yoomoney::Models::Airline
5
5
 
6
+ AirlineLeg = Yoomoney::Models::AirlineLeg
7
+
8
+ AirlinePassenger = Yoomoney::Models::AirlinePassenger
9
+
6
10
  B2bSberbankCalculatedVatData = Yoomoney::Models::B2bSberbankCalculatedVatData
7
11
 
8
12
  B2bSberbankMixedVatData = Yoomoney::Models::B2bSberbankMixedVatData
@@ -135,6 +139,8 @@ module Yoomoney
135
139
 
136
140
  ReceiptDataCustomer = Yoomoney::Models::ReceiptDataCustomer
137
141
 
142
+ ReceiptDataItem = Yoomoney::Models::ReceiptDataItem
143
+
138
144
  ReceiptItemAgentType = Yoomoney::Models::ReceiptItemAgentType
139
145
 
140
146
  ReceiptItemMeasure = Yoomoney::Models::ReceiptItemMeasure
@@ -34,6 +34,8 @@ module Yoomoney
34
34
 
35
35
  attr_reader me: Yoomoney::Resources::Me
36
36
 
37
+ private def auth_headers: -> ::Hash[String, String]
38
+
37
39
  def initialize: (
38
40
  ?username: String?,
39
41
  ?password: String?,
@@ -85,6 +85,8 @@ module Yoomoney
85
85
  ?idempotency_header: String?
86
86
  ) -> void
87
87
 
88
+ private def auth_headers: -> ::Hash[String, String]
89
+
88
90
  private def user_agent: -> String
89
91
 
90
92
  private def generate_idempotency_key: -> String
@@ -3,8 +3,8 @@ module Yoomoney
3
3
  type airline =
4
4
  {
5
5
  booking_reference: String,
6
- legs: ::Array[Yoomoney::Airline::Leg],
7
- passengers: ::Array[Yoomoney::Airline::Passenger],
6
+ legs: ::Array[Yoomoney::AirlineLeg],
7
+ passengers: ::Array[Yoomoney::AirlinePassenger],
8
8
  ticket_number: String
9
9
  }
10
10
 
@@ -13,17 +13,17 @@ module Yoomoney
13
13
 
14
14
  def booking_reference=: (String) -> String
15
15
 
16
- attr_reader legs: ::Array[Yoomoney::Airline::Leg]?
16
+ attr_reader legs: ::Array[Yoomoney::AirlineLeg]?
17
17
 
18
18
  def legs=: (
19
- ::Array[Yoomoney::Airline::Leg]
20
- ) -> ::Array[Yoomoney::Airline::Leg]
19
+ ::Array[Yoomoney::AirlineLeg]
20
+ ) -> ::Array[Yoomoney::AirlineLeg]
21
21
 
22
- attr_reader passengers: ::Array[Yoomoney::Airline::Passenger]?
22
+ attr_reader passengers: ::Array[Yoomoney::AirlinePassenger]?
23
23
 
24
24
  def passengers=: (
25
- ::Array[Yoomoney::Airline::Passenger]
26
- ) -> ::Array[Yoomoney::Airline::Passenger]
25
+ ::Array[Yoomoney::AirlinePassenger]
26
+ ) -> ::Array[Yoomoney::AirlinePassenger]
27
27
 
28
28
  attr_reader ticket_number: String?
29
29
 
@@ -31,63 +31,17 @@ module Yoomoney
31
31
 
32
32
  def initialize: (
33
33
  ?booking_reference: String,
34
- ?legs: ::Array[Yoomoney::Airline::Leg],
35
- ?passengers: ::Array[Yoomoney::Airline::Passenger],
34
+ ?legs: ::Array[Yoomoney::AirlineLeg],
35
+ ?passengers: ::Array[Yoomoney::AirlinePassenger],
36
36
  ?ticket_number: String
37
37
  ) -> void
38
38
 
39
39
  def to_hash: -> {
40
40
  booking_reference: String,
41
- legs: ::Array[Yoomoney::Airline::Leg],
42
- passengers: ::Array[Yoomoney::Airline::Passenger],
41
+ legs: ::Array[Yoomoney::AirlineLeg],
42
+ passengers: ::Array[Yoomoney::AirlinePassenger],
43
43
  ticket_number: String
44
44
  }
45
-
46
- type leg =
47
- {
48
- departure_airport: String,
49
- departure_date: String,
50
- destination_airport: String,
51
- carrier_code: String
52
- }
53
-
54
- class Leg < Yoomoney::Internal::Type::BaseModel
55
- attr_accessor departure_airport: String
56
-
57
- attr_accessor departure_date: String
58
-
59
- attr_accessor destination_airport: String
60
-
61
- attr_reader carrier_code: String?
62
-
63
- def carrier_code=: (String) -> String
64
-
65
- def initialize: (
66
- departure_airport: String,
67
- departure_date: String,
68
- destination_airport: String,
69
- ?carrier_code: String
70
- ) -> void
71
-
72
- def to_hash: -> {
73
- departure_airport: String,
74
- departure_date: String,
75
- destination_airport: String,
76
- carrier_code: String
77
- }
78
- end
79
-
80
- type passenger = { first_name: String, last_name: String }
81
-
82
- class Passenger < Yoomoney::Internal::Type::BaseModel
83
- attr_accessor first_name: String
84
-
85
- attr_accessor last_name: String
86
-
87
- def initialize: (first_name: String, last_name: String) -> void
88
-
89
- def to_hash: -> { first_name: String, last_name: String }
90
- end
91
45
  end
92
46
  end
93
47
  end
@@ -0,0 +1,37 @@
1
+ module Yoomoney
2
+ module Models
3
+ type airline_leg =
4
+ {
5
+ departure_airport: String,
6
+ departure_date: String,
7
+ destination_airport: String,
8
+ carrier_code: String
9
+ }
10
+
11
+ class AirlineLeg < Yoomoney::Internal::Type::BaseModel
12
+ attr_accessor departure_airport: String
13
+
14
+ attr_accessor departure_date: String
15
+
16
+ attr_accessor destination_airport: String
17
+
18
+ attr_reader carrier_code: String?
19
+
20
+ def carrier_code=: (String) -> String
21
+
22
+ def initialize: (
23
+ departure_airport: String,
24
+ departure_date: String,
25
+ destination_airport: String,
26
+ ?carrier_code: String
27
+ ) -> void
28
+
29
+ def to_hash: -> {
30
+ departure_airport: String,
31
+ departure_date: String,
32
+ destination_airport: String,
33
+ carrier_code: String
34
+ }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,15 @@
1
+ module Yoomoney
2
+ module Models
3
+ type airline_passenger = { first_name: String, last_name: String }
4
+
5
+ class AirlinePassenger < Yoomoney::Internal::Type::BaseModel
6
+ attr_accessor first_name: String
7
+
8
+ attr_accessor last_name: String
9
+
10
+ def initialize: (first_name: String, last_name: String) -> void
11
+
12
+ def to_hash: -> { first_name: String, last_name: String }
13
+ end
14
+ end
15
+ end
@@ -118,149 +118,37 @@ module Yoomoney
118
118
 
119
119
  type item =
120
120
  {
121
- amount: Yoomoney::MonetaryAmount,
122
- description: String,
123
- quantity: Float,
124
- vat_code: Integer,
125
121
  additional_payment_subject_props: String,
126
122
  agent_type: Yoomoney::Models::receipt_item_agent_type,
127
- country_of_origin_code: String,
128
- customs_declaration_number: String,
129
- excise: String,
130
- mark_code_info: Yoomoney::MarkCodeInfo,
131
- mark_mode: String,
132
- mark_quantity: Yoomoney::MarkQuantity,
133
- measure: Yoomoney::Models::receipt_item_measure,
134
- payment_mode: Yoomoney::Models::receipt_item_payment_mode,
135
- payment_subject: Yoomoney::Models::receipt_item_payment_subject,
136
- payment_subject_industry_details: ::Array[Yoomoney::IndustryDetails],
137
- planned_status: Integer,
138
- product_code: String,
139
123
  supplier: Yoomoney::ReceiptCreateParams::Item::Supplier
140
124
  }
141
125
 
142
- class Item < Yoomoney::Internal::Type::BaseModel
143
- attr_accessor amount: Yoomoney::MonetaryAmount
126
+ class Item < Yoomoney::Models::ReceiptDataItem
127
+ def additional_payment_subject_props: -> String?
144
128
 
145
- attr_accessor description: String
129
+ def additional_payment_subject_props=: (String _) -> String
146
130
 
147
- attr_accessor quantity: Float
148
-
149
- attr_accessor vat_code: Integer
150
-
151
- attr_reader additional_payment_subject_props: String?
152
-
153
- def additional_payment_subject_props=: (String) -> String
154
-
155
- attr_reader agent_type: Yoomoney::Models::receipt_item_agent_type?
131
+ def agent_type: -> Yoomoney::Models::receipt_item_agent_type?
156
132
 
157
133
  def agent_type=: (
158
- Yoomoney::Models::receipt_item_agent_type
134
+ Yoomoney::Models::receipt_item_agent_type _
159
135
  ) -> Yoomoney::Models::receipt_item_agent_type
160
136
 
161
- attr_reader country_of_origin_code: String?
162
-
163
- def country_of_origin_code=: (String) -> String
164
-
165
- attr_reader customs_declaration_number: String?
166
-
167
- def customs_declaration_number=: (String) -> String
168
-
169
- attr_reader excise: String?
170
-
171
- def excise=: (String) -> String
172
-
173
- attr_reader mark_code_info: Yoomoney::MarkCodeInfo?
174
-
175
- def mark_code_info=: (Yoomoney::MarkCodeInfo) -> Yoomoney::MarkCodeInfo
176
-
177
- attr_reader mark_mode: String?
178
-
179
- def mark_mode=: (String) -> String
180
-
181
- attr_reader mark_quantity: Yoomoney::MarkQuantity?
182
-
183
- def mark_quantity=: (Yoomoney::MarkQuantity) -> Yoomoney::MarkQuantity
184
-
185
- attr_reader measure: Yoomoney::Models::receipt_item_measure?
186
-
187
- def measure=: (
188
- Yoomoney::Models::receipt_item_measure
189
- ) -> Yoomoney::Models::receipt_item_measure
190
-
191
- attr_reader payment_mode: Yoomoney::Models::receipt_item_payment_mode?
192
-
193
- def payment_mode=: (
194
- Yoomoney::Models::receipt_item_payment_mode
195
- ) -> Yoomoney::Models::receipt_item_payment_mode
196
-
197
- attr_reader payment_subject: Yoomoney::Models::receipt_item_payment_subject?
198
-
199
- def payment_subject=: (
200
- Yoomoney::Models::receipt_item_payment_subject
201
- ) -> Yoomoney::Models::receipt_item_payment_subject
202
-
203
- attr_reader payment_subject_industry_details: ::Array[Yoomoney::IndustryDetails]?
204
-
205
- def payment_subject_industry_details=: (
206
- ::Array[Yoomoney::IndustryDetails]
207
- ) -> ::Array[Yoomoney::IndustryDetails]
208
-
209
- attr_reader planned_status: Integer?
210
-
211
- def planned_status=: (Integer) -> Integer
212
-
213
- attr_reader product_code: String?
214
-
215
- def product_code=: (String) -> String
216
-
217
- attr_reader supplier: Yoomoney::ReceiptCreateParams::Item::Supplier?
137
+ def supplier: -> Yoomoney::ReceiptCreateParams::Item::Supplier?
218
138
 
219
139
  def supplier=: (
220
- Yoomoney::ReceiptCreateParams::Item::Supplier
140
+ Yoomoney::ReceiptCreateParams::Item::Supplier _
221
141
  ) -> Yoomoney::ReceiptCreateParams::Item::Supplier
222
142
 
223
143
  def initialize: (
224
- amount: Yoomoney::MonetaryAmount,
225
- description: String,
226
- quantity: Float,
227
- vat_code: Integer,
228
144
  ?additional_payment_subject_props: String,
229
145
  ?agent_type: Yoomoney::Models::receipt_item_agent_type,
230
- ?country_of_origin_code: String,
231
- ?customs_declaration_number: String,
232
- ?excise: String,
233
- ?mark_code_info: Yoomoney::MarkCodeInfo,
234
- ?mark_mode: String,
235
- ?mark_quantity: Yoomoney::MarkQuantity,
236
- ?measure: Yoomoney::Models::receipt_item_measure,
237
- ?payment_mode: Yoomoney::Models::receipt_item_payment_mode,
238
- ?payment_subject: Yoomoney::Models::receipt_item_payment_subject,
239
- ?payment_subject_industry_details: ::Array[Yoomoney::IndustryDetails],
240
- ?planned_status: Integer,
241
- ?product_code: String,
242
146
  ?supplier: Yoomoney::ReceiptCreateParams::Item::Supplier
243
147
  ) -> void
244
148
 
245
149
  def to_hash: -> {
246
- amount: Yoomoney::MonetaryAmount,
247
- description: String,
248
- quantity: Float,
249
- vat_code: Integer,
250
150
  additional_payment_subject_props: String,
251
151
  agent_type: Yoomoney::Models::receipt_item_agent_type,
252
- country_of_origin_code: String,
253
- customs_declaration_number: String,
254
- excise: String,
255
- mark_code_info: Yoomoney::MarkCodeInfo,
256
- mark_mode: String,
257
- mark_quantity: Yoomoney::MarkQuantity,
258
- measure: Yoomoney::Models::receipt_item_measure,
259
- payment_mode: Yoomoney::Models::receipt_item_payment_mode,
260
- payment_subject: Yoomoney::Models::receipt_item_payment_subject,
261
- payment_subject_industry_details: ::Array[Yoomoney::IndustryDetails],
262
- planned_status: Integer,
263
- product_code: String,
264
152
  supplier: Yoomoney::ReceiptCreateParams::Item::Supplier
265
153
  }
266
154