From 36cf0c02ca4a9dea7447cf4f1c58121d810144d9 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 5 Sep 2024 13:08:21 +0200 Subject: [PATCH] exchange stuffs --- TIAMSharedUI/Pages/EditTransfers.razor | 9 +- TIAMSharedUI/Pages/User/Home.razor | 780 +----------------- .../Pages/User/SysAdmins/SysAdmin.razor | 171 +--- .../User/SysAdmins/SysAdminComponent.razor | 297 +------ .../User/SysAdmins/SysAdminComponent.razor.cs | 62 -- .../Controllers/PaymentAPIController.cs | 10 +- TIAMWebApp/Server/wwwroot/ExchangeRate.xml | 2 +- .../Shared/Models/ClientSide/Setting.cs | 4 +- TIAMWebApp/Shared/Services/SumupService.cs | 3 +- 9 files changed, 79 insertions(+), 1259 deletions(-) delete mode 100644 TIAMSharedUI/Pages/User/SysAdmins/SysAdminComponent.razor.cs diff --git a/TIAMSharedUI/Pages/EditTransfers.razor b/TIAMSharedUI/Pages/EditTransfers.razor index f5694a2f..01c5426d 100644 --- a/TIAMSharedUI/Pages/EditTransfers.razor +++ b/TIAMSharedUI/Pages/EditTransfers.razor @@ -12,6 +12,7 @@ @using TIAMWebApp.Shared.Application.Interfaces @using AyCode.Services.Loggers @using TIAM.Core.Enums +@using TIAMWebApp.Shared.Application.Models @using TIAMWebApp.Shared.Application.Models.ClientSide.UI @using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels @using TIAMWebApp.Shared.Application.Services @@ -28,6 +29,7 @@ @inject IStringLocalizer localizer @inject IWizardProcessor wizardProcessor @inject AdminSignalRClient _adminSignalRClient +@inject ExchangeRateService ExchangeRateService @localizer.GetString("MyTransfers.Subtitle")
@@ -158,7 +160,8 @@ else
-

EUR @_transfer.Price

+

EUR @_transfer.Price

