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.
@@ -171,6 +171,11 @@ module Yoomoney
171
171
  )
172
172
  end
173
173
 
174
+ # @api private
175
+ sig { overridable.returns(T::Hash[String, String]) }
176
+ private def auth_headers
177
+ end
178
+
174
179
  # @api private
175
180
  sig { returns(String) }
176
181
  private def user_agent
@@ -12,17 +12,17 @@ module Yoomoney
12
12
  sig { params(booking_reference: String).void }
13
13
  attr_writer :booking_reference
14
14
 
15
- sig { returns(T.nilable(T::Array[Yoomoney::Airline::Leg])) }
15
+ sig { returns(T.nilable(T::Array[Yoomoney::AirlineLeg])) }
16
16
  attr_reader :legs
17
17
 
18
- sig { params(legs: T::Array[Yoomoney::Airline::Leg::OrHash]).void }
18
+ sig { params(legs: T::Array[Yoomoney::AirlineLeg::OrHash]).void }
19
19
  attr_writer :legs
20
20
 
21
- sig { returns(T.nilable(T::Array[Yoomoney::Airline::Passenger])) }
21
+ sig { returns(T.nilable(T::Array[Yoomoney::AirlinePassenger])) }
22
22
  attr_reader :passengers
23
23
 
24
24
  sig do
25
- params(passengers: T::Array[Yoomoney::Airline::Passenger::OrHash]).void
25
+ params(passengers: T::Array[Yoomoney::AirlinePassenger::OrHash]).void
26
26
  end
27
27
  attr_writer :passengers
28
28
 
@@ -35,8 +35,8 @@ module Yoomoney
35
35
  sig do
36
36
  params(
37
37
  booking_reference: String,
38
- legs: T::Array[Yoomoney::Airline::Leg::OrHash],
39
- passengers: T::Array[Yoomoney::Airline::Passenger::OrHash],
38
+ legs: T::Array[Yoomoney::AirlineLeg::OrHash],
39
+ passengers: T::Array[Yoomoney::AirlinePassenger::OrHash],
40
40
  ticket_number: String
41
41
  ).returns(T.attached_class)
42
42
  end
@@ -52,90 +52,14 @@ module Yoomoney
52
52
  override.returns(
53
53
  {
54
54
  booking_reference: String,
55
- legs: T::Array[Yoomoney::Airline::Leg],
56
- passengers: T::Array[Yoomoney::Airline::Passenger],
55
+ legs: T::Array[Yoomoney::AirlineLeg],
56
+ passengers: T::Array[Yoomoney::AirlinePassenger],
57
57
  ticket_number: String
58
58
  }
59
59
  )
60
60
  end
61
61
  def to_hash
62
62
  end
63
-
64
- class Leg < Yoomoney::Internal::Type::BaseModel
65
- OrHash =
66
- T.type_alias do
67
- T.any(Yoomoney::Airline::Leg, Yoomoney::Internal::AnyHash)
68
- end
69
-
70
- sig { returns(String) }
71
- attr_accessor :departure_airport
72
-
73
- sig { returns(String) }
74
- attr_accessor :departure_date
75
-
76
- sig { returns(String) }
77
- attr_accessor :destination_airport
78
-
79
- sig { returns(T.nilable(String)) }
80
- attr_reader :carrier_code
81
-
82
- sig { params(carrier_code: String).void }
83
- attr_writer :carrier_code
84
-
85
- sig do
86
- params(
87
- departure_airport: String,
88
- departure_date: String,
89
- destination_airport: String,
90
- carrier_code: String
91
- ).returns(T.attached_class)
92
- end
93
- def self.new(
94
- departure_airport:,
95
- departure_date:,
96
- destination_airport:,
97
- carrier_code: nil
98
- )
99
- end
100
-
101
- sig do
102
- override.returns(
103
- {
104
- departure_airport: String,
105
- departure_date: String,
106
- destination_airport: String,
107
- carrier_code: String
108
- }
109
- )
110
- end
111
- def to_hash
112
- end
113
- end
114
-
115
- class Passenger < Yoomoney::Internal::Type::BaseModel
116
- OrHash =
117
- T.type_alias do
118
- T.any(Yoomoney::Airline::Passenger, Yoomoney::Internal::AnyHash)
119
- end
120
-
121
- sig { returns(String) }
122
- attr_accessor :first_name
123
-
124
- sig { returns(String) }
125
- attr_accessor :last_name
126
-
127
- sig do
128
- params(first_name: String, last_name: String).returns(
129
- T.attached_class
130
- )
131
- end
132
- def self.new(first_name:, last_name:)
133
- end
134
-
135
- sig { override.returns({ first_name: String, last_name: String }) }
136
- def to_hash
137
- end
138
- end
139
63
  end
