Skip to content

Commit 156a467

Browse files
phone_number_remove
1 parent 191d683 commit 156a467

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

scraper/scripts/methods.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,19 @@ def fix_state!(row)
142142

143143
# Parses the contact details on the RTGS Sheet
144144
# TODO: Add support for parsing NEFT contact data as well
145-
def parse_contact(std_code, phone)
145+
def parse_contact(std_code, phone, ifsc_code = nil)
146+
# List of phone numbers that should be discarded/ignored
147+
# If the scraper receives any of these phone numbers, the contact will not be updated
148+
phone_numbers_to_discard = [
149+
# Add specific phone numbers here that should be ignored, for example:
150+
'9418404343',
151+
'7571862000',
152+
'8053110006',
153+
'9596776744',
154+
'9706738986',
155+
'9085138862'
156+
]
157+
146158
scan_contact = phone.to_s.gsub(/[\s-]/, '').scan(/^(\d+)\D?/).last
147159
scan_std_code = std_code.to_s.gsub(/[\s-]/, '').scan(/^(\d+)\D?/).last
148160

@@ -220,15 +232,15 @@ def parse_csv(files, banks, additional_attributes = {})
220232
row['MICR'] = nil
221233
end
222234

223-
row['CONTACT'] = parse_contact(row['STD CODE'], row['PHONE'])
224-
225235
# There is a second header in the middle of the sheet.
226236
# :facepalm: RBI
227237
next if row['IFSC'].nil? or ['IFSC_CODE', 'BANK OF BARODA', '', 'KPK HYDERABAD'].include?(row['IFSC'])
228238

229239
original_ifsc = row['IFSC']
230240
row['IFSC'] = row['IFSC'].upcase.gsub(/[^0-9A-Za-z]/, '').strip
231241

242+
row['CONTACT'] = parse_contact(row['STD CODE'], row['PHONE'], row['IFSC'])
243+
232244
bankcode = row['IFSC'][0..3]
233245

234246
if banks[bankcode] and banks[bankcode].key? :upi and banks[bankcode][:upi]

0 commit comments

Comments
 (0)