forked from ebhomengo/niki
29 lines
892 B
Go
29 lines
892 B
Go
package notification
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
params "git.gocasts.ir/ebhomengo/niki/param"
|
|
bnfparam "git.gocasts.ir/ebhomengo/niki/param/admin/benefactor"
|
|
kbparam "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
|
|
smsmsg "git.gocasts.ir/ebhomengo/niki/pkg/sms_msg"
|
|
)
|
|
|
|
func (s Service) KindBoxReqAccepted(req params.NotificationKindBoxReqAccepted) {
|
|
const op = "notification.KindBoxReqAccepted"
|
|
|
|
ctx := context.Background()
|
|
kb, err := s.KindBoxReqSvc.Get(ctx, kbparam.GetKindBoxReqRequest{
|
|
KindBoxID: req.KindBoxReqID,
|
|
})
|
|
if err != nil {
|
|
fmt.Println(fmt.Errorf("error(%s):%w", op, err))
|
|
}
|
|
bnf, gErr := s.BenefactorSvc.GetByID(ctx, bnfparam.GetBenefactorByIDRequest{BenefactorID: kb.BenefactorID})
|
|
if err != nil {
|
|
fmt.Println(fmt.Errorf("error(%s):%w", op, gErr))
|
|
}
|
|
s.smsAdapter.Send(bnf.PhoneNumber, fmt.Sprintf(smsmsg.SmsMsgKindBoxReqAccepted, bnf.FirstName))
|
|
}
|