1
This commit is contained in:
parent
c5ad64c474
commit
6c6e99bcee
17
config.yaml
17
config.yaml
@ -70,9 +70,20 @@ wechat:
|
||||
refund-notify-domain: https://dev.hospital.applets.igandanyiyuan.com/
|
||||
doctor-app-id: wxc83296720404aa7b
|
||||
doctor-app-secret: 817665d3763637fe66d56548f8484622
|
||||
mch-id: 1636644248
|
||||
v3-api-secret: gdxz292sjSOadN3m2pCda03NfCsmNadY
|
||||
mch-certificate-serial-number: 7DEC0E6C57E0DC71F077F02F52406566AF39BEBB
|
||||
pay-1636644248:
|
||||
mch-id: 1636644248
|
||||
v3-api-secret: gdxz292sjSOadN3m2pCda03NfCsmNadY
|
||||
mch-certificate-serial-number: 7DEC0E6C57E0DC71F077F02F52406566AF39BEBB
|
||||
platform-certs: extend/weChat/certs/1659662936/wechatpay_112FCCD1B9ECC8292703AB7363C73D74B6AFDC1A.pem
|
||||
private-key: extend/weChat/certs/1636644248/apiclient_key.pem
|
||||
certificate: extend/weChat/certs/1636644248/apiclient_cert.pem
|
||||
pay-1659662936:
|
||||
mch-id: 1659662936
|
||||
v3-api-secret: gdxz292sjSOadNNad2pCda03NfC2msmY
|
||||
mch-certificate-serial-number: 12FAA5F61708B795BB5337AE915494E2DC2CA87B
|
||||
platform-certs: extend/weChat/certs/1659662936/wechatpay_5B5C8A69CC86D1127F6B6AA06AAAF10531EEFE90.pem
|
||||
private-key: extend/weChat/certs/1659662936/apiclient_key.pem
|
||||
certificate: extend/weChat/certs/1659662936/apiclient_cert.pem
|
||||
|
||||
# [处方平台]
|
||||
pre:
|
||||
|
||||
@ -1,18 +1,37 @@
|
||||
package config
|
||||
|
||||
type Wechat struct {
|
||||
PatientAppId string `mapstructure:"patient-app-id" json:"patient-app-id" yaml:"patient-app-id"`
|
||||
PatientAppSecret string `mapstructure:"patient-app-secret" json:"patient-app-secret" yaml:"patient-app-secret"`
|
||||
PatientInquiryPayNotifyUrl string `mapstructure:"patient-inquiry-pay-notify-url" json:"patient-inquiry-pay-notify-url" yaml:"patient-inquiry-pay-notify-url"`
|
||||
PatientInquiryRefundNotifyUrl string `mapstructure:"patient-inquiry-refund-notify-url" json:"patient-inquiry-refund-notify-url" yaml:"patient-inquiry-refund-notify-url"`
|
||||
PatientProductPayNotifyUrl string `mapstructure:"patient-product-pay-notify-url" json:"patient-product-pay-notify-url" yaml:"patient-product-pay-notify-url"`
|
||||
PatientProductRefundNotifyUrl string `mapstructure:"patient-product-refund-notify-url" json:"patient-product-refund-notify-url" yaml:"patient-product-refund-notify-url"`
|
||||
PatientDetectionPayNotifyUrl string `mapstructure:"patient-detection-pay-notify-url" json:"patient-detection-pay-notify-url" yaml:"patient-detection-pay-notify-url"`
|
||||
PatientDetectionRefundNotifyUrl string `mapstructure:"patient-detection-refund-notify-url" json:"patient-detection-refund-notify-url" yaml:"patient-detection-refund-notify-url"`
|
||||
RefundNotifyDomain string `mapstructure:"refund-notify-domain" json:"refund-notify-domain" yaml:"refund-notify-domain"` // 回调域名
|
||||
DoctorAppId string `mapstructure:"doctor-app-id" json:"doctor-app-id" yaml:"doctor-app-id"`
|
||||
DoctorAppSecret string `mapstructure:"doctor-app-secret" json:"doctor-app-secret" yaml:"doctor-app-secret"`
|
||||
MchId string `mapstructure:"mch-id" json:"mch-id" yaml:"mch-id"` // 商户号
|
||||
V3ApiSecret string `mapstructure:"v3-api-secret" json:"v3-api-secret" yaml:"v3-api-secret"` // 商户APIv3密钥
|
||||
MchCertificateSerialNumber string `mapstructure:"mch-certificate-serial-number" json:"mch-certificate-serial-number" yaml:"mch-certificate-serial-number"` // 商户证书序列号
|
||||
PatientAppId string `mapstructure:"patient-app-id" json:"patient-app-id" yaml:"patient-app-id"`
|
||||
PatientAppSecret string `mapstructure:"patient-app-secret" json:"patient-app-secret" yaml:"patient-app-secret"`
|
||||
PatientInquiryPayNotifyUrl string `mapstructure:"patient-inquiry-pay-notify-url" json:"patient-inquiry-pay-notify-url" yaml:"patient-inquiry-pay-notify-url"`
|
||||
PatientInquiryRefundNotifyUrl string `mapstructure:"patient-inquiry-refund-notify-url" json:"patient-inquiry-refund-notify-url" yaml:"patient-inquiry-refund-notify-url"`
|
||||
PatientProductPayNotifyUrl string `mapstructure:"patient-product-pay-notify-url" json:"patient-product-pay-notify-url" yaml:"patient-product-pay-notify-url"`
|
||||
PatientProductRefundNotifyUrl string `mapstructure:"patient-product-refund-notify-url" json:"patient-product-refund-notify-url" yaml:"patient-product-refund-notify-url"`
|
||||
PatientDetectionPayNotifyUrl string `mapstructure:"patient-detection-pay-notify-url" json:"patient-detection-pay-notify-url" yaml:"patient-detection-pay-notify-url"`
|
||||
PatientDetectionRefundNotifyUrl string `mapstructure:"patient-detection-refund-notify-url" json:"patient-detection-refund-notify-url" yaml:"patient-detection-refund-notify-url"`
|
||||
RefundNotifyDomain string `mapstructure:"refund-notify-domain" json:"refund-notify-domain" yaml:"refund-notify-domain"` // 回调域名
|
||||
DoctorAppId string `mapstructure:"doctor-app-id" json:"doctor-app-id" yaml:"doctor-app-id"`
|
||||
DoctorAppSecret string `mapstructure:"doctor-app-secret" json:"doctor-app-secret" yaml:"doctor-app-secret"`
|
||||
Pay1636644248 Pay1636644248 `mapstructure:"pay-1636644248" json:"pay-1636644248" yaml:"pay-1636644248"`
|
||||
Pay1659662936 Pay1659662936 `mapstructure:"pay-1659662936" json:"pay-1659662936" yaml:"pay-1659662936"`
|
||||
}
|
||||
|
||||
// Pay1636644248 北京欣欣相照
|
||||
type Pay1636644248 struct {
|
||||
MchId string `mapstructure:"mch-id" json:"mch-id" yaml:"mch-id"` // 商户号
|
||||
V3ApiSecret string `mapstructure:"v3-api-secret" json:"v3-api-secret" yaml:"v3-api-secret"` // 商户APIv3密钥
|
||||
MchCertificateSerialNumber string `mapstructure:"mch-certificate-serial-number" json:"mch-certificate-serial-number" yaml:"mch-certificate-serial-number"` // 商户证书序列号
|
||||
PlatformCerts string `mapstructure:"platform-certs" json:"platform-certs" yaml:"platform-certs"` // 平台证书
|
||||
PrivateKey string `mapstructure:"private-key" json:"private-key" yaml:"private-key"`
|
||||
Certificate string `mapstructure:"certificate" json:"certificate" yaml:"certificate"`
|
||||
}
|
||||
|
||||
// Pay1659662936 成都欣欣相照
|
||||
type Pay1659662936 struct {
|
||||
MchId string `mapstructure:"mch-id" json:"mch-id" yaml:"mch-id"` // 商户号
|
||||
V3ApiSecret string `mapstructure:"v3-api-secret" json:"v3-api-secret" yaml:"v3-api-secret"` // 商户APIv3密钥
|
||||
MchCertificateSerialNumber string `mapstructure:"mch-certificate-serial-number" json:"mch-certificate-serial-number" yaml:"mch-certificate-serial-number"` // 商户证书序列号
|
||||
PlatformCerts string `mapstructure:"platform-certs" json:"platform-certs" yaml:"platform-certs"` // 平台证书
|
||||
PrivateKey string `mapstructure:"private-key" json:"private-key" yaml:"private-key"`
|
||||
Certificate string `mapstructure:"certificate" json:"certificate" yaml:"certificate"`
|
||||
}
|
||||
|
||||
@ -23,13 +23,20 @@ type RefundRequest struct {
|
||||
// Refund 退款
|
||||
func (r RefundRequest) Refund(orderType int) (*refunddomestic.Refund, error) {
|
||||
mchId := ""
|
||||
mchCertificateSerialNumber := ""
|
||||
v3ApiSecret := ""
|
||||
|
||||
if orderType == 1 {
|
||||
// 问诊
|
||||
mchId = "1659662936"
|
||||
mchId = config.C.Wechat.Pay1659662936.MchId
|
||||
mchCertificateSerialNumber = config.C.Wechat.Pay1659662936.MchCertificateSerialNumber
|
||||
v3ApiSecret = config.C.Wechat.Pay1659662936.V3ApiSecret
|
||||
|
||||
} else if orderType == 2 || orderType == 3 {
|
||||
// 药品/检测
|
||||
mchId = "1636644248"
|
||||
mchId = config.C.Wechat.Pay1636644248.MchId
|
||||
mchCertificateSerialNumber = config.C.Wechat.Pay1636644248.MchCertificateSerialNumber
|
||||
v3ApiSecret = config.C.Wechat.Pay1636644248.V3ApiSecret
|
||||
}
|
||||
|
||||
if mchId == "" {
|
||||
@ -49,7 +56,7 @@ func (r RefundRequest) Refund(orderType int) (*refunddomestic.Refund, error) {
|
||||
ctx := context.Background()
|
||||
// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
|
||||
opts := []core.ClientOption{
|
||||
option.WithWechatPayAutoAuthCipher(config.C.Wechat.MchId, config.C.Wechat.MchCertificateSerialNumber, mchPrivateKey, config.C.Wechat.V3ApiSecret),
|
||||
option.WithWechatPayAutoAuthCipher(mchId, mchCertificateSerialNumber, mchPrivateKey, v3ApiSecret),
|
||||
}
|
||||
|
||||
client, err := core.NewClient(ctx, opts...)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user