dxetech / PaymentechCore

C# Client for Chase Paymentech
4 stars 2 forks source link

Does this work with Dotnetcore v5? #1

Open br8kpoint opened 2 years ago

br8kpoint commented 2 years ago

Hi,

I came across your libaray and would like to use it in my dotnet core project but when I tried to use it I got a Binary Serialization error.

Is this compatible with dotnet core v5?

System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information.
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
   at PaymentechCore.Models.RequestModels.ClientRequest.DeepCopy()
   at PaymentechCore.Services.PaymentechClient.ScrubClientRequest(ClientRequest clientRequest)
   at PaymentechCore.Services.PaymentechClient.SendRequestAsync(String url, ClientRequest clientRequest)
   at PaymentechCore.Services.PaymentechClient.ProfileAsync(ProfileType profile, String traceNumber)
   at PaymentechCore.Services.PaymentechClient.Profile(ProfileType profile, String traceNumber)
   at server.Controllers.ChaseMethodsApiController.Get(GetCustomerRequest req) in /Users/mikefair/Work/mvcMessianicBible/Controllers/Chase.cs:line 66
   at lambda_method114(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
dxetech commented 2 years ago

I'll have to review. It targets net standard 2.1, so it should support 5.0 Please see the Microsoft docs on standard 2.1

The immediate thing to look into is the self reflection serialization, which is the basis for generating the XML needed to send to Chase.

dxetech commented 2 years ago

Since you are getting a System.NotSupportedException error, can I ask what your development environment is?

br8kpoint commented 2 years ago

My dev environment is dotnet core on mac. I have looked into this and it looks like the Binary Format used to copy the object for sanitization is not recommended moving forward in .net 5 so it is disabled. You can read about in here https://aka.ms/binaryformatter.

I have forked your library and am using it bypassing the sanitization parts and it is working but I would like to have those parts working as it does make sense to have sanitized version of the results as well.