Skip to content

Commit

Permalink
Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
TheR00st3r committed Jun 30, 2023
1 parent c2e60af commit 7384df5
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 47 deletions.
10 changes: 5 additions & 5 deletions NetEvent/Client/Pages/Administration/Events/TicketType.razor.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using MudBlazor;
using NetEvent.Shared.Dto.Event;
using NetEvent.Client.Extensions;
using NetEvent.Client.Services;
using System.Globalization;
using System.Threading;
using NetEvent.Shared.Dto.Event;
using NetEvent.Shared.Validators;
using Microsoft.Extensions.Localization;
using NetEvent.Client.Extensions;

namespace NetEvent.Client.Pages.Administration.Events
{
Expand Down
65 changes: 32 additions & 33 deletions NetEvent/Client/Pages/Checkout/CheckoutTicket.razor.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Microsoft.JSInterop;
using MudBlazor;
using NetEvent.Client.Services;
using System.Threading;
using NetEvent.Shared.Dto.Event;
using Microsoft.Extensions.Localization;
using NetEvent.Shared.Dto;
using NetEvent.Shared.Config;
using System.Text.Json.Serialization;
using System.Text.Json;
using NetEvent.Shared.Dto;
using NetEvent.Shared.Dto.Event;

namespace NetEvent.Client.Pages.Checkout
{
Expand Down Expand Up @@ -108,38 +108,37 @@ public Task<object> MakeDetailsCall(object data)
return Task.FromResult<object>(null);
}

private static class PurchaseResultCode
{
public const int AuthenticationFinished = 0;
public const int AuthenticationNotRequired = 1;
public const int Authorised = 2;
public const int Received = 9;

public const int Cancelled = 3;

public const int Error = 5;
public const int ChallengeShopper = 4;
public const int IdentifyShopper = 6;
public const int Pending = 7;
public const int PresentToShopper = 8;
public const int RedirectShopper = 10;

public const int Refused = 11;
}

[JSInvokable]
public void ShowResult(int resultCode, string? refusedCode)
{
// https://docs.adyen.com/online-payments/payment-result-codes
switch (resultCode)
_ResultSeverity = resultCode switch
{
case 0 /* AuthenticationFinished */:
case 1 /* AuthenticationNotRequired */:
case 2 /* Authorised */:
case 9 /* Received */:
_ResultSeverity = Severity.Success;
break;
case 5 /* Error */:
_ResultSeverity = Severity.Error;
break;
case 3 /* Cancelled */:
case 4 /* ChallengeShopper */:
case 6 /* IdentifyShopper */:
case 7 /* Pending */:
case 8 /* PresentToShopper */:
case 10 /* RedirectShopper */:
_ResultSeverity = Severity.Info;
break;
case 11 /* Refused */:
_ResultSeverity = Severity.Warning;

break;
default:
_ResultSeverity = Severity.Normal;
break;
}

PurchaseResultCode.AuthenticationFinished or PurchaseResultCode.AuthenticationNotRequired or PurchaseResultCode.Authorised or PurchaseResultCode.Received => Severity.Success,
PurchaseResultCode.Error => Severity.Error,
PurchaseResultCode.Cancelled or PurchaseResultCode.ChallengeShopper or PurchaseResultCode.IdentifyShopper or PurchaseResultCode.Pending or PurchaseResultCode.PresentToShopper or PurchaseResultCode.RedirectShopper => Severity.Info,
PurchaseResultCode.Refused => Severity.Warning,
_ => Severity.Normal,
};
_Result = Localizer[$"CheckoutTicket.Result.{resultCode}"];
if (refusedCode != null)
{
Expand Down
2 changes: 0 additions & 2 deletions NetEvent/Client/Services/NavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public void NavigateBack()
_NavigationManager.NavigateTo(backPageUrl);
}

// .. All other navigation methods.

private void OnLocationChanged(object sender, LocationChangedEventArgs e)
{
EnsureSize();
Expand Down
10 changes: 5 additions & 5 deletions NetEvent/Client/Services/PaymentService.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.Net.Http;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading;
using System;
using System.Threading.Tasks;
using Blazored.LocalStorage;
using NetEvent.Shared.Dto;
using System.Net.Http.Json;
using Microsoft.Extensions.Logging;
using NetEvent.Shared.Dto;
using NetEvent.Shared.Dto.Event;
using System.Collections.Generic;

namespace NetEvent.Client.Services
{
Expand Down
6 changes: 4 additions & 2 deletions NetEvent/Shared/Config/BooleanValueType.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
namespace NetEvent.Shared.Config
using System.Globalization;

namespace NetEvent.Shared.Config
{
public class BooleanValueType : ValueType<bool>
{
public BooleanValueType(bool defaultValue) : base(defaultValue)
{
}

public override string DefaultValueSerialized => DefaultValue.ToString();
public override string DefaultValueSerialized => DefaultValue.ToString(CultureInfo.InvariantCulture);

public override bool IsValid(bool value) => true;

Expand Down

0 comments on commit 7384df5

Please sign in to comment.