|
@@ -116,25 +116,25 @@ namespace WingPaymentService.Service
|
|
|
switch (request.PayType)
|
|
|
{
|
|
|
case PayTypeEnum.Alipay_PAGE:
|
|
|
- _recordRelation.AddOrUpdate(recordCode, request.OrderCode, (a,b)=> { return request.OrderCode; });
|
|
|
+ _recordRelation.AddOrUpdate(recordCode, request.OrderCode, (a, b) => { return request.OrderCode; });
|
|
|
payContent = _alipayCommon.AlipayPagePay(orderInfo.OrderTitle, orderInfo.OrderAmount, recordCode, _alipayPayReturnUrl);
|
|
|
payUrlRequest.PaymentOrderCode = request.OrderCode;
|
|
|
payUrlRequest.PayLink = payContent.payUrl;
|
|
|
payUrlRequest.PayShortLink = string.Format(_alipayShortBaseUrl, payUrlRequest.PaymentOrderCode);
|
|
|
payUrlResult = await _paymentDBService.InsertPayUrlAsync(payUrlRequest);
|
|
|
- if(payUrlResult.IsSuccess)
|
|
|
+ if (payUrlResult.IsSuccess)
|
|
|
{
|
|
|
payContent.payUrl = payUrlResult.PayShortUrl;
|
|
|
}
|
|
|
break;
|
|
|
case PayTypeEnum.Alipay_WAP:
|
|
|
- _recordRelation.AddOrUpdate(recordCode, request.OrderCode, (a,b)=> { return request.OrderCode; });
|
|
|
+ _recordRelation.AddOrUpdate(recordCode, request.OrderCode, (a, b) => { return request.OrderCode; });
|
|
|
payContent = _alipayCommon.AlipayWapPay(orderInfo.OrderTitle, orderInfo.OrderAmount, recordCode, _alipayPayReturnUrl);
|
|
|
payUrlRequest.PaymentOrderCode = request.OrderCode;
|
|
|
payUrlRequest.PayLink = payContent.payUrl;
|
|
|
payUrlRequest.PayShortLink = string.Format(_alipayShortBaseUrl, payUrlRequest.PaymentOrderCode);
|
|
|
payUrlResult = await _paymentDBService.InsertPayUrlAsync(payUrlRequest);
|
|
|
- if(payUrlResult.IsSuccess)
|
|
|
+ if (payUrlResult.IsSuccess)
|
|
|
{
|
|
|
payContent.payUrl = payUrlResult.PayShortUrl;
|
|
|
}
|
|
@@ -145,7 +145,7 @@ namespace WingPaymentService.Service
|
|
|
payUrlRequest.PayLink = payContent.payUrl;
|
|
|
payUrlRequest.PayShortLink = string.Format(_wechatShortBaseUrl, payUrlRequest.PaymentOrderCode);
|
|
|
payUrlResult = await _paymentDBService.InsertPayUrlAsync(payUrlRequest);
|
|
|
- if(payUrlResult.IsSuccess)
|
|
|
+ if (payUrlResult.IsSuccess)
|
|
|
{
|
|
|
payContent.payUrl = payUrlResult.PayShortUrl;
|
|
|
}
|
|
@@ -156,7 +156,7 @@ namespace WingPaymentService.Service
|
|
|
payUrlRequest.PayLink = payContent.payUrl;
|
|
|
payUrlRequest.PayShortLink = string.Format(_wechatShortBaseUrl, payUrlRequest.PaymentOrderCode);
|
|
|
payUrlResult = await _paymentDBService.InsertPayUrlAsync(payUrlRequest);
|
|
|
- if(payUrlResult.IsSuccess)
|
|
|
+ if (payUrlResult.IsSuccess)
|
|
|
{
|
|
|
payContent.payUrl = payUrlResult.PayShortUrl;
|
|
|
}
|
|
@@ -213,20 +213,20 @@ namespace WingPaymentService.Service
|
|
|
/// 获取可支付列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public Task<PayableTypeDTO> GetPayableTypes()
|
|
|
+ public async Task<PayableTypeDTO> GetPayableTypes()
|
|
|
{
|
|
|
var payTypes = new List<string>();
|
|
|
- if(_alipayPayEnable)
|
|
|
+ if (_alipayPayEnable)
|
|
|
{
|
|
|
payTypes.Add("alipay");
|
|
|
}
|
|
|
- if(_wechatPayEnable)
|
|
|
+ if (_wechatPayEnable)
|
|
|
{
|
|
|
payTypes.Add("wechat");
|
|
|
}
|
|
|
var result = new PayableTypeDTO();
|
|
|
result.PayTypes = payTypes;
|
|
|
- return result;
|
|
|
+ return await Task.FromResult(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -255,7 +255,7 @@ namespace WingPaymentService.Service
|
|
|
var payStatus = keyValuePairs.GetValueOrDefault("trade_status") == "TRADE_SUCCESS" ? WingInterfaceLibrary.Enum.PayStatusEnum.Paid : WingInterfaceLibrary.Enum.PayStatusEnum.NoPay;
|
|
|
var payTime = DateTime.UtcNow;
|
|
|
var success = await PayRecordWriteRes(orderCode, recordCode, totalAmount, payStatus, payTime, request);
|
|
|
- if(success)
|
|
|
+ if (success)
|
|
|
{
|
|
|
_recordRelation.TryRemove(recordCode, out _);
|
|
|
}
|