1
This commit is contained in:
@@ -465,14 +465,119 @@ func (a *API) QueryCarBin(orderNo, orgCode, cardNo string) (*BinInfo, error) {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
type BinInfo struct {
|
||||
CardBin string `json:"cardBin"` // 卡bin
|
||||
BankCode string `json:"bankCode"` // 开户行号
|
||||
OrderNo string `json:"orderNo"` // 订单号
|
||||
CardName string `json:"cardName"` // 卡种名称
|
||||
OrgCode string `json:"orgCode"` // 机构代码
|
||||
CardType string `json:"cardType"` // 银行卡类别
|
||||
BankName string `json:"bankName"` // 开户行名称
|
||||
ClearingBankCode string `json:"clearingBankCode"` // 清算行号
|
||||
CardNo string `json:"cardNo"` // 银行卡号
|
||||
// SaveAuthentication 微信支付宝认证
|
||||
func (a *API) SaveAuthentication(param *AuthenticationInfo, authType string) error {
|
||||
reqData := utils.Struct2Map(param, "", false)
|
||||
activityUrl := WeChatAuthentication
|
||||
if authType == AuthenticationType {
|
||||
reqData["realNameType"] = AuthenticationType
|
||||
activityUrl = AlibabaAuthentication
|
||||
}
|
||||
reqParameter := map[string]interface{}{
|
||||
"req_data": reqData,
|
||||
"ver": Version,
|
||||
"timestamp": utils.Int64ToStr(time.Now().Unix()),
|
||||
"reqId": utils.GetUUID(),
|
||||
}
|
||||
result, err := a.AccessAPISign(SeparateAccountProdUrl, activityUrl, http.MethodPost, "", reqParameter)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if result["retCode"].(string) != Success {
|
||||
return errors.New(result["retMsg"].(string))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateAuthentication 实名认证修改
|
||||
// https://o.lakala.com/#/home/document/detail?id=183
|
||||
func (a *API) UpdateAuthentication(param *UpdateAuthentication, authType string) error {
|
||||
reqData := utils.Struct2Map(param, "", false)
|
||||
activityUrl := WeChatUpdateAuthentication
|
||||
if authType == AuthenticationType {
|
||||
activityUrl = AlibabaUpdateAuthentication
|
||||
}
|
||||
reqParameter := map[string]interface{}{
|
||||
"reqData": reqData,
|
||||
"ver": Version,
|
||||
"timestamp": utils.Int64ToStr(time.Now().Unix()),
|
||||
"reqId": utils.GetUUID(),
|
||||
}
|
||||
result, err := a.AccessAPISign(SeparateAccountProdUrl, activityUrl, http.MethodPost, "", reqParameter)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if result["retCode"].(string) != Success {
|
||||
return errors.New(result["retMsg"].(string))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// QueryAuthentication 实名认证查询
|
||||
// https://o.lakala.com/#/home/document/detail?id=181
|
||||
func (a *API) QueryAuthentication(param *QueryAuthentication, authType string) (*QueryAuthenticationResp, error) {
|
||||
reqData := utils.Struct2Map(param, "", false)
|
||||
activityUrl := WeChatQueryAuthentication
|
||||
if authType == AuthenticationType {
|
||||
reqData["realNameType"] = AuthenticationType
|
||||
activityUrl = AlibabaQueryAuthentication
|
||||
}
|
||||
reqParameter := map[string]interface{}{
|
||||
"reqData": reqData,
|
||||
"ver": Version,
|
||||
"timestamp": utils.Int64ToStr(time.Now().Unix()),
|
||||
"reqId": utils.GetUUID(),
|
||||
}
|
||||
result, err := a.AccessAPISign(SeparateAccountProdUrl, activityUrl, http.MethodPost, "", reqParameter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result["retCode"].(string) != Success {
|
||||
return nil, errors.New(result["retMsg"].(string))
|
||||
}
|
||||
|
||||
body, err := json.Marshal(result["respData"])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp := &QueryAuthenticationResp{}
|
||||
if err = json.Unmarshal(body, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// AccountStatusQuery 开户状态查询
|
||||
// https://o.lakala.com/#/home/document/detail?id=528
|
||||
func (a *API) AccountStatusQuery(tradeMode, subMerchantId, merchantNo string) (map[string]interface{}, error) {
|
||||
activityUrl := ""
|
||||
switch tradeMode {
|
||||
case "ALIPAY":
|
||||
activityUrl = AlibabaAccountStatusQuery
|
||||
case "WECHAT":
|
||||
activityUrl = WeChatAccountStatusQuery
|
||||
}
|
||||
reqParameter := map[string]interface{}{
|
||||
"reqData": map[string]interface{}{"tradeMode": tradeMode, "subMerchantId": subMerchantId, "merchantNo": merchantNo},
|
||||
"ver": Version,
|
||||
"timestamp": utils.Int64ToStr(time.Now().Unix()),
|
||||
"reqId": utils.GetUUID(),
|
||||
}
|
||||
result, err := a.AccessAPISign(PayAccountProdUrl, activityUrl, http.MethodPost, "", reqParameter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result["retCode"].(string) != Success {
|
||||
return nil, errors.New(result["retMsg"].(string))
|
||||
}
|
||||
|
||||
return result["respData"].(map[string]interface{}), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user