transfer_rs/cmd/api/internal/logic/do/notify.go

28 lines
820 B
Go
Raw Normal View History

2024-07-09 18:19:52 +08:00
package do
import (
"context"
"encoding/json"
"rs/cmd/api/internal/svc"
"rs/cmd/api/internal/types"
)
func NotifyInfo(req any, SipOrderNo string, svcCtx *svc.ServiceContext, ctx context.Context) (notify types.NotifyTypes, requestBody map[string]string, err error) {
requestBody = make(map[string]string, 3)
reqJson, _ := json.Marshal(req)
_ = json.Unmarshal(reqJson, &requestBody)
orderInfo, err := svcCtx.TransferOrder.FindByOutBizNo(ctx, SipOrderNo)
if err != nil {
return notify, requestBody, err
}
merchantInfo, err := svcCtx.MerchantWechat.FindOneByMerchantId(ctx, orderInfo.VoucherNum)
if err != nil {
return notify, requestBody, err
}
err = json.Unmarshal([]byte(merchantInfo.NotifyUrl.String), &notify)
if err != nil {
return notify, requestBody, err
}
return notify, requestBody, err
}