From 8a9ef2a883b91d9edae510c57ff8a4c4bd37aba5 Mon Sep 17 00:00:00 2001 From: Max Mannstein Date: Sat, 9 Aug 2025 14:45:07 +0200 Subject: [PATCH] finale anpassungen und schicken der richtigen daten + aufmerksam machen der nutzer auf den zustand dass es aktuell nur cash gibt --- .DS_Store | Bin 6148 -> 6148 bytes gehGassiApp/.DS_Store | Bin 0 -> 6148 bytes .../Interfaces/IPublicWalkRequestService.cs | 3 +- .../Services/PublicWalkRequestService.cs | 4 +- gehGassiApp/gehGassiApp/.DS_Store | Bin 0 -> 6148 bytes .../gehGassiApp/Resources/Images/cashonly.svg | 17 ++++ .../Popups/PaymentInfoPopupViewModel.cs | 29 ------- .../ViewModels/Walks/BookWalkViewModel.cs | 15 +++- .../Walks/PublicWalkResponseShowViewModel.cs | 16 +++- .../Views/Popups/PaymentInfoPopup.xaml | 75 ++++++++---------- 10 files changed, 83 insertions(+), 76 deletions(-) create mode 100644 gehGassiApp/.DS_Store create mode 100644 gehGassiApp/gehGassiApp/.DS_Store create mode 100644 gehGassiApp/gehGassiApp/Resources/Images/cashonly.svg diff --git a/.DS_Store b/.DS_Store index 964d30570c7341855e0871181b25c2105ae69afc..28f106b5a7aed2ab49ef35f44f7a16379bf29e1e 100644 GIT binary patch delta 17 YcmZoMXfc?uj*)TW#xVBHtQ`OO0Xe${HUIzs delta 14 VcmZoMXfc?uZsW!<_Qfn50st)X1tkCg diff --git a/gehGassiApp/.DS_Store b/gehGassiApp/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..28f106b5a7aed2ab49ef35f44f7a16379bf29e1e GIT binary patch literal 6148 zcmeHKIZgvX5Ud6VmYg^woGJBzNLCA(Nv!HsPtEjp z&1fpv-UeW+)Ak-%0+`bs@$JLZ{Js0cZYp9#I`??Nk~ zFjn9;mrJkzkMuwK|1n7`DIf)|N&%a#H|rIzRJC<-Ij^;i{!I6rAG#aoLE#YPm>A`l g3oplak(7DO=X~D_hs2;W9(1C923!}J6!>oi&Uc&@nE(I) literal 0 HcmV?d00001 diff --git a/gehGassiApp/gehGassiApp.Core/Interfaces/IPublicWalkRequestService.cs b/gehGassiApp/gehGassiApp.Core/Interfaces/IPublicWalkRequestService.cs index 4f19616..a4ea1d9 100644 --- a/gehGassiApp/gehGassiApp.Core/Interfaces/IPublicWalkRequestService.cs +++ b/gehGassiApp/gehGassiApp.Core/Interfaces/IPublicWalkRequestService.cs @@ -163,9 +163,10 @@ namespace gehGassiApp.Core.Interfaces /// Id der öffentlichen Anfrage /// Id des akzeptierten Angebotes /// Id des Hundebesitzers + /// Zahlungsart für den Walk /// Aktuelles Accesstoken /// CancellationToken /// Erstellter Walk wenn erfolgreich, false sonst - Task AcceptResponseAsync(string publicWalkRequestId, string publicWalkResponseId, string appUserId, string accessToken, CancellationToken token); + Task AcceptResponseAsync(string publicWalkRequestId, string publicWalkResponseId, string appUserId, WalkPaymentType? paymentType, string accessToken, CancellationToken token); } } diff --git a/gehGassiApp/gehGassiApp.Core/Services/PublicWalkRequestService.cs b/gehGassiApp/gehGassiApp.Core/Services/PublicWalkRequestService.cs index 5ac7e18..38c6acf 100644 --- a/gehGassiApp/gehGassiApp.Core/Services/PublicWalkRequestService.cs +++ b/gehGassiApp/gehGassiApp.Core/Services/PublicWalkRequestService.cs @@ -487,16 +487,18 @@ namespace gehGassiApp.Core.Services /// Id der öffentlichen Anfrage /// Id des akzeptierten Angebotes /// Id des Hundebesitzers + /// Zahlungsart für den Walk /// Aktuelles Accesstoken /// CancellationToken /// Erstellter Walk wenn erfolgreich, false sonst - public async Task AcceptResponseAsync(string publicWalkRequestId, string publicWalkResponseId, string appUserId, string accessToken, CancellationToken token) + public async Task AcceptResponseAsync(string publicWalkRequestId, string publicWalkResponseId, string appUserId, WalkPaymentType? paymentType, string accessToken, CancellationToken token) { var dto = new PublicWalkRequestAcceptDto() { PublicWalkRequestId = publicWalkRequestId, PublicWalkResponseId = publicWalkResponseId, DogOwnerId = appUserId, + PaymentType = paymentType.HasValue ? (WalkPaymentTypeDto)paymentType.Value : null, UpdatedAt = DateTimeOffset.UtcNow }; diff --git a/gehGassiApp/gehGassiApp/.DS_Store b/gehGassiApp/gehGassiApp/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 + + + + + + + + + + + + + + + + diff --git a/gehGassiApp/gehGassiApp/ViewModels/Popups/PaymentInfoPopupViewModel.cs b/gehGassiApp/gehGassiApp/ViewModels/Popups/PaymentInfoPopupViewModel.cs index 1efd047..7d3ae74 100644 --- a/gehGassiApp/gehGassiApp/ViewModels/Popups/PaymentInfoPopupViewModel.cs +++ b/gehGassiApp/gehGassiApp/ViewModels/Popups/PaymentInfoPopupViewModel.cs @@ -6,50 +6,21 @@ namespace gehGassiApp.ViewModels.Popups { /// /// ViewModel für das Zahlungshinweis-Popup - /// - /// Verwendung: - /// // Prüfen ob bereits angezeigt - /// if (!PaymentInfoPopupViewModel.HasInfoBeenShown()) - /// { - /// var popup = new PaymentInfoPopup(); - /// await Shell.Current.CurrentPage.ShowPopupAsync(popup); - /// } /// public partial class PaymentInfoPopupViewModel : ObservableObject { private readonly Popup _popup; - private const string PAYMENT_INFO_SHOWN_KEY = "payment_info_july_shown_2025"; public PaymentInfoPopupViewModel(Popup popup) { _popup = popup; } - - /// - /// Prüft, ob der Zahlungshinweis bereits angezeigt wurde - /// - public static bool HasInfoBeenShown() - { - return Preferences.Get(PAYMENT_INFO_SHOWN_KEY, false); - } - - /// - /// Markiert den Hinweis als angezeigt - /// - private static void MarkInfoAsShown() - { - Preferences.Set(PAYMENT_INFO_SHOWN_KEY, true); - } - /// /// User hat den Hinweis zur Kenntnis genommen /// [RelayCommand] private async Task Acknowledge() { - // Hinweis als angezeigt markieren - MarkInfoAsShown(); - // Popup schließen await _popup.CloseAsync(true); } diff --git a/gehGassiApp/gehGassiApp/ViewModels/Walks/BookWalkViewModel.cs b/gehGassiApp/gehGassiApp/ViewModels/Walks/BookWalkViewModel.cs index 37747f9..a41ec34 100644 --- a/gehGassiApp/gehGassiApp/ViewModels/Walks/BookWalkViewModel.cs +++ b/gehGassiApp/gehGassiApp/ViewModels/Walks/BookWalkViewModel.cs @@ -2,6 +2,7 @@ using System.Text.Json; using System.Web; using CommunityToolkit.Maui.Core.Extensions; +using CommunityToolkit.Maui.Views; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; @@ -615,6 +616,10 @@ namespace gehGassiApp.ViewModels.Walks var helpStartDate = new DateTimeOffset(StartDate.Year, StartDate.Month, StartDate.Day, StartTime.Hours, StartTime.Minutes, StartTime.Seconds, DateTimeOffset.Now.Offset); var helpEndDate = new DateTimeOffset(EndDate.Year, EndDate.Month, EndDate.Day, EndTime.Hours, EndTime.Minutes, EndTime.Seconds, DateTimeOffset.Now.Offset); + // PaymentType auswählen + var paymentPopup = new Views.Popups.PaymentInfoPopup(); + var paymentResult = await Shell.Current.CurrentPage.ShowPopupAsync(paymentPopup); + var walkCreateDto = new WalkCreateDto() { Type = WalkTypeDto.Scheduled, @@ -628,7 +633,8 @@ namespace gehGassiApp.ViewModels.Walks PickupAddress = PickupAddress.ToDto(), ReturnAddress = ReturnAddress.ToDto(), Price = Price, - Info = Info + Info = Info, + PaymentType = paymentResult is true ? WalkPaymentTypeDto.Cash : null }; #region Pickupaddress @@ -723,6 +729,10 @@ namespace gehGassiApp.ViewModels.Walks var helpStartDate = new DateTimeOffset(StartDate.Year, StartDate.Month, StartDate.Day, StartTime.Hours, StartTime.Minutes, StartTime.Seconds, DateTimeOffset.Now.Offset); var helpEndDate = new DateTimeOffset(EndDate.Year, EndDate.Month, EndDate.Day, EndTime.Hours, EndTime.Minutes, EndTime.Seconds, DateTimeOffset.Now.Offset); + // PaymentType auswählen + var paymentPopup = new Views.Popups.PaymentInfoPopup(); + var paymentResult = await Shell.Current.CurrentPage.ShowPopupAsync(paymentPopup); + var walkCreateDto = new WalkCreateDto() { Type = WalkTypeDto.Direct, @@ -736,7 +746,8 @@ namespace gehGassiApp.ViewModels.Walks PickupAddress = PickupAddress.ToDto(), ReturnAddress = ReturnAddress.ToDto(), Price = Price, - Info = Info + Info = Info, + PaymentType = paymentResult is true ? WalkPaymentTypeDto.Cash : null }; #region Pickupaddress diff --git a/gehGassiApp/gehGassiApp/ViewModels/Walks/PublicWalkResponseShowViewModel.cs b/gehGassiApp/gehGassiApp/ViewModels/Walks/PublicWalkResponseShowViewModel.cs index ebfae29..34a22be 100644 --- a/gehGassiApp/gehGassiApp/ViewModels/Walks/PublicWalkResponseShowViewModel.cs +++ b/gehGassiApp/gehGassiApp/ViewModels/Walks/PublicWalkResponseShowViewModel.cs @@ -1,5 +1,6 @@ using System.Web; using CommunityToolkit.Maui.Core; +using CommunityToolkit.Maui.Views; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; @@ -120,9 +121,22 @@ namespace gehGassiApp.ViewModels.Walks return; } + // PaymentInfoPopup anzeigen um PaymentType zu bestimmen + var paymentInfoPopup = new Views.Popups.PaymentInfoPopup(); + var popupResult = await Shell.Current.CurrentPage.ShowPopupAsync(paymentInfoPopup); + + // Wenn das Popup geschlossen wurde ohne "Alles klar" zu klicken, abbrechen + if (popupResult == null || !(bool)popupResult) + { + return; + } + + // Popup Result = true bedeutet Cash Payment + var paymentType = WalkPaymentType.Cash; + IsSaving = true; using var cts = new CancellationTokenSource(Core.Common.Constants.CreateTimeout); - var createdWalk = await _publicWalkRequestService.AcceptResponseAsync(_requestId, PublicWalkResponse.Id, App.CurrentAppUser.Id, App.CurrentUser.AccessToken, cts.Token); + var createdWalk = await _publicWalkRequestService.AcceptResponseAsync(_requestId, PublicWalkResponse.Id, App.CurrentAppUser.Id, paymentType, App.CurrentUser.AccessToken, cts.Token); if (createdWalk != null) { WeakReferenceMessenger.Default.Send(new RefreshViewModelMessage(Core.Messaging.Messages.Refresh_PublicWalkRequestDetails)); diff --git a/gehGassiApp/gehGassiApp/Views/Popups/PaymentInfoPopup.xaml b/gehGassiApp/gehGassiApp/Views/Popups/PaymentInfoPopup.xaml index fe318b5..f10e822 100644 --- a/gehGassiApp/gehGassiApp/Views/Popups/PaymentInfoPopup.xaml +++ b/gehGassiApp/gehGassiApp/Views/Popups/PaymentInfoPopup.xaml @@ -5,13 +5,14 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:res="clr-namespace:gehGassiApp.Resources" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" - CanBeDismissedByTappingOutsideOfPopup="True" + CanBeDismissedByTappingOutsideOfPopup="False" Color="Transparent"> @@ -19,79 +20,69 @@ - - - - - + + Grid.Row="0" + Padding="20,30,20,20" + Spacing="20"> - + + + +