EasySeries.Pay.Static 4.1.0

dotnet add package EasySeries.Pay.Static --version 4.1.0                
NuGet\Install-Package EasySeries.Pay.Static -Version 4.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasySeries.Pay.Static" Version="4.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasySeries.Pay.Static --version 4.1.0                
#r "nuget: EasySeries.Pay.Static, 4.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasySeries.Pay.Static as a Cake Addin
#addin nuget:?package=EasySeries.Pay.Static&version=4.1.0

// Install EasySeries.Pay.Static as a Cake Tool
#tool nuget:?package=EasySeries.Pay.Static&version=4.1.0                

EasySeries.Pay.Static

Easy支付,Easy系列的首个应用,用于微信支付,阿里支付, 中信全付通。

使用说明:全static方法直接调用即可

配置模式-支付配置Appsettings

using EasySeries.Pay.Static;
using EasySeries.Pay.Static.Models.Ali;
using EasySeries.Pay.Static.Models.Wechat;
using Microsoft.AspNetCore.Mvc;

namespace EasySeries.Simple.Controllers;

[Route("api/[controller]")]
[ApiController]
public class PayStaticController : ControllerBase
{
    [HttpPost("order")]
    public async Task<WechatJsApiSignInfo> CreateOrderAsync([FromBody] WechatPayInfo payInfo)
    {
        var payConfig = GetWechatPayConfig();
        return await WechatPay.JsApiOrderAsync(payConfig, payInfo);
    }

    [HttpGet("close")]
    public async Task<dynamic> CloseOrderAsync(string outTradeNo)
    {
        var payConfig = GetWechatPayConfig();
        return await WechatPay.CloseAsync(payConfig, outTradeNo);
    }

    [HttpGet("query")]
    public async Task<dynamic> QueryPayAsync(string outTradeNo)
    {
        var payConfig = GetWechatPayConfig();
        return await WechatPay.QueryPayAsync(payConfig, outTradeNo);
    }

    [HttpPost("notify")]
    public async Task<ActionResult> NotifyAsync()
    {
        var reader = new StreamReader(Request.Body);
        var body = await reader.ReadToEndAsync();

        var config = GetWechatPayConfig();
        var notify = new WechatNotify
        {
            Body = body,
            IsVerifySign = true,
            Nonce = Request.Headers["Wechatpay-Nonce"]!,
            Signature = Request.Headers["Wechatpay-Signature"]!,
            Stamp = Request.Headers["Wechatpay-Timestamp"]!
        };

        try
        {
            var result = WechatPay.PayNotifyHandel(config, notify);
            if(result.TradeState == "SUCCESS")
            {

            }
        }
        catch(Exception)
        {
            return BadRequest(new
            {
                code = "FAIL",
                messag = "xxx"
            });
        }

        return Ok();
    }

    private static WechatPayConfig GetWechatPayConfig()
    {
        return new WechatPayConfig
        {
            AppId = "xxx",
            CertSerialNo = "xxx",
            MchId = "xxx",
            V3Key = "xxx",
            PrivateKeyPath = "D:\\IIS\\cert\\wechatpay\\wuhou\\apiclient_key.pem",
            PlatformCertPath = "D:\\IIS\\cert\\wechatpay\\wuhou\\platform_cert.pem",
            PayNotifyUrl = "https://xxx/api/PayService/wechat_notify_1",
            RefundNotifyUrl = "https://xxx/api/PayService/wechat_notify_1"
        };
    }

    [HttpGet("ali_pay")]
    public dynamic AliPay1()
    {
        return AliPay.AppOrder(new AliPayConfig(), new AliPayInfo());
    }
}

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.1.0 88 11/29/2024
4.0.0 107 10/2/2024