fix:提交银联支付绝对路径读取配置文件
This commit is contained in:
BIN
.vs/Pos/v17/.wsuo
Normal file
BIN
.vs/Pos/v17/.wsuo
Normal file
Binary file not shown.
12
.vs/Pos/v17/DocumentLayout.json
Normal file
12
.vs/Pos/v17/DocumentLayout.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"Version": 1,
|
||||||
|
"WorkspaceRootPath": "C:\\backup\\Code\\Code\\QYZYYYY\\Pos\\",
|
||||||
|
"Documents": [],
|
||||||
|
"DocumentGroupContainers": [
|
||||||
|
{
|
||||||
|
"Orientation": 0,
|
||||||
|
"VerticalTabListWidth": 256,
|
||||||
|
"DocumentGroups": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
7
.vs/VSWorkspaceState.json
Normal file
7
.vs/VSWorkspaceState.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"SelectedNode": "\\C:\\backup\\Code\\Code\\QYZYYYY\\Pos",
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
17
AssemblyInfo.cs
Normal file
17
AssemblyInfo.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// Assembly MisPosFD, Version 2.0.0.1
|
||||||
|
|
||||||
|
[assembly: System.Runtime.CompilerServices.CompilationRelaxations(8)]
|
||||||
|
[assembly: System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)]
|
||||||
|
[assembly: System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
|
||||||
|
[assembly: System.Reflection.AssemblyTitle("MisPosFD")]
|
||||||
|
[assembly: System.Reflection.AssemblyDescription("银联MisPos封装")]
|
||||||
|
[assembly: System.Reflection.AssemblyConfiguration("")]
|
||||||
|
[assembly: System.Reflection.AssemblyCompany("广州方鼎软件科技发展有限公司")]
|
||||||
|
[assembly: System.Reflection.AssemblyProduct("MisPosFD")]
|
||||||
|
[assembly: System.Reflection.AssemblyCopyright("Copyright \x00a9 2025")]
|
||||||
|
[assembly: System.Reflection.AssemblyTrademark("")]
|
||||||
|
[assembly: System.Runtime.InteropServices.ComVisible(true)]
|
||||||
|
[assembly: System.Runtime.InteropServices.Guid("f8d14652-2d34-4866-a809-ed6072282ded")]
|
||||||
|
[assembly: System.Reflection.AssemblyFileVersion("2.0.0.2")]
|
||||||
|
[assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName=".NET Framework 4.5")]
|
||||||
|
|
64
MisPosFD.csproj
Normal file
64
MisPosFD.csproj
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>local</ProjectType>
|
||||||
|
<ProjectVersion>7.10.377</ProjectVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{CF67D09B-E914-4E35-B209-C55E21E2DDF4}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<AssemblyName>MisPosFD</AssemblyName>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Global.cs" />
|
||||||
|
<Compile Include="MisPosFD\IOnline.cs" />
|
||||||
|
<Compile Include="MisPosFD\Online.cs" />
|
||||||
|
<Compile Include="MisPosFD\ISocial.cs" />
|
||||||
|
<Compile Include="MisPosFD\Social.cs" />
|
||||||
|
<Compile Include="MisPosFD\ITest.cs" />
|
||||||
|
<Compile Include="MisPosFD\Test.cs" />
|
||||||
|
<Compile Include="MisPosFD\IUnion.cs" />
|
||||||
|
<Compile Include="MisPosFD\Union.cs" />
|
||||||
|
<Compile Include="MisPosFD\Model\CorrectResponse.cs" />
|
||||||
|
<Compile Include="MisPosFD\Model\OnlineResponse.cs" />
|
||||||
|
<Compile Include="MisPosFD\Model\QueryResponse.cs" />
|
||||||
|
<Compile Include="MisPosFD\Model\TradeResponse.cs" />
|
||||||
|
<Compile Include="MisPosFD\Helper\CommonHelper.cs" />
|
||||||
|
<Compile Include="MisPosFD\Helper\ResponseHelper.cs" />
|
||||||
|
<Compile Include="MisPosFD\Domain\Online.cs" />
|
||||||
|
<Compile Include="MisPosFD\Domain\Social.cs" />
|
||||||
|
<Compile Include="MisPosFD\Domain\Union.cs" />
|
||||||
|
<Compile Include="MisPosFD\Api\MisPos.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\清远中医院\最终版本\MisPos调用v1.2\MisPos调用v1.2\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
25
MisPosFD.sln
Normal file
25
MisPosFD.sln
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.11.35312.102
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MisPosFD", "MisPosFD.csproj", "{CF67D09B-E914-4E35-B209-C55E21E2DDF4}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{CF67D09B-E914-4E35-B209-C55E21E2DDF4}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{CF67D09B-E914-4E35-B209-C55E21E2DDF4}.Debug|x86.Build.0 = Debug|x86
|
||||||
|
{CF67D09B-E914-4E35-B209-C55E21E2DDF4}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{CF67D09B-E914-4E35-B209-C55E21E2DDF4}.Release|x86.Build.0 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {66951C8B-3E2D-475A-A640-FBCF9068FE9E}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
18
MisPosFD/Api/MisPos.cs
Normal file
18
MisPosFD/Api/MisPos.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
namespace MisPosFD.Api
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
internal class MisPos
|
||||||
|
{
|
||||||
|
[DllImport("MisPos.dll", CharSet = CharSet.Ansi, SetLastError = true)]
|
||||||
|
public static extern int MyMisPos([MarshalAs(UnmanagedType.LPStr)] StringBuilder sappname, [MarshalAs(UnmanagedType.LPStr)] StringBuilder stransid, [MarshalAs(UnmanagedType.LPStr)] StringBuilder stime, [MarshalAs(UnmanagedType.LPStr)] StringBuilder sjsondata, [MarshalAs(UnmanagedType.LPStr)] StringBuilder outdata);
|
||||||
|
|
||||||
|
|
||||||
|
[DllImport("MisPos.dll", CharSet = CharSet.Ansi, SetLastError = true)]
|
||||||
|
public static extern int MyMisPosPath([MarshalAs(UnmanagedType.LPStr)] StringBuilder sappname, [MarshalAs(UnmanagedType.LPStr)] StringBuilder stransid, [MarshalAs(UnmanagedType.LPStr)] StringBuilder stime, [MarshalAs(UnmanagedType.LPStr)] StringBuilder sjsondata, [MarshalAs(UnmanagedType.LPStr)] StringBuilder setDizhi, [MarshalAs(UnmanagedType.LPStr)] StringBuilder outdata);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
99
MisPosFD/Domain/Online.cs
Normal file
99
MisPosFD/Domain/Online.cs
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
namespace MisPosFD.Domain
|
||||||
|
{
|
||||||
|
using MisPosFD.Api;
|
||||||
|
using MisPosFD.Helper;
|
||||||
|
using MisPosFD.Model;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
public class Online
|
||||||
|
{
|
||||||
|
public static string correct(string path ,string traceNo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError("传入conf.ini配置文件地址为空,请检查入参", null);
|
||||||
|
}
|
||||||
|
StringBuilder sappname = new StringBuilder("05");
|
||||||
|
StringBuilder stransid = new StringBuilder("52");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new { sOrgTraceNo = traceNo }));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
StringBuilder infoPath = new StringBuilder(path);
|
||||||
|
int num = MisPos.MyMisPosPath(sappname, stransid, stime, sjsondata, infoPath, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
OnlineResponse response = JsonConvert.DeserializeObject<OnlineResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string pos(string path, string amount, string orderNo = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(orderNo))
|
||||||
|
{
|
||||||
|
orderNo = "FD" + DateTime.Now.ToString("yyyyMMddHHmmss") + CommonHelper.random(5);
|
||||||
|
}
|
||||||
|
StringBuilder sappname = new StringBuilder("05");
|
||||||
|
StringBuilder stransid = new StringBuilder("51");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new {
|
||||||
|
sAmt = amount,
|
||||||
|
sType = "00",
|
||||||
|
sMerOrderNo = orderNo
|
||||||
|
}));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
StringBuilder infoPath = new StringBuilder(path);
|
||||||
|
int num = MisPos.MyMisPosPath(sappname, stransid, stime, sjsondata, infoPath, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
OnlineResponse response = JsonConvert.DeserializeObject<OnlineResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo,
|
||||||
|
orderNo = response.out_trade_no
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
140
MisPosFD/Domain/Social.cs
Normal file
140
MisPosFD/Domain/Social.cs
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
namespace MisPosFD.Domain
|
||||||
|
{
|
||||||
|
using MisPosFD.Api;
|
||||||
|
using MisPosFD.Helper;
|
||||||
|
using MisPosFD.Model;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
public class Social
|
||||||
|
{
|
||||||
|
public static string correct(string path ,string traceNo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError("传入conf.ini配置文件地址为空,请检查入参", null);
|
||||||
|
}
|
||||||
|
StringBuilder sappname = new StringBuilder("03");
|
||||||
|
StringBuilder stransid = new StringBuilder("12");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new { sOrgTraceNo = traceNo }));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
StringBuilder infoPath = new StringBuilder(path);
|
||||||
|
int num = MisPos.MyMisPosPath(sappname, stransid, stime, sjsondata, infoPath, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
CorrectResponse response = JsonConvert.DeserializeObject<CorrectResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string query(string path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError("传入conf.ini配置文件地址为空,请检查入参", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder stransid = new StringBuilder("22");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(0x400);
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
StringBuilder infoPath = new StringBuilder(path);
|
||||||
|
int num = MisPos.MyMisPosPath(new StringBuilder("03"), stransid, stime, sjsondata, infoPath, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
QueryResponse response = JsonConvert.DeserializeObject<QueryResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
decimal num2 = decimal.Parse(response.amt) / 100M;
|
||||||
|
var rdata = new {
|
||||||
|
balance = num2.ToString(),
|
||||||
|
cardNo = response.cardNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string trade(string path, string amount, string orderNo = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError("传入conf.ini配置文件地址为空,请检查入参", null);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(orderNo))
|
||||||
|
{
|
||||||
|
orderNo = "FD" + DateTime.Now.ToString("yyyyMMddHHmmss") + CommonHelper.random(5);
|
||||||
|
}
|
||||||
|
StringBuilder sappname = new StringBuilder("03");
|
||||||
|
StringBuilder stransid = new StringBuilder("11");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new {
|
||||||
|
sAmt4 = amount,
|
||||||
|
sMerOrderNo = orderNo
|
||||||
|
}));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
StringBuilder infoPath = new StringBuilder(path);
|
||||||
|
int num = MisPos.MyMisPosPath(sappname, stransid, stime, sjsondata, infoPath, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
TradeResponse response = JsonConvert.DeserializeObject<TradeResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo,
|
||||||
|
orderNo = response.sMerOrderNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
139
MisPosFD/Domain/Union.cs
Normal file
139
MisPosFD/Domain/Union.cs
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
namespace MisPosFD.Domain
|
||||||
|
{
|
||||||
|
using MisPosFD.Api;
|
||||||
|
using MisPosFD.Helper;
|
||||||
|
using MisPosFD.Model;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
public class Union
|
||||||
|
{
|
||||||
|
public static string correct(string path ,string traceNo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError("传入conf.ini配置文件地址为空,请检查入参", null);
|
||||||
|
}
|
||||||
|
StringBuilder sappname = new StringBuilder("03");
|
||||||
|
StringBuilder stransid = new StringBuilder("32");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new { sOrgTraceNo = traceNo }));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
StringBuilder infoPath = new StringBuilder(path);
|
||||||
|
int num = MisPos.MyMisPosPath(sappname, stransid, stime, sjsondata, infoPath, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
CorrectResponse response = JsonConvert.DeserializeObject<CorrectResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string query(string path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError("传入conf.ini配置文件地址为空,请检查入参", null);
|
||||||
|
}
|
||||||
|
StringBuilder stransid = new StringBuilder("21");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(0x400);
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
StringBuilder infoPath = new StringBuilder(path);
|
||||||
|
int num = MisPos.MyMisPosPath(new StringBuilder("03"), stransid, stime, sjsondata, infoPath, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
QueryResponse response = JsonConvert.DeserializeObject<QueryResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
decimal num2 = decimal.Parse(response.amt) / 100M;
|
||||||
|
var rdata = new {
|
||||||
|
balance = num2.ToString(),
|
||||||
|
cardNo = response.cardNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string trade(string path, string amount, string orderNo = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError("传入conf.ini配置文件地址为空,请检查入参", null);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(orderNo))
|
||||||
|
{
|
||||||
|
orderNo = "FD" + DateTime.Now.ToString("yyyyMMddHHmmss") + CommonHelper.random(5);
|
||||||
|
}
|
||||||
|
StringBuilder sappname = new StringBuilder("03");
|
||||||
|
StringBuilder stransid = new StringBuilder("31");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new {
|
||||||
|
sAmt = amount,
|
||||||
|
sMerOrderNo = orderNo
|
||||||
|
}));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
StringBuilder infoPath = new StringBuilder(path);
|
||||||
|
int num = MisPos.MyMisPosPath(sappname, stransid, stime, sjsondata, infoPath, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
TradeResponse response = JsonConvert.DeserializeObject<TradeResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo,
|
||||||
|
orderNo = response.sMerOrderNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
20
MisPosFD/Helper/CommonHelper.cs
Normal file
20
MisPosFD/Helper/CommonHelper.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
namespace MisPosFD.Helper
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
|
||||||
|
internal class CommonHelper
|
||||||
|
{
|
||||||
|
private static int GenerateRandomNumber(int length)
|
||||||
|
{
|
||||||
|
int num = ((int) Math.Pow(10.0, (double) length)) - 1;
|
||||||
|
return new Random().Next(0, num + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GenerateRandomNumberString(int length) =>
|
||||||
|
GenerateRandomNumber(length).ToString().PadLeft(length, '0');
|
||||||
|
|
||||||
|
public static string random(int length) =>
|
||||||
|
GenerateRandomNumberString(length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
31
MisPosFD/Helper/ResponseHelper.cs
Normal file
31
MisPosFD/Helper/ResponseHelper.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
namespace MisPosFD.Helper
|
||||||
|
{
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
public class ResponseHelper
|
||||||
|
{
|
||||||
|
public static string jError(string rmsg, object rdata = null) =>
|
||||||
|
JsonConvert.SerializeObject(new {
|
||||||
|
code = "-2",
|
||||||
|
msg = rmsg,
|
||||||
|
data = rdata
|
||||||
|
});
|
||||||
|
|
||||||
|
public static string jFailure(string rmsg, object rdata = null) =>
|
||||||
|
JsonConvert.SerializeObject(new {
|
||||||
|
code = "-1",
|
||||||
|
msg = rmsg,
|
||||||
|
data = rdata
|
||||||
|
});
|
||||||
|
|
||||||
|
public static string jSuccess(string rmsg, object rdata = null) =>
|
||||||
|
JsonConvert.SerializeObject(new {
|
||||||
|
code = "0",
|
||||||
|
msg = rmsg,
|
||||||
|
data = rdata
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
13
MisPosFD/IOnline.cs
Normal file
13
MisPosFD/IOnline.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace MisPosFD
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[Guid("B85E1284-E657-4DB8-BBD4-EF39BE3208DD")]
|
||||||
|
public interface IOnline
|
||||||
|
{
|
||||||
|
string pos(string amount, string orderNo = "");
|
||||||
|
string correct(string traceNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
14
MisPosFD/ISocial.cs
Normal file
14
MisPosFD/ISocial.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
namespace MisPosFD
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[Guid("06FF9559-0B27-47E2-8D3B-74B825011D32")]
|
||||||
|
public interface ISocial
|
||||||
|
{
|
||||||
|
string query();
|
||||||
|
string trade(string amount, string orderNo = "");
|
||||||
|
string correct(string traceNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
12
MisPosFD/ITest.cs
Normal file
12
MisPosFD/ITest.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace MisPosFD
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[Guid("9439CB9C-5030-455F-85A1-5F6E4BC8FA3B")]
|
||||||
|
public interface ITest
|
||||||
|
{
|
||||||
|
int Add(int a, int b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
14
MisPosFD/IUnion.cs
Normal file
14
MisPosFD/IUnion.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
namespace MisPosFD
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[Guid("C48A2C52-E9F1-4E32-8535-9BA1F5B34CFB")]
|
||||||
|
public interface IUnion
|
||||||
|
{
|
||||||
|
string query();
|
||||||
|
string trade(string amount, string orderNo = "");
|
||||||
|
string correct(string traceNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
39
MisPosFD/Model/CorrectResponse.cs
Normal file
39
MisPosFD/Model/CorrectResponse.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
namespace MisPosFD.Model
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
internal class CorrectResponse
|
||||||
|
{
|
||||||
|
public string resCode { get; set; }
|
||||||
|
|
||||||
|
public string resMsg { get; set; }
|
||||||
|
|
||||||
|
public string merchantNo { get; set; }
|
||||||
|
|
||||||
|
public string terminalNo { get; set; }
|
||||||
|
|
||||||
|
public string amt { get; set; }
|
||||||
|
|
||||||
|
public string traceNo { get; set; }
|
||||||
|
|
||||||
|
public string refNo { get; set; }
|
||||||
|
|
||||||
|
public string cardNo { get; set; }
|
||||||
|
|
||||||
|
public string date { get; set; }
|
||||||
|
|
||||||
|
public string time { get; set; }
|
||||||
|
|
||||||
|
public string transChnName { get; set; }
|
||||||
|
|
||||||
|
public string appName { get; set; }
|
||||||
|
|
||||||
|
public string transId { get; set; }
|
||||||
|
|
||||||
|
public string settleDate { get; set; }
|
||||||
|
|
||||||
|
public string authNo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
43
MisPosFD/Model/OnlineResponse.cs
Normal file
43
MisPosFD/Model/OnlineResponse.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
namespace MisPosFD.Model
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
internal class OnlineResponse
|
||||||
|
{
|
||||||
|
public string resCode { get; set; }
|
||||||
|
|
||||||
|
public string resMsg { get; set; }
|
||||||
|
|
||||||
|
public string merchantNo { get; set; }
|
||||||
|
|
||||||
|
public string terminalNo { get; set; }
|
||||||
|
|
||||||
|
public string amt { get; set; }
|
||||||
|
|
||||||
|
public string traceNo { get; set; }
|
||||||
|
|
||||||
|
public string refNo { get; set; }
|
||||||
|
|
||||||
|
public string cardNo { get; set; }
|
||||||
|
|
||||||
|
public string out_trade_no { get; set; }
|
||||||
|
|
||||||
|
public string date { get; set; }
|
||||||
|
|
||||||
|
public string time { get; set; }
|
||||||
|
|
||||||
|
public string channelName { get; set; }
|
||||||
|
|
||||||
|
public string transChnName { get; set; }
|
||||||
|
|
||||||
|
public string appName { get; set; }
|
||||||
|
|
||||||
|
public string transId { get; set; }
|
||||||
|
|
||||||
|
public string settleDate { get; set; }
|
||||||
|
|
||||||
|
public string authNo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
31
MisPosFD/Model/QueryResponse.cs
Normal file
31
MisPosFD/Model/QueryResponse.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
namespace MisPosFD.Model
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
internal class QueryResponse
|
||||||
|
{
|
||||||
|
public string resCode { get; set; }
|
||||||
|
|
||||||
|
public string resMsg { get; set; }
|
||||||
|
|
||||||
|
public string merchantNo { get; set; }
|
||||||
|
|
||||||
|
public string terminalNo { get; set; }
|
||||||
|
|
||||||
|
public string amt { get; set; }
|
||||||
|
|
||||||
|
public string cardNo { get; set; }
|
||||||
|
|
||||||
|
public string date { get; set; }
|
||||||
|
|
||||||
|
public string time { get; set; }
|
||||||
|
|
||||||
|
public string appName { get; set; }
|
||||||
|
|
||||||
|
public string transId { get; set; }
|
||||||
|
|
||||||
|
public string authNo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
43
MisPosFD/Model/TradeResponse.cs
Normal file
43
MisPosFD/Model/TradeResponse.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
namespace MisPosFD.Model
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
internal class TradeResponse
|
||||||
|
{
|
||||||
|
public string resCode { get; set; }
|
||||||
|
|
||||||
|
public string resMsg { get; set; }
|
||||||
|
|
||||||
|
public string merchantNo { get; set; }
|
||||||
|
|
||||||
|
public string terminalNo { get; set; }
|
||||||
|
|
||||||
|
public string amt { get; set; }
|
||||||
|
|
||||||
|
public string traceNo { get; set; }
|
||||||
|
|
||||||
|
public string refNo { get; set; }
|
||||||
|
|
||||||
|
public string cardNo { get; set; }
|
||||||
|
|
||||||
|
public string date { get; set; }
|
||||||
|
|
||||||
|
public string time { get; set; }
|
||||||
|
|
||||||
|
public string channelName { get; set; }
|
||||||
|
|
||||||
|
public string transChnName { get; set; }
|
||||||
|
|
||||||
|
public string sMerOrderNo { get; set; }
|
||||||
|
|
||||||
|
public string appName { get; set; }
|
||||||
|
|
||||||
|
public string transId { get; set; }
|
||||||
|
|
||||||
|
public string settleDate { get; set; }
|
||||||
|
|
||||||
|
public string authNo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
94
MisPosFD/Online.cs
Normal file
94
MisPosFD/Online.cs
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
namespace MisPosFD
|
||||||
|
{
|
||||||
|
using MisPosFD.Api;
|
||||||
|
using MisPosFD.Helper;
|
||||||
|
using MisPosFD.Model;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
[Guid("C952B56E-BDFB-4FF9-A84C-1DD8AC013F0A"), ClassInterface(ClassInterfaceType.None)]
|
||||||
|
public class Online : IOnline
|
||||||
|
{
|
||||||
|
public string correct(string traceNo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringBuilder sappname = new StringBuilder("05");
|
||||||
|
StringBuilder stransid = new StringBuilder("52");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new { sOrgTraceNo = traceNo }));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
int num = MisPos.MyMisPos(sappname, stransid, stime, sjsondata, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
OnlineResponse response = JsonConvert.DeserializeObject<OnlineResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string pos(string amount, string orderNo = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(orderNo))
|
||||||
|
{
|
||||||
|
orderNo = "FD" + DateTime.Now.ToString("yyyyMMddHHmmss") + CommonHelper.random(5);
|
||||||
|
}
|
||||||
|
StringBuilder sappname = new StringBuilder("05");
|
||||||
|
StringBuilder stransid = new StringBuilder("51");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new {
|
||||||
|
sAmt = amount,
|
||||||
|
sType = "00",
|
||||||
|
sMerOrderNo = orderNo
|
||||||
|
}));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
int num = MisPos.MyMisPos(sappname, stransid, stime, sjsondata, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
OnlineResponse response = JsonConvert.DeserializeObject<OnlineResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo,
|
||||||
|
orderNo = response.out_trade_no
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
125
MisPosFD/Social.cs
Normal file
125
MisPosFD/Social.cs
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
namespace MisPosFD
|
||||||
|
{
|
||||||
|
using MisPosFD.Api;
|
||||||
|
using MisPosFD.Helper;
|
||||||
|
using MisPosFD.Model;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
[Guid("2BDD814F-0E23-427A-AFB8-DDFE6AF4ABE1"), ClassInterface(ClassInterfaceType.None)]
|
||||||
|
public class Social : ISocial
|
||||||
|
{
|
||||||
|
public string correct(string traceNo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringBuilder sappname = new StringBuilder("03");
|
||||||
|
StringBuilder stransid = new StringBuilder("12");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new { sOrgTraceNo = traceNo }));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
int num = MisPos.MyMisPos(sappname, stransid, stime, sjsondata, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
CorrectResponse response = JsonConvert.DeserializeObject<CorrectResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string query()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringBuilder stransid = new StringBuilder("22");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(0x400);
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
int num = MisPos.MyMisPos(new StringBuilder("03"), stransid, stime, sjsondata, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
QueryResponse response = JsonConvert.DeserializeObject<QueryResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
decimal num2 = decimal.Parse(response.amt) / 100M;
|
||||||
|
var rdata = new {
|
||||||
|
balance = num2.ToString(),
|
||||||
|
cardNo = response.cardNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string trade(string amount, string orderNo = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(orderNo))
|
||||||
|
{
|
||||||
|
orderNo = "FD" + DateTime.Now.ToString("yyyyMMddHHmmss") + CommonHelper.random(5);
|
||||||
|
}
|
||||||
|
StringBuilder sappname = new StringBuilder("03");
|
||||||
|
StringBuilder stransid = new StringBuilder("11");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new {
|
||||||
|
sAmt4 = amount,
|
||||||
|
sMerOrderNo = orderNo
|
||||||
|
}));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
int num = MisPos.MyMisPos(sappname, stransid, stime, sjsondata, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
TradeResponse response = JsonConvert.DeserializeObject<TradeResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo,
|
||||||
|
orderNo = response.sMerOrderNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
13
MisPosFD/Test.cs
Normal file
13
MisPosFD/Test.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace MisPosFD
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[Guid("6C165D8A-9A16-41CD-BA4F-A9D82073A669"), ClassInterface(ClassInterfaceType.None)]
|
||||||
|
public class Test : ITest
|
||||||
|
{
|
||||||
|
public int Add(int a, int b) =>
|
||||||
|
(a + b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
125
MisPosFD/Union.cs
Normal file
125
MisPosFD/Union.cs
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
namespace MisPosFD
|
||||||
|
{
|
||||||
|
using MisPosFD.Api;
|
||||||
|
using MisPosFD.Helper;
|
||||||
|
using MisPosFD.Model;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
[Guid("95132F66-A747-4967-A284-5C3B2D8553C0"), ClassInterface(ClassInterfaceType.None)]
|
||||||
|
public class Union : IUnion
|
||||||
|
{
|
||||||
|
public string correct(string traceNo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringBuilder sappname = new StringBuilder("03");
|
||||||
|
StringBuilder stransid = new StringBuilder("32");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new { sOrgTraceNo = traceNo }));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
int num = MisPos.MyMisPos(sappname, stransid, stime, sjsondata, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
CorrectResponse response = JsonConvert.DeserializeObject<CorrectResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string query()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringBuilder stransid = new StringBuilder("21");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(0x400);
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
int num = MisPos.MyMisPos(new StringBuilder("03"), stransid, stime, sjsondata, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
QueryResponse response = JsonConvert.DeserializeObject<QueryResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
decimal num2 = decimal.Parse(response.amt) / 100M;
|
||||||
|
var rdata = new {
|
||||||
|
balance = num2.ToString(),
|
||||||
|
cardNo = response.cardNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string trade(string amount, string orderNo = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(orderNo))
|
||||||
|
{
|
||||||
|
orderNo = "FD" + DateTime.Now.ToString("yyyyMMddHHmmss") + CommonHelper.random(5);
|
||||||
|
}
|
||||||
|
StringBuilder sappname = new StringBuilder("03");
|
||||||
|
StringBuilder stransid = new StringBuilder("31");
|
||||||
|
StringBuilder stime = new StringBuilder(DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||||
|
StringBuilder sjsondata = new StringBuilder(JsonConvert.SerializeObject(new {
|
||||||
|
sAmt = amount,
|
||||||
|
sMerOrderNo = orderNo
|
||||||
|
}));
|
||||||
|
StringBuilder outdata = new StringBuilder(0x400);
|
||||||
|
int num = MisPos.MyMisPos(sappname, stransid, stime, sjsondata, outdata);
|
||||||
|
string str = outdata.ToString();
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
TradeResponse response = JsonConvert.DeserializeObject<TradeResponse>(str);
|
||||||
|
if ("00".Equals(response.resCode))
|
||||||
|
{
|
||||||
|
var rdata = new {
|
||||||
|
amount = response.amt,
|
||||||
|
cardNo = response.cardNo,
|
||||||
|
traceNo = response.traceNo,
|
||||||
|
settleDate = response.settleDate,
|
||||||
|
refNo = response.refNo,
|
||||||
|
orderNo = response.sMerOrderNo
|
||||||
|
};
|
||||||
|
return ResponseHelper.jSuccess("SUCCESS", rdata);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jFailure(response.resMsg, null);
|
||||||
|
}
|
||||||
|
return ResponseHelper.jError(str, null);
|
||||||
|
}
|
||||||
|
catch (Exception exception1)
|
||||||
|
{
|
||||||
|
return ResponseHelper.jError(exception1.Message, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
BIN
bin/Debug/MisPosFD.dll
Normal file
BIN
bin/Debug/MisPosFD.dll
Normal file
Binary file not shown.
BIN
bin/Debug/MisPosFD.pdb
Normal file
BIN
bin/Debug/MisPosFD.pdb
Normal file
Binary file not shown.
BIN
bin/Debug/Newtonsoft.Json.dll
Normal file
BIN
bin/Debug/Newtonsoft.Json.dll
Normal file
Binary file not shown.
11363
bin/Debug/Newtonsoft.Json.xml
Normal file
11363
bin/Debug/Newtonsoft.Json.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
|
@@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
|
BIN
obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache
Normal file
BIN
obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache
Normal file
Binary file not shown.
BIN
obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Normal file
BIN
obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Normal file
Binary file not shown.
BIN
obj/x86/Debug/MisPosFD.csproj.AssemblyReference.cache
Normal file
BIN
obj/x86/Debug/MisPosFD.csproj.AssemblyReference.cache
Normal file
Binary file not shown.
0
obj/x86/Debug/MisPosFD.csproj.CopyComplete
Normal file
0
obj/x86/Debug/MisPosFD.csproj.CopyComplete
Normal file
1
obj/x86/Debug/MisPosFD.csproj.CoreCompileInputs.cache
Normal file
1
obj/x86/Debug/MisPosFD.csproj.CoreCompileInputs.cache
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1be31c4151ab265193a894bf2488dfbc1e2e8cf7bf70a54f8f2a38841d8f625e
|
12
obj/x86/Debug/MisPosFD.csproj.FileListAbsolute.txt
Normal file
12
obj/x86/Debug/MisPosFD.csproj.FileListAbsolute.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
C:\Users\Nine\Desktop\new\obj\x86\Debug\MisPosFD.csproj.CoreCompileInputs.cache
|
||||||
|
C:\Users\Nine\Desktop\new\bin\Debug\MisPosFD.dll
|
||||||
|
C:\Users\Nine\Desktop\new\bin\Debug\MisPosFD.pdb
|
||||||
|
C:\Users\Nine\Desktop\new\bin\Debug\Newtonsoft.Json.dll
|
||||||
|
C:\Users\Nine\Desktop\new\bin\Debug\Newtonsoft.Json.xml
|
||||||
|
C:\Users\Nine\Desktop\new\obj\x86\Debug\MisPosFD.csproj.CopyComplete
|
||||||
|
C:\Users\Nine\Desktop\new\obj\x86\Debug\MisPosFD.dll
|
||||||
|
C:\Users\Nine\Desktop\new\obj\x86\Debug\MisPosFD.pdb
|
||||||
|
C:\Users\Nine\Desktop\MisPosFD\obj\x86\Debug\MisPosFD.csproj.AssemblyReference.cache
|
||||||
|
C:\Users\Nine\Desktop\MisPosFD\obj\x86\Debug\MisPosFD.csproj.CoreCompileInputs.cache
|
||||||
|
C:\Users\Nine\Desktop\MisPosFD\obj\x86\Debug\MisPosFD.dll
|
||||||
|
C:\Users\Nine\Desktop\MisPosFD\obj\x86\Debug\MisPosFD.pdb
|
BIN
obj/x86/Debug/MisPosFD.dll
Normal file
BIN
obj/x86/Debug/MisPosFD.dll
Normal file
Binary file not shown.
BIN
obj/x86/Debug/MisPosFD.pdb
Normal file
BIN
obj/x86/Debug/MisPosFD.pdb
Normal file
Binary file not shown.
Reference in New Issue
Block a user