using LifePayment.Domain.Models;
|
using LifePayment.Domain.Shared;
|
using Microsoft.Extensions.Logging;
|
using NPOI.SS.Formula.Functions;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Text.Json;
|
using System.Threading.Tasks;
|
using Volo.Abp;
|
using Volo.Abp.Domain.Repositories;
|
using static LifePayment.Domain.Shared.LifePaymentConstant;
|
|
namespace LifePayment.Domain
|
{
|
public class AlipayManager : IAlipayManager
|
{
|
private readonly ILogger<AlipayManager> _logger;
|
private readonly IAlipayInterfaceManager _alipayInterfaceManager;
|
|
public AlipayManager(ILogger<AlipayManager> logger, IAlipayInterfaceManager alipayInterfaceManager)
|
{
|
_logger = logger;
|
_alipayInterfaceManager = alipayInterfaceManager;
|
}
|
|
public async Task<WalletSingleApplicationSuspensionPaymentOutput> AlipayTransUniTransferToCard(WalletSingleApplicationSuspensionPaymentInput input, bool isToCard)
|
{
|
var result = new WalletSingleApplicationSuspensionPaymentOutput() { Stt = LifePaymentConstant.AlipayOrderStatus.支付失败 };
|
//var walletMainEntity = _walletMainRepository.Where(r => r.Id == input.WalletMainId).FirstOrDefault();
|
//CheckExtensions.IfTrueThrowUserFriendlyException(walletMainEntity == null,
|
// "查询支付宝记账本出错");
|
//FundAccountBookQueryInput inputQuery = new FundAccountBookQueryInput
|
//{
|
// AccountBookId = input.OutAcctNo,
|
// SceneCode = AlipayConstant.SceneCode,
|
// ExtInfo = "{\"agreement_no\":\"" + walletMainEntity.AlipayAgreementNo + "\"}"
|
|
//};
|
//var queryReusult = await _alipayInterfaceManager.FundAccountBookQuery(inputQuery);
|
//CheckExtensions.IfTrueThrowUserFriendlyException(queryReusult == null,
|
// "查询支付宝记账本出错");
|
//if (queryReusult != null)
|
//{
|
|
// CheckExtensions.IfTrueThrowUserFriendlyException(Convert.ToDecimal(queryReusult.AvaliableAmount) < input.TranAmount,
|
// "记账本余额不足");
|
//}
|
|
//try
|
//{
|
// FundTransUniTransferInput inputNew = new FundTransUniTransferInput
|
// {
|
// TransAmount = input.TranAmount.ToString(),
|
// ProductCode = "SINGLE_TRANSFER_NO_PWD",
|
// BizScene = "ENTRUST_TRANSFER",
|
|
// OrderTitle = input.UseEx,
|
// Remark = input.UseEx,
|
// PayerInfo = new Participant
|
// {
|
// IdentityType = "ACCOUNT_BOOK_ID",
|
// Identity = input.OutAcctNo,
|
// ExtInfo = "{\"agreement_no\":\"" + walletMainEntity.AlipayAgreementNo + "\"}"
|
// },
|
// BusinessParams = "{\"withdraw_timeliness\":\"" + "T0" + "\"}"
|
|
// };
|
// if (isToCard)
|
// {
|
// inputNew.OutBizNo = input.CnsmrSeqNo;
|
// inputNew.PayeeInfo = new Participant
|
// {
|
// IdentityType = "BANKCARD_ACCOUNT",
|
// Identity = input.InAcctNo,
|
// Name = input.InAcctName,
|
// BankCardExtInfo = new BankcardExtInfo
|
// {
|
// AccountType = "2",
|
// BankCode = input.InAcctBankNode,
|
// InstName = input.InAcctBankName,
|
// },
|
|
// };
|
// }
|
// else
|
// {
|
// inputNew.OutBizNo = input.CnsmrSeqNo;
|
// inputNew.PayeeInfo = new Participant
|
// {
|
// IdentityType = "ALIPAY_LOGON_ID",
|
// Identity = input.InAcctNo,
|
// Name = input.InAcctName,
|
// };
|
// }
|
// var output = await _alipayInterfaceManager.FundTransUniTransfer(inputNew);
|
// if (output != null && output.Code == AlipayResultCode.Success)
|
// {
|
|
// result = new WalletSingleApplicationSuspensionPaymentOutput
|
// {
|
// FrontLogNo = output.OrderId,
|
// InAcctName = input.InAcctName,
|
// InAcctNo = input.InAcctNo,
|
// TranAmount = input.TranAmount.ToString(),
|
// OutAcctNo = input.OutAcctNo,
|
// AlipayStatus = output.Stauts,
|
// ThirdVoucher = output.OutBizNo,
|
// CstInnerFlowNo = output.PayFundOrderId,
|
// InAcctBankName = input.InAcctBankName,
|
// OutAcctName = input.OutAcctName,
|
// HostFlowNo = output.PayFundOrderId,
|
// Stt = output.Stauts
|
// };
|
// }
|
// else
|
// {
|
// result = new WalletSingleApplicationSuspensionPaymentOutput
|
// {
|
// AlipayStatus = LifePaymentConstant.AlipayOrderStatus.支付失败
|
// };
|
// }
|
//}
|
//catch (Exception ex)
|
//{
|
// _logger.LogError(ex, "发起扣款异常");
|
// result = new WalletSingleApplicationSuspensionPaymentOutput
|
// {
|
// AlipayStatus = LifePaymentConstant.AlipayOrderStatus.支付失败
|
// };
|
//}
|
|
return result;
|
}
|
|
}
|
}
|