rus_bank_rails 1.4.2 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -60,11 +60,15 @@ module RusBankRails
|
|
60
60
|
if bank.nil?
|
61
61
|
get_int_code_by_reg_number.call
|
62
62
|
else
|
63
|
-
|
64
|
-
|
65
|
-
resp.
|
66
|
-
|
67
|
-
|
63
|
+
if bank.bic # Банк в базе может быть без БИК
|
64
|
+
resp = check_and_update(bic: bank.bic)
|
65
|
+
if resp.reg_number == reg_number.to_i # На случай если после обновления записи в базе reg_number
|
66
|
+
resp.internal_code # поменялся и найденный банк из базы становится неактуальным
|
67
|
+
else
|
68
|
+
get_int_code_by_reg_number.call
|
69
|
+
end
|
70
|
+
else # Если без БИК, обновлять не требуется, банк не действующий.
|
71
|
+
bank.internal_code
|
68
72
|
end
|
69
73
|
end
|
70
74
|
end
|
@@ -201,7 +205,7 @@ module RusBankRails
|
|
201
205
|
# Возвращает экземпляр класса <Bank> из базы или nil.
|
202
206
|
|
203
207
|
def search_by_reg_number(reg_number)
|
204
|
-
internal_code = reg_num_to_int_code(reg_number)
|
208
|
+
internal_code = reg_num_to_int_code(reg_number.to_i)
|
205
209
|
internal_code ? check_and_update(internal_code: internal_code) : nil
|
206
210
|
end
|
207
211
|
|
@@ -214,7 +218,7 @@ module RusBankRails
|
|
214
218
|
# Возвращает экземпляр класса <Bank> из базы или nil.
|
215
219
|
|
216
220
|
def search_by_main_reg_number(main_reg_number)
|
217
|
-
bank = Bank.
|
221
|
+
bank = Bank.where(main_reg_number: main_reg_number.to_s).first
|
218
222
|
if bank
|
219
223
|
check_and_update(internal_code: bank.internal_code )
|
220
224
|
else # Единственный метод в API, из которого можно вытянуть банк по ОГРН
|
Binary file
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -8905,3 +8905,8 @@ Migrating to ChangeUstMoneyDatatype (20140310145403)
|
|
8905
8905
|
[1m[36mBank Load (0.2ms)[0m [1mSELECT "banks".* FROM "banks" WHERE "banks"."reg_number" = 500 LIMIT 1[0m
|
8906
8906
|
[1m[35mBank Load (0.5ms)[0m SELECT "banks".* FROM "banks" WHERE "banks"."reg_number" = 500 LIMIT 1
|
8907
8907
|
[1m[36mBank Load (0.2ms)[0m [1mSELECT "banks".* FROM "banks" WHERE "banks"."reg_number" = 500 LIMIT 1[0m
|
8908
|
+
[1m[36mBank Load (0.1ms)[0m [1mSELECT "banks".* FROM "banks" WHERE "banks"."reg_number" = 999 LIMIT 1[0m
|
8909
|
+
[1m[35mBank Load (0.2ms)[0m SELECT "banks".* FROM "banks" WHERE "banks"."internal_code" = 350000012 LIMIT 1
|
8910
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
8911
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "banks" ("created_at", "date_kgr_registration", "fact_adr", "internal_code", "licences", "org_full_name", "org_name", "org_status", "reg_code", "reg_number", "updated_at", "ust_money", "ustav_adr") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-04-15 19:01:05.518560"], ["date_kgr_registration", "1990-12-12"], ["fact_adr", "103780, г. Москва, ул. Кузнецкий мост, 15"], ["internal_code", 350000012], ["licences", "--- []\n"], ["org_full_name", "Московский акционерный банк содействия предпринимательству (открытое акционерное общество)"], ["org_name", "МОСБИЗНЕСБАНК"], ["org_status", "ликвидирована"], ["reg_code", 16], ["reg_number", 999], ["updated_at", "2014-04-15 19:01:05.518560"], ["ust_money", "123000000"], ["ustav_adr", "103780, г. Москва, ул. Кузнецкий мост, 15"]]
|
8912
|
+
[1m[36m (1.7ms)[0m [1mcommit transaction[0m
|