Пример #1
0
        /// <summary>
        /// 创建交易日志
        /// </summary>
        /// <returns></returns>
        private async Task <TransactionLog> CreateToPayTransactionInfo(PayInput input, Exception exception = null)
        {
            var transactionInfo = new TransactionInfo()
            {
                Amount           = input.TotalAmount,
                CustomData       = input.CustomData,
                OutTradeNo       = input.OutTradeNo ?? GenerateOutTradeNo(),
                PayChannel       = input.PayChannel,
                Subject          = input.Subject,
                TransactionState = TransactionStates.NotPay,
                //TransactionId = "",
                Exception = exception
            };
            TransactionLog transactionLog = null;

            if (input.PayChannel == PayChannels.GlobalAlipay)
            {
                //添加货币符号,以支持国际支付
                var config = Magicodes.Alipay.Global.GlobalAlipayAppService.GetPayConfigFunc();
                transactionLog = _transactionLogHelper.CreateTransactionLog(transactionInfo, config.Currency);
            }
            else
            {
                transactionLog = _transactionLogHelper.CreateTransactionLog(transactionInfo);
            }
            await _transactionLogHelper.SaveAsync(transactionLog);

            return(transactionLog);
        }
Пример #2
0
        /// <summary>
        /// 创建交易日志
        /// </summary>
        /// <returns></returns>
        private async Task <TransactionLog> CreateToPayTransactionInfo(PayInputBase input, Exception exception = null)
        {
            var transactionInfo = new TransactionInfo()
            {
                Amount           = input.TotalAmount,
                CustomData       = input.CustomData,
                OutTradeNo       = input.OutTradeNo ?? GenerateOutTradeNo(),
                PayChannel       = input.PayChannel,
                Subject          = input.Subject,
                TransactionState = TransactionStates.NotPay,
                //TransactionId = "",
                Exception = exception
            };
            TransactionLog transactionLog = null;

            transactionLog = _transactionLogHelper.CreateTransactionLog(transactionInfo);
            await _transactionLogHelper.SaveAsync(transactionLog);

            return(transactionLog);
        }