revo-loans_api 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 943b0c7dd5e0f413a7ef93c3d55fcb77be5241ef60f8f33185a22ddcd8c99e57
4
- data.tar.gz: 168bd39b35bfaed97f502ed4ef2c58fbf49b9e3ecdcd441b7cdba1229913a03c
3
+ metadata.gz: 627c8ee996c8b365402eb708b4a85d20e8df58b3a5ed4f491ff682c2b4d074b0
4
+ data.tar.gz: a72213f6e01273763deefe4bbed2d5bf23de2d4d48732df640c1c45b6bd25f80
5
5
  SHA512:
6
- metadata.gz: 8ba876be94b1e71e467f3581eeb0a1f453e563165ddb7203229755cc2c66c4e74b0cbadcc7707dff8048a7a1acfac8b444a303e8af335a3c878033cb90e32ffb
7
- data.tar.gz: f5869f14dcc57c815e73d6bd5c3e0e7384e7ed94ff5aa8b7a3beb58598631a7c8695a0f40264081a4dfca514866b84a2653d59608c1924c2a75425937bee7ee0
6
+ metadata.gz: b738a3cc8438d6ac1460e45ef850ea867df3aa61db30e4c30d59451eb7f7cf44f57fcfa7cbf2cb8db4775bcab00435cce9a0658b55c4793268feed7c474c6701
7
+ data.tar.gz: a220277e10e3e458c0d47bbe45cf8835fe91aff784f93c061ac6fd9d10fb5a85a63d4a9296855c479865d8bb43e74edea4393bb9ee4ef37da0ae73458db62043
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- revo-loans_api (0.0.3)
4
+ revo-loans_api (0.0.4)
5
5
  activesupport
6
6
  http
7
7
 
data/README.md CHANGED
@@ -283,6 +283,149 @@ result.success? # => true
283
283
  result.response # => `nil`
