Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
roc916 committed Nov 4, 2024
1 parent ce06608 commit 3f63797
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Essensoft.Paylink.WeChatPay/V3/WeChatPayClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private async Task CheckResponseSignAsync(WeChatPayHeaders headers, string body,
throw new WeChatPayException($"sign check fail: {nameof(headers.Signature)} is empty!");
}

if (headers.Serial.StartsWith("PUB_KEY_ID_")) // 微信支付公钥
if (headers.Serial.StartsWith(WeChatPayConsts.WeChatPayPublicKeyIdPrefix)) // 微信支付公钥
{
if (!string.IsNullOrEmpty(options.WeChatPayPublicKeyId) && headers.Serial == options.WeChatPayPublicKeyId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private async Task CheckNotifySignAsync(WeChatPayHeaders headers, string body, W
throw new WeChatPayException("sign check fail: body is empty!");
}

if(headers.Serial.StartsWith("PUB_KEY_ID_")) // 微信支付公钥
if(headers.Serial.StartsWith(WeChatPayConsts.WeChatPayPublicKeyIdPrefix)) // 微信支付公钥
{
if (!string.IsNullOrEmpty(options.WeChatPayPublicKeyId) && headers.Serial == options.WeChatPayPublicKeyId)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Essensoft.Paylink.WeChatPay/WeChatPayConsts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ public class WeChatPayConsts
public const string Wechatpay_Timestamp = "Wechatpay-Timestamp";
public const string Wechatpay_Nonce = "Wechatpay-Nonce";
public const string Wechatpay_Signature = "Wechatpay-Signature";

public const string WeChatPayPublicKeyIdPrefix = "PUB_KEY_ID_";
}
}

0 comments on commit 3f63797

Please sign in to comment.