| | |
| | | using FlexJobApi.Core; |
| | | using Azure; |
| | | using FlexJobApi.Core; |
| | | using Furion; |
| | | using Furion.DatabaseAccessor; |
| | | using Furion.FriendlyException; |
| | | using MediatR; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Org.BouncyCastle.Ocsp; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | /// <summary> |
| | | /// 支付宝通知回传 |
| | | /// </summary> |
| | | public class GetAlipayNotifyCommandHandler : |
| | | IRequestHandler<GetAlipayNotifyCommand, bool> |
| | | public class GetAlipayNotifyCommandHandler( |
| | | IRepository<EnterpriseWallet> rep |
| | | ) : |
| | | IRequestHandler<GetAlipayNotifyCommand, bool>, |
| | | IRequestHandler<AlipayUserAgreementPageSignNotifyCommand, bool> |
| | | { |
| | | private readonly IRepository<EnterpriseWallet> rep = rep; |
| | | |
| | | /// <summary> |
| | | /// 支付宝通知回传 |
| | | /// </summary> |
| | |
| | | { |
| | | return Task.FromResult(true); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 支付宝用户授权协议签约通知 |
| | | /// </summary> |
| | | /// <param name="request"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<bool> Handle(AlipayUserAgreementPageSignNotifyCommand request, CancellationToken cancellationToken) |
| | | { |
| | | var entity = await rep.AsQueryable() |
| | | .Where(it => it.Code == request.external_agreement_no) |
| | | .FirstOrDefaultAsync(); |
| | | if (entity == null) throw Oops.Oh(EnumErrorCodeType.s404, "企业钱包"); |
| | | entity.AgreementNo = request.agreement_no; |
| | | entity.SignTime = request.sign_time.ToDateTime(); |
| | | entity.ValidTime = request.valid_time.ToDateTime(); |
| | | entity.InvalidTime = request.invalid_time.ToDateTime(); |
| | | entity.SignStatus = request.status == "TEMP" |
| | | ? EnumEnterpriseWalletSignStatus.Apply |
| | | : request.status == "NORMAL" |
| | | ? EnumEnterpriseWalletSignStatus.Normal |
| | | : request.status == "STOP" |
| | | ? EnumEnterpriseWalletSignStatus.Stop |
| | | : throw Oops.Oh(EnumErrorCodeType.s510, "状态异常"); |
| | | entity.AlipayLogonId = request.alipay_logon_id; |
| | | entity.PrincipalId = request.alipay_user_id; |
| | | entity.PrincipalOpenId = request.alipay_open_id; |
| | | entity.ZmOpenId = request.zm_open_id; |
| | | entity.CreditAuthMode = request.credit_auth_mode; |
| | | await rep.UpdateAsync(entity); |
| | | return true; |
| | | } |
| | | } |
| | | } |