This commit is contained in:
邹宗楠
2025-04-28 10:06:21 +08:00
parent 0c30e34be5
commit 40e8c79ff1
3 changed files with 54 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ import (
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
"strings"
"time"
)
@@ -287,6 +288,36 @@ func RefundBarCodeScannerOrder(ctx *jxcontext.Context, vendorOrderId string, sku
return nil
}
// AddStoreTerm 添加设备终端
func AddStoreTerm(storeId int, operation string) error {
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeId, model.VendorIDJX, "")
if err != nil {
return err
}
index := strings.LastIndex(storeDetail.Address, storeDetail.DistrictName)
address := ""
if index < 0 {
address = storeDetail.Address
} else {
address = storeDetail.Address[index+len(storeDetail.DistrictName):]
}
param := &tonglianpayapi.AddTermReq{
Termno: fmt.Sprintf("%d_1", storeDetail.ID),
Devicetype: "10",
Termsn: fmt.Sprintf("%d_1", storeDetail.ID),
Operation: operation,
Termstate: "",
Termaddress: fmt.Sprintf("%s-%s-%s-%s", storeDetail.ProvinceName, storeDetail.CityName, storeDetail.DistrictName, address),
Signtype: tonglianpayapi.EncryptionRsa,
Sign: "",
}
if operation == tonglianpayapi.ScannerOperrationStart {
param.Termstate = tonglianpayapi.ScannerOperrationStart
}
return api.TLpayAPI.TLAddTerm(param)
}
func checkJxAfsOrder(db *dao.DaoDB, goodsOrder *model.GoodsOrder, vendorOrderId string, skuIds map[int]int) (bool, int, error) {
if goodsOrder.Status != model.OrderStatusFinished {
return false, 0, fmt.Errorf("订单未完成支付,无法退款(刷新订单状态/联系管理员)")