钱包结算所有, 第三方充值到钱包
This commit is contained in:
@@ -50,6 +50,32 @@ func TestVerifyNotifyIncludesEmptyAndExcludesErrorCode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestVerifyNotifyFallsBackToSignKey(t *testing.T) {
|
||||
client := NewClient(config.LeshuaPaymentConfig{
|
||||
NotifyKey: "wrong-notify-secret",
|
||||
SignKey: "sign-secret",
|
||||
})
|
||||
params := map[string]string{
|
||||
"merchant_id": "1234567890",
|
||||
"third_order_id": "NO1",
|
||||
"leshua_order_id": "LS1",
|
||||
"amount": "100",
|
||||
"status": "2",
|
||||
}
|
||||
params["sign"] = Sign(params, "sign-secret", SignOptions{
|
||||
IncludeEmpty: true,
|
||||
ExcludeKeys: []string{"error_code", "sign"},
|
||||
})
|
||||
|
||||
result := client.VerifyNotifyDetail(params)
|
||||
if !result.OK {
|
||||
t.Fatal("VerifyNotifyDetail().OK = false, want true")
|
||||
}
|
||||
if result.MatchedKey != "sign_key" {
|
||||
t.Fatalf("MatchedKey = %s, want sign_key", result.MatchedKey)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParsePayloadSupportsFormAndXML(t *testing.T) {
|
||||
form, err := ParsePayload([]byte("third_order_id=NO1&status=2&amount=100"))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user