140
64
  end
141
65
  end
@@ -0,0 +1,56 @@
1
+ # typed: strong
2
+
3
+ module Yoomoney
4
+ module Models
5
+ class AirlineLeg < Yoomoney::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Yoomoney::AirlineLeg, Yoomoney::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(String) }
12
+ attr_accessor :departure_airport
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :departure_date
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :destination_airport
19
+
20
+ sig { returns(T.nilable(String)) }
21
+ attr_reader :carrier_code
22
+
23
+ sig { params(carrier_code: String).void }
24
+ attr_writer :carrier_code
25
+
26
+ sig do
27
+ params(
28
+ departure_airport: String,
29
+ departure_date: String,
30
+ destination_airport: String,
31
+ carrier_code: String
32
+ ).returns(T.attached_class)
33
+ end
34
+ def self.new(
35
+ departure_airport:,
36
+ departure_date:,
37
+ destination_airport:,
38
+ carrier_code: nil
39
+ )
40
+ end
41
+
42
+ sig do
43
+ override.returns(
44
+ {
45
+ departure_airport: String,
46
+ departure_date: String,
47
+ destination_airport: String,
48
+ carrier_code: String
49
+ }
50
+ )
51
+ end
52
+ def to_hash
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,28 @@
1
+ # typed: strong
2
+
3
+ module Yoomoney
4
+ module Models
5
+ class AirlinePassenger < Yoomoney::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Yoomoney::AirlinePassenger, Yoomoney::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(String) }
12
+ attr_accessor :first_name
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :last_name
16
+
17
+ sig do
18
+ params(first_name: String, last_name: String).returns(T.attached_class)
19
+ end
20
+ def self.new(first_name:, last_name:)
21
+ end
22
+
23
+ sig { override.returns({ first_name: String, last_name: String }) }
24
+ def to_hash
25
+ end
26
+ end
27
+ end
28
+ end
@@ -196,7 +196,7 @@ module Yoomoney
196
196
  def to_hash
197
197
  end
198
198
 
199
- class Item < Yoomoney::Internal::Type::BaseModel
199
+ class Item < Yoomoney::Models::ReceiptDataItem
200
200
  OrHash =
201
201
  T.type_alias do
202
202
  T.any(
@@ -205,25 +205,6 @@ module Yoomoney
205
205
  )
206
206
  end
207
207
 
208
- # Сумма.
209
- sig { returns(Yoomoney::MonetaryAmount) }
210
- attr_reader :amount
211
-
212
- sig { params(amount: Yoomoney::MonetaryAmount::OrHash).void }
213
- attr_writer :amount
214
-
215
- # Название товара.
216
- sig { returns(String) }
217
- attr_accessor :description
218
-
219
- # Количество.
220
- sig { returns(Float) }
221
- attr_accessor :quantity
222
-
223
- # Ставка НДС.
224
- sig { returns(Integer) }
225
- attr_accessor :vat_code
226
-
227
208
  # Дополнительный реквизит предмета расчета.
228
209
  sig { returns(T.nilable(String)) }
229
210
  attr_reader :additional_payment_subject_props
@@ -239,91 +220,6 @@ module Yoomoney
239
220
  end
240
221
  attr_writer :agent_type
241
222
 
