多笔立减金
This commit is contained in:
parent
408a929b33
commit
654540ba65
|
|
@ -210,6 +210,7 @@ message CmbNotifyRequest {
|
||||||
string ext = 13 [json_name = "ext"];
|
string ext = 13 [json_name = "ext"];
|
||||||
string attach = 14 [json_name = "attach"];
|
string attach = 14 [json_name = "attach"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message CmbNotifyReply {
|
message CmbNotifyReply {
|
||||||
// 接口调用返回码,1000 成功,1001 失败
|
// 接口调用返回码,1000 成功,1001 失败
|
||||||
string respCode = 1 [json_name = "respCode"];
|
string respCode = 1 [json_name = "respCode"];
|
||||||
|
|
@ -217,6 +218,32 @@ message CmbNotifyReply {
|
||||||
string respMsg = 2 [json_name = "respMsg"];
|
string respMsg = 2 [json_name = "respMsg"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message CmbMultiNotifyRequest {
|
||||||
|
// cmb业务号
|
||||||
|
string transactionId = 1 [json_name = "transactionId"];
|
||||||
|
// 活动编号
|
||||||
|
string activityId = 2 [json_name = "activityId"];
|
||||||
|
// 微信券id
|
||||||
|
string couponId = 3 [json_name = "couponId"];
|
||||||
|
// 券领取时间
|
||||||
|
string acquiredDate = 4 [json_name = "acquiredDate"];
|
||||||
|
// 券状态0:可使用,1:已使用
|
||||||
|
string status = 5 [json_name = "status"];
|
||||||
|
// 券核销时间 格式:yyyy-MM-dd HH:mm:ss.sss
|
||||||
|
string transDate = 6 [json_name = "transDate"];
|
||||||
|
// 券核销金额,单位-分
|
||||||
|
string transAmount = 7 [json_name = "transAmount"];
|
||||||
|
// 券核销支付单号,微信支付系统生成的订单号
|
||||||
|
string orderId = 8 [json_name = "orderId"];
|
||||||
|
// 优惠券券码 codeNo
|
||||||
|
string ticket = 9 [json_name = "ticket"];
|
||||||
|
// 发码机构号,固定值,掌上生活优惠券系统提供
|
||||||
|
string orgNo = 10 [json_name = "orgNo"];
|
||||||
|
// 500 标识位
|
||||||
|
string attach = 12 [json_name = "attach"];
|
||||||
|
// 扩展字段
|
||||||
|
string ext = 11 [json_name = "ext"];
|
||||||
|
}
|
||||||
|
|
||||||
message EncryptBodyRequest {
|
message EncryptBodyRequest {
|
||||||
string encryptBody = 1 [json_name = "encryptBody"];
|
string encryptBody = 1 [json_name = "encryptBody"];
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package bo
|
package bo
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"time"
|
||||||
|
"voucher/internal/biz/vo"
|
||||||
|
)
|
||||||
|
|
||||||
// MultiNotifyLogBo 领域实体Bo结构,字段和模型字段保持一致
|
// MultiNotifyLogBo 领域实体Bo结构,字段和模型字段保持一致
|
||||||
type MultiNotifyLogBo struct {
|
type MultiNotifyLogBo struct {
|
||||||
|
|
@ -12,7 +15,7 @@ type MultiNotifyLogBo struct {
|
||||||
ActivityNo string
|
ActivityNo string
|
||||||
StockID string
|
StockID string
|
||||||
EventType string
|
EventType string
|
||||||
Status string
|
Status vo.WechatVoucherStatus
|
||||||
ConsumeAmount int32
|
ConsumeAmount int32
|
||||||
ConsumeTime *time.Time
|
ConsumeTime *time.Time
|
||||||
TransactionID string
|
TransactionID string
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ func (biz *MultiBiz) nlCreate(ctx context.Context, req *bo.WechatVoucherNotifyBo
|
||||||
ActivityNo: order.ProductNo,
|
ActivityNo: order.ProductNo,
|
||||||
StockID: mnd.StockID,
|
StockID: mnd.StockID,
|
||||||
EventType: mnd.EventType,
|
EventType: mnd.EventType,
|
||||||
Status: req.PlainText.Status.GetValue(),
|
Status: req.PlainText.Status,
|
||||||
ConsumeAmount: mnd.ConsumeAmount,
|
ConsumeAmount: mnd.ConsumeAmount,
|
||||||
ConsumeTime: mnd.ConsumeTime,
|
ConsumeTime: mnd.ConsumeTime,
|
||||||
TransactionID: req.PlainText.ConsumeInformation.TransactionID,
|
TransactionID: req.PlainText.ConsumeInformation.TransactionID,
|
||||||
|
|
@ -193,10 +193,12 @@ func (biz *MultiBiz) nlCreate(ctx context.Context, req *bo.WechatVoucherNotifyBo
|
||||||
OrderCreateTime: order.CreateTime,
|
OrderCreateTime: order.CreateTime,
|
||||||
CouponCreateTime: &req.PlainText.CreateTime,
|
CouponCreateTime: &req.PlainText.CreateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
request, err := biz.GetRequest(ctx, nl, order)
|
request, err := biz.GetRequest(ctx, nl, order)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
b, _ := json.Marshal(request)
|
b, _ := json.Marshal(request)
|
||||||
nl.Request = string(b)
|
nl.Request = string(b)
|
||||||
|
|
||||||
|
|
@ -205,18 +207,23 @@ func (biz *MultiBiz) nlCreate(ctx context.Context, req *bo.WechatVoucherNotifyBo
|
||||||
|
|
||||||
func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo, order *bo.OrderBo) (string, error) {
|
func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo, order *bo.OrderBo) (string, error) {
|
||||||
|
|
||||||
req := &v1.CmbNotifyRequest{ // 待确定
|
req := &v1.CmbMultiNotifyRequest{
|
||||||
|
TransactionId: nl.OutBizNo, // cmb业务号
|
||||||
|
ActivityId: nl.ActivityNo, // 批次活动号
|
||||||
|
CouponId: nl.CouponID, // 微信券券号
|
||||||
|
AcquiredDate: order.ReceiveSuccessTime.Format("2006-01-02 15:04:05.000"), // 券领取时间
|
||||||
|
Status: "0", // 券状态 0:可使用,1:已使用
|
||||||
|
TransDate: nl.ConsumeTime.Format("2006-01-02 15:04:05.000"), // 核销时间,验券时间,格式yyyy-mm-dd hh:mm:ss.sss
|
||||||
|
TransAmount: fmt.Sprintf("%d", nl.ConsumeAmount),
|
||||||
|
OrderId: nl.TransactionID, // 券核销支付单号
|
||||||
Ticket: nl.OrderNo, // 券订单号,lsxd订单号
|
Ticket: nl.OrderNo, // 券订单号,lsxd订单号
|
||||||
TransDate: "", // 核销时间,验券时间,格式yyyy-mm-dd hh:mm:ss.sss
|
|
||||||
Status: "1", // 状态:1-核销成功
|
|
||||||
OrgNo: biz.bc.Cmb.OrgNo, // cmb固定值
|
OrgNo: biz.bc.Cmb.OrgNo, // cmb固定值
|
||||||
Attach: order.Attach, // cmb拓展参数
|
Attach: order.Attach, // cmb拓展参数
|
||||||
Ext: "",
|
Ext: "",
|
||||||
}
|
}
|
||||||
if nl.ConsumeTime != nil {
|
|
||||||
req.TransDate = nl.ConsumeTime.Format("2006-01-02 15:04:05.000")
|
if nl.Status.IsUsed() {
|
||||||
} else {
|
req.Status = "1"
|
||||||
req.TransDate = nl.CreateTime.Format("2006-01-02 15:04:05.000")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bizJsonBytes, err := json.Marshal(req)
|
bizJsonBytes, err := json.Marshal(req)
|
||||||
|
|
@ -235,7 +242,7 @@ func (biz *MultiBiz) GetRequest(ctx context.Context, nl *bo.MultiNotifyLogBo, or
|
||||||
}
|
}
|
||||||
|
|
||||||
request, err := biz.CmbMixRepo.GetRequest(ctx, &bo.CmbRequestBo{
|
request, err := biz.CmbMixRepo.GetRequest(ctx, &bo.CmbRequestBo{
|
||||||
FuncName: vo.CmbNotifyFuncName, // 待确定
|
FuncName: vo.CmbNotifyFuncNameUpdateCodeStatusForMulti,
|
||||||
BizContent: bizContent,
|
BizContent: bizContent,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ type CmbFuncName string
|
||||||
const (
|
const (
|
||||||
// CmbNotifyFuncName . 券状态回调通知方法
|
// CmbNotifyFuncName . 券状态回调通知方法
|
||||||
CmbNotifyFuncName CmbFuncName = "updateCodeStatus.json"
|
CmbNotifyFuncName CmbFuncName = "updateCodeStatus.json"
|
||||||
|
CmbNotifyFuncNameUpdateCodeStatusForMulti CmbFuncName = "updateCodeStatusForMulti.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s CmbFuncName) GetValue() string {
|
func (s CmbFuncName) GetValue() string {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ func (p *MultiNotifyLogRepoImpl) Create(ctx context.Context, req *bo.MultiNotify
|
||||||
ActivityNo: req.ActivityNo,
|
ActivityNo: req.ActivityNo,
|
||||||
StockID: req.StockID,
|
StockID: req.StockID,
|
||||||
EventType: req.EventType,
|
EventType: req.EventType,
|
||||||
Status: req.Status,
|
Status: req.Status.GetValue(),
|
||||||
ConsumeAmount: req.ConsumeAmount,
|
ConsumeAmount: req.ConsumeAmount,
|
||||||
ConsumeTime: req.ConsumeTime,
|
ConsumeTime: req.ConsumeTime,
|
||||||
TransactionID: req.TransactionID,
|
TransactionID: req.TransactionID,
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ func TestVerifyBody(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDecryptBody(t *testing.T) {
|
func TestDecryptBody(t *testing.T) {
|
||||||
//priKey := "f6a8d2f412e289686aba6a0f33cad1a64367d0ba012046ee0fbbefd3ffd675bd"
|
//priKey := "f6a8d2f412e289686aba6a0f33cad1a64367d0ba012046ee0fbbefd3ffd675bd" // 测试
|
||||||
priKey := "8d39ff3d2559258c163f4510f082727f51531e1953ab203d5ab1ea4a6d94fd73"
|
priKey := "8d39ff3d2559258c163f4510f082727f51531e1953ab203d5ab1ea4a6d94fd73"
|
||||||
|
|
||||||
//content := "BAdcIauIjNx3LsrplpJiZoljE4hCiGHra6ulhgG1qL0tKcAeenX+Z9VaHfXLSdkji1fYBpdZiiI35R0vFtnXPXJCJdHsGbfbae+PzNznYQS3KM8/90Y/FIWzSoszfUiF6fAuv8I6v9kQuqHUTidHeHyICDoyvJ0nhbNyUyg85bAKd6TmkVX1MgXLQ81m|5KfR/5UkpVBEQv1dx+iJbojOykNRuDV8Gsy3QOIlRI+cZvafRRPUUG6eeixnPMumhOvyZwsSG/OBeg0U/lSlAepg12tXWcQ601wjgyLaKN1iMvb1DCtfnJFAm8EWAc2SLH3NQuyhxGe/jgCXvj0wGphh4vBUzm8la8i8Aij0BI5lfgU5OzglkKDln6zHN3vBHDqOurEh18eU6z1bfvNnDpzdwEcygcEIH/6lGiqVnGH+C2+QpcKeCnj5qKGFiuSC"
|
//content := "BAdcIauIjNx3LsrplpJiZoljE4hCiGHra6ulhgG1qL0tKcAeenX+Z9VaHfXLSdkji1fYBpdZiiI35R0vFtnXPXJCJdHsGbfbae+PzNznYQS3KM8/90Y/FIWzSoszfUiF6fAuv8I6v9kQuqHUTidHeHyICDoyvJ0nhbNyUyg85bAKd6TmkVX1MgXLQ81m|5KfR/5UkpVBEQv1dx+iJbojOykNRuDV8Gsy3QOIlRI+cZvafRRPUUG6eeixnPMumhOvyZwsSG/OBeg0U/lSlAepg12tXWcQ601wjgyLaKN1iMvb1DCtfnJFAm8EWAc2SLH3NQuyhxGe/jgCXvj0wGphh4vBUzm8la8i8Aij0BI5lfgU5OzglkKDln6zHN3vBHDqOurEh18eU6z1bfvNnDpzdwEcygcEIH/6lGiqVnGH+C2+QpcKeCnj5qKGFiuSC"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue