1
This commit is contained in:
@@ -151,7 +151,7 @@ func (a *API) RefundOrderQuery(param *RefundOrderQueryReq) ([]*RefundOrderQueryR
|
||||
}
|
||||
|
||||
// ApplyElectronicContract 电子合同签约
|
||||
func (a *API) ApplyElectronicContract(param *ApplyContractParam) (*ApplyContractResp, error) {
|
||||
func (a *API) ApplyElectronicContract(param *ApplyContractParam) (*ApplyContract, error) {
|
||||
reqParameter := map[string]interface{}{
|
||||
"req_data": utils.Struct2Map(param, "", false),
|
||||
"version": Version3,
|
||||
@@ -162,16 +162,12 @@ func (a *API) ApplyElectronicContract(param *ApplyContractParam) (*ApplyContract
|
||||
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{}))
|
||||
bodyResult, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp := &ApplyContractResp{}
|
||||
resp := &ApplyContract{}
|
||||
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -251,6 +251,12 @@ type ApplyContractParam struct {
|
||||
RetUrl string `json:"ret_url"` // 电子合同签约结果回调通知 C String(128) 成功签约才通知
|
||||
}
|
||||
|
||||
type ApplyContract struct {
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
RespData *ApplyContractResp `json:"resp_data"`
|
||||
}
|
||||
|
||||
// ApplyContractResp 签约响应参数
|
||||
type ApplyContractResp struct {
|
||||
OrderNo string `json:"order_no"`
|
||||
|
||||
@@ -1,28 +1,79 @@
|
||||
package lakala
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestApplyElectronicContract(t *testing.T) {
|
||||
api.ApplyElectronicContract(&ApplyContractParam{
|
||||
OrderNo: "9839312025071609240676528932",
|
||||
OrgId: 983931,
|
||||
EcTypeCode: "EC008",
|
||||
CertType: "RESIDENT_ID",
|
||||
CertName: "石锋",
|
||||
CertNo: "610126198012230014",
|
||||
Mobile: "18048531223",
|
||||
BusinessLicenseNo: "915101003431062533",
|
||||
BusinessLicenseName: "成都若溪科技有限公司",
|
||||
OpenningBankCode: "305651000261",
|
||||
OpenningBankName: "中国民生银行股份有限公司成都金牛支行",
|
||||
AcctTypeCode: "58",
|
||||
AcctNo: "6226192004500005",
|
||||
AcctName: "石锋",
|
||||
EcContentParameters: "{\"A1\":\"成都若溪科技有限公司\",\"A29\":\"0.2\",\"A30\":\"0.2\",\"A31\":\"0.2\",\"A32\":\"0.2\",\"A33\":\"0.2\",\"A34\":\"0.2\",\"A88\":\"0.2\",\"A96\":\"D1\",\"A97\":\"开通\",\"A100\":\"不开通\",\"A101\":\"中国境内\",\"A104\":2025,\"A105\":7,\"A106\":16,\"A107\":2025,\"A108\":7,\"A109\":16}",
|
||||
})
|
||||
//api.ApplyElectronicContract(&ApplyContractParam{
|
||||
// OrderNo: "9839312025071609240676528932",
|
||||
// OrgId: 983931,
|
||||
// EcTypeCode: "EC008",
|
||||
// CertType: "RESIDENT_ID",
|
||||
// CertName: "石锋",
|
||||
// CertNo: "610126198012230014",
|
||||
// Mobile: "18048531223",
|
||||
// BusinessLicenseNo: "915101003431062533",
|
||||
// BusinessLicenseName: "成都若溪科技有限公司",
|
||||
// OpenningBankCode: "305651000261",
|
||||
// OpenningBankName: "中国民生银行股份有限公司成都金牛支行",
|
||||
// AcctTypeCode: "58",
|
||||
// AcctNo: "6226192004500005",
|
||||
// AcctName: "石锋",
|
||||
// EcContentParameters: "{\"A1\":\"成都若溪科技有限公司\",\"A29\":\"0.2\",\"A30\":\"0.2\",\"A31\":\"0.2\",\"A32\":\"0.2\",\"A33\":\"0.2\",\"A34\":\"0.2\",\"A88\":\"0.2\",\"A96\":\"D1\",\"A97\":\"开通\",\"A100\":\"不开通\",\"A101\":\"中国境内\",\"A104\":2025,\"A105\":7,\"A106\":16,\"A107\":2025,\"A108\":7,\"A109\":16}",
|
||||
//})
|
||||
reqParameter := map[string]interface{}{
|
||||
"req_data": map[string]interface{}{
|
||||
"order_no": "9839312025071616403365650684",
|
||||
"org_id": 983931,
|
||||
"ec_type_code": "EC008",
|
||||
"cert_type": "RESIDENT_ID",
|
||||
"cert_name": "石锋",
|
||||
"cert_no": "610126198012230014",
|
||||
"mobile": "18048531223",
|
||||
"business_license_no": "915101003431062533",
|
||||
"business_license_name": "成都若溪科技有限公司",
|
||||
|
||||
"openning_bank_code": "308651020187",
|
||||
"openning_bank_name": "招商银行成都红牌楼支行",
|
||||
"acct_type_code": "58",
|
||||
"acct_no": "6214830283341583",
|
||||
"acct_name": "招商银行",
|
||||
"ec_content_parameters": "1",
|
||||
"agent_tag": 0,
|
||||
},
|
||||
"version": Version3,
|
||||
"req_time": utils.Time2TimeStrByFormat(time.Now(), TimeFormat),
|
||||
}
|
||||
result, err := api.AccessAPISign(OrderProdUrl, OrderEcApplyActive, http.MethodPost, "", reqParameter)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
if result["code"].(string) != Success {
|
||||
fmt.Println(fmt.Errorf(result["msg"].(string)))
|
||||
return
|
||||
}
|
||||
|
||||
bodyResult, err := json.Marshal(result["resp_data"].(map[string]interface{}))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
resp := &ApplyContractResp{}
|
||||
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func TestCreateOrder(t *testing.T) {
|
||||
|
||||
@@ -461,7 +461,7 @@ func (a *API) QueryCarBin(orderNo, orgCode, cardNo string) (*BinInfo, error) {
|
||||
}
|
||||
|
||||
type BinInfo struct {
|
||||
cardBin string `json:"cardBin"` // 卡bin
|
||||
CardBin string `json:"cardBin"` // 卡bin
|
||||
BankCode string `json:"bankCode"` // 开户行号
|
||||
OrderNo string `json:"orderNo"` // 订单号
|
||||
CardName string `json:"cardName"` // 卡种名称
|
||||
|
||||
Reference in New Issue
Block a user