Browse Source

update

tmp
dengbiao 8 months ago
parent
commit
26c7ac3b08
6 changed files with 51 additions and 22 deletions
  1. +1
    -1
      app/admin/hdl/hdl_demo.go
  2. +8
    -17
      app/admin/svc/enterprise_manage/svc_self_support_for_school.go
  3. +1
    -1
      app/admin/svc/order/svc_central_kitchen_for_school_order.go
  4. +1
    -1
      app/admin/svc/order/svc_nursing_home_package_ord.go
  5. +9
    -1
      app/customer/md/md_curl_smart_pay.go
  6. +31
    -1
      app/customer/svc/svc_curl_smart_pay.go

+ 1
- 1
app/admin/hdl/hdl_demo.go View File

@@ -95,7 +95,7 @@ func Demo(c *gin.Context) {
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey)

//调用支付宝进行退款
err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
err6, _ := svc2.OldCurlAlipayTradeRefund(md2.OldCurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`


+ 8
- 17
app/admin/svc/enterprise_manage/svc_self_support_for_school.go View File

@@ -1306,9 +1306,9 @@ func SelfSupportForSchoolOrdRefund(req md.SelfSupportForSchoolOrdRefundReq) (err
return err
}

sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.OpenAlipayAppid, enum2.OpenAlipayAppPrivateKey, enum2.OpenAlipayPublicKey)
//sysCfgDb := db.SysCfgDb{}
//sysCfgDb.Set()
//sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.OpenAlipayAppid, enum2.OpenAlipayAppPrivateKey, enum2.OpenAlipayPublicKey)

companyWithAlipayAppAuthTokenDb := db.CompanyWithAlipayAppAuthTokenDb{}
companyWithAlipayAppAuthTokenDb.Set()
@@ -1333,20 +1333,11 @@ func SelfSupportForSchoolOrdRefund(req md.SelfSupportForSchoolOrdRefundReq) (err

//2、支付宝进行退款
err1, _ = svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
}{
PayAliAppId: sysCfg[enum2.OpenAlipayAppid],
PayAliPrivateKey: sysCfg[enum2.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum2.OpenAlipayPublicKey],
},
OutTradeNo: v.OutOrderNo,
RefundAmount: v.TradeAmount,
RefundReason: "刷脸就餐-退款",
OutRequestNo: utils.OrderUUID(v.Uid),
AppAuthToken: companyWithAlipayAppAuthToken.AppAuthToken,
OutOrderNo: v.OutOrderNo,
RefundAmount: v.TradeAmount,
RefundReason: "刷脸就餐-退款",
RefundOutOrderNo: utils.OrderUUID(v.Uid),
MerchantCode: v.CpMerchantId,
})
if err1 != nil {
return err1


+ 1
- 1
app/admin/svc/order/svc_central_kitchen_for_school_order.go View File

@@ -350,7 +350,7 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch

//调用支付宝进行退款
for k, v := range dealReturnOrdMap {
err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
err6, _ := svc2.OldCurlAlipayTradeRefund(md2.OldCurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`


+ 1
- 1
app/admin/svc/order/svc_nursing_home_package_ord.go View File

@@ -128,7 +128,7 @@ func NursingHomeOrderRefundAudit(req md.NursingHomeOrderRefundAuditReq) (err err
userWithDay.State = enum.NursingHomeUserWithDayStateForCancel
time.Sleep(250 * time.Millisecond) //TODO::避免频繁调用
//调用支付宝进行退款
err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
err6, _ := svc2.OldCurlAlipayTradeRefund(md2.OldCurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`


+ 9
- 1
app/customer/md/md_curl_smart_pay.go View File

@@ -57,7 +57,7 @@ type CurlAlipayTradeQueryResp struct {
TradeStatus string `json:"trade_status" label:"交易状态:WAIT_BUYER_PAY(交易创建,等待买家付款)、TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、TRADE_SUCCESS(交易支付成功)、TRADE_FINISHED(交易结束,不可退款)"`
}

type CurlAlipayTradeRefundReq struct {
type OldCurlAlipayTradeRefundReq struct {
Config struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
@@ -70,6 +70,14 @@ type CurlAlipayTradeRefundReq struct {
AppAuthToken string `json:"app_auth_token" binding:"required" label:"应用授权token"`
}

type CurlAlipayTradeRefundReq struct {
OutOrderNo string `json:"out_order_no" label:"商户订单号"`
MerchantCode string `json:"merchant_code" label:"商户编号"`
RefundOutOrderNo string `json:"refund_out_order_no" label:"退款订单号"`
RefundAmount string `json:"refund_amount" label:"退款金额"`
RefundReason string `json:"refund_reason" label:"退款原因"`
}

type CurlAlipayTradeRefundQueryReq struct {
Config struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`


+ 31
- 1
app/customer/svc/svc_curl_smart_pay.go View File

@@ -135,7 +135,7 @@ func CurlAlipayTradeQuery(args md.CurlAlipayTradeQueryReq) (err error, resp md.C
return
}

func CurlAlipayTradeRefund(args md.CurlAlipayTradeRefundReq) (err error, resp interface{}) {
func OldCurlAlipayTradeRefund(args md.OldCurlAlipayTradeRefundReq) (err error, resp interface{}) {
url := cfg.SmartCanteenPay + "/alipay/pay/tradeRefund"
utils.FilePutContents("CurlAlipayTradeRefund", utils.SerializeStr(map[string]interface{}{
"args": args,
@@ -165,6 +165,36 @@ func CurlAlipayTradeRefund(args md.CurlAlipayTradeRefundReq) (err error, resp in
return nil, result.Data
}

func CurlAlipayTradeRefund(args md.CurlAlipayTradeRefundReq) (err error, resp interface{}) {
url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiTradeRefund"
utils.FilePutContents("CurlAlipayTradeRefund", utils.SerializeStr(map[string]interface{}{
"args": args,
}))
bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
if err != nil {
return
}
var result struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
utils.FilePutContents("CurlAlipayTradeRefund", utils.SerializeStr(result))
err = json.Unmarshal(bytes, &result)
if err != nil {
return
}
if result.Code != 0 {
if result.Msg != "" {
err = errors.New(result.Msg)
return
}
err = errors.New("请求智慧餐厅支付 异常/失败")
return
}
return nil, result.Data
}

func CurlAlipayTradeRefundQuery(args md.CurlAlipayTradeRefundQueryReq) (err error, resp interface{}) {
url := cfg.SmartCanteenPay + "/alipay/pay/tradeRefundQuery"
utils.FilePutContents("CurlAlipayTradeRefundQuery", utils.SerializeStr(map[string]interface{}{


Loading…
Cancel
Save