Compare commits
No commits in common. "677582d4bb23bddd58a50800c659035df9f6e67d" and "9c06f80dd7fb6bf6ca69d267361451deab2d063e" have entirely different histories.
677582d4bb
...
9c06f80dd7
@ -1,28 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
|
||||||
|
|
||||||
namespace CA_ANC.Formatters;
|
|
||||||
public class Formatters {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ByteArrayInputFormatter : InputFormatter
|
|
||||||
{
|
|
||||||
public ByteArrayInputFormatter()
|
|
||||||
{
|
|
||||||
SupportedMediaTypes.Add(Microsoft.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/octet-stream"));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool CanReadType(Type type)
|
|
||||||
{
|
|
||||||
return type == typeof(byte[]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async override Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
|
|
||||||
{
|
|
||||||
var stream = new MemoryStream();
|
|
||||||
await context.HttpContext.Request.Body.CopyToAsync(stream);
|
|
||||||
return await InputFormatterResult.SuccessAsync(stream.ToArray());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using CVRLIB.CARTS;
|
|
||||||
using static CVRLIB.CVSTRINGS.TextFuncs;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using CVRLIB;
|
|
||||||
|
|
||||||
namespace VSERVERWS.Controllers {
|
|
||||||
|
|
||||||
//https://vserverws.cvr.cvrco.ca/api/cart/CartStatus
|
|
||||||
|
|
||||||
[Route("api/Cart/[action]")]
|
|
||||||
[ApiController]
|
|
||||||
public class CartController : ControllerBase {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult CartStatus() {
|
|
||||||
|
|
||||||
var rOBJ = new { STATUS = "OK" };
|
|
||||||
|
|
||||||
return new JsonResult(rOBJ);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public async Task<IActionResult> SubmitCartData([FromBody] byte[] data) {
|
|
||||||
|
|
||||||
var JSON = await NonSecureDecryptByteAToStringAsync(data);
|
|
||||||
|
|
||||||
var rOBJ = new TryCartOperationResult();
|
|
||||||
|
|
||||||
try {
|
|
||||||
var tCART = JsonConvert.DeserializeObject<ShoppingCart>(JSON);
|
|
||||||
|
|
||||||
if (tCART != null) {
|
|
||||||
|
|
||||||
tCART.TrySyncToInventory(CVGlobal.INVENTORY);
|
|
||||||
|
|
||||||
await tCART.SaveToDBAsync();
|
|
||||||
|
|
||||||
rOBJ.AddResult(true, "CART_SAVE_TO_DB");
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
rOBJ.AddResult(false, "CONVERT_TO_JSON", "Failed to convert to json from byte data.");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
|
|
||||||
rOBJ.AddResult(false, "CART_SAVE_TRY", ex.Message, ex);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//return new result
|
|
||||||
return new JsonResult(rOBJ);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -35,9 +35,9 @@ namespace VSERVERWS.Controllers {
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult PaymentStatus() {
|
public IActionResult PaymentStatus() {
|
||||||
//api/Payment/PaymentStatus
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CVRPRINTER_MF264dw? CVP2 = CVP_MF264dw;
|
CVRPRINTER_MF264dw? CVP2 = CVP_MF264dw;
|
||||||
CVRPRINTER_MFC_L8900CDW? CVP3 = CVP_MFC_L8900CDW;
|
CVRPRINTER_MFC_L8900CDW? CVP3 = CVP_MFC_L8900CDW;
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ namespace VSERVERWS.Controllers {
|
|||||||
|
|
||||||
if (DateTime.Now.Subtract(LastError).Hours > 2) {
|
if (DateTime.Now.Subtract(LastError).Hours > 2) {
|
||||||
Email E = new Email();
|
Email E = new Email();
|
||||||
E.SEND_FROM = SEND_FROM_ENUM.OFFICE365;
|
E.SEND_FROM = Email.SEND_FROM_ENUM.OFFICE365;
|
||||||
|
|
||||||
string B = "Payment System Printer error / offline: Check applicable printer(s) for error or offline!";
|
string B = "Payment System Printer error / offline: Check applicable printer(s) for error or offline!";
|
||||||
string S = "<cc> Payment System Printer Error: Check Printer(s)!";
|
string S = "<cc> Payment System Printer Error: Check Printer(s)!";
|
||||||
@ -148,7 +148,7 @@ namespace VSERVERWS.Controllers {
|
|||||||
object? rOBJ = null;
|
object? rOBJ = null;
|
||||||
|
|
||||||
Email E = new Email();
|
Email E = new Email();
|
||||||
E.SEND_FROM = SEND_FROM_ENUM.OFFICE365;
|
E.SEND_FROM = Email.SEND_FROM_ENUM.OFFICE365;
|
||||||
|
|
||||||
bool DupRetry = false;
|
bool DupRetry = false;
|
||||||
|
|
||||||
|
|||||||
47
Program.cs
47
Program.cs
@ -1,32 +1,18 @@
|
|||||||
|
|
||||||
using CVRLIB.CVENVIRONMENT;
|
|
||||||
using static CVRLIB.CVGlobal;
|
|
||||||
|
|
||||||
using CA_ANC.Formatters;
|
|
||||||
using CVRLIB;
|
|
||||||
using CVRLIB.Inventory;
|
|
||||||
using CVRLIB.Customers;
|
|
||||||
|
|
||||||
//ZXING.dll does not copy properly to publish folder, copy manually from another lib, ie cvrlib-nf.
|
//ZXING.dll does not copy properly to publish folder, copy manually from another lib, ie cvrlib-nf.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddRazorPages();
|
builder.Services.AddRazorPages();
|
||||||
|
|
||||||
//builder.Services.AddControllers().AddJsonOptions((options => {
|
builder.Services.AddControllers().AddJsonOptions((options => {
|
||||||
// //was changing PRINTER_NAME to printeR_NAME (pascal Case: https://github.com/dotnet/runtime/issues/30887)
|
//was changing PRINTER_NAME to printeR_NAME (pascal Case: https://github.com/dotnet/runtime/issues/30887)
|
||||||
// options.JsonSerializerOptions.PropertyNamingPolicy = null;
|
options.JsonSerializerOptions.PropertyNamingPolicy = null;
|
||||||
//}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
builder.Services
|
|
||||||
.AddControllers(options => { options.InputFormatters.Add(new ByteArrayInputFormatter()); })
|
|
||||||
.AddNewtonsoftJson()
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
@ -41,14 +27,6 @@ if (!app.Environment.IsDevelopment()) {
|
|||||||
VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
|
VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
|
||||||
|
|
||||||
|
|
||||||
VSERVERWS.Global.Globals.LoadPrinters();
|
|
||||||
|
|
||||||
|
|
||||||
CVGlobal.TryGlobalPRELoadCVCollections(new[] { typeof(CVINVENTORY), typeof(CVCustomers) });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
@ -64,19 +42,4 @@ app.MapRazorPages();
|
|||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
|
|
||||||
|
VSERVERWS.Global.Globals.LoadPrinters();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public partial class Program {
|
|
||||||
|
|
||||||
public static CVSECRETS? CVS { get; set; } = null;
|
|
||||||
public static string AppPath { get; set; } = "";
|
|
||||||
public static string HTTPROOT { get; set; } = "";
|
|
||||||
public static bool IsDevMode { get; set; } = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
@ -9,43 +9,19 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="11.3.0" />
|
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="11.3.0" />
|
||||||
<PackageReference Include="Magick.NET.Core" Version="11.3.0" />
|
<PackageReference Include="Magick.NET.Core" Version="11.3.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.16" />
|
|
||||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
||||||
<PackageReference Include="System.Text.Json" Version="7.0.2" />
|
|
||||||
<PackageReference Include="ZXing.Net" Version="0.16.8" />
|
<PackageReference Include="ZXing.Net" Version="0.16.8" />
|
||||||
<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
|
<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
<Choose>
|
<Reference Include="CVRLIB">
|
||||||
<When Condition=" '$(Configuration)'=='Debug' ">
|
<HintPath>..\..\VB.NET\CVRLIB\CVRLIB\bin\Release\netstandard2.0\CVRLIB.dll</HintPath>
|
||||||
<ItemGroup>
|
</Reference>
|
||||||
<Reference Include="CVRLIB">
|
<Reference Include="CVRLIB-NF">
|
||||||
<HintPath>..\..\VB.NET\CVRLIB\CVRLIB\bin\Debug\netstandard2.0\CVRLIB.dll</HintPath>
|
<HintPath>..\..\VB.NET\CVRLIB-NF\CVRLIB-NF\bin\Release\CVRLIB-NF.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="CVRLIB-NF">
|
</ItemGroup>
|
||||||
<HintPath>..\..\VB.NET\CVRLIB-NF\CVRLIB-NF\bin\Debug\CVRLIB-NF.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="HtmlFactory">
|
|
||||||
<HintPath>..\HtmlFactory\HtmlFactory\bin\Debug\netstandard2.0\HtmlFactory.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
</When>
|
|
||||||
<When Condition=" '$(Configuration)'=='Release' ">
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="CVRLIB">
|
|
||||||
<HintPath>..\..\VB.NET\CVRLIB\CVRLIB\bin\Release\netstandard2.0\CVRLIB.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="CVRLIB-NF">
|
|
||||||
<HintPath>..\..\VB.NET\CVRLIB-NF\CVRLIB-NF\bin\Release\CVRLIB-NF.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="HtmlFactory">
|
|
||||||
<HintPath>..\HtmlFactory\HtmlFactory\bin\Release\netstandard2.0\HtmlFactory.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
</When>
|
|
||||||
</Choose>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user