-
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
Add support for YO! and SMS Central channels #31
Conversation
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, just a few tweaks!
handlers/smscentral/smscentral.go
Outdated
// Initialize is called by the engine once everything is loaded | ||
func (h *handler) Initialize(s courier.Server) error { | ||
h.SetServer(s) | ||
s.AddReceiveMsgRoute(h, "POST", "receive", h.ReceiveMessage) |
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.
These should be checking error status and returning them if non-nil
handlers/smscentral/smscentral.go
Outdated
func (h *handler) Initialize(s courier.Server) error { | ||
h.SetServer(s) | ||
s.AddReceiveMsgRoute(h, "POST", "receive", h.ReceiveMessage) | ||
s.AddReceiveMsgRoute(h, "GET", "receive", h.ReceiveMessage) |
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.
Let's figure out which SMS Central uses and only support that one.
handlers/smscentral/smscentral.go
Outdated
func (h *handler) SendMsg(msg courier.Msg) (courier.MsgStatus, error) { | ||
username := msg.Channel().StringConfigForKey(courier.ConfigUsername, "") | ||
if username == "" { | ||
return nil, fmt.Errorf("no username set for KN channel") |
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.
Wrong error msg.
handlers/smscentral/smscentral.go
Outdated
return status, err | ||
} | ||
|
||
if rr.StatusCode != 200 && rr.StatusCode != 201 && rr.StatusCode != 202 { |
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.
rr.StatusCode / 100 != 2
?
handlers/yo/yo.go
Outdated
// Initialize is called by the engine once everything is loaded | ||
func (h *handler) Initialize(s courier.Server) error { | ||
h.SetServer(s) | ||
s.AddReceiveMsgRoute(h, "POST", "receive", h.ReceiveMessage) |
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.
Check error status, lets only register what these guys currently use. (look at our logs to figure out)
handlers/yo/yo.go
Outdated
failed = true | ||
} | ||
|
||
if failed == false && rr.StatusCode != 200 && rr.StatusCode != 201 { |
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.
!failed
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.
Maybe see if you can refactor this a bit with continue
s instead of checking failed everywhere
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.
By using continue we won't be able to stop blacklisted contacts
@@ -1,6 +1,119 @@ | |||
package smscentral |
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.
Add tests for smscentral.
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.
Added the file
I have updated to only add handler for the requests we get for each channel type |
No description provided.