2024-07-27 16:17:13 +00:00
|
|
|
package notification
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
2024-07-30 14:20:49 +00:00
|
|
|
|
2024-07-27 16:17:13 +00:00
|
|
|
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) {
|
2024-07-30 14:20:49 +00:00
|
|
|
const op = "notification.KindBoxReqAccepted"
|
|
|
|
|
2024-07-27 16:17:13 +00:00
|
|
|
ctx := context.Background()
|
2024-07-30 14:20:49 +00:00
|
|
|
kb, err := s.KindBoxReqSvc.Get(ctx, kbparam.GetKindBoxReqRequest{
|
2024-07-27 16:17:13 +00:00
|
|
|
KindBoxID: req.KindBoxReqID,
|
|
|
|
})
|
2024-07-30 14:20:49 +00:00
|
|
|
if err != nil {
|
|
|
|
fmt.Println(fmt.Errorf("error(%s):%w", op, err))
|
|
|
|
}
|
|
|
|
bnf, gErr := s.BenefactorSvc.GetByID(ctx, bnfparam.GetBenefactorByIDRequest{BenefactorID: kb.BenefactorID})
|
2024-08-06 21:41:09 +00:00
|
|
|
if gErr != nil {
|
2024-07-30 14:20:49 +00:00
|
|
|
fmt.Println(fmt.Errorf("error(%s):%w", op, gErr))
|
|
|
|
}
|
2024-07-27 16:17:13 +00:00
|
|
|
s.smsAdapter.Send(bnf.PhoneNumber, fmt.Sprintf(smsmsg.SmsMsgKindBoxReqAccepted, bnf.FirstName))
|
|
|
|
}
|