1
This commit is contained in:
@@ -10,6 +10,7 @@ const (
|
|||||||
BankList = "bank" // 银行列表查询
|
BankList = "bank" // 银行列表查询
|
||||||
MerchantMcc = "customer/category" // 银行列表查询
|
MerchantMcc = "customer/category" // 银行列表查询
|
||||||
FileUpload = "file/upload" // 文件上传
|
FileUpload = "file/upload" // 文件上传
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 业务访问路由2
|
// 业务访问路由2
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const (
|
|||||||
SeparateBindAction = "ledger/applyBind" // 分账关系绑定
|
SeparateBindAction = "ledger/applyBind" // 分账关系绑定
|
||||||
SeparateUnBindAction = "ledger/applyUnBind" // 分账关系解除绑定
|
SeparateUnBindAction = "ledger/applyUnBind" // 分账关系解除绑定
|
||||||
SeparateCardBinAction = "cardBin" // 卡BIN查询
|
SeparateCardBinAction = "cardBin" // 卡BIN查询
|
||||||
|
AttachmentUpload = "uploadFile" // 附件上传
|
||||||
)
|
)
|
||||||
|
|
||||||
// 分账
|
// 分账
|
||||||
|
|||||||
@@ -134,36 +134,53 @@ type UploadImgResp struct {
|
|||||||
Result interface{} `json:"result"` //
|
Result interface{} `json:"result"` //
|
||||||
}
|
}
|
||||||
|
|
||||||
// signParamRSA 支付签名
|
// AttachmentUpload 附件上传
|
||||||
//func (a *API) signParamRSA(params map[string]interface{}, RSAPrivate string) (sig string, err error) {
|
func (a *API) AttachmentUpload(param *AttachmentImg) (*AttachmentImgResp, error) {
|
||||||
// block, _ := pem.Decode([]byte(RSAPrivate))
|
reqParameter := map[string]interface{}{
|
||||||
// private, err := x509.ParsePKCS8PrivateKey(block.Bytes)
|
"reqData": param,
|
||||||
// if err != nil {
|
"ver": Version,
|
||||||
// return "", err
|
"timestamp": utils.Int64ToStr(time.Now().Unix()),
|
||||||
// }
|
"reqId": utils.GetUUID(),
|
||||||
//
|
}
|
||||||
// // 签名参数
|
result, err := a.AccessAPISign(SeparateAccountProdUrl, AttachmentUpload, http.MethodPost, "", reqParameter)
|
||||||
// body, err := json.Marshal(params)
|
if err != nil {
|
||||||
// if err != nil {
|
return nil, err
|
||||||
// return "", err
|
}
|
||||||
// }
|
|
||||||
//
|
if result["retCode"].(string) != Success {
|
||||||
// //bodyData := base64.StdEncoding.EncodeToString(body)
|
return nil, errors.New(result["retMsg"].(string))
|
||||||
// nonceStr := GenerateSecureRandomString(12)
|
}
|
||||||
// timeStamp := utils.Int64ToStr(time.Now().Unix())
|
|
||||||
// context := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n", a.appID, a.serialNo, timeStamp, nonceStr, string(body))
|
bodyResult, err := json.Marshal(result["respData"])
|
||||||
//
|
if err != nil {
|
||||||
// // 进行rsa加密签名
|
return nil, err
|
||||||
// hashed := sha256.Sum256([]byte(context))
|
}
|
||||||
// signedData, err := rsa.SignPKCS1v15(rand.Reader, private.(*rsa.PrivateKey), crypto.SHA256, hashed[:])
|
|
||||||
// if err != nil {
|
attachment := &AttachmentImgResp{}
|
||||||
// return "", err
|
if err = json.Unmarshal(bodyResult, attachment); err != nil {
|
||||||
// }
|
return nil, err
|
||||||
//
|
}
|
||||||
// signData := base64.StdEncoding.EncodeToString(signedData)
|
|
||||||
// authorization := fmt.Sprintf(`LKLAPI-SHA256withRSA appid="%s",serial_no="%s",timestamp="%s",nonce_str="%s",signature="%s"`, a.appID, a.serialNo, timeStamp, nonceStr, signData)
|
return attachment, nil
|
||||||
// return authorization, nil
|
}
|
||||||
//}
|
|
||||||
|
// AttachmentImg 进件附件上传
|
||||||
|
type AttachmentImg struct {
|
||||||
|
Version string `json:"version"`
|
||||||
|
OrderNo string `json:"orderNo"`
|
||||||
|
OrgCode string `json:"orgCode"`
|
||||||
|
AttType string `json:"attType"`
|
||||||
|
AttExtName string `json:"attExtName"`
|
||||||
|
AttContext string `json:"attContext"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AttachmentImgResp 进件返回值
|
||||||
|
type AttachmentImgResp struct {
|
||||||
|
AttType string `json:"attType"`
|
||||||
|
OrderNo string `json:"orderNo"`
|
||||||
|
OrgCode string `json:"orgCode"`
|
||||||
|
AttFileId string `json:"attFileId"`
|
||||||
|
}
|
||||||
|
|
||||||
// signParamRSA 支付签名
|
// signParamRSA 支付签名
|
||||||
func (a *API) signParamPrivateKey(params map[string]interface{}, RSAPrivate string) (sig string, err error) {
|
func (a *API) signParamPrivateKey(params map[string]interface{}, RSAPrivate string) (sig string, err error) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user