41 lines
845 B
Go
41 lines
845 B
Go
package payment
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"bsm/full/module/finance/wallet/internal/models"
|
|
pb "bsm/full/module/finance/wallet/pb"
|
|
"git.apinb.com/bsm-sdk/core/errcode"
|
|
"git.apinb.com/bsm-sdk/core/service"
|
|
"git.apinb.com/bsm-sdk/core/vars"
|
|
)
|
|
|
|
// 回调更新支付的结果和状态
|
|
func Callback(ctx context.Context, in *pb.CallbackRequest) (reply *pb.StatusReply, err error) {
|
|
auth, ok := service.ParseMetaCtx(ctx, nil)
|
|
if ok != nil {
|
|
return nil, ok
|
|
}
|
|
|
|
if in.Identity == "" {
|
|
return nil, errcode.ErrInvalidArgument
|
|
}
|
|
|
|
var status int8 = 0
|
|
if in.CallbackStatus {
|
|
status = 2
|
|
} else {
|
|
status = -1
|
|
}
|
|
err = models.UpsetWalletPaymentByIdentity(auth.Identity, in.Identity, status, in.CallbackMsg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &pb.StatusReply{
|
|
Message: vars.OK,
|
|
Timeseq: time.Now().UnixMilli(),
|
|
}, nil
|
|
|
|
}
|