-
Notifications
You must be signed in to change notification settings - Fork 71
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
Update M* handlers to use new send #699
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #699 +/- ##
==========================================
+ Coverage 73.89% 74.73% +0.84%
==========================================
Files 98 98
Lines 13053 13115 +62
==========================================
+ Hits 9645 9802 +157
+ Misses 2722 2626 -96
- Partials 686 687 +1 ☔ View full report in Codecov by Sentry. |
handlers/messangi/handler.go
Outdated
clog.Error(courier.ErrorResponseValueUnexpected("status", "OK")) | ||
break | ||
return courier.ErrFailedWithReason("", "response returned non-OK status") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like both of these can be replaced with return courier.ErrResponseStatus
handlers/meta/handlers.go
Outdated
} | ||
|
||
if respPayload.ExternalID == "" { | ||
clog.Error(courier.ErrorResponseValueMissing("message_id")) | ||
return status, nil | ||
return courier.ErrFailedWithReason("", "response missing message_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrFailedWithReason
is specifically for when the channel gives an external error code..
both of these lines could just be replaced with return courier.ErrResponseUnexpected
handlers/meta/handlers.go
Outdated
recipientID := respPayload.RecipientID | ||
if recipientID == "" { | ||
clog.Error(courier.ErrorResponseValueMissing("recipient_id")) | ||
return courier.ErrFailedWithReason("", "response missing recipient_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
handlers/meta/handlers.go
Outdated
@@ -885,7 +873,7 @@ func (h *handler) sendWhatsAppMsg(ctx context.Context, msg courier.MsgOut, clog | |||
|
|||
payload.Interactive = &interactive | |||
} else { | |||
return nil, fmt.Errorf("too many quick replies WAC supports only up to 10 quick replies") | |||
return fmt.Errorf("too many quick replies WAC supports only up to 10 quick replies") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be a terminal error - we can send the message with 10 quick replies and add a channel log error to say that
handlers/meta/handlers.go
Outdated
@@ -1040,7 +1025,7 @@ func (h *handler) sendWhatsAppMsg(ctx context.Context, msg courier.MsgOut, clog | |||
|
|||
payload.Interactive = &interactive | |||
} else { | |||
return nil, fmt.Errorf("too many quick replies WAC supports only up to 10 quick replies") | |||
return fmt.Errorf("too many quick replies WAC supports only up to 10 quick replies") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
func setSendURL(s *httptest.Server, h courier.ChannelHandler, c courier.Channel, m courier.MsgOut) { | ||
sendURL = s.URL | ||
} | ||
|
||
var defaultSendTestCases = []OutgoingTestCase{ | ||
{Label: "Plain Send", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice to fix this formatting while you're in here
No description provided.