242
- sig { returns(T.nilable(String)) }
243
- attr_reader :country_of_origin_code
244
-
245
- sig { params(country_of_origin_code: String).void }
246
- attr_writer :country_of_origin_code
247
-
248
- sig { returns(T.nilable(String)) }
249
- attr_reader :customs_declaration_number
250
-
251
- sig { params(customs_declaration_number: String).void }
252
- attr_writer :customs_declaration_number
253
-
254
- sig { returns(T.nilable(String)) }
255
- attr_reader :excise
256
-
257
- sig { params(excise: String).void }
258
- attr_writer :excise
259
-
260
- sig { returns(T.nilable(Yoomoney::MarkCodeInfo)) }
261
- attr_reader :mark_code_info
262
-
263
- sig { params(mark_code_info: Yoomoney::MarkCodeInfo::OrHash).void }
264
- attr_writer :mark_code_info
265
-
266
- sig { returns(T.nilable(String)) }
267
- attr_reader :mark_mode
268
-
269
- sig { params(mark_mode: String).void }
270
- attr_writer :mark_mode
271
-
272
- sig { returns(T.nilable(Yoomoney::MarkQuantity)) }
273
- attr_reader :mark_quantity
274
-
275
- sig { params(mark_quantity: Yoomoney::MarkQuantity::OrHash).void }
276
- attr_writer :mark_quantity
277
-
278
- sig { returns(T.nilable(Yoomoney::ReceiptItemMeasure::OrSymbol)) }
279
- attr_reader :measure
280
-
281
- sig { params(measure: Yoomoney::ReceiptItemMeasure::OrSymbol).void }
282
- attr_writer :measure
283
-
284
- sig { returns(T.nilable(Yoomoney::ReceiptItemPaymentMode::OrSymbol)) }
285
- attr_reader :payment_mode
286
-
287
- sig do
288
- params(payment_mode: Yoomoney::ReceiptItemPaymentMode::OrSymbol).void
289
- end
290
- attr_writer :payment_mode
291
-
292
- sig do
293
- returns(T.nilable(Yoomoney::ReceiptItemPaymentSubject::OrSymbol))
294
- end
295
- attr_reader :payment_subject
296
-
297
- sig do
298
- params(
299
- payment_subject: Yoomoney::ReceiptItemPaymentSubject::OrSymbol
300
- ).void
301
- end
302
- attr_writer :payment_subject
303
-
304
- sig { returns(T.nilable(T::Array[Yoomoney::IndustryDetails])) }
305
- attr_reader :payment_subject_industry_details
306
-
307
- sig do
308
- params(
309
- payment_subject_industry_details:
310
- T::Array[Yoomoney::IndustryDetails::OrHash]
311
- ).void
312
- end
313
- attr_writer :payment_subject_industry_details
314
-
315
- sig { returns(T.nilable(Integer)) }
316
- attr_reader :planned_status
317
-
318
- sig { params(planned_status: Integer).void }
319
- attr_writer :planned_status
320
-
321
- sig { returns(T.nilable(String)) }
322
- attr_reader :product_code
323
-
324
- sig { params(product_code: String).void }
325
- attr_writer :product_code
326
-
327
223
  sig do
328
224
  returns(T.nilable(Yoomoney::ReceiptCreateParams::Item::Supplier))
329
225
  end
@@ -338,52 +234,15 @@ module Yoomoney
338
234
 
339
235
  sig do
340
236
  params(
341
- amount: Yoomoney::MonetaryAmount::OrHash,
342
- description: String,
343
- quantity: Float,
344
- vat_code: Integer,
345
237
  additional_payment_subject_props: String,
346
238
  agent_type: Yoomoney::ReceiptItemAgentType::OrSymbol,
347
- country_of_origin_code: String,
348
- customs_declaration_number: String,
349
- excise: String,
350
- mark_code_info: Yoomoney::MarkCodeInfo::OrHash,
351
- mark_mode: String,
352
- mark_quantity: Yoomoney::MarkQuantity::OrHash,
353
- measure: Yoomoney::ReceiptItemMeasure::OrSymbol,
354
- payment_mode: Yoomoney::ReceiptItemPaymentMode::OrSymbol,
355
- payment_subject: Yoomoney::ReceiptItemPaymentSubject::OrSymbol,
356
- payment_subject_industry_details:
357
- T::Array[Yoomoney::IndustryDetails::OrHash],
358
- planned_status: Integer,
359
- product_code: String,
360
239
  supplier: Yoomoney::ReceiptCreateParams::Item::Supplier::OrHash
361
240
  ).returns(T.attached_class)
362
241
  end
363
242
  def self.new(
364
- # Сумма.
365
- amount:,
366
- # Название товара.
367
- description:,
368
- # Количество.
369
- quantity:,
370
- # Ставка НДС.
371
- vat_code:,
372
243
  # Дополнительный реквизит предмета расчета.
373
244
  additional_payment_subject_props: nil,
374
245
  agent_type: nil,
375
- country_of_origin_code: nil,
376
- customs_declaration_number: nil,
377
- excise: nil,
378
- mark_code_info: nil,
379
- mark_mode: nil,
380
- mark_quantity: nil,
381
- measure: nil,
382
- payment_mode: nil,
383
- payment_subject: nil,
384
- payment_subject_industry_details: nil,
385
- planned_status: nil,
386
- product_code: nil,
387
246
  supplier: nil
388
247
  )
389
248
  end
@@ -391,25 +250,8 @@ module Yoomoney
391
250
  sig do
392
251
  override.returns(
393
252
  {
394
- amount: Yoomoney::MonetaryAmount,
395
- description: String,
396
- quantity: Float,
397
- vat_code: Integer,
398
253
  additional_payment_subject_props: String,
399
254
  agent_type: Yoomoney::ReceiptItemAgentType::OrSymbol,
400
- country_of_origin_code: String,
401
- customs_declaration_number: String,
402
- excise: String,
403
- mark_code_info: Yoomoney::MarkCodeInfo,
404
- mark_mode: String,
405
- mark_quantity: Yoomoney::MarkQuantity,
406
- measure: Yoomoney::ReceiptItemMeasure::OrSymbol,
407
- payment_mode: Yoomoney::ReceiptItemPaymentMode::OrSymbol,
408
- payment_subject: Yoomoney::ReceiptItemPaymentSubject::OrSymbol,
409
- payment_subject_industry_details:
410
- T::Array[Yoomoney::IndustryDetails],
411
- planned_status: Integer,
412
- product_code: String,
413
255
  supplier: Yoomoney::ReceiptCreateParams::Item::Supplier
414
256
  }
415
257
  )
@@ -8,7 +8,7 @@ module Yoomoney
8
8
  T.any(Yoomoney::ReceiptData, Yoomoney::Internal::AnyHash)
9
9
  end
10
10
 
11
- sig { returns(T::Array[Yoomoney::ReceiptData::Item]) }
11
+ sig { returns(T::Array[Yoomoney::ReceiptDataItem]) }
12
12
  attr_accessor :items
13
13
 
14
14
  sig { returns(T.nilable(Yoomoney::ReceiptDataCustomer)) }
@@ -57,7 +57,7 @@ module Yoomoney
57
57
 
58
58
  sig do
