Payment problem

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 года назад
Hi, i tried to create a custom payment method (MonriPayment) and i make it work on my localhost, but when i installed it on my web server (Windows/IIS) and try to make a payment i got this error
https://prnt.sc/uz5tni

or raw
System.NullReferenceException: Object reference not set to an instance of an object.
   at WebMarkupMin.AspNetCore3.BodyWrapperStreamBase.InternalFinishAsync()
   at WebMarkupMin.AspNetCore3.BodyWrapperStreamWithResponseBodyFeature.FinishAsync()
   at WebMarkupMin.AspNetCore3.WebMarkupMinMiddleware.ProcessAsync(HttpContext context, Boolean useMinification, Boolean useCompression)
   at WebMarkupMin.AspNetCore3.WebMarkupMinMiddleware.ProcessAsync(HttpContext context, Boolean useMinification, Boolean useCompression)
   at WebMarkupMin.AspNetCore3.WebMarkupMinMiddlewareBase.Invoke(HttpContext context)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 125
   at Nop.Services.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) in C:\Users\Ademir\Desktop\nopcommerce\Libraries\Nop.Services\Authentication\AuthenticationMiddleware.cs:line 79
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Nop.Services.Installation.InstallUrlMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in C:\Users\Ademir\Desktop\nopcommerce\Libraries\Nop.Services\Installation\InstallUrlMiddleware.cs:line 52
   at Nop.Services.Common.KeepAliveMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in C:\Users\Ademir\Desktop\nopcommerce\Libraries\Nop.Services\Common\KeepAliveMiddleware.cs:line 49
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


my PostProcessPayment

public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest)
        {
            var baseUrl = _MonriStandardPaymentSettings.Test ?
                "https://ipgtest.monri.com/form/" :
                "https://ipg.pikpay.ba/form/";
_logger.Warning("SALJI");
            var salji = _httpContextAccessor.HttpContext.Response;
            salji.Clear();
            salji.ContentType = "text/html";
            var queryParameters = CreateQueryParameters(postProcessPaymentRequest);
            var parametri = new Dictionary<string, string>(queryParameters);
            _logger.Information("P-Parametar");
            var s = new StringBuilder();
            s.Append("<html>");
            _logger.Information("HTML");
            s.Append("<body onload='document.forms[\"form\"].submit()'>");
            s.AppendFormat("<form name='form' action='{0}' method='post'>", baseUrl);
            foreach(string kljuc in parametri.Keys)
            {
                string s1;
                parametri.TryGetValue(kljuc, out s1);
                s.AppendFormat("<input type='hidden' name='{0}' value='{1}' />", kljuc, s1);
            }
            s.Append("</form></body></html>");
            var ispis = Encoding.UTF8.GetBytes(s.ToString());
            _logger.Information(s.ToString());
            salji.Body.WriteAsync(ispis, 0, ispis.Length);
            _logger.Information("Proso");
              salji.Body.Close();
        }



Yeah, i added this logger's to see debug, but any of theese _logger's ar not showed.
So on localhost (4.30 version) everything is working fine

On my webserver(Windows/IIS) i Installed NoSource 4.30 Version.
On localhost(Windows/IISEXpress) is Source 4.30
3 года назад
What Minification settings are enabled?  Are they different  in prod vs local?
3 года назад
everything is same exepct this


On Local these two things are checked.
3 года назад
Sorry for DP

Minifications settings are same.
3 года назад
Sorry for DP Again,
C:\Users\Ademir\Desktop\nopcommerce\Libraries\Nop.Services\Installation\InstallUrlMiddleware.cs:line 52

As i can see theese lines, he tried to use something from my PC(localhost). Should that make a problem ?
3 года назад
I Compiled plugin with "Release" configuration and everything is working now...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.