Skip to content

Commit

Permalink
Add support for Azerbaijan-Italy VFS
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjan-mohanty committed May 7, 2024
1 parent d890321 commit b78d4fe
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 21 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,12 @@ It currently supports three notification channels to keep you informed about app

The following table lists currently supported countries and their corresponding appointment parameters:

| Country | Appointment Parameters |
| ----------------------- | ----------------------------------------------------------- |
| India(IN) - Germany(DE) | visa_category, visa_sub_category, visa_center |
| Iraq(IQ) - Germany(DE) | visa_category, visa_sub_category, visa_center |
| Morocco(MA) - Italy(IT) | visa_category, visa_sub_category, visa_center, payment_mode |
| Country | Appointment Parameters |
| -------------------------- | ----------------------------------------------------------- |
| India(IN) - Germany(DE) | visa_category, visa_sub_category, visa_center |
| Iraq(IQ) - Germany(DE) | visa_category, visa_sub_category, visa_center |
| Morocco(MA) - Italy(IT) | visa_category, visa_sub_category, visa_center, payment_mode |
| Azerbaijan(AZ) - Italy(IT) | visa_category, visa_sub_category, visa_center |

**Notes:**

Expand Down
3 changes: 2 additions & 1 deletion config/vfs_urls.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[vfs-url]
IN-DE = https://visa.vfsglobal.com/ind/en/deu/login
IQ-DE = https://visa.vfsglobal.com/irq/en/deu/login
MA-IT = https://visa.vfsglobal.com/mar/en/ita/login
MA-IT = https://visa.vfsglobal.com/mar/en/ita/login
AZ-IT = https://visa.vfsglobal.com/aze/en/ita/login
3 changes: 2 additions & 1 deletion vfs_appointment_bot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def main() -> None:
if appointment_found:
break
countdown(
get_config_value("default", "interval"), "Next appointment check in"
int(get_config_value("default", "interval")),
"Next appointment check in",
)

except (UnsupportedCountryError, LoginError) as e:
Expand Down
2 changes: 1 addition & 1 deletion vfs_appointment_bot/utils/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from tqdm import tqdm


def countdown(t, message="Countdown", unit="seconds"):
def countdown(t: int, message="Countdown", unit="seconds"):
"""
Implements a countdown timer
Expand Down
2 changes: 1 addition & 1 deletion vfs_appointment_bot/vfs_bot/vfs_bot_de.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, source_country_code: str):
"""
super().__init__()
self.source_country_code = source_country_code
self.destination_country_code = "de"
self.destination_country_code = "DE"
self.appointment_param_keys = [
"visa_center",
"visa_category",
Expand Down
6 changes: 3 additions & 3 deletions vfs_appointment_bot/vfs_bot/vfs_bot_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ def get_vfs_bot(source_country_code: str, destination_country_code: str) -> VfsB
UnsupportedCountryError: If the provided country is not supported.
"""

country_lower = destination_country_code.lower()
country_lower = destination_country_code

if country_lower == "de":
if country_lower == "DE":
from .vfs_bot_de import VfsBotDe

return VfsBotDe(source_country_code)
elif country_lower == "it":
elif country_lower == "IT":
from .vfs_bot_it import VfsBotIt

return VfsBotIt(source_country_code)
Expand Down
21 changes: 12 additions & 9 deletions vfs_appointment_bot/vfs_bot/vfs_bot_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ def __init__(self, source_country_code: str):
"""
super().__init__()
self.source_country_code = source_country_code
self.destination_country_code = "it"
self.destination_country_code = "IT"
self.appointment_param_keys = [
"visa_center",
"visa_category",
"visa_sub_category",
"payment_mode",
]

if self.source_country_code == "MA":
self.appointment_param_keys.append("payment_mode")

def login(self, page: Page, email_id: str, password: str) -> None:
"""
Performs login steps specific to the Italy VFS website.
Expand Down Expand Up @@ -127,13 +129,14 @@ def check_for_appontment(
)
visa_subcategory_dropdown_option.click()

# Select Payment Mode
payment_mode_dropdown = page.query_selector_all("mat-form-field")[3]
payment_mode_dropdown.click()
payment_mode_dropdown_option = page.wait_for_selector(
f'mat-option:has-text("{appointment_params.get("payment_mode")}")'
)
payment_mode_dropdown_option.click()
if self.source_country_code == "MA":
# Select Payment Mode
payment_mode_dropdown = page.query_selector_all("mat-form-field")[3]
payment_mode_dropdown.click()
payment_mode_dropdown_option = page.wait_for_selector(
f'mat-option:has-text("{appointment_params.get("payment_mode")}")'
)
payment_mode_dropdown_option.click()

try:
page.wait_for_selector("div.alert")
Expand Down

0 comments on commit b78d4fe

Please sign in to comment.