2024-08-06 21:41:09 +00:00
|
|
|
package notification
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
params "git.gocasts.ir/ebhomengo/niki/param"
|
|
|
|
bnfparam "git.gocasts.ir/ebhomengo/niki/param/admin/benefactor"
|
|
|
|
kbp "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
|
|
|
|
smsmsg "git.gocasts.ir/ebhomengo/niki/pkg/sms_msg"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s Service) KindBoxEnumerated(req params.NotificationKindBoxEnumerated) {
|
|
|
|
const op = "notification.KindBoxEnumerated"
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
kb, err := s.KindBoxSvc.Get(ctx, kbp.KindBoxGetRequest{
|
|
|
|
KindBoxID: req.KindBoxID,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(fmt.Errorf("error(%s):%w", op, err))
|
|
|
|
}
|
2024-09-10 20:55:19 +00:00
|
|
|
bnf, gErr := s.BenefactorSvc.GetByID(ctx, bnfparam.GetBenefactorByIDRequest{BenefactorID: kb.Data.BenefactorID})
|
2024-08-06 21:41:09 +00:00
|
|
|
if gErr != nil {
|
|
|
|
fmt.Println(fmt.Errorf("error(%s):%w", op, gErr))
|
|
|
|
}
|
2024-09-10 20:55:19 +00:00
|
|
|
s.smsAdapter.Send(bnf.PhoneNumber, fmt.Sprintf(smsmsg.SmsMsgKindBoxEnumerated, bnf.FirstName, kb.Data.SerialNumber, kb.Data.Amount))
|
2024-08-06 21:41:09 +00:00
|
|
|
}
|