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UHziiWo7phIo+mC9gRRYdOyO\n5FhTiq1sWWsam8XLOKYh3rXIl8DhtphG736CI10AskZx2fQl5xe6UnhHNIyHQUxr\nBy3ncdAjyfR4qDxHT65aTcgygt9XpRpg3kgOZzJFfSdwZFhvvP/VzChhxbI9TCgB\ndoHG2glUdQKBgQCf9egiZNI1MZaLP2Pkxmg20Z/tXz0lzcOMVjYUFbXelTneUXmH\ngYCIe2c3quRBd+FDDgAmmbNlPQtHSKCMlA/+Z40KesgwW+LYjJGbXj2t9OR0nuDY\neOas5BBtG1uHscMZrtWTB/HQs85sojXRM3HL4f6wSINWU1t5r2+Kb0X4mwKBgH8O\nx0DWdiE7/tFyKeZlEM94ITkPaK0Jm4VA1nuc4RtRx/iZFF166TyRmbZdeaqlbyZF\nkCmw0yyXa/ceIs1/PEeBlGSNe7MiA8aj5WPPTd96P8eB0BqbhF5PLLXMXiHGO2BL\nQDkbSQeleNvK5QP/Shsb8PUxBQeN/UQnq2zQQPXZAoGBALcEWSE0pjJTI36isHPz\n005GVe4TTyIzXDQ24I8JP7nMg+Z+zyjcAePmcg49vvmMD32rrSynb+CqeL8RUD3N\nkDU1KZ8HgKOOapub1YP6KqWfKX5nN1id70voVefNeKxnOcyk09KNT32TTguo6WQs\nDWxJI9MWHEeoHXLOT5K0FVpP\n-----END PRIVATE KEY-----" | |||||
// SignNo = "562265003122220003" | |||||
// CustomerCode = "562265003122220" | |||||
// PublicKeyStr = "MIID0jCCArqgAwIBAgIJAP7Hut/02gF6MA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNV\nBAYTAkdaMQswCQYDVQQIDAJHRDELMAkGA1UEBwwCR1oxDTALBgNVBAoMBEVQQVkx\nEjAQBgNVBAsMCWVwYXlsaW5rczENMAsGA1UEAwwEeWlscjEjMCEGCSqGSIb3DQEJ\nARYUeWlsaXJlbkBlcGF5bGlua3MuY24wHhcNMjMwNDEzMDE1MDM5WhcNMzMwNDEw\nMDE1MDM5WjB+MQswCQYDVQQGEwJHWjEL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l8DhtphG736CI10AskZx2fQl5xe6UnhHNIyHQUxr\nBy3ncdAjyfR4qDxHT65aTcgygt9XpRpg3kgOZzJFfSdwZFhvvP/VzChhxbI9TCgB\ndoHG2glUdQKBgQCf9egiZNI1MZaLP2Pkxmg20Z/tXz0lzcOMVjYUFbXelTneUXmH\ngYCIe2c3quRBd+FDDgAmmbNlPQtHSKCMlA/+Z40KesgwW+LYjJGbXj2t9OR0nuDY\neOas5BBtG1uHscMZrtWTB/HQs85sojXRM3HL4f6wSINWU1t5r2+Kb0X4mwKBgH8O\nx0DWdiE7/tFyKeZlEM94ITkPaK0Jm4VA1nuc4RtRx/iZFF166TyRmbZdeaqlbyZF\nkCmw0yyXa/ceIs1/PEeBlGSNe7MiA8aj5WPPTd96P8eB0BqbhF5PLLXMXiHGO2BL\nQDkbSQeleNvK5QP/Shsb8PUxBQeN/UQnq2zQQPXZAoGBALcEWSE0pjJTI36isHPz\n005GVe4TTyIzXDQ24I8JP7nMg+Z+zyjcAePmcg49vvmMD32rrSynb+CqeL8RUD3N\nkDU1KZ8HgKOOapub1YP6KqWfKX5nN1id70voVefNeKxnOcyk09KNT32TTguo6WQs\nDWxJI9MWHEeoHXLOT5K0FVpP\n-----END PRIVATE KEY-----" | |||||
SignNo = "562265003122220003" | |||||
CustomerCode = "562265003122220" | |||||
PublicKeyStr = "MIID0jCCArqgAwIBAgIJAP7Hut/02gF6MA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNV\nBAYTAkdaMQswCQYDVQQIDAJHRDELMAkGA1UEBwwCR1oxDTALBgNVBAoMBEVQQVkx\nEjAQBgNVBAsMCWVwYXlsaW5rczENMAsGA1UEAwwEeWlscjEjMCEGCSqGSIb3DQEJ\nARYUeWlsaXJlbkBlcGF5bGlua3MuY24wHhcNMjMwNDEzMDE1MDM5WhcNMzMwNDEw\nMDE1MDM5WjB+MQswCQYDVQQGEwJHWjELMAkGA1UECAwCR0QxCzAJBgNVBAcMAkda\nMQ0wCwYDVQQKDARFUEFZMRIwEAYDVQQLDAllcGF5bGlua3MxDTALBgNVBAMMBHlp\nbHIxIzAhBgkqhkiG9w0BCQEWFHlpbGlyZW5AZXBheWxpbmtzLmNuMIIBIjANBgkq\nhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1SL1lt41Phow3aZKQhB0zXNCX4DNqMkr\n88/auTe/Lq7llBNYWtPJeABg6K+8JHAs6L90yzQN3mUU3k4gKFLCJPQEIlK9sPKA\nAJQnDAs+3PUucgl1QCJnmeSRQKQCGfFjmsGOn+deyV/Lx4gHd3ytpErUDM1iEfen\nYHQACuGlRK9G7w90V0UnF7YJca5FCB/wzL3QjqcQC6Z9e/bYXQES7fQH8vX+ajBr\ngvi9nMVjFugsZk5sLkwGeYuY4/HMuUWQ8wW+Fvu8cJKtb48sqTl1eTPMhKPwgrgY\nEB+RIBA4Ls/gF4/7/dQJA18xFS60Dbn7LS6IP6OTkO9BP4k+qi0kLQIDAQABo1Mw\nUTAdBgNVHQ4EFgQUZlpKcM3zf5c8fed6tWnRVVQfC4AwHwYDVR0jBBgwFoAUZlpK\ncM3zf5c8fed6tWnRVVQfC4AwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsF\nAAOCAQEAyIhFS5AzMVNYXqjRxkKIgdEFt3DXVWermW6L/w0S774ebflQT7fabZhP\n+NirUB9VP2hM4axZEhXSXYBeRMw9ahs/It0OrBNbmH+N4bIUVLdGeMoGpjjV5vvd\nOV5Tagna7hhaK0F3iBOnjDiO17INxMiRx9yt7n41ml+4VLAbaLY1l0CGouNmrkzT\n15CxLnB29m0Xq3V+YsLfDV5ohUNtbFX3NrBUXSHUUf5n8YWqJWTQl2TkeMoYAJbs\nWSdkZGNB5KGDUORRPjabpEs2+0+uGHgVr3Llxc3rEVgLSX0wFe1ytLbIW0ibmQV+\ntpiZYSSfN6lzzX9NnQk3zGLv+UfIag==" | |||||
) | |||||
func CardPaySend(method string, keyArr map[string]string, param map[string]string) (string, error) { | func CardPaySend(method string, keyArr map[string]string, param map[string]string) (string, error) { | ||||
url := "http://test-efps.epaylinks.cn/" + method | url := "http://test-efps.epaylinks.cn/" + method | ||||
@@ -1,5 +1,7 @@ | |||||
package card_pay | package card_pay | ||||
import "time" | |||||
//绑卡 | //绑卡 | ||||
func BindCard(keyArr, param map[string]string) (string, error) { | func BindCard(keyArr, param map[string]string) (string, error) { | ||||
//param = map[string]string{ | //param = map[string]string{ | ||||
@@ -44,52 +46,52 @@ func UnBindCard(keyArr, param map[string]string) (string, error) { | |||||
return CardPaySend("api/txs/protocol/unBindCard", keyArr, param) | return CardPaySend("api/txs/protocol/unBindCard", keyArr, param) | ||||
} | } | ||||
func Pay(keyArr map[string]string, param map[string]interface{}) (string, error) { | func Pay(keyArr map[string]string, param map[string]interface{}) (string, error) { | ||||
//memberId := "562902003186055" | |||||
//ordId := "1111111" | |||||
//amount := "100" | |||||
//param = map[string]interface{}{ | |||||
// "version": "2.0", | |||||
// "protocol": "p202306084666779900235", | |||||
// "outTradeNo": ordId, | |||||
// "transType": "01", | |||||
// "isSendSmsCode": "2", | |||||
// "payAmount": amount, | |||||
// "payCurrency": "CNY", | |||||
// "transactionStartTime": time.Now().Format("20060102150405"), | |||||
// "memberId": memberId, //分账模式(splitModel)为“1-普通分账”的,该值一律传商户自编的编号。 | |||||
// "notifyUrl": "", | |||||
// "splitNotifyUrl": "", | |||||
//} | |||||
//goodsList := []map[string]string{ | |||||
// { | |||||
// "name": "充值", | |||||
// "number": "1", | |||||
// "amount": amount, | |||||
// }, | |||||
//} | |||||
//orderInfo := map[string]interface{}{ | |||||
// "Id": ordId, | |||||
// "businessType": "130003", | |||||
// "goodsList": goodsList, | |||||
//} | |||||
//param["orderInfo"] = orderInfo | |||||
// | |||||
//param["needSplit"] = true | |||||
//param["splitMain"] = param["memberId"] | |||||
//param["splitModel"] = "5" | |||||
//splitInfoList := []map[string]string{ | |||||
// { | |||||
// "amount": "10", | |||||
// "customerCode": CustomerCode, | |||||
// "isProcedureCustomer": "3", | |||||
// }, | |||||
// { | |||||
// "amount": "90", | |||||
// "customerCode": memberId, | |||||
// "isProcedureCustomer": "0", | |||||
// }, | |||||
//} | |||||
//param["splitInfoList"] = splitInfoList | |||||
memberId := "562902003186055" | |||||
ordId := "11111114" | |||||
amount := "100" | |||||
param = map[string]interface{}{ | |||||
"version": "2.0", | |||||
"protocol": "p202306084666779900235", | |||||
"outTradeNo": ordId, | |||||
"transType": "01", | |||||
"isSendSmsCode": "2", | |||||
"payAmount": amount, | |||||
"payCurrency": "CNY", | |||||
"transactionStartTime": time.Now().Format("20060102150405"), | |||||
"memberId": memberId, //分账模式(splitModel)为“1-普通分账”的,该值一律传商户自编的编号。 | |||||
"notifyUrl": "https://inapi.izhyin.cn/api/v1/swipe/order/notify/123456", | |||||
"splitNotifyUrl": "https://inapi.izhyin.cn/api/v1/swipe/order/split_notify/123456", | |||||
} | |||||
goodsList := []map[string]string{ | |||||
{ | |||||
"name": "充值", | |||||
"number": "1", | |||||
"amount": amount, | |||||
}, | |||||
} | |||||
orderInfo := map[string]interface{}{ | |||||
"Id": ordId, | |||||
"businessType": "130003", | |||||
"goodsList": goodsList, | |||||
} | |||||
param["orderInfo"] = orderInfo | |||||
param["needSplit"] = true | |||||
param["splitMain"] = param["memberId"] | |||||
param["splitModel"] = "5" | |||||
splitInfoList := []map[string]string{ | |||||
{ | |||||
"amount": "10", | |||||
"customerCode": CustomerCode, | |||||
"isProcedureCustomer": "3", | |||||
}, | |||||
{ | |||||
"amount": "90", | |||||
"customerCode": memberId, | |||||
"isProcedureCustomer": "0", | |||||
}, | |||||
} | |||||
param["splitInfoList"] = splitInfoList | |||||
return CardPaySendSecond("api/txs/protocol/protocolPayPre", keyArr, param) | return CardPaySendSecond("api/txs/protocol/protocolPayPre", keyArr, param) | ||||
} | } | ||||