284
284
  ```
285
285
 
286
+
287
+ ### Start self registration
288
+
289
+
290
+ ```ruby
291
+ result = client.start_self_registration(
292
+ token: 'some-lr-token', # use the one you got when creating a loan request
293
+ mobile_phone: '78881234567'
294
+ )
295
+
296
+ # Success:
297
+ result.success? # => true
298
+ result.response # => `nil`
299
+
300
+ # Failure:
301
+ result.success? # => false
302
+ result.response # => `{ errors: { mobile_phone: ['error'] } }`
303
+ ```
304
+
305
+
306
+ ### Check client confirmation code
307
+
308
+
309
+ ```ruby
310
+ result = client.check_client_code(
311
+ token: 'some-lr-token', # use the one you got when creating a loan request
312
+ code: '1234'
313
+ )
314
+
315
+ # Success:
316
+ result.success? # => true
317
+ result.response # => `{ code: { valid: true } }`
318
+
319
+ # Failure:
320
+ result.success? # => true
321
+ result.response # => `{ code: { valid: false } }`
322
+ ```
323
+
324
+
325
+ ### Update client data
326
+
327
+
328
+ ```ruby
329
+ result = client.create_client(
330
+ token: 'some-lr-token', # use the one you got when creating a loan request
331
+ client_params: {
332
+ mobile_phone: '8881234567',
333
+ first_name: 'Иван',
334
+ middle_name: 'Иванович',
335
+ last_name: 'Иванов',
336
+ birth_date: '01-01-1990',
337
+ email: 'user@example.com',
338
+ area: 'Москва',
339
+ settlement: 'Москва',
340
+ street: 'Новая',
341
+ house: '123',
342
+ building: '123',
343
+ apartment: '123',
344
+ postal_code: '12345',
345
+ black_mark: false,
346
+ agrees_bki: '1',
347
+ agrees_terms: '1',
348
+ confirmation_code: '1111',
349
+ password: 's3cure p4ssw0rd!',
350
+ password_confirmation: 's3cure p4ssw0rd!',
351
+ id_documents: {
352
+ russian_passport: {
353
+ number: '123456',
354
+ series: '2204'
355
+ }
356
+ }
357
+ },
358
+ provider_data: {}
359
+ )
360
+
361
+ # Success:
362
+ result.success? # => true
363
+ result.response # =>
364
+ # client: {
365
+ # email: 'user@example.com',
366
+ # birth_date: '01-01-1990',
367
+ # first_name: 'Иван',
368
+ # middle_name: 'Иванович',
369
+ # last_name: 'Ивановтест',
370
+ # area: 'Москва',
371
+ # settlement: 'Москва',
372
+ # street: 'Новая',
373
+ # house: '123',
374
+ # building: '123',
375
+ # apartment: '123',
376
+ # postal_code: '12345',
377
+ # credit_limit: nil,
378
+ # missing_documents: ['name', 'client_with_passport', 'living_addr'],
379
+ # id_documents: {
380
+ # russian_passport: {
381
+ # number: '123456',
382
+ # series: '2204',
383
+ # expiry_date: nil
384
+ # }
385
+ # },
386
+ # decision: 'approved',
387
+ # credit_decision: 'approved',
388
+ # decision_code: 210,
389
+ # decision_message: 'Покупка на сумму 5000.0 ₽ успешно совершена!'
390
+ # }
391
+
392
+ # Failure 422:
393
+ result.success? # => false
394
+ result.response # => `{ errors: { mobile_phone: ['error'], id_documents: { russian_passport: ['another error'] } }`
395
+
396
+ # Failure 452:
397
+ result.success? # => false
398
+ result.response # =>
399
+ # client: {
400
+ # email: 'user@example.com',
401
+ # birth_date: '01-01-1990',
402
+ # first_name: 'Иван',
403
+ # middle_name: 'Иванович',
404
+ # last_name: 'Ивановтест',
405
+ # area: 'Москва',
406
+ # settlement: 'Москва',
407
+ # street: 'Новая',
408
+ # house: '123',
409
+ # building: '123',
410
+ # apartment: '123',
411
+ # postal_code: '12345',
412
+ # credit_limit: nil,
413
+ # missing_documents: ['name', 'client_with_passport', 'living_addr'],
414
+ # id_documents: {
415
+ # russian_passport: {
416
+ # number: '123456',
417
+ # series: '2204',
418
+ # expiry_date: nil
419
+ # }
420
+ # },
421
+ # decision: 'declined',
422
+ # credit_decision: 'declined',
423
+ # decision_code: 610,
424
+ # decision_message: 'К сожалению, Ваша заявка отклонена'
425
+ # }
426
+ ```
427
+
428
+
286
429
  ### Possible Exceptions
287
430
 
288
431
  In case of generic HTTP errors (i.e. server is not reachable or network is down), `Revo::LoansApi::UnexpectedResponseError` will be raised.
@@ -110,6 +110,20 @@ class Revo::LoansApi::Client
110
110
  make_request(:post, "returns/#{return_id}/cancel")
111
111
  end
112
112
 
113
+ def start_self_registration(token:, mobile_phone:)
114
+ make_request(:post, "loan_requests/#{token}/client/self_registration",
115
+ mobile_phone: mobile_phone)
116
+ end
117
+
118
+ def check_client_code(token:, code:)
119
+ make_request(:post, "loan_requests/#{token}/client/check_code", code: code)
120
+ end
121
+
122
+ def create_client(token:, client_params:, provider_data: {})
123
+ make_request(:post, "loan_requests/#{token}/client",
124
+ client: client_params, provider_data: provider_data)
125
+ end
126
+
113
127
  private
114
128
 
115
129
  attr_reader :connection, :base_url, :login, :password
@@ -1,5 +1,5 @@
1
1
  module Revo
2
2
  module LoansApi
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revo-loans_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Revo Developers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http