1
This commit is contained in:
@@ -56,7 +56,7 @@ func (a *API) AccessAPI(baseUrl, action, method string, pathParam string, bizPar
|
|||||||
func() *http.Request {
|
func() *http.Request {
|
||||||
var request *http.Request
|
var request *http.Request
|
||||||
if http.MethodPost == method {
|
if http.MethodPost == method {
|
||||||
// 全路径请求参数
|
// 全路径请求参数s
|
||||||
fullURL := utils.GenerateGetURL(baseUrl, action, nil)
|
fullURL := utils.GenerateGetURL(baseUrl, action, nil)
|
||||||
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(bizParams).Encode()))
|
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(bizParams).Encode()))
|
||||||
request.Header.Set("charset", "UTF-8")
|
request.Header.Set("charset", "UTF-8")
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@@ -64,3 +65,9 @@ func TestPayStatusQuery(t *testing.T) {
|
|||||||
TradeNo: "",
|
TradeNo: "",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCardBin(t *testing.T) {
|
||||||
|
result, err := api.QueryCarBin(GetOrderNumber(8), "1", "4275711234554321")
|
||||||
|
globals.SugarLogger.Debugf("result := %s", utils.Format4Output(result, false))
|
||||||
|
globals.SugarLogger.Debugf("result := %v", err)
|
||||||
|
}
|
||||||
|
|||||||
@@ -424,3 +424,50 @@ func (a *API) SeparateQueryAmt(merchantNo, logNo, logDate string) (*SeparateQuer
|
|||||||
|
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryCarBin 卡BIN查询
|
||||||
|
func (a *API) QueryCarBin(orderNo, orgCode, cardNo string) (*BinInfo, error) {
|
||||||
|
reqData := map[string]string{
|
||||||
|
"version": "1.0",
|
||||||
|
"orderNo": orderNo,
|
||||||
|
"orgCode": orgCode,
|
||||||
|
"cardNo": cardNo,
|
||||||
|
}
|
||||||
|
reqParameter := map[string]interface{}{
|
||||||
|
"reqData": reqData,
|
||||||
|
"ver": Version,
|
||||||
|
"timestamp": utils.Int64ToStr(time.Now().Unix()),
|
||||||
|
"reqId": utils.GetUUID(),
|
||||||
|
}
|
||||||
|
result, err := a.AccessAPISign(SeparateAccountTestUrl, SeparateCardBinAction, http.MethodPost, "", reqParameter)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if result["retCode"].(string) != Success {
|
||||||
|
return nil, fmt.Errorf(result["retMsg"].(string))
|
||||||
|
}
|
||||||
|
bodyResult, err := json.Marshal(result["respData"])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
resp := &BinInfo{}
|
||||||
|
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
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"` // 银行卡号
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,17 +16,18 @@ const (
|
|||||||
|
|
||||||
// 分账前置
|
// 分账前置
|
||||||
const (
|
const (
|
||||||
SeparateAccountTestUrl = "https://test.wsmsd.cn/sit/api/v2/mms/openApi/ledger" // 测试
|
SeparateAccountTestUrl = "https://test.wsmsd.cn/sit/api/v2/mms/openApi/" // 测试
|
||||||
SeparateAccountProdUrl = "https://s2.lakala.com/api/v2/mms/openApi/ledger" // 生产
|
SeparateAccountProdUrl = "https://s2.lakala.com/api/v2/mms/openApi/" // 生产
|
||||||
|
|
||||||
SeparateAccountApplyAction = "applyLedgerMer" // 商户申请开通分账
|
SeparateAccountApplyAction = "ledger/applyLedgerMer" // 商户申请开通分账
|
||||||
SeparateAccountModifyAction = "modifyLedgerMer" // 商户变更申请开通分账
|
SeparateAccountModifyAction = "ledger/modifyLedgerMer" // 商户变更申请开通分账
|
||||||
SeparateAccountQueryAction = "queryLedgerMer" // 商户分账信息查询
|
SeparateAccountQueryAction = "ledger/queryLedgerMer" // 商户分账信息查询
|
||||||
SeparateReceiverApplyAction = "applyLedgerReceiver" // 分账接受方创建
|
SeparateReceiverApplyAction = "ledger/applyLedgerReceiver" // 分账接受方创建
|
||||||
SeparateReceiverModifyAction = "modifyLedgerReceiver" // 分账接受方变更
|
SeparateReceiverModifyAction = "ledger/modifyLedgerReceiver" // 分账接受方变更
|
||||||
SeparateReceiverQueryAction = "queryReceiverDetail" // 分账接受方查询
|
SeparateReceiverQueryAction = "ledger/queryReceiverDetail" // 分账接受方查询
|
||||||
SeparateBindAction = "applyBind" // 分账关系绑定
|
SeparateBindAction = "ledger/applyBind" // 分账关系绑定
|
||||||
SeparateUnBindAction = "applyUnBind" // 分账关系解除绑定
|
SeparateUnBindAction = "ledger/applyUnBind" // 分账关系解除绑定
|
||||||
|
SeparateCardBinAction = "cardBin" // 卡BIN查询
|
||||||
)
|
)
|
||||||
|
|
||||||
// 分账
|
// 分账
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ func init() {
|
|||||||
baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
|
|
||||||
// 菜市
|
// 菜市
|
||||||
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||||
|
|
||||||
// 果园
|
// 果园
|
||||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||||
|
|
||||||
//商超
|
//商超
|
||||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_lfakvRM4GLSa_VLMUIZDHA")
|
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_lfakvRM4GLSa_VLMUIZDHA")
|
||||||
//cookieStr := `
|
//cookieStr := `
|
||||||
// acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
// acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||||
//`
|
//`
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ func TestOrderGetRiderInfoPhoneNumber(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetOrderRefundDetail(t *testing.T) {
|
func TestGetOrderRefundDetail(t *testing.T) {
|
||||||
result, err := api.GetOrderRefundDetail(3901636712926079606, 0)
|
result, err := api.GetOrderRefundDetail(2801668233203841348, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user