Afro SMS integration fix
This commit is contained in:
parent
4adfb011d2
commit
6e7b957551
|
|
@ -111,7 +111,7 @@ type Config struct {
|
|||
AFRO_SMS_API_KEY string
|
||||
AFRO_SMS_SENDER_NAME string
|
||||
AFRO_SMS_RECEIVER_PHONE_NUMBER string
|
||||
ADRO_SMS_HOST_URL string
|
||||
AFRO_SMS_HOST_URL string
|
||||
CHAPA_WEBHOOK_SECRET string
|
||||
CHAPA_TRANSFER_TYPE string
|
||||
CHAPA_PAYMENT_TYPE string
|
||||
|
|
@ -367,14 +367,14 @@ func (c *Config) loadEnv() error {
|
|||
|
||||
c.AFRO_SMS_SENDER_NAME = os.Getenv("AFRO_SMS_SENDER_NAME")
|
||||
if c.AFRO_SMS_SENDER_NAME == "" {
|
||||
c.AFRO_SMS_SENDER_NAME = "Yimaru"
|
||||
c.AFRO_SMS_SENDER_NAME = "Yimaru Acad"
|
||||
}
|
||||
|
||||
c.AFRO_SMS_RECEIVER_PHONE_NUMBER = os.Getenv("AFRO_SMS_RECEIVER_PHONE_NUMBER")
|
||||
|
||||
c.ADRO_SMS_HOST_URL = os.Getenv("ADRO_SMS_HOST_URL")
|
||||
if c.ADRO_SMS_HOST_URL == "" {
|
||||
c.ADRO_SMS_HOST_URL = "https://api.afromessage.com"
|
||||
c.AFRO_SMS_HOST_URL = os.Getenv("AFRO_SMS_HOST_URL")
|
||||
if c.AFRO_SMS_HOST_URL == "" {
|
||||
c.AFRO_SMS_HOST_URL = "https://api.afromessage.com"
|
||||
}
|
||||
|
||||
//Atlas
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ func (s *Service) SendSMS(ctx context.Context, receiverPhone, message string) er
|
|||
func (s *Service) SendAfroMessageSMS(ctx context.Context, receiverPhone, message string) error {
|
||||
apiKey := s.config.AFRO_SMS_API_KEY
|
||||
senderName := s.config.AFRO_SMS_SENDER_NAME
|
||||
hostURL := s.config.ADRO_SMS_HOST_URL
|
||||
hostURL := s.config.AFRO_SMS_HOST_URL
|
||||
endpoint := "/api/send"
|
||||
|
||||
// API endpoint has been updated
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ func (s *Service) SendAfroMessageSMSTemp(
|
|||
}
|
||||
|
||||
// Construct full URL
|
||||
reqURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())
|
||||
reqURL := fmt.Sprintf("%s/api/send?%s", baseURL, params.Encode())
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, reqURL, nil)
|
||||
if err != nil {
|
||||
|
|
@ -413,7 +413,7 @@ func (s *Service) DisconnectWebSocket(recipientID int64) {
|
|||
// apiKey := s.config.AFRO_SMS_API_KEY
|
||||
// senderName := s.config.AFRO_SMS_SENDER_NAME
|
||||
// receiverPhone := s.config.AFRO_SMS_RECEIVER_PHONE_NUMBER
|
||||
// hostURL := s.config.ADRO_SMS_HOST_URL
|
||||
// hostURL := s.config.AFRO_SMS_HOST_URL
|
||||
// endpoint := "/api/send"
|
||||
|
||||
// request := afro.GetRequest(apiKey, endpoint, hostURL)
|
||||
|
|
|
|||
|
|
@ -618,10 +618,11 @@ func (h *Handler) SendSingleAfroSMS(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
// Send SMS via service
|
||||
if err := h.notificationSvc.SendAfroMessageSMS(
|
||||
if err := h.notificationSvc.SendAfroMessageSMSTemp(
|
||||
c.Context(),
|
||||
req.Recipient,
|
||||
req.Message,
|
||||
nil,
|
||||
); err != nil {
|
||||
|
||||
h.mongoLoggerSvc.Error("Failed to send AfroMessage SMS",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user