+
HUF @(_transfer.Price * Convert.ToDouble(exchangeRate.EURtoHUF))
@@ -315,6 +318,8 @@ else private bool _popupVisible; + private ExchangeRate exchangeRate; + public List IgnoreList = [ "ReceiverEmailAddress", @@ -429,6 +434,8 @@ else _logger = new LoggerClient(_logWriters.ToArray()); _logger.Info($"parameter: {transferId.ToString()}"); + exchangeRate = await ExchangeRateService.GetExchangeRateAsync(); + await LoadTransfer(); sysAdmins = await _adminSignalRClient.GetByIdAsync>(SignalRTags.GetAllUserModelDtoDetails, TiamConstClient.SysAdmins[0]); var test = _transfer.UserId; diff --git a/TIAMSharedUI/Pages/User/Home.razor b/TIAMSharedUI/Pages/User/Home.razor index aa1a1c62..61b1bbf5 100644 --- a/TIAMSharedUI/Pages/User/Home.razor +++ b/TIAMSharedUI/Pages/User/Home.razor @@ -3,590 +3,42 @@ @using TIAMWebApp.Shared.Application.Models; @using TIAMWebApp.Shared.Application.Interfaces; @using TIAMSharedUI.Shared.Components.BaseComponents +@using TIAMWebApp.Shared.Application.Services @inherits BasePageComponent -@layout AdminLayout +@* @layout AdminLayout *@ @inject IPopulationStructureDataProvider DataProvider @inject ISupplierService SupplierService @inject IUserDataService UserDataService -Transfer +@inject ExchangeRateService ExchangeRateService +Sysadmin
-

Dashboard

+

Welcome

Have a nice day!

- @{ - if(userType == 4) - { - -
-
-
-
-
-
- Transfers -

Summary

-
- -
-
-
- -
New
-

12

-
Scheduled
-

182

-
Finished
-

15665

- -
- - - - -
-
-
-
-
-
-
- Service providers -

Summary

-
- -
-
-
- -
Guides
-

32

-
Hotels
-

82

-
Restaurants
-

15

-
Transfer company
-

1

- -
- -
-
-
-
-
-
-
- Finances -

Summary

-
- -
-
-
- -
Income
-

$32 456

-
Comission to be paid
-

$5 345

-
Service fees to be paid
-

$23 871

-
Revenue
-

$3 240

- -
- -
-
-
-
-
-
-
- Affiliates -

Summary

-
- -
-
-
- -
Top affiliate
-

Hotel Bambara

-
Comission Earned
-

$1 315

-
-
Top referred item
-

Buda castle tour

-
-
Level 1 affiliates
-

132

- -
- -
-
-
-
-
-
-
- Hotel details - -
- -
-
-
-
- - - - - - - - - - - - - -
-
- -
-
-
-
-
-
-
- Population Data -

12,March 2020

-
- -
-
-
-
- - - - - - - - - -
-
@context.Point.Argument
-
Age Group: @context.Point.SeriesName
-
Population: @($"{context.Point.Value:N0}")
-
-
-
- - - -
- -
- -
- - - - - -
-
-
-
-
-
- Affiliates -

Details

-
- -
-
-
- - - - - - - - - - - - - - - -
- -
-
-
- - - - - } - - else if(userType == 1) - { -
- -
-
-
-
-
- Hotel details - -
- -
-
-
-
-
-
Your QR code
-

Use this in printed material, to gain referrals

-
-
- -
- -
- -
-

Some conclusion

-
-
- -
-
-
-
-
-
-
- My orders - -
- -
-
-
-
- - - - - - @context.Value - - - - - - - - - - - -
- -
-

Some conclusion

-
-
- -
-
-
-
-
-
-
- Hotel details - -
- -
-
-
-
-
-
- -
-
- -
-
-
-
-
- Panel title -

Subtitle

-
- -
-
-
-
-
-
Some info
-

Budapest, Dózsa György út 35, 1146

-
-
- -
- -
-
    -
  • - PLACED -
  • -
  • WAITING FOR PICK UP
  • -
  • - FINISHED -
  • -
- -
-

Some conclusion

-
-
- -
-
-
-
-
-
-
- Affiliates -

Details

-
- -
-
-
- - - - - - - - - - - - - - - -
- -
-
- -
- - - } - } - - - - - -
-
+ +

Exchange Rate

+ + @if (exchangeRate == null) + { +

Loading...

+ } + else + { +

Current EUR to HUF exchange rate: @exchangeRate.EURtoHUF

+ + + } + + @*
Panel title @@ -631,112 +83,9 @@
-
+
*@
-
-
-
-
-
- Panel title -

Subtitle

-
- -
-
-
-
-
-
Some info
-

Budapest, Dózsa György út 35, 1146

-
-
- -
- -
-
    -
  • - PLACED -
  • -
  • WAITING FOR PICK UP
  • -
  • - FINISHED -
  • -
- -
-

Some conclusion

-
-
- -
-
-
-
-
-
-
- Panel title -

Subtitle

-
- -
-
-
-
-
-
Some info
-

Budapest, Dózsa György út 35, 1146

-
-
- -
- -
-
    -
  • - PLACED -
  • -
  • WAITING FOR PICK UP
  • -
  • - FINISHED -
  • -
- -
-

Some conclusion

-
-
- -
-
-
- -
@@ -745,89 +94,18 @@ @code { - object? OrderData { get; set; } - object? AffiliateData { get; set; } - - IEnumerable? ChartsData; - - object? Data { get; set; } - - bool isUserLoggedIn; - int userType = 0; - - + private ExchangeRate exchangeRate; protected override async Task OnInitializedAsync() { - base.OnInitialized(); - - OrderData = new object[] - { - new { - Date = DateTime.Now.AddDays(3), - Income = "$5", - TransactionId = "POX987532582", - Status = "Finished" - }, - new { - Date = DateTime.Today.AddDays(-2), - Income = "$5", - TransactionId = "POX645646382", - Status = "Finished" - }, - new { - Date = DateTime.Today.AddDays(-6), - Income = "$8", - TransactionId = "POX645766311", - Status = "Finished" - }, - }; - - AffiliateData = new object[] - { - new { - AffiliateId = 1, - IncomeThisMonth = "$5", - IncomeAlltime = "9425", - CompanyName = "Upgen Ltd.", - Status = "Active" - }, - new { - AffiliateId = 2, - IncomeThisMonth = "$538", - IncomeAlltime = "13425", - CompanyName = "Kovacs hotel Ltd.", - Status = "Active" - }, - new { - AffiliateId = 3, - IncomeThisMonth = "$0", - IncomeAlltime = "134200", - CompanyName = "Innosaurus Ltd.", - Status = "Passive" - }, - }; - - - ChartsData = await DataProvider.QueryData(); - - var suppliers = await SupplierService.GetSuppliersAsync(); - Data = suppliers.Select(s => - { - return new - { - CompanyName = s.CompanyName, - ContactName = s.ContactName, - ContactTitle = s.ContactTitle, - Country = s.Country, - City = s.City, - Address = s.Address, - Phone = s.Phone - }; - }); + exchangeRate = await ExchangeRateService.GetExchangeRateAsync(); } - [Parameter] public bool ShowSeriesPointMarkers { get; set; } - [Parameter] public bool ShowSeriesLabels { get; set; } + + private async Task SaveExchangeRate() + { + await ExchangeRateService.SetExchangeRateAsync(exchangeRate); + } + } diff --git a/TIAMSharedUI/Pages/User/SysAdmins/SysAdmin.razor b/TIAMSharedUI/Pages/User/SysAdmins/SysAdmin.razor index aeeac7e9..2312eb54 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/SysAdmin.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/SysAdmin.razor @@ -16,186 +16,21 @@ -
- - - - - - - - - - -
- - - +
-
-
-
-
-
-
- Panel title -

Subtitle

-
- -
-
-
-
-
-
Some info
-

Budapest, Dózsa György út 35, 1146

-
-
- -
- -
-
    -
  • - PLACED -
  • -
  • WAITING FOR PICK UP
  • -
  • - FINISHED -
  • -
- -
-

Some conclusion

-
-
- -
-
-
-
-
-
-
- Panel title -

Subtitle

-
- -
-
-
-
-
-
Some info
-

Budapest, Dózsa György út 35, 1146

-
-
- -
-
-
    -
  • - PLACED -
  • -
  • WAITING FOR PICK UP
  • -
  • - FINISHED -
  • -
- -
-

Some conclusion

-
-
- -
-
-
-
-
-
-
- Panel title -

Subtitle

-
- -
-
-
-
-
-
Some info
-

Budapest, Dózsa György út 35, 1146

-
-
- -
- -
-
    -
  • - PLACED -
  • -
  • WAITING FOR PICK UP
  • -
  • - FINISHED -
  • -
- -
-

Some conclusion

-
-
- -
-
-
-
- -
@code { - bool isUserLoggedIn; + bool isUserLoggedIn; protected override async Task OnInitializedAsync() { diff --git a/TIAMSharedUI/Pages/User/SysAdmins/SysAdminComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/SysAdminComponent.razor index eba3ab84..25d3646f 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/SysAdminComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/SysAdminComponent.razor @@ -3,290 +3,47 @@ @using TIAMSharedUI.Shared @using TIAMWebApp.Shared.Application.Models; @using TIAMWebApp.Shared.Application.Interfaces; - +@using TIAMWebApp.Shared.Application.Services +@inject ExchangeRateService ExchangeRateService
- - +
-
-
-
- Transfers -

Summary

-
- -
-
-
-
New
-

12

-
Scheduled
-

182

-
Finished
-

15665

+

Exchange Rate

-
+ @if (exchangeRate == null) + { +

Loading...

+ } + else + { +

Current EUR to HUF exchange rate: @exchangeRate.EURtoHUF

+ + + } - - -
-
-
- -
-
-
-
- Service providers -

Summary

-
- -
-
-
- -
Guides
-

32

-
Hotels
-

82

-
Restaurants
-

15

-
Transfer company
-

1

- -
- -
-
-
-
- -
-
-
-
- Finances -

Summary

-
- -
-
-
- -
Income
-

$32 456

-
Comission to be paid
-

$5 345

-
Service fees to be paid
-

$23 871

-
Revenue
-

$3 240

- -
- -
-
-
-
- -
-
-
-
- Affiliates -

Summary

-
- -
-
-
- -
Top affiliate
-

Hotel Bambara

-
Comission Earned
-

$1 315

-
-
Top referred item
-

Buda castle tour

-
-
Level 1 affiliates
-

132

- -
- -
-
-
-
- -
-
-
-
- Hotel details - -
- -
-
-
-
- - - - - - - - - - - - - -
-
- -
-
-
-
- -
-
-
-
- Population Data -

12,March 2020

-
- -
-
-
-
- - - - - - - - - -
-
@context.Point.Argument
-
Age Group: @context.Point.SeriesName
-
Population: @($"{context.Point.Value:N0}")
-
-
-
- - - -
- -
- -
-
- -
@code { + + private ExchangeRate exchangeRate; + + protected override async Task OnInitializedAsync() + { + exchangeRate = await ExchangeRateService.GetExchangeRateAsync(); + } + + private async Task SaveExchangeRate() + { + await ExchangeRateService.SetExchangeRateAsync(exchangeRate); + } + } diff --git a/TIAMSharedUI/Pages/User/SysAdmins/SysAdminComponent.razor.cs b/TIAMSharedUI/Pages/User/SysAdmins/SysAdminComponent.razor.cs deleted file mode 100644 index d799f858..00000000 --- a/TIAMSharedUI/Pages/User/SysAdmins/SysAdminComponent.razor.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Microsoft.AspNetCore.Components; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TIAMWebApp.Shared.Application.Interfaces; -using TIAMWebApp.Shared.Application.Models; - -namespace TIAMSharedUI.Pages.User.SysAdmins -{ - public partial class SysAdminComponent : ComponentBase - { - [Inject] - IPopulationStructureDataProvider DataProvider { get; set; } - - object? AffiliateData { get; set; } - - IEnumerable? ChartsData; - - - protected override async Task OnInitializedAsync() - { - base.OnInitialized(); - - - - AffiliateData = new object[] - { - new { - AffiliateId = 1, - IncomeThisMonth = "$5", - IncomeAlltime = "9425", - CompanyName = "Upgen Ltd.", - Status = "Active" - }, - new { - AffiliateId = 2, - IncomeThisMonth = "$538", - IncomeAlltime = "13425", - CompanyName = "Kovacs hotel Ltd.", - Status = "Active" - }, - new { - AffiliateId = 3, - IncomeThisMonth = "$0", - IncomeAlltime = "134200", - CompanyName = "Innosaurus Ltd.", - Status = "Passive" - }, - }; - - - ChartsData = await DataProvider.QueryData(); - - - } - [Parameter] public bool ShowSeriesPointMarkers { get; set; } - [Parameter] public bool ShowSeriesLabels { get; set; } - - } -} diff --git a/TIAMWebApp/Server/Controllers/PaymentAPIController.cs b/TIAMWebApp/Server/Controllers/PaymentAPIController.cs index 075f7a58..c2795b63 100644 --- a/TIAMWebApp/Server/Controllers/PaymentAPIController.cs +++ b/TIAMWebApp/Server/Controllers/PaymentAPIController.cs @@ -25,14 +25,16 @@ namespace TIAMWebApp.Server.Controllers private SumupService _sumupService; private readonly TIAM.Core.Loggers.ILogger _logger; private readonly IMessageSenderService _messageSenderService; + private readonly ExchangeRateService _exchangeRateService; - public PaymentAPIController(AdminDal adminDal, SumupService sumupService, IMessageSenderService messageSenderService, IEnumerable logWriters) + public PaymentAPIController(AdminDal adminDal, SumupService sumupService, IMessageSenderService messageSenderService, IEnumerable logWriters, ExchangeRateService exchangeRateService) { _adminDal = adminDal; _sumupService = sumupService; _messageSenderService = messageSenderService; + _exchangeRateService = exchangeRateService; _logger = new TIAM.Core.Loggers.Logger(logWriters.ToArray()); } @@ -53,12 +55,14 @@ namespace TIAMWebApp.Server.Controllers { transferToPay.Price = 1000; } - + var exchangeRate = await _exchangeRateService.GetExchangeRateAsync(); + var price = transferToPay.Price * Convert.ToDouble(exchangeRate.EURtoHUF); + var paymentRequest = new SumupPaymentRequest { CheckoutReference = transferToPay.OrderId.ToString(), - Amount = transferToPay.Price.ToString(), + Amount = price.ToString(), Currency = "HUF", PayToEmail = "6befaf69f97f4320bff2b9adf1a3894d@developer.sumup.com", Description = "Test transfer payment" diff --git a/TIAMWebApp/Server/wwwroot/ExchangeRate.xml b/TIAMWebApp/Server/wwwroot/ExchangeRate.xml index 382d61cb..7f89c697 100644 --- a/TIAMWebApp/Server/wwwroot/ExchangeRate.xml +++ b/TIAMWebApp/Server/wwwroot/ExchangeRate.xml @@ -1,4 +1,4 @@ - 390 + 375 \ No newline at end of file diff --git a/TIAMWebApp/Shared/Models/ClientSide/Setting.cs b/TIAMWebApp/Shared/Models/ClientSide/Setting.cs index 83fdc1ff..b1593ced 100644 --- a/TIAMWebApp/Shared/Models/ClientSide/Setting.cs +++ b/TIAMWebApp/Shared/Models/ClientSide/Setting.cs @@ -8,8 +8,8 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide //public static string BaseUrl = "https://touriam.mangoweb.hu"; //public static string ApiBaseUrl = "https://touriam.mangoweb.hu"; #if RELEASE - public static string BaseUrl = "https://test.touriam.com"; - public static string ApiBaseUrl = "https://test.touriam.com"; + //public static string BaseUrl = "https://test.touriam.com"; + //public static string ApiBaseUrl = "https://test.touriam.com"; //public static string BaseUrl = "https://touriam.com"; //public static string ApiBaseUrl = "https://touriam.com"; //public static string BaseUrl = "https://qa.touriam.com"; diff --git a/TIAMWebApp/Shared/Services/SumupService.cs b/TIAMWebApp/Shared/Services/SumupService.cs index 51507053..ad8ba553 100644 --- a/TIAMWebApp/Shared/Services/SumupService.cs +++ b/TIAMWebApp/Shared/Services/SumupService.cs @@ -25,7 +25,8 @@ namespace TIAMWebApp.Shared.Application.Services public async Task CreatePaymentAsync(Transfer transferToPay) { var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreatePayment}"; - //var url = $"{APIUrls.GetTransferDestinations}"; + //var url = $"{APIUrls.GetTransferDestinations}"; + _logger.Info(url); var response = await _http.PostAsJsonAsync(url, transferToPay);