59
59
  params(
60
- items: T::Array[Yoomoney::ReceiptData::Item::OrHash],
60
+ items: T::Array[Yoomoney::ReceiptDataItem::OrHash],
61
61
  customer: Yoomoney::ReceiptDataCustomer::OrHash,
62
62
  internet: T::Boolean,
63
63
  receipt_industry_details: T::Array[Yoomoney::IndustryDetails::OrHash],
@@ -80,7 +80,7 @@ module Yoomoney
80
80
  sig do
81
81
  override.returns(
82
82
  {
83
- items: T::Array[Yoomoney::ReceiptData::Item],
83
+ items: T::Array[Yoomoney::ReceiptDataItem],
84
84
  customer: Yoomoney::ReceiptDataCustomer,
85
85
  internet: T::Boolean,
86
86
  receipt_industry_details: T::Array[Yoomoney::IndustryDetails],
@@ -92,188 +92,6 @@ module Yoomoney
92
92
  end
93
93
  def to_hash
94
94
  end
95
-
96
- class Item < Yoomoney::Internal::Type::BaseModel
97
- OrHash =
98
- T.type_alias do
99
- T.any(Yoomoney::ReceiptData::Item, Yoomoney::Internal::AnyHash)
100
- end
101
-
102
- # Сумма.
103
- sig { returns(Yoomoney::MonetaryAmount) }
104
- attr_reader :amount
105
-
106
- sig { params(amount: Yoomoney::MonetaryAmount::OrHash).void }
107
- attr_writer :amount
108
-
109
- # Название товара.
110
- sig { returns(String) }
111
- attr_accessor :description
112
-
113
- # Количество.
114
- sig { returns(Float) }
115
- attr_accessor :quantity
116
-
117
- # Ставка НДС.
118
- sig { returns(Integer) }
119
- attr_accessor :vat_code
120
-
121
- sig { returns(T.nilable(String)) }
122
- attr_reader :country_of_origin_code
123
-
124
- sig { params(country_of_origin_code: String).void }
125
- attr_writer :country_of_origin_code
126
-
127
- sig { returns(T.nilable(String)) }
128
- attr_reader :customs_declaration_number
129
-
130
- sig { params(customs_declaration_number: String).void }
131
- attr_writer :customs_declaration_number
132
-
133
- sig { returns(T.nilable(String)) }
134
- attr_reader :excise
135
-
136
- sig { params(excise: String).void }
137
- attr_writer :excise
138
-
139
- sig { returns(T.nilable(Yoomoney::MarkCodeInfo)) }
140
- attr_reader :mark_code_info
141
-
142
- sig { params(mark_code_info: Yoomoney::MarkCodeInfo::OrHash).void }
143
- attr_writer :mark_code_info
144
-
145
- sig { returns(T.nilable(String)) }
146
- attr_reader :mark_mode
147
-
148
- sig { params(mark_mode: String).void }
149
- attr_writer :mark_mode
150
-
151
- sig { returns(T.nilable(Yoomoney::MarkQuantity)) }
152
- attr_reader :mark_quantity
153
-
154
- sig { params(mark_quantity: Yoomoney::MarkQuantity::OrHash).void }
155
- attr_writer :mark_quantity
156
-
157
- sig { returns(T.nilable(Yoomoney::ReceiptItemMeasure::OrSymbol)) }
158
- attr_reader :measure
159
-
160
- sig { params(measure: Yoomoney::ReceiptItemMeasure::OrSymbol).void }
161
- attr_writer :measure
162
-
163
- sig { returns(T.nilable(Yoomoney::ReceiptItemPaymentMode::OrSymbol)) }
164
- attr_reader :payment_mode
165
-
166
- sig do
167
- params(payment_mode: Yoomoney::ReceiptItemPaymentMode::OrSymbol).void
168
- end
169
- attr_writer :payment_mode
170
-
171
- sig do
172
- returns(T.nilable(Yoomoney::ReceiptItemPaymentSubject::OrSymbol))
173
- end
174
- attr_reader :payment_subject
175
-
176
- sig do
177
- params(
178
- payment_subject: Yoomoney::ReceiptItemPaymentSubject::OrSymbol
179
- ).void
180
- end
181
- attr_writer :payment_subject
182
-
183
- sig { returns(T.nilable(T::Array[Yoomoney::IndustryDetails])) }
184
- attr_reader :payment_subject_industry_details
185
-
186
- sig do
187
- params(
188
- payment_subject_industry_details:
189
- T::Array[Yoomoney::IndustryDetails::OrHash]
190
- ).void
191
- end
192
- attr_writer :payment_subject_industry_details
193
-
194
- sig { returns(T.nilable(Integer)) }
195
- attr_reader :planned_status
196
-
197
- sig { params(planned_status: Integer).void }
198
- attr_writer :planned_status
199
-
200
- sig { returns(T.nilable(String)) }
201
- attr_reader :product_code
202
-
203
- sig { params(product_code: String).void }
204
- attr_writer :product_code
205
-
206
- sig do
207
- params(
208
- amount: Yoomoney::MonetaryAmount::OrHash,
209
- description: String,
210
- quantity: Float,
211
- vat_code: Integer,
212
- country_of_origin_code: String,
213
- customs_declaration_number: String,
214
- excise: String,
215
- mark_code_info: Yoomoney::MarkCodeInfo::OrHash,
216
- mark_mode: String,
217
- mark_quantity: Yoomoney::MarkQuantity::OrHash,
218
- measure: Yoomoney::ReceiptItemMeasure::OrSymbol,
219
- payment_mode: Yoomoney::ReceiptItemPaymentMode::OrSymbol,
220
- payment_subject: Yoomoney::ReceiptItemPaymentSubject::OrSymbol,
221
- payment_subject_industry_details:
222
- T::Array[Yoomoney::IndustryDetails::OrHash],
223
- planned_status: Integer,
224
- product_code: String
225
- ).returns(T.attached_class)
226
- end
227
- def self.new(
228
- # Сумма.
229
- amount:,
230
- # Название товара.
231
- description:,
232
- # Количество.
233
- quantity:,
234
- # Ставка НДС.
235
- vat_code:,
236
- country_of_origin_code: nil,
237
- customs_declaration_number: nil,
238
- excise: nil,
239
- mark_code_info: nil,
240
- mark_mode: nil,
241
- mark_quantity: nil,
242
- measure: nil,
243
- payment_mode: nil,
244
- payment_subject: nil,
245
- payment_subject_industry_details: nil,
246
- planned_status: nil,
247
- product_code: nil
248
- )
249
- end
250
-
251
- sig do
252
- override.returns(
253
- {
254
- amount: Yoomoney::MonetaryAmount,
255
- description: String,
256
- quantity: Float,
257
- vat_code: Integer,
258
- country_of_origin_code: String,
259
- customs_declaration_number: String,
260
- excise: String,
261
- mark_code_info: Yoomoney::MarkCodeInfo,
262
- mark_mode: String,
263
- mark_quantity: Yoomoney::MarkQuantity,
264
- measure: Yoomoney::ReceiptItemMeasure::OrSymbol,
265
- payment_mode: Yoomoney::ReceiptItemPaymentMode::OrSymbol,
266
- payment_subject: Yoomoney::ReceiptItemPaymentSubject::OrSymbol,
267
- payment_subject_industry_details:
268
- T::Array[Yoomoney::IndustryDetails],
269
- planned_status: Integer,
270
- product_code: String
271
- }
272
- )
273
- end
274
- def to_hash
275
- end
276
- end
277
95
  end
278
96
  end
279
97
  end