| | |
| | | using Aliyun.OSS; |
| | | using Aliyun.Acs.Core.Logging; |
| | | using Aliyun.OSS; |
| | | using Aop.Api; |
| | | using Aop.Api.Domain; |
| | | using Aop.Api.Request; |
| | | using Aop.Api.Response; |
| | | using Aop.Api.Util; |
| | | using Furion.FriendlyException; |
| | | using Microsoft.Extensions.Logging; |
| | | using Microsoft.Extensions.Options; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | public class AlipayUtils |
| | | { |
| | | private readonly IAopClient alipayClient; |
| | | private readonly ILogger<AlipayUtils> logger; |
| | | |
| | | public AlipayUtils(IOptions<AlipayOptions> options) |
| | | public AlipayUtils( |
| | | ILogger<AlipayUtils> logger, |
| | | IOptions<AlipayOptions> options) |
| | | { |
| | | alipayClient = new DefaultAopClient(new AlipayConfig |
| | | { |
| | |
| | | AlipayPublicKey = options.Value.AlipayPublicKey, |
| | | EncryptKey = options.Value.EncryptKey, |
| | | }); |
| | | this.logger = logger; |
| | | } |
| | | |
| | | public void UserAgreementPageSign(AlipayUserAgreementPageSignModel model) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 资金二级商户KYB代进件 |
| | | /// 资金二级商户KYB代进件文件上传接口 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public AlipayFundExpandindirectImageUploadResponse FundExpandindirectImageUpload(AlipayFundExpandindirectImageUploadRequest request) |
| | | { |
| | | logger.LogInformation("正在执行资金二级商户KYB代进件文件上传接口"); |
| | | AlipayFundExpandindirectImageUploadResponse response = alipayClient.Execute(request); |
| | | if (response.IsError) throw Oops.Oh(EnumErrorCodeType.s510, response.Msg); |
| | | logger.LogInformation($"结果:{response.ToJson()}"); |
| | | return response; |
| | | } |
| | | |
| | |
| | | /// <returns></returns> |
| | | public AlipayFundExpandindirectCreateResponse FundExpandindirectCreate(AlipayFundExpandindirectCreateModel model, string notifyUrl = null) |
| | | { |
| | | logger.LogInformation($"正在执行资金二级商户KYB代进件:{model.ToJson()}"); |
| | | AlipayFundExpandindirectCreateRequest request = new AlipayFundExpandindirectCreateRequest(); |
| | | request.SetBizModel(model); |
| | | if (notifyUrl.IsNotNull()) |
| | |
| | | request.SetNotifyUrl(notifyUrl); |
| | | } |
| | | AlipayFundExpandindirectCreateResponse response = alipayClient.Execute(request); |
| | | if (response.IsError) throw Oops.Oh(EnumErrorCodeType.s510, response.Msg); |
| | | logger.LogInformation($"结果:{response.ToJson()}"); |
| | | return response; |
| | | } |
| | | |
| | |
| | | /// <returns></returns> |
| | | public AlipayFundExpandindirectOrderQueryResponse FundExpandindirectOrderQuery(AlipayFundExpandindirectOrderQueryModel model) |
| | | { |
| | | logger.LogInformation($"正在执行资金二级商户KYB代进件单查询接口:{model.ToJson()}"); |
| | | AlipayFundExpandindirectOrderQueryRequest request = new AlipayFundExpandindirectOrderQueryRequest(); |
| | | request.SetBizModel(model); |
| | | AlipayFundExpandindirectOrderQueryResponse response = alipayClient.Execute(request); |
| | | if (response.IsError) throw Oops.Oh(EnumErrorCodeType.s510, response.Msg); |
| | | logger.LogInformation($"结果:{response.ToJson()}"); |
| | | return response; |
| | | } |
| | | |
| | |
| | | /// <returns></returns> |
| | | public AlipayFundExpandindirectOrderCancelResponse FundExpandindirectOrderCancel(AlipayFundExpandindirectOrderCancelModel model) |
| | | { |
| | | logger.LogInformation($"正在执行资金二级商户KYB代进件单取消接口:{model.ToJson()}"); |
| | | AlipayFundExpandindirectOrderCancelRequest request = new AlipayFundExpandindirectOrderCancelRequest(); |
| | | request.SetBizModel(model); |
| | | AlipayFundExpandindirectOrderCancelResponse response = alipayClient.Execute(request); |
| | | if (response.IsError) throw Oops.Oh(EnumErrorCodeType.s510, response.Msg); |
| | | logger.LogInformation($"结果:{response.ToJson()}"); |
| | | return response; |
| | | } |
| | | } |