Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTD-5740-handle-hmrc-mail-files #287

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mail/libraries/data_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_mail_instance(extract_type, run_number) -> Mail or None:
logging.info("Licence update reply has already been processed")
return
return find_mail_of(
[ExtractTypeEnum.LICENCE_DATA, ExtractTypeEnum.LICENCE_REPLY], ReceptionStatusEnum.REPLY_PENDING
[ExtractTypeEnum.LICENCE_DATA, ExtractTypeEnum.LICENCE_REPLY], ReceptionStatusEnum.REPLY_PENDING, run_number
)
elif extract_type == ExtractTypeEnum.USAGE_REPLY:
last_email = UsageData.objects.filter(spire_run_number=run_number).last()
Expand Down
4 changes: 2 additions & 2 deletions mail/libraries/mailbox_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ def read_last_three_emails(pop3connection: POP3_SSL) -> list:
return email_message_dtos


def find_mail_of(extract_types: List[str], reception_status: str) -> Mail or None:
def find_mail_of(extract_types: List[str], reception_status: str, hmrc_run_number) -> Mail or None:
try:
mail = Mail.objects.get(status=reception_status, extract_type__in=extract_types)
mail = Mail.objects.get(status=reception_status, extract_type__in=extract_types, hmrc_run_number=hmrc_run_number)
except Mail.DoesNotExist:
logging.warning("Can not find any mail in [%s] of extract type [%s]", reception_status, extract_types)
return
Expand Down
Loading