32 lines
715 B
Go
32 lines
715 B
Go
package client
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
|
|
"git.selly.red/Selly-Modules/natsio"
|
|
"git.selly.red/Selly-Modules/natsio/model"
|
|
"git.selly.red/Selly-Modules/natsio/subject"
|
|
)
|
|
|
|
func GetNotification() Notification {
|
|
return Notification{}
|
|
}
|
|
|
|
type Notification struct{}
|
|
|
|
func (n Notification) SupplierChangeBalanceRequestApproved(p model.NotificationSupplierChangeBalanceRequestApprovedReq) error {
|
|
msg, err := natsio.GetServer().Request(subject.Notification.SupplierChangeBalanceRequestApproved, toBytes(p))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
var r model.CommonResponseData
|
|
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
|
return err
|
|
}
|
|
if r.Error != "" {
|
|
return errors.New(r.Error)
|
|
}
|
|
return nil
|
|
}
|