diff --git a/src/payment/apply4Sub/client.go b/src/payment/apply4Sub/client.go index 746693f4..e2e1636c 100644 --- a/src/payment/apply4Sub/client.go +++ b/src/payment/apply4Sub/client.go @@ -28,10 +28,11 @@ func NewClient(app *payment.ApplicationPaymentInterface) (*Client, error) { // 特约商户进件 // https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter11_1_1.shtml -func (comp *Client) ApplyForBusiness(ctx context.Context, params *request.RequestApply) (*response.ResponseApply, error) { +func (comp *Client) ApplyForBusiness(ctx context.Context, params *request.RequestApplyForBusiness) (*response.ResponseApplyForBusiness, error) { - result := &response.ResponseApply{} + result := &response.ResponseApplyForBusiness{} + // 获取RSA签名器 config := (*comp.App).GetConfig() rsaSigner, err := sign.NewRSASigner(crypto.SHA1) @@ -44,6 +45,7 @@ func (comp *Client) ApplyForBusiness(ctx context.Context, params *request.Reques return nil, err } + // 加密params.ContactInfo.ContactEmail cipherData, err := rsaSigner.RSAEncryptor.Encrypt([]byte(params.ContactInfo.ContactEmail)) buffer := base64.StdEncoding.EncodeToString(cipherData) if err != nil { @@ -54,6 +56,7 @@ func (comp *Client) ApplyForBusiness(ctx context.Context, params *request.Reques return nil, err } + // 结构体转化 options, err := object.StructToHashMap(params) if err != nil { return nil, err diff --git a/src/payment/apply4Sub/request/requestApplyment.go b/src/payment/apply4Sub/request/requestApplyment.go index 4a41a5b7..03fff232 100644 --- a/src/payment/apply4Sub/request/requestApplyment.go +++ b/src/payment/apply4Sub/request/requestApplyment.go @@ -1,6 +1,6 @@ package request -type RequestApply struct { +type RequestApplyForBusiness struct { BusinessCode string `json:"business_code"` ContactInfo struct { BusinessAuthorizationLetter string `json:"business_authorization_letter"` diff --git a/src/payment/apply4Sub/response/responseApply.go b/src/payment/apply4Sub/response/responseApply.go index 8dacccee..011e4a44 100644 --- a/src/payment/apply4Sub/response/responseApply.go +++ b/src/payment/apply4Sub/response/responseApply.go @@ -1,5 +1,5 @@ package response -type ResponseApply struct { +type ResponseApplyForBusiness struct { ApplymentId int64 `json:"applyment_id"` }