Skip to content

Sms handler updates#15

Open
akash1mgs wants to merge 28 commits intomainfrom
sms-handler-updates
Open

Sms handler updates#15
akash1mgs wants to merge 28 commits intomainfrom
sms-handler-updates

Conversation

@akash1mgs
Copy link
Collaborator

@akash1mgs akash1mgs commented May 19, 2025


DeputyDev generated PR summary:


Size L: This PR changes include 183 lines and should take approximately 1-3 hours to review


The PR titled "Sms handler updates" introduces the following changes:

  1. New Python Module: A new file execution_details.py is added. It provides classes and methods to map SMS event statuses to internal execution statuses, such as QUEUED, PENDING, SUCCESS, and FAILED, based on the status constants defined in SmsEventStatus.

  2. Updated Logging: The logging system in sqs.py and within SMS handlers uses newly mapped execution statuses. This ensures a more consistent and meaningful logging of SMS handling results.

  3. Constants for SMS Events: Added sms.py to define various SMS event statuses like SENT, DELIVERED, FAILED, etc., as an Enum, which can now be easily used across different modules.

  4. Handlers Improvements: In various handler modules (e.g., plivo_manager.py, sms_country_manager.py), the SMS send operation and callback handling logic now utilizes ExecutionDetails to determine the status of operations more consistently.

  5. Configuration Template Enhancements: Added SMS gateway configuration details to config_template.json, laying out settings for gateways such as aws_sns, plivo, and sms_country.

Overall, this PR effectively streamlines status mapping and logging functions for SMS operations across the application.


DeputyDev generated PR summary until 8c4c311

@deputydev-agent
Copy link

DeputyDev has started reviewing your pull request.

@deputydev-agent
Copy link

DeputyDev has completed a review of your pull request for commit 8c4c311.



class MailSenderConstant(Enum):
SparkPost = "spark_post"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPARK_POST

Please follow 1 convention throughout

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was in small case previously also

Pipfile Outdated
torpedo = {editable = true, ref = "1.0.0", git = "https://github.com/tata1mg/torpedo"}
commonutils = {editable = true, ref = "1.0.0", git = "https://github.com/tata1mg/commonutils"}
torpedo = {editable = true, ref = "4.2.0", git = "ssh://git@bitbucket.org/tata1mg/torpedo.git"}
commonutils = {editable = true, ref = "1.8.7", git = "ssh://git@bitbucket.org/tata1mg/commonutils.git"}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't these private ? How will these work for open source repo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were getting used before also, as in the existing version of notifyone.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updating this to public repo links

Host._listeners = listeners
torpedo.run()

# register combined blueprint group here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prshant70 can you verify this, not sure if this wasn't working earlier,

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is due to update in Torpedo version.

@staticmethod
def map_sms_status(event_status: SmsEventStatus) -> ExecutionDetailsEventStatus:
status_map = {
SmsEventStatus.SENT: ExecutionDetailsEventStatus.SUCCESS,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are these statuses being mapped prior to our change?

from torpedo import CONFIG, BaseApiRequest
from torpedo.constants import HTTPMethod

from app.constants import Channels

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

error={
"error": f"Encountered error while sending push noitifcation {str(err)}"
},
meta=str(err),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm that this is in use?

}

files = template_data.get("files") or list()
attachment_data = template_data.get("attachment_data")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too big a method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants