46 lines
900 B
Go
46 lines
900 B
Go
package services
|
|
|
|
import (
|
|
"PaymentCenter/app/constants/errorcode"
|
|
"PaymentCenter/app/http/entities/front"
|
|
"PaymentCenter/app/services/thirdpay"
|
|
"context"
|
|
)
|
|
|
|
func ThirdPayWeb(ctx context.Context, req *front.PayWebReqs, appCheck *AppCheck, ip string) (code int) {
|
|
pay := thirdpay.NewWebPay(&ctx, req, appCheck, ip)
|
|
// 校验表单
|
|
pay.CheckForm()
|
|
if pay.PayCode != errorcode.Success {
|
|
code = pay.PayCode
|
|
return
|
|
}
|
|
// 校验商户
|
|
pay.CheckMerchant()
|
|
if pay.PayCode != errorcode.Success {
|
|
code = pay.PayCode
|
|
return
|
|
}
|
|
// 校验支付通道
|
|
pay.CheckPayChannel()
|
|
if pay.PayCode != errorcode.Success {
|
|
code = pay.PayCode
|
|
return
|
|
}
|
|
// 校验订单
|
|
pay.CheckOrder()
|
|
if pay.PayCode != errorcode.Success {
|
|
code = pay.PayCode
|
|
return
|
|
}
|
|
// 创建订单
|
|
pay.CreateOrder()
|
|
if pay.PayCode != errorcode.Success {
|
|
code = pay.PayCode
|
|
return
|
|
}
|
|
// 支付
|
|
pay.Pay()
|
|
return
|
|
}
|