Skip to content

Commit

Permalink
add new
Browse files Browse the repository at this point in the history
  • Loading branch information
idprm committed Oct 8, 2024
1 parent 3033d6d commit 943d9eb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions internal/domain/entity/mt.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type MT struct {
ID int64 `gorm:"primaryKey" json:"id"`
TrxId string `gorm:"size:100" json:"trx_id,omitempty"`
Msisdn string `gorm:"size:15;not null" json:"msisdn"`
Keyword string `gorm:"size:250" json:"keyword"`
Content string `gorm:"type:text" json:"content"`
StatusCode int `gorm:"size:10" json:"status_code"`
StatusText string `gorm:"size:100" json:"status_text"`
Expand Down
5 changes: 5 additions & 0 deletions internal/domain/model/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func (m *MORequest) GetServiceByNumber() string {
type MTRequest struct {
TrxId string `json:"trx_id,omitempty"`
Smsc string `json:"smsc,omitempty"`
Keyword string `json:"keyword,omitempty"`
Service *entity.Service `json:"service,omitempty"`
Content *entity.Content `json:"content,omitempty"`
Subscription *entity.Subscription `json:"subscription,omitempty"`
Expand All @@ -178,6 +179,10 @@ func (m *MTRequest) SetTrxId(v string) {
m.TrxId = v
}

func (m *MTRequest) SetKeyword(v string) {
m.Keyword = v
}

type ErrorResponse struct {
FailedField string `json:"failed_field" xml:"failed_field"`
Tag string `json:"tag" xml:"tag"`
Expand Down
1 change: 1 addition & 0 deletions internal/handler/mt_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (h *MTHandler) MessageTerminated() {
&entity.MT{
TrxId: h.req.TrxId,
Msisdn: h.req.Subscription.GetMsisdn(),
Keyword: h.req.Keyword,
Content: h.req.Content.GetValue(),
StatusCode: statusCode,
StatusText: http.StatusText(statusCode),
Expand Down
22 changes: 17 additions & 5 deletions internal/handler/sms_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ func (h *SMSHandler) Subscription(category string) {

mt := &model.MTRequest{
Smsc: h.req.GetTo(),
Keyword: h.req.GetSMS(),
Service: service,
Subscription: sub,
Content: content,
Expand Down Expand Up @@ -359,7 +360,8 @@ func (h *SMSHandler) AlerteCompetition() {
}

mt := &model.MTRequest{
Smsc: h.req.GetTo(),
Smsc: h.req.GetTo(),
Keyword: h.req.GetSMS(),
Service: &entity.Service{
UrlMT: URL_MT,
UserMT: USER_MT,
Expand Down Expand Up @@ -393,7 +395,8 @@ func (h *SMSHandler) AlerteEquipe() {
}

mt := &model.MTRequest{
Smsc: h.req.GetTo(),
Smsc: h.req.GetTo(),
Keyword: h.req.GetSMS(),
Service: &entity.Service{
UrlMT: URL_MT,
UserMT: USER_MT,
Expand Down Expand Up @@ -424,7 +427,8 @@ func (h *SMSHandler) Info() {
log.Println(err.Error())
}
mt := &model.MTRequest{
Smsc: h.req.GetTo(),
Smsc: h.req.GetTo(),
Keyword: h.req.GetSMS(),
Service: &entity.Service{
UrlMT: URL_MT,
UserMT: USER_MT,
Expand Down Expand Up @@ -467,6 +471,7 @@ func (h *SMSHandler) Stop() {

mt := &model.MTRequest{
Smsc: h.req.GetTo(),
Keyword: h.req.GetSMS(),
Service: service,
Subscription: sub,
Content: content,
Expand Down Expand Up @@ -494,8 +499,13 @@ func (h *SMSHandler) Unvalid(v string) {
}

mt := &model.MTRequest{
Smsc: h.req.GetTo(),
Service: &entity.Service{},
Smsc: h.req.GetTo(),
Keyword: h.req.GetSMS(),
Service: &entity.Service{
UrlMT: URL_MT,
UserMT: USER_MT,
PassMT: PASS_MT,
},
Subscription: &entity.Subscription{Msisdn: h.req.GetMsisdn()},
Content: content,
}
Expand Down Expand Up @@ -690,6 +700,7 @@ func (h *SMSHandler) Firstpush() {

mt := &model.MTRequest{
Smsc: h.req.GetTo(),
Keyword: h.req.GetSMS(),
Service: service,
Subscription: &entity.Subscription{},
Content: content,
Expand Down Expand Up @@ -799,6 +810,7 @@ func (h *SMSHandler) Unsub() {

mt := &model.MTRequest{
Smsc: h.req.GetTo(),
Keyword: h.req.GetSMS(),
Service: service,
Subscription: sub,
Content: content,
Expand Down

0 comments on commit 943d9eb

Please sign in to comment.