Coder Social home page Coder Social logo

payment's Introduction

Payments

基于netcore实现的微信和支付宝支付等第三方的服务,支持多商户同时使用。

微信支付服务

使用方法如下:

MysqlWechatPayConfigStorage继承IWechatPayConfigStorage 主要是多商户支付配置,根据不同名称获取不同的支付配置。

     serviceDescriptors.AddWechatPay(w =>
     {
         w.AppId = "wx1111111111111";
         w.MerchantId = "11111111111";
         w.PrivateKey = "xxxxxxxxxxxxxxxxxxx";
         w.NotifyUrl = "https://www.xxxx.com?NotifyUrl";

     }).AddWehcatpayStorage<MysqlWechatPayConfigStorage>();                        
           

根据IWehcatPayServiceProvider去拿微信支付的服务【IWechatPayNativePayService】,参数是商户支付配置的名称。

    public class PayController
    {
        private readonly IWechatPayNativePayService _wechatPayNativePayService;
        public PayController(IWehcatPayServiceProvider wehcatPayServiceProvider)
        {
            _wechatPayNativePayService = wehcatPayServiceProvider.GetService<IWechatPayNativePayService>("shanghu1");

        }
        public async Task<WechatPayResult<WechatPayNativePayResponse>> Pay(WechatPayNativePayRequest request)
        {
            var resp = await _wechatPayNativePayService.PayAsync(request);
            return resp; 
        }
    }

如果微信有新增接口,但Payments没有更新该怎么调用呢

     public class CustomePayController
    {
        private readonly ICustomeWehcatPayService _customeWehcatPayService;
        public CustomePayController(IWehcatPayServiceProvider wehcatPayServiceProvider)
        {
            _customeWehcatPayService = wehcatPayServiceProvider.GetService<ICustomeWehcatPayService>("shanghu1");

        }
        public async Task<WechatPayResult<WechatPayResponse>> Pay()
        {
            //设置请求url
            _customeWehcatPayService.SetUrl("https://api.mch.weixin.qq.com/new/aaa");            
            IDictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("params1", "11");
            dic.Add("params2", "22");
            dic.Add("params3", "33");
            //构造参数
            _customeWehcatPayService.SetExtensionParameter(dic);
            var resp = await _customeWehcatPayService.Request();          
            return resp;
        }
    }

Native支付【IWechatpayNativePayService】

App支付【IWechatpayAppPayService】

JsApi支付【IWechatpayJsApiPayService】

小程序支付【IWechatpayMiniProgramPayService】

H5支付【IWechatpayMWebPayService】

付款码支付【IWechatpayMicroPayService】

授权码查询openid【IWechatAuthorizeService,IWechatAccessTokenService】

查询支付订单【IWechatOrderQueryService】

撤销支付订单【IWechatReverseOrderService】

关闭支付订单【IWechatCloseOrderService】

申请退款订单【IWechatRefundOrderService】

退款订单查询【IWechatRefundQueryService】

支付异步回调【IWechatpayNotifyService】

退款异步支付回调【IWechatRefundNotifyService】

下载对账单【】

下载资金账单【】

交易保障【】

拉取订单评价数据【】

发放普通红包【IWechatSendRedPackService】

发放裂变红包【IWechatSendGroupRedPackService】

查询红包记录【IWechatpayHbInfoService】

企业付款【IWechatTransfersService】

查询企业付款【IWechatGetTransferInfoService】

申请签约【IWechatEntrustWebService】

H5纯签约【IWechatH5EntrustWebService】

支付中签约api【IWechatContractOrderService】

签约、解约结果通知【IWechatSignNotifyService】

查询签约关系【IWechatQueryContractService】

申请扣款【IWechatPapPayApplyService】

申请解约【IWechatDeleteContractService】

扣款结果通知【IWechatContractNotifyService】

查询扣款通知IWechatPapOrderQueryService

支付宝支付

Page支付【IAlipayPagePayService】

二维码支付【IAlipayQrCodePayService】

App支付【IAlipayAppPayService】

条码支付【IAlipayBarcodePayService】

手机wap支付【IAlipayWapPayService】

异步回调【IAlipayNotifyService】

同步回调【IAlipayReturnService】

payment's People

Contributors

coobeedior avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.