-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (35 loc) · 1009 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
** @创建时间: 2022/6/22 11:52
** @作者 : return
** @描述 :
*/
package alipayEasySdkGo
import (
"github.com/daifuyang/alipayEasySdkGo/data"
"io/ioutil"
)
func init() {
options := GetOptions()
options.AppId = "2021001192664075"
data.SetOptions(options)
}
func GetOptions() *data.Options {
config := new(data.Options)
privateData, err := ioutil.ReadFile("../pem/private_key.pem")
if err != nil {
panic("读取私钥出错,文件不存在!")
}
config.MerchantPrivateKey = string(privateData)
publicData, err := ioutil.ReadFile("../pem/public_key.pem")
if err != nil {
panic("读取公钥钥出错,文件不存在!")
}
config.MerchantPublicKey = string(publicData)
alipayPublicData, err := ioutil.ReadFile("../pem/ali_public_key.pem")
if err != nil {
panic("读取公钥钥出错,文件不存在!")
}
config.AlipayCertPath = string(alipayPublicData)
config.NotifyUrl = "http://www.codecloud.ltd/api/v1/app/alipay/receive_notify"
return config
}