Ver Fonte

支付与退款调整

Your Name há 1 mês atrás
pai
commit
d9cd9d5291

+ 1 - 1
FuelCloud/Fuel.Application/MqttService/MqttClientService .cs

@@ -64,7 +64,7 @@ namespace Fuel.Application.MqttService
             var options = new MqttClientOptionsBuilder()
                 .WithTcpServer(_options.Server, _options.Port)
                 .WithClientId(_options.ClientId)
-                .WithCredentials(_options.Username, _options.Password)
+                .WithCredentials("HSClient", "HS202503")
                 .WithCleanSession()
                 .Build();
 

+ 2 - 2
FuelCloud/Fuel.Application/MqttService/MqttOptions.cs

@@ -11,7 +11,7 @@ namespace Fuel.Application.MqttService
         public string Server { get; set; } = "192.168.5.5";
         public int Port { get; set; } = 1883;
         public string ClientId { get; set; } = $"client_{Guid.NewGuid()}";
-        public string Username { get; set; }
-        public string Password { get; set; }
+        public string Username { get; set; } = "HSClient";
+        public string Password { get; set; } = "HS202503";
     }
 }

+ 39 - 18
FuelCloud/Fuel.Application/Service/NozzleService.cs

@@ -1,10 +1,13 @@
-using DFS.Infrastructure;
+using DFS.Core.Abstractions.Models;
+using DFS.Infrastructure;
 using Fuel.Application.MqttService;
 using Fuel.Core;
 using Fuel.Core.Models;
 using Fuel.Core.Nozzle.Dto;
+using Fuel.Core.Transactions.Dto;
 using FuelServer.Core.Entity;
 using Newtonsoft.Json;
+using Org.BouncyCastle.Asn1.Ocsp;
 using Org.BouncyCastle.Ocsp;
 using System;
 using System.Collections.Generic;
@@ -13,6 +16,7 @@ using System.Net;
 using System.Text;
 using System.Threading.Tasks;
 using System.Transactions;
+using System.Xml;
 using static FreeSql.Internal.GlobalFilter;
 
 namespace Fuel.Application.Service
@@ -222,11 +226,12 @@ namespace Fuel.Application.Service
             _nozzle.ExternalGunNumber = uploadNozzle.ExternalGunNumber;
             _nozzle.ProductID = _product.Id;
             _nozzle.NozzleId = uploadNozzle.NozzleId;
-            int affectedRows = _fsql.Insert<nozzle>().AppendData(_nozzle).ExecuteAffrows();
-            if (affectedRows <= 0)
+            long id = _fsql.Insert<nozzle>().AppendData(_nozzle).ExecuteIdentity();
+            if (id <= 0)
             {
                 return ServiceResponse.Error("油枪信息插入失败");
             }
+            _nozzle.Id = id;
             return ServiceResponse.Ok(_nozzle);
         }
         /// <summary>
@@ -268,7 +273,7 @@ namespace Fuel.Application.Service
                 return ServiceResponse.Error("未找到油枪");
             }
             int affectedRows = _fsql.Delete<nozzle>()
-    .Where(p => p.NozzleId == uploadNozzle.NozzleId) 
+    .Where(p => p.NozzleId == uploadNozzle.NozzleId)
     .ExecuteAffrows();
             if (affectedRows <= 0)
             {
@@ -281,13 +286,15 @@ namespace Fuel.Application.Service
         {
             Guid guid = HttpRequestReader.GetCurrentBuId(); //站点id
             List<nozzle> nozzleStatuses = new List<nozzle>();
+            var nozzleList = _fsql.Select<nozzle>().Where(_ => _.Buid == guid).ToList();
             foreach (var n in uploadNozzleStatuses)
             {
-                nozzleStatuses.Add(new nozzle() { 
-                    NozzleId = n.NozzleId,
-                    Buid = guid,
-                    Status = n.Status
-                });
+                var _nozzle = nozzleList.Where(_ => _.Id == n.NozzleId).First();
+                if (_nozzle != null)
+                {
+                    _nozzle.Status = n.Status;
+                    nozzleStatuses.Add(_nozzle);
+                }
             }
             int affectedRows = _fsql.InsertOrUpdate<nozzle>().SetSource(nozzleStatuses).ExecuteAffrows();
             return ServiceResponse.Ok();
@@ -319,7 +326,7 @@ namespace Fuel.Application.Service
         {
             Guid guid = HttpRequestReader.GetCurrentBuId(); //站点id
             return _entityHelper._fsql.Select<nozzle>()
-                 .Where((a) =>  a.ExternalGunNumber == Nozzleid)
+                 .Where((a) => a.ExternalGunNumber == Nozzleid)
                  .ToList((a) => new NozzleInfo()
                  {
                      Nozzleid = a.Id
@@ -355,10 +362,10 @@ namespace Fuel.Application.Service
             var user = _fsql.Select<miniprogramusers>().Where(_ => _.Id == trx.MiniProgramID).First();
             string key = guid + "_" + trx.NozzleId;//授权结果的key
             string jsonString = JsonConvert.SerializeObject(trx);
-            await _mqttService.SubscribeAsync("fromClound/" + guid);
+            await _mqttService.SubscribeAsync("authorization/" + guid);
             await Task.Delay(2000);
-            var sendjson = new { type= 1,data = jsonString, UserName = user.UserName, UserPhoneNumber = user.UserPhoneNumber };
-            await _mqttService.PublishAsync("fromClound/" + guid, JsonConvert.SerializeObject(sendjson));
+            var sendjson = new { data = jsonString, UserName = user.UserName, UserPhoneNumber = user.UserPhoneNumber };
+            await _mqttService.PublishAsync("authorization/" + guid, JsonConvert.SerializeObject(sendjson));
             KeyValueCache.AddOrUpdate("authGun", key, AuthorizationStatus.WaitAuthorization);//添加字典,用于监听授权结果
             bool changed = await KeyValueCache.MonitorDictionaryChanges("authGun", key, AuthorizationStatus.WaitAuthorization);
             if (!changed)
@@ -373,7 +380,7 @@ namespace Fuel.Application.Service
             }
             trx.TransactionNumber = auth.TransactionNumber;
             trx.authorizationStatus = AuthorizationStatus.Authorized;//将订单授权状态更改成已授权
-            _entityHelper.UpdateAsync(trx);
+            int affectedRows = _fsql.Update<transactions>().SetSource(trx).ExecuteAffrows();
             return ServiceResponse.Ok("授权成功");
         }
         /// <summary>
@@ -391,10 +398,10 @@ namespace Fuel.Application.Service
             }
             string key = guid + "_" + trx.NozzleId;//授权结果的key
             string jsonString = JsonConvert.SerializeObject(trx);
-            await _mqttService.SubscribeAsync("fromClound/" + guid);
+            await _mqttService.SubscribeAsync("unAuthorization/" + guid);
             await Task.Delay(2000);
-            var sendjson = new { type = 2, data = jsonString };
-            await _mqttService.PublishAsync("fromClound/" + guid, JsonConvert.SerializeObject(sendjson));
+            var sendjson = new { data = jsonString };
+            await _mqttService.PublishAsync("unAuthorization/" + guid, JsonConvert.SerializeObject(sendjson));
             KeyValueCache.AddOrUpdate("cancelAuth", key, AuthorizationStatus.WaitAuthorization);//添加字典,用于监听授权结果
             bool changed = await KeyValueCache.MonitorDictionaryChanges("cancelAuth", key, AuthorizationStatus.WaitAuthorization);
             if (!changed)
@@ -409,7 +416,7 @@ namespace Fuel.Application.Service
             }
             trx.TransactionNumber = auth.TransactionNumber;
             trx.authorizationStatus = AuthorizationStatus.Unauthorized;//将订单授权状态更改成已授权
-            _entityHelper.UpdateAsync(trx);
+            int affectedRows = _fsql.Update<transactions>().SetSource(trx).ExecuteAffrows();
             return ServiceResponse.Ok("取消授权成功");
         }
         /// <summary>
@@ -422,6 +429,20 @@ namespace Fuel.Application.Service
             Guid guid = HttpRequestReader.GetCurrentBuId(); //站点id
             string key = guid + "_" + nozzleAuthorization.NozzleId;//授权结果的key
             KeyValueCache.AddOrUpdate("cancelAuth", key, nozzleAuthorization);//更新授权结果
+            if (nozzleAuthorization.OilMachineStatus == OilMachineStatus.Success)
+            {
+                var _nozzle = await _entityHelper.GetEntitiesAsync<nozzle>(_ => _.Buid == guid && _.ExternalGunNumber == nozzleAuthorization.NozzleId);
+                if (_nozzle.Count() <= 0)
+                {
+                    return ServiceResponse.Error("油枪查询失败,油枪名称:" + nozzleAuthorization.NozzleId);
+                }
+                var trx = _entityHelper.GetEntitiesAsync<transactions>(_ => _.Buid == guid && _.NozzleId == _nozzle.First().Id).Result.FirstOrDefault();
+                if (trx != null)
+                {
+                    trx.authorizationStatus = AuthorizationStatus.Unauthorized;
+                    int affectedRows = _fsql.Update<transactions>().SetSource(trx).ExecuteAffrows();
+                }
+            }
             return ServiceResponse.Ok();
         }
     }

+ 75 - 35
FuelCloud/Fuel.Application/Service/TransactionsService.cs

@@ -20,6 +20,7 @@ using Microsoft.Extensions.DependencyInjection;
 using static Fuel.Core.WechatServer.WeChatService;
 using System.Linq.Dynamic.Core;
 using System.Text.Json;
+using Org.BouncyCastle.Asn1.Ocsp;
 
 
 namespace Fuel.Application.Service
@@ -58,6 +59,16 @@ namespace Fuel.Application.Service
                 return ServiceResponse.Error("站点信息查询为空 buid: " + Buid);
             }
             string key = string.Empty;
