Skip to content

Commit da85501

Browse files
Merge pull request #431 from razorpay/remove_phone_number
phone_number_remove
2 parents d6c2f04 + 5f69d16 commit da85501

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

scraper/scripts/methods.rb

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,27 @@ 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+
158+
# Clean the phone number for comparison
159+
clean_phone = phone.to_s.strip.gsub(/[\s-]/, '')
160+
161+
# Check for specific phone numbers to discard
162+
if clean_phone && phone_numbers_to_discard.include?(clean_phone)
163+
return nil
164+
end
165+
146166
scan_contact = phone.to_s.gsub(/[\s-]/, '').scan(/^(\d+)\D?/).last
147167
scan_std_code = std_code.to_s.gsub(/[\s-]/, '').scan(/^(\d+)\D?/).last
148168

@@ -220,15 +240,15 @@ def parse_csv(files, banks, additional_attributes = {})
220240
row['MICR'] = nil
221241
end
222242

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

229247
original_ifsc = row['IFSC']
230248
row['IFSC'] = row['IFSC'].upcase.gsub(/[^0-9A-Za-z]/, '').strip
231249

250+
row['CONTACT'] = parse_contact(row['STD CODE'], row['PHONE'], row['IFSC'])
251+
232252
bankcode = row['IFSC'][0..3]
233253

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

0 commit comments

Comments
 (0)