37 lines
900 B
Go
37 lines
900 B
Go
package biz
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"voucher/internal/biz/bo"
|
|
"voucher/internal/biz/wechatrepo"
|
|
)
|
|
|
|
type WechatBiz struct {
|
|
BankMultiActivityRepo wechatrepo.BankMultiActivityRepo
|
|
}
|
|
|
|
func NewWechatBiz(bankMultiActivityRepo wechatrepo.BankMultiActivityRepo) *WechatBiz {
|
|
return &WechatBiz{BankMultiActivityRepo: bankMultiActivityRepo}
|
|
}
|
|
|
|
func (biz *WechatBiz) CallBack(ctx context.Context, mchId string, headers *http.Header, respBody []byte) (*bo.WechatVoucherNotifyBo, error) {
|
|
|
|
response, err := biz.BankMultiActivityRepo.Notify(ctx, mchId, headers, respBody)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return response, nil
|
|
}
|
|
|
|
func (biz *WechatBiz) DecodeBody(ctx context.Context, mchId string, respBody []byte) (*bo.WechatVoucherNotifyBo, error) {
|
|
|
|
response, err := biz.BankMultiActivityRepo.DecodeBody(ctx, mchId, respBody)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return response, nil
|
|
}
|