+            var _product = await _entityHelper.GetEntitiesAsync<product>(_ => _.Buid == Buid && _.ProductName == uploadTransactions.Product);
+            if (_product.Count() <= 0)
+            {
+                return ServiceResponse.Error("油品查询失败,油品名称:" + uploadTransactions.Product);
+            }
+            var _nozzle = await _entityHelper.GetEntitiesAsync<nozzle>(_ => _.Buid == Buid && _.ExternalGunNumber == uploadTransactions.ExternalGunNumber);
+            if (_nozzle.Count() <= 0)
+            {
+                return ServiceResponse.Error("油枪查询失败,油枪名称:" + uploadTransactions.ExternalGunNumber);
+            }
             if (site.PaymentMode == 1)//预支付
             {
                 key = uploadTransactions.ExternalGunNumber + ":" +
@@ -65,6 +76,34 @@ namespace Fuel.Application.Service
                          uploadTransactions.Qty + ":" +
                          uploadTransactions.MiniProgramID + ":" +
                          Buid.ToString();
+                string WachatID = HttpRequestReader.GetWachatID(); //用户
+                var userSession = WechatUserSessionRepo.GetUserSession(WachatID.ToString());
+                if (userSession == null)
+                {
+                    return ServiceResponse.Error(HttpStatusCode.NonAuthoritativeInformation, "未找到用户!");
+                }
+                var user = _fsql.Select<miniprogramusers>().Where(_ => _.OpenId == userSession.openid).First();
+
+
+                if (uploadTransactions.OriginalAmount != null)
+                {
+                    decimal decimalValue = uploadTransactions.OriginalAmount.HasValue ? uploadTransactions.OriginalAmount.Value : 0m;
+                    decimal ProductPrice = _product.First().ProductPrice.HasValue ? _product.First().ProductPrice.Value : 0m;
+                    decimal qty = decimalValue / ProductPrice;
+                    uploadTransactions.Qty = qty;
+                }
+                else if (uploadTransactions.Qty != null)
+                {
+                    decimal decimalValue = uploadTransactions.Qty.HasValue ? uploadTransactions.Qty.Value : 0m;
+                    decimal ProductPrice = _product.First().ProductPrice.HasValue ? _product.First().ProductPrice.Value : 0m;
+                    decimal OriginalAmount = decimalValue * ProductPrice;
+                    uploadTransactions.OriginalAmount = OriginalAmount;
+                }
+                else if (uploadTransactions.OriginalAmount == null && uploadTransactions.Qty == null)
+                {
+                    return ServiceResponse.Error("金额与升数为空");
+                }
+                uploadTransactions.MiniProgramID = user.Id;
             }
             else//后支付
             {
@@ -81,16 +120,7 @@ namespace Fuel.Application.Service
             {
                 return ServiceResponse.Ok(output);
             }
-            var _product = await _entityHelper.GetEntitiesAsync<product>(_ => _.Buid == Buid && _.ProductName == uploadTransactions.Product);
-            if (_product.Count() <= 0)
-            {
-                return ServiceResponse.Error("油品查询失败,油品名称:" + uploadTransactions.Product);
-            }
-            var _nozzle = await _entityHelper.GetEntitiesAsync<nozzle>(_ => _.Buid == Buid && _.ExternalGunNumber == uploadTransactions.ExternalGunNumber);
-            if (_nozzle.Count() <= 0)
-            {
-                return ServiceResponse.Error("油枪查询失败,油枪名称:" + uploadTransactions.ExternalGunNumber);
-            }
+          
             var trx = uploadTransactions.ToTransactions(uploadTransactions, Buid, _product.FirstOrDefault(), _nozzle.FirstOrDefault(), site.PaymentMode);
             //int affectedRows = _fsql.Insert<transactions>().AppendData(trx).ExecuteAffrows();
             // var affectedRows = _fsql.Insert<transactions>().AppendData(trx).ExecuteInserted();
@@ -143,7 +173,6 @@ namespace Fuel.Application.Service
             //    where = CombineExpressions(where, p => p.TransactionTime == input.TransactionETime);
             //}
             var result = await _entityHelper.GetEntitiesAsync<transactions>(where);
-            var sdfsd = _fsql.Select<transactions>().Where(where).ToList();
 
             List<TransactionsList> list = new List<TransactionsList>();
             foreach (var item in result)
@@ -291,6 +320,11 @@ namespace Fuel.Application.Service
                 return null;
             }
             transactions transactions = JsonConvert.DeserializeObject<transactions>(respond);
+            var trx = _entityHelper.GetEntitiesAsync<transactions>(_ => _.Id == transactions.Id).Result.FirstOrDefault();
+            if (trx == null || trx.OrderStatus != transactionsORDERSTATUS.Unpaid)
+            {
+                return null;
+            }
             return transactions;
         }
         // 辅助方法:组合两个表达式
@@ -306,8 +340,8 @@ namespace Fuel.Application.Service
         /// <param name="input"></param>
         /// <returns></returns>
         public async Task<ServiceResponse> RefundTrx(int trxId,
-            double longitude,
-            double latitude)
+            double longitude = 0.0,
+            double latitude = 0.0)
         {
             Guid Buid = HttpRequestReader.GetCurrentBuId(); //站点id
             var businessunitinfo = _entityHelper.GetEntitiesAsync<businessunitinfo>(_ => _.Buid == Buid).Result.FirstOrDefault();
@@ -316,22 +350,22 @@ namespace Fuel.Application.Service
                 return ServiceResponse.Error(HttpStatusCode.NotAcceptable, "站点为空");
             }
             string[] parts = businessunitinfo.GpsCoordinates.Split(',');
