1
This commit is contained in:
@@ -148,5 +148,78 @@ func (a *API) RefundOrderQuery(param *RefundOrderQueryReq) ([]*RefundOrderQueryR
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
|
||||
}
|
||||
|
||||
// ApplyElectronicContract 电子合同签约
|
||||
func (a *API) ApplyElectronicContract(param *ApplyContractParam) (*ApplyContractResp, error) {
|
||||
reqParameter := map[string]interface{}{
|
||||
"req_data": utils.Struct2Map(param, "", false),
|
||||
"version": Version3,
|
||||
"req_time": utils.Time2TimeStrByFormat(time.Now(), TimeFormat),
|
||||
}
|
||||
result, err := a.AccessAPISign(OrderProdUrl, OrderEcApplyActive, http.MethodPost, "", reqParameter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result["code"].(string) != Success {
|
||||
return nil, fmt.Errorf(result["msg"].(string))
|
||||
}
|
||||
|
||||
bodyResult, err := json.Marshal(result["resp_data"].(map[string]interface{}))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp := &ApplyContractResp{}
|
||||
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// QueryElectronicContract 电子合同签约审核结果查询
|
||||
func (a *API) QueryElectronicContract(orderNo string, orgId int, ecApplyId string) (*ElectronicContractStatus, error) {
|
||||
reqParameter := map[string]interface{}{
|
||||
"req_data": map[string]interface{}{
|
||||
"version": "1.0",
|
||||
"order_no": orderNo,
|
||||
"org_id": orgId,
|
||||
"ec_apply_id": ecApplyId,
|
||||
},
|
||||
"version": Version,
|
||||
"req_time": utils.Time2TimeStrByFormat(time.Now(), TimeFormat),
|
||||
}
|
||||
result, err := a.AccessAPISign(OrderProdUrl, OrderEcApplyStatusActive, http.MethodPost, "", reqParameter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result["code"].(string) != Success {
|
||||
return nil, fmt.Errorf(result["msg"].(string))
|
||||
}
|
||||
|
||||
bodyResult, err := json.Marshal(result["resp_data"].(map[string]interface{}))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp := &ElectronicContractStatus{}
|
||||
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
type ElectronicContractStatus struct {
|
||||
Version string `json:"version"`
|
||||
OrderNo string `json:"order_no"`
|
||||
OrgId int `json:"org_id"`
|
||||
EcApplyId int64 `json:"ec_apply_id"` // ec_apply_id
|
||||
AuditStatus string `json:"audit_status"` // 人工审核状态
|
||||
AuditDesc string `json:"audit_desc"` // 人工审核结果说明
|
||||
SignH5Url string `json:"sign_h5_url"` // 签约H5地址
|
||||
SignH5UrlExpTm string `json:"sign_h5_url_exp_tm"` // 签约H5地址过期时间
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user