package yibao_pay import ( "github.com/yop-platform/yop-go-sdk/yop/client" "github.com/yop-platform/yop-go-sdk/yop/constants" "github.com/yop-platform/yop-go-sdk/yop/request" "github.com/yop-platform/yop-go-sdk/yop/response" "github.com/yop-platform/yop-go-sdk/yop/utils" "os" ) func GetSend(method, appId, isvPriKey string, param map[string]string) (*response.YopResponse, error) { var priKey = request.IsvPriKey{Value: isvPriKey, CertType: request.RSA2048} var yopRequest = request.NewYopRequest(constants.GET_HTTP_METHOD, method) yopRequest.AppId = appId yopRequest.IsvPriKey = priKey for k, v := range param { yopRequest.AddParam(k, v) } yopResp, err := client.DefaultClient.Request(yopRequest) return yopResp, err } func PostFormSend(method, appId, isvPriKey string, param map[string]string) (*response.YopResponse, error) { var priKey = request.IsvPriKey{Value: isvPriKey, CertType: request.RSA2048} var yopRequest = request.NewYopRequest(constants.POST_HTTP_METHOD, method) yopRequest.AppId = appId yopRequest.IsvPriKey = priKey for k, v := range param { yopRequest.AddParam(k, v) } yopResp, err := client.DefaultClient.Request(yopRequest) return yopResp, err } func PostJsonSend(method, appId, isvPriKey string, params map[string]interface{}) (*response.YopResponse, error) { var priKey = request.IsvPriKey{Value: isvPriKey, CertType: request.RSA2048} var yopRequest = request.NewYopRequest(constants.POST_HTTP_METHOD, method) yopRequest.AppId = appId yopRequest.IsvPriKey = priKey yopRequest.Content = utils.ParseToJsonStr(params) yopResp, err := client.DefaultClient.Request(yopRequest) return yopResp, err } func FileUploadSend(method, appId, isvPriKey string, name string, f *os.File) (*response.YopResponse, error) { var priKey = request.IsvPriKey{Value: isvPriKey, CertType: request.RSA2048} var yopRequest = request.NewYopRequest(constants.POST_HTTP_METHOD, method) yopRequest.AppId = appId yopRequest.IsvPriKey = priKey yopRequest.AddFile(name, f) yopResp, err := client.DefaultClient.Request(yopRequest) return yopResp, err }