-            if (parts.Length == 2 &&
-           double.TryParse(parts[0], out double latitude2) &&
-           double.TryParse(parts[1], out double longitude2))
-            {
+           // if (parts.Length == 2 &&
+           //double.TryParse(parts[0], out double latitude2) &&
+           //double.TryParse(parts[1], out double longitude2))
+           // {
 
-            }
-            else
-            {
-                return ServiceResponse.Error(HttpStatusCode.NotAcceptable, "站点经纬度获取失败");
-            }
-            //计算调用方和油站的距离,超过距离判定为恶意请求
-            double distance = DistanceCalculator.CalculateDistance(longitude, latitude, longitude2, latitude2);
-            if (distance > 5)
-            {
-                return ServiceResponse.Error(HttpStatusCode.NotAcceptable, "该请求大于油站地址5公里");
-            }
+           // }
+           // else
+           // {
+           //     return ServiceResponse.Error(HttpStatusCode.NotAcceptable, "站点经纬度获取失败");
+           // }
+           // //计算调用方和油站的距离,超过距离判定为恶意请求
+           // double distance = DistanceCalculator.CalculateDistance(longitude, latitude, longitude2, latitude2);
+           // if (distance > 5)
+           // {
+           //     return ServiceResponse.Error(HttpStatusCode.NotAcceptable, "该请求大于油站地址5公里");
+           // }
 
             var trx = _entityHelper.GetEntitiesAsync<transactions>(_ => _.Id == trxId).Result.FirstOrDefault();
             if (trx == null)
@@ -361,8 +395,8 @@ namespace Fuel.Application.Service
                 return ServiceResponse.Error(HttpStatusCode.NotAcceptable, "单价获取失败");
             }
             //计算退款金额
-            decimal RefundAmount = (decimal)trx.ActualPaymentAmount;
-            //decimal RefundAmount = (decimal)((trx.Qty - trx.OriginalQty) * ProductPrice.Value);
+            //decimal RefundAmount = (decimal)trx.ActualPaymentAmount;
+            decimal RefundAmount = (decimal)((trx.Qty - trx.OriginalQty) * ProductPrice.Value);
             //if (RefundAmount <= 0.0M)
             //{
             //    return ServiceResponse.Error(HttpStatusCode.NotAcceptable, "该笔单无需退款");
@@ -382,6 +416,7 @@ namespace Fuel.Application.Service
             {
                 trx.RefundStatus = RefundStatus.PartiallyRefunded;//部分退款
             }
+            trx.OrderStatus = transactionsORDERSTATUS.Cancelled;
             trx.RefundAmount = RefundAmount;
             int affectedRows = _fsql.Update<transactions>().SetSource(trx).ExecuteAffrows();
             return ServiceResponse.Ok(trx);
@@ -409,7 +444,7 @@ namespace Fuel.Application.Service
                     return ServiceResponse.Error(HttpStatusCode.NotAcceptable, "未查询到订单!");
                 }
                 logger.Debug("统一下单开始");
-                var serviceResult = await _payService.UnifiedOrder((decimal)0.01, "WX_SCAN", userSession.openid);
+                var serviceResult = await _payService.UnifiedOrder(trx.OriginalAmount.Value, "WX_SCAN", userSession.openid);
                 var dataProperties = serviceResult.Data.GetType().GetProperty("UnifiedOrderResult");
                 if (!serviceResult.IsSuccessful() || dataProperties == null)
                 {
@@ -436,12 +471,12 @@ namespace Fuel.Application.Service
                             trx.PaymentMethod = 2;//2 :微信支付
                             try
                             {
-                                await scopedMqttService.SubscribeAsync("fromClound/" + Buid);
+                                await scopedMqttService.SubscribeAsync("paid/" + Buid);
                                 string jsonString = JsonConvert.SerializeObject(trx);
                                 await Task.Delay(2000);
-                                var sendjson = new { type = 3, data = jsonString, UserName = user.UserName, UserPhoneNumber = user.UserPhoneNumber };
+                                var sendjson = new { data = jsonString, UserName = user.UserName, UserPhoneNumber = user.UserPhoneNumber };
                                 //支付完成将订单信息推送到fcc
-                                await scopedMqttService.PublishAsync("fromClound/" + Buid, JsonConvert.SerializeObject(sendjson));
+                                await scopedMqttService.PublishAsync("paid/" + Buid, JsonConvert.SerializeObject(sendjson));
                             }
                             catch (Exception ex)
                             {
@@ -476,7 +511,12 @@ namespace Fuel.Application.Service
                 return ServiceResponse.Error(HttpStatusCode.NotAcceptable, "未查询到订单!");
             }
             trx.OriginalQty = OriginalQty;
-            _entityHelper.UpdateAsync(trx);
+            var refund = await RefundTrx(trxId);
+            if (refund.IsSuccessful() || refund.StatusCode == HttpStatusCode.NotAcceptable)
+            {
+                trx.OrderStatus = transactionsORDERSTATUS.Completed;
+            }
+            int affectedRows = _fsql.Update<transactions>().SetSource(trx).ExecuteAffrows();
             return ServiceResponse.Ok(trx);
         }
         /// <summary>

+ 5 - 0
FuelCloud/src/Fuel.Payment.Server/Controllers/NozzleController.cs

@@ -58,6 +58,11 @@ namespace Fuel.PaymentServer.Controllers
             var serviceResult = await InozzleService.DeleteNozzle(uploadNozzle);
             return Ok(serviceResult);
         }
+        /// <summary>
+        /// fcc更新油枪状态
+        /// </summary>
+        /// <param name="uploadNozzleStatuses"></param>
+        /// <returns></returns>
         [Permission("Nozzle:UpdateNozzleStatus:PUT")]
         [Route("UpdateNozzleStatus")]
         [HttpPut]

+ 2 - 2
FuelCloud/src/Fuel.Payment.Server/Controllers/TransactionsController.cs

@@ -139,9 +139,9 @@ namespace Fuel.PaymentServer.Controllers
         /// <returns></returns>
         [Route("Redeem")]
         [HttpPost]
-        public async Task<IActionResult> Redeem(int trxId, decimal OriginalQty)
+        public async Task<IActionResult> Redeem(RedeemRequest redeemRequest)
         {
-            var serviceResult = await _transactionsService.Redeem(trxId, OriginalQty);
+            var serviceResult = await _transactionsService.Redeem(redeemRequest.trxId, redeemRequest.OriginalQty);
             return Ok(serviceResult);
         }
         /// <summary>

+ 2 - 1
FuelCloud/src/Fuel.Payment.Server/Program.cs

@@ -128,7 +128,8 @@ builder.Services.AddCors(options =>
 
 builder.WebHost.ConfigureKestrel(options =>
 {
-  options.Listen(System.Net.IPAddress.Parse("192.168.0.202"), 5006); // 监听特定IPv4地址的5002端口
+    options.Listen(System.Net.IPAddress.Parse("192.168.0.202"), 5006); // 监听特定IPv4地址的5002端口
+    //options.Listen(System.Net.IPAddress.Parse("172.31.2.202"), 5006); // 监听特定IPv4地址的5002端口
     options.Listen(System.Net.IPAddress.Parse("::1"), 5006); // 监听特定IPv6地址(这里是localhost)的5003端口
 });
 builder.Services.AddControllers()

+ 1 - 1
FuelCloud/src/Fuel.Payment.Server/appsettings.json

@@ -15,7 +15,7 @@
     "KeyName": "Trans"
   },
   "Mqtt": {
-    "Server": "192.168.0.202",
+    "Server": "produce.hsfuel.com",
     "Port": 1883,
     "Username": "",
     "Password": ""

+ 20 - 10
FuelCloud/src/Fuel.Payment.Service/WeChatPaymentProcessor/Wechat/WechatPaymentProcessor.cs

@@ -87,15 +87,25 @@ namespace Fuel.Payment.Service.WeChatPaymentProcessor.Wechat
         public override async Task<GenericProcessResponse> Query(ElectronicOrderModel order, int count, int interval)
         {
             order.TradeStatus = TradeStatus.PAYERROR;
-            Log.Info("MicroPay", "Wechat OrderQuery is processing order: " + order.BillNumber);
-            var result = await MicroPay.RunQuery(ModelMapper.ConvertToWayneCloudModel(order), count, interval);
+            try
+            {
+                Log.Info("MicroPay", "Wechat OrderQuery is processing order: " + order.BillNumber);
+                var result = await MicroPay.RunQuery(ModelMapper.ConvertToWayneCloudModel(order), count, interval);
 
-            Log.Info("MicroPay", "Wechat OrderQuery process complete, result : \r\n" + result.ToXml());
-            order.TradeStatus = TradeStatus.SUCCESS;
-            return new GenericProcessResponse()
+                Log.Info("MicroPay", "Wechat OrderQuery process complete, result : \r\n" + result.ToXml());
+                order.TradeStatus = TradeStatus.SUCCESS;
+                return new GenericProcessResponse()
+                {
+                    WeChatResponse = result
+                };
+            }
+            catch (Exception e)
             {
-                WeChatResponse = result
-            };
+                return new GenericProcessResponse()
+                {
+                };
+            }
+          
         }
 
         public override async Task<GenericProcessResponse> Return(ElectronicOrderModel order)
@@ -140,7 +150,7 @@ namespace Fuel.Payment.Service.WeChatPaymentProcessor.Wechat
             {
                 Log.Info("UnifiedOrder", "WechatPaymentProcessor :" + ex.Message);
                 return new GenericProcessResponse()
-                { 
+                {
 
                 };
             }
@@ -148,8 +158,8 @@ namespace Fuel.Payment.Service.WeChatPaymentProcessor.Wechat
 
         protected override async Task<GenericProcessResponse> Initialize(ElectronicOrderModel order)
         {
-           // string sourceFilePath = @"C:\cw\Code\smartfuel_lite\FuelCloud\src\Fuel.Payment.Server\File\Certificate\12345678-9abc-def0-1234-56789abcdef0\apiclient_cert.p12";
-            string sourceFilePath = @"D:/fuelcloud/fabu/File/Certificate/12345678-9abc-def0-1234-56789abcdef0/apiclient_cert.p12";
+            string sourceFilePath = @"C:\cw\Code\smartfuel_lite\FuelCloud\src\Fuel.Payment.Server\File\Certificate\12345678-9abc-def0-1234-56789abcdef0\apiclient_cert.p12";
+            //string sourceFilePath = @"D:/fuelcloud/fabu/File/Certificate/12345678-9abc-def0-1234-56789abcdef0/apiclient_cert.p12";
             string config = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<WxPayConfig>  \r\n  <APPID>wxb198dafff060e651</APPID>  \r\n  <SUBAPPID></SUBAPPID>\r\n  <MINI_PROGRAM_APPID>wxb198dafff060e651</MINI_PROGRAM_APPID>\r\n  <MCHID>1617253894</MCHID>\r\n  <SUBMCHID></SUBMCHID>\r\n  <KEY>Kguangzhouhengshangongsi20250211</KEY>\r\n  <APPSECRET>2e6ee037b95c8fb90eb415bb559f8259</APPSECRET>\r\n  <SSLCERT>apiclient_cert.p12</SSLCERT>\r\n  <SSLCERT_PASSWORD>1617253894</SSLCERT_PASSWORD>\r\n  <NOTIFY_URL>http://paysdk.weixin.qq.com/example/ResultNotifyPage.aspx</NOTIFY_URL>\r\n  <IP>8.8.8.8</IP>\r\n  <PROXY_URL>http://10.152.18.220:8080</PROXY_URL>\r\n  <REPORT_LEVENL>1</REPORT_LEVENL>\r\n</WxPayConfig>";
             FileHandler fileHandler = new FileHandler();
             byte[] fileBytes = fileHandler.ReadFileToByteArray(sourceFilePath);

+ 7 - 7
FuelCloud/src/FuelServer.Core/Entity/transactions.cs

@@ -32,7 +32,7 @@ namespace FuelServer.Core.Entity
 		/// 用户ID
 		/// </summary>
 		[JsonProperty]
-		public long MiniProgramID { get; set; }
+		public long? MiniProgramID { get; set; }
 
 		/// <summary>
 		/// 枪号
@@ -184,6 +184,10 @@ namespace FuelServer.Core.Entity
     }
     public enum RefundStatus
     {
+        /// <summary>
+        /// 无退款
+        /// </summary>
+        NotRefunded,
         /// <summary>
         /// 订单全额退款。
         /// </summary>
@@ -192,11 +196,7 @@ namespace FuelServer.Core.Entity
         /// <summary>
         /// 订单部分退款。
         /// </summary>
-        PartiallyRefunded,
-        /// <summary>
-        /// 无退款
-        /// </summary>
-        NotRefunded
+        PartiallyRefunded
     }
     public enum AuthorizationStatus
     {
@@ -211,7 +211,7 @@ namespace FuelServer.Core.Entity
         Authorized,
 
         /// <summary>
-        /// 等待授权
+        /// 等待授权 发起授权时,等待中的状态
         /// </summary>
         WaitAuthorization,
 

+ 1 - 1
FuelCloud/src/FuelServer.Core/Nozzle/Dto/UploadNozzle.cs

@@ -86,7 +86,7 @@ namespace Fuel.Core.Nozzle.Dto
         /// <summary>
         /// 油枪ID
         /// </summary>
-        public string NozzleId { get; set; }
+        public long NozzleId { get; set; }
         /// <summary>
         /// 交易流水
         /// </summary>

+ 5 - 0
FuelCloud/src/FuelServer.Core/Transactions/Dto/RefundTrxRequest.cs

@@ -18,4 +18,9 @@ namespace Fuel.Core.Transactions.Dto
         public int trxid { get; set; }
         public string orderType { get; set; }
     }
+    public class RedeemRequest
+    {
+        public int trxId { get; set; }
+        public decimal OriginalQty { get; set; }
+    }
 }

+ 5 - 4
FuelCloud/src/FuelServer.Core/Transactions/Dto/UploadTransactions.cs

@@ -25,7 +25,7 @@ namespace Fuel.Core.Transactions.Dto
         /// <summary>
         /// 升数
         /// </summary>
-        public decimal Qty { get; set; }
+        public decimal? Qty { get; set; }
         /// <summary>
         /// 挂枪时间
         /// </summary>
@@ -41,7 +41,7 @@ namespace Fuel.Core.Transactions.Dto
         /// <summary>
         /// 用户id
         /// </summary>
-        public int? MiniProgramID { get; set; }
+        public long? MiniProgramID { get; set; }
         /// <summary>
         /// 订单流水号
         /// </summary>
@@ -78,8 +78,9 @@ namespace Fuel.Core.Transactions.Dto
                 TransactionTime = DateTime.Now,
                 Price = upload.Price,
                 CreateTime = DateTime.Now,
-                OriginalQty = upload.Qty,
-                FuelItemPumpTotalizerVolume = upload.FuelItemPumpTotalizerVolume
+                OriginalQty = _OrderType == 1 ?0.00M: upload.Qty,
+                FuelItemPumpTotalizerVolume = upload.FuelItemPumpTotalizerVolume,
+                MiniProgramID = upload.MiniProgramID
             };
         }
         public static transactionsORDERTYPE ToTransactionsOrderType(int value)