Skip to content

Commit b0f903a

Browse files
authored
Merge pull request #15 from dynamicweb/sha/25224-quickpay-callback-fix
QuickPay callback fix
2 parents 1a84409 + 699d3be commit b0f903a

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @frederik5480
1+
* @dynamicweb/commerce-codeowners

src/Dynamicweb.Ecommerce.CheckoutHandlers.QuickPayPaymentWindow.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<VersionPrefix>10.1.1</VersionPrefix>
3+
<VersionPrefix>10.1.2</VersionPrefix>
44
<AssemblyVersion>1.0.0.0</AssemblyVersion>
55
<Title>QuickPay Payment Window</Title>
66
<Description>The QuickPay Payment Window checkout handler is designed to work with QuickPay v10.</Description>

src/QuickPayPaymentWindow.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public override OutputResult BeginCheckout(Order order, CheckoutParameters param
321321
catch (Exception ex)
322322
{
323323
LogError(order, ex, "Unhandled exception with message: {0}", ex.Message);
324-
return PrintErrorTemplate(order, ex.Message);
324+
return new ContentOutputResult() { Content = "An error occurred in the callback. Check event log for error details" };
325325
}
326326

327327
QuickpayTemplateHelper GetTemplateHelper() => new()
@@ -378,7 +378,7 @@ public override OutputResult HandleRequest(Order order)
378378
catch (Exception ex)
379379
{
380380
LogError(order, ex, "Unhandled exception with message: {0}", ex.Message);
381-
return PrintErrorTemplate(order, ex.Message);
381+
return new ContentOutputResult() { Content = "An error occurred in the callback. Check event log for error details" };
382382
}
383383
}
384384

@@ -566,15 +566,21 @@ private void Callback(Order order)
566566
{
567567
lock (lockObject)
568568
{
569+
if (Context.Current.Request.InputStream.Length == 0)
570+
{
571+
LogEvent(order, "Invalid callback - no InputStream or not a POST");
572+
return;
573+
}
574+
569575
LogEvent(order, "Callback started");
570-
string callbackResponce;
576+
string callbackResponse;
571577

572578
using (StreamReader reader = new StreamReader(Context.Current.Request.InputStream, Encoding.UTF8))
573579
{
574-
callbackResponce = reader.ReadToEndAsync().GetAwaiter().GetResult();
580+
callbackResponse = reader.ReadToEndAsync().GetAwaiter().GetResult();
575581
}
576582

577-
CheckedData checkedData = CheckData(order, callbackResponce ?? string.Empty, order.Price.PricePIP);
583+
CheckedData checkedData = CheckData(order, callbackResponse ?? string.Empty, order.Price.PricePIP);
578584
string resultInfo = checkedData.Result switch
579585
{
580586
//ViaBill autocapture starts callback.

0 commit comments

Comments
 (0)