From 2f9971ae71fb919f1e3d5eb61a381bad63e451be Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Mon, 22 Aug 2022 11:53:15 +0100 Subject: [PATCH 1/7] Initial framework added --- .../Models/ContractProductModel.cs | 30 +++++ .../Models/ListViewItem.cs | 6 + .../RequestHandlers/MerchantRequestHandler.cs | 16 ++- .../Requests/GetMerchantBalanceRequest.cs | 12 ++ .../Services/ApplicationCache.cs | 9 ++ .../DummyServices/DummyMerchantService.cs | 24 ++++ .../Services/IApplicationCache.cs | 4 + .../Services/IMerchantService.cs | 2 + .../Services/MerchantService.cs | 4 + .../UIServices/INavigationService.cs | 4 + .../MyAccountAddressPageViewModel.cs | 48 +++++++ .../MyAccountContactPageViewModel.cs | 48 +++++++ .../MyAccountDetailsPageViewModel.cs | 84 ++++++++++++ .../MyAccount/MyAccountPageViewModel.cs | 120 ++++++++++++++++-- TransactionMobile.Maui/App.xaml.cs | 6 + .../Extensions/MauiAppBuilderExtensions.cs | 9 +- .../MyAccount/MyAccountAddressesPage.xaml | 32 +++++ .../MyAccount/MyAccountAddressesPage.xaml.cs | 20 +++ .../Pages/MyAccount/MyAccountContactPage.xaml | 20 +++ .../MyAccount/MyAccountContactPage.xaml.cs | 20 +++ .../Pages/MyAccount/MyAccountDetailsPage.xaml | 29 +++++ .../MyAccount/MyAccountDetailsPage.xaml.cs | 23 ++++ .../Pages/MyAccount/MyAccountPage.xaml | 16 ++- .../Pages/MyAccount/MyAccountPage.xaml.cs | 44 +++++++ .../Resources/Styles/LightTheme.xaml | 10 ++ .../TransactionMobile.Maui.csproj | 18 +++ .../UIServices/ShellNavigationService.cs | 67 +++++----- 27 files changed, 669 insertions(+), 56 deletions(-) create mode 100644 TransactionMobile.Maui.BusinessLogic/Models/ListViewItem.cs create mode 100644 TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountAddressPageViewModel.cs create mode 100644 TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountContactPageViewModel.cs create mode 100644 TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountDetailsPageViewModel.cs create mode 100644 TransactionMobile.Maui/Pages/MyAccount/MyAccountAddressesPage.xaml create mode 100644 TransactionMobile.Maui/Pages/MyAccount/MyAccountAddressesPage.xaml.cs create mode 100644 TransactionMobile.Maui/Pages/MyAccount/MyAccountContactPage.xaml create mode 100644 TransactionMobile.Maui/Pages/MyAccount/MyAccountContactPage.xaml.cs create mode 100644 TransactionMobile.Maui/Pages/MyAccount/MyAccountDetailsPage.xaml create mode 100644 TransactionMobile.Maui/Pages/MyAccount/MyAccountDetailsPage.xaml.cs diff --git a/TransactionMobile.Maui.BusinessLogic/Models/ContractProductModel.cs b/TransactionMobile.Maui.BusinessLogic/Models/ContractProductModel.cs index 615c1267..97bd6a08 100644 --- a/TransactionMobile.Maui.BusinessLogic/Models/ContractProductModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/Models/ContractProductModel.cs @@ -78,4 +78,34 @@ public class ContractProductModel #endregion } + + public class MerchantDetailsModel + { + public Decimal Balance { get; set; } + public Decimal AvailableBalance { get; set; } + public String MerchantName { get; set; } + public DateTime NextStatementDate { get; set; } + public DateTime LastStatementDate { get; set; } + public String SettlementSchedule { get; set; } + public AddressModel Address { get; set; } + public ContactModel Contact { get; set; } + } + + public class AddressModel + { + public String AddressLine1 { get; set; } + public String AddressLine2 { get; set; } + public String AddressLine3 { get; set; } + public String AddressLine4 { get; set; } + public String PostalCode { get; set; } + public String Region { get; set; } + public String Town { get; set; } + } + + public class ContactModel + { + public String EmailAddress { get; set; } + public String Name { get; set; } + public String MobileNumber { get; set; } + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/Models/ListViewItem.cs b/TransactionMobile.Maui.BusinessLogic/Models/ListViewItem.cs new file mode 100644 index 00000000..fd5bd788 --- /dev/null +++ b/TransactionMobile.Maui.BusinessLogic/Models/ListViewItem.cs @@ -0,0 +1,6 @@ +namespace TransactionMobile.Maui.BusinessLogic.Models; + +public class ListViewItem +{ + public String Title { get; set; } +} \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs b/TransactionMobile.Maui.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs index 5e995215..f6c9d499 100644 --- a/TransactionMobile.Maui.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs +++ b/TransactionMobile.Maui.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs @@ -7,7 +7,9 @@ using Requests; using Services; -public class MerchantRequestHandler : IRequestHandler>, IRequestHandler +public class MerchantRequestHandler : IRequestHandler>, + IRequestHandler, + IRequestHandler { #region Fields @@ -54,6 +56,16 @@ public async Task Handle(GetMerchantBalanceRequest request, IMerchantService merchantService = this.MerchantServiceResolver(useTrainingMode); return await merchantService.GetMerchantBalance(cancellationToken); } - + + + public async Task Handle(GetMerchantDetailsRequest request, + CancellationToken cancellationToken) { + Boolean useTrainingMode = this.ApplicationCache.GetUseTrainingMode(); + IMerchantService merchantService = this.MerchantServiceResolver(useTrainingMode); + + MerchantDetailsModel merchantDetails = await merchantService.GetMerchantDetails(cancellationToken); + + return merchantDetails; + } #endregion } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/Requests/GetMerchantBalanceRequest.cs b/TransactionMobile.Maui.BusinessLogic/Requests/GetMerchantBalanceRequest.cs index 27721ff9..e610ea4a 100644 --- a/TransactionMobile.Maui.BusinessLogic/Requests/GetMerchantBalanceRequest.cs +++ b/TransactionMobile.Maui.BusinessLogic/Requests/GetMerchantBalanceRequest.cs @@ -1,6 +1,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Requests; using MediatR; +using TransactionMobile.Maui.BusinessLogic.Models; public class GetMerchantBalanceRequest : IRequest { @@ -24,4 +25,15 @@ public static GetMerchantBalanceRequest Create() } #endregion +} + +public class GetMerchantDetailsRequest : IRequest +{ + public GetMerchantDetailsRequest() { + + } + + public static GetMerchantDetailsRequest Create() { + return new GetMerchantDetailsRequest(); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/Services/ApplicationCache.cs b/TransactionMobile.Maui.BusinessLogic/Services/ApplicationCache.cs index 9b03ab83..5bf68d37 100644 --- a/TransactionMobile.Maui.BusinessLogic/Services/ApplicationCache.cs +++ b/TransactionMobile.Maui.BusinessLogic/Services/ApplicationCache.cs @@ -79,6 +79,15 @@ public void SetMerchantId(Guid value, this.Set("MerchantId", value, options); } + public MerchantDetailsModel GetMerchantDetails() { + return this.TryGetValue("MerchantDetails"); + } + + public void SetMerchantDetails(MerchantDetailsModel value, + MemoryCacheEntryOptions options = default) { + this.Set("MerchantDetails", value, options); + } + public void SetUseTrainingMode(Boolean value, MemoryCacheEntryOptions options = default) { this.Set("UseTrainingMode", value, options); diff --git a/TransactionMobile.Maui.BusinessLogic/Services/DummyServices/DummyMerchantService.cs b/TransactionMobile.Maui.BusinessLogic/Services/DummyServices/DummyMerchantService.cs index 58bfb17e..8a877583 100644 --- a/TransactionMobile.Maui.BusinessLogic/Services/DummyServices/DummyMerchantService.cs +++ b/TransactionMobile.Maui.BusinessLogic/Services/DummyServices/DummyMerchantService.cs @@ -96,4 +96,28 @@ public async Task GetMerchantBalance(CancellationToken cancellationToke { return 100; } + + public async Task GetMerchantDetails(CancellationToken cancellationToken) { + MerchantDetailsModel model = new MerchantDetailsModel { + Address = new AddressModel { + AddressLine1 = "test address line 1", + AddressLine2 = null, + AddressLine3 = null, + AddressLine4 = null, + PostalCode = "TE57 1NG", + Region = "Region", + Town = "Town" + }, + Contact = new ContactModel { + Name = "Test Contact", + EmailAddress = "stuart_ferguson1@outlook.com", + MobileNumber = "123456789" + }, + LastStatementDate = DateTime.Now.AddDays(-30), + NextStatementDate = DateTime.Now.AddDays(30), + MerchantName = "Dummy Merchant", + SettlementSchedule = "Monthly" + }; + return model; + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/Services/IApplicationCache.cs b/TransactionMobile.Maui.BusinessLogic/Services/IApplicationCache.cs index 72bc56d0..4d5ce0c4 100644 --- a/TransactionMobile.Maui.BusinessLogic/Services/IApplicationCache.cs +++ b/TransactionMobile.Maui.BusinessLogic/Services/IApplicationCache.cs @@ -32,4 +32,8 @@ public interface IApplicationCache Guid GetMerchantId(); void SetMerchantId(Guid value, MemoryCacheEntryOptions options = default); + + MerchantDetailsModel GetMerchantDetails(); + + void SetMerchantDetails(MerchantDetailsModel value, MemoryCacheEntryOptions options = default); } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/Services/IMerchantService.cs b/TransactionMobile.Maui.BusinessLogic/Services/IMerchantService.cs index 4bf933d3..58b3a0ee 100644 --- a/TransactionMobile.Maui.BusinessLogic/Services/IMerchantService.cs +++ b/TransactionMobile.Maui.BusinessLogic/Services/IMerchantService.cs @@ -13,5 +13,7 @@ public interface IMerchantService Task GetMerchantBalance(CancellationToken cancellationToken); + Task GetMerchantDetails(CancellationToken cancellationToken); + #endregion } diff --git a/TransactionMobile.Maui.BusinessLogic/Services/MerchantService.cs b/TransactionMobile.Maui.BusinessLogic/Services/MerchantService.cs index 44175d68..f4e6c926 100644 --- a/TransactionMobile.Maui.BusinessLogic/Services/MerchantService.cs +++ b/TransactionMobile.Maui.BusinessLogic/Services/MerchantService.cs @@ -104,4 +104,8 @@ public async Task GetMerchantBalance(CancellationToken cancellationToke return merchantBalance.AvailableBalance; } + + public Task GetMerchantDetails(CancellationToken cancellationToken) { + throw new NotImplementedException(); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/UIServices/INavigationService.cs b/TransactionMobile.Maui.BusinessLogic/UIServices/INavigationService.cs index 10d152c8..237edece 100644 --- a/TransactionMobile.Maui.BusinessLogic/UIServices/INavigationService.cs +++ b/TransactionMobile.Maui.BusinessLogic/UIServices/INavigationService.cs @@ -40,5 +40,9 @@ Task GoToVoucherIssueVoucherPage(String operatorIdentifier, Task GoToViewLogsPage(); + Task GoToMyAccountAddresses(); + Task GoToMyAccountContacts(); + Task GoToMyAccountDetails(); + #endregion } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountAddressPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountAddressPageViewModel.cs new file mode 100644 index 00000000..94356840 --- /dev/null +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountAddressPageViewModel.cs @@ -0,0 +1,48 @@ +namespace TransactionMobile.Maui.BusinessLogic.ViewModels.MyAccount; + +using Maui.UIServices; +using MediatR; +using Models; +using MvvmHelpers; +using Services; + +public class MyAccountAddressPageViewModel : BaseViewModel +{ + private readonly INavigationService NavigationService; + + private readonly IApplicationCache ApplicationCache; + + private readonly IMediator Mediator; + + #region Constructors + + public MyAccountAddressPageViewModel(INavigationService navigationService, + IApplicationCache applicationCache, + IMediator mediator) { + this.NavigationService = navigationService; + this.ApplicationCache = applicationCache; + this.Mediator = mediator; + this.Title = "My Addresses"; + } + + #endregion + + private AddressModel address; + + public AddressModel Address{ + get => this.address; + set => this.SetProperty(ref this.address, value); + } + + #region Properties + + public async Task Initialise(CancellationToken cancellationToken) { + MerchantDetailsModel merchantDetails = this.ApplicationCache.GetMerchantDetails(); + + // TODO: handle a null + + this.Address = merchantDetails.Address; + } + + #endregion +} \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountContactPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountContactPageViewModel.cs new file mode 100644 index 00000000..540c237e --- /dev/null +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountContactPageViewModel.cs @@ -0,0 +1,48 @@ +namespace TransactionMobile.Maui.BusinessLogic.ViewModels.MyAccount; + +using Maui.UIServices; +using MediatR; +using MvvmHelpers; +using Services; +using TransactionMobile.Maui.BusinessLogic.Models; + +public class MyAccountContactPageViewModel : BaseViewModel +{ + private readonly INavigationService NavigationService; + + private readonly IApplicationCache ApplicationCache; + + private readonly IMediator Mediator; + + private ContactModel contact; + + public ContactModel Contact { + get => this.contact; + set => this.SetProperty(ref this.contact, value); + } + + #region Constructors + + public MyAccountContactPageViewModel(INavigationService navigationService, IApplicationCache applicationCache, + IMediator mediator) + { + this.NavigationService = navigationService; + this.ApplicationCache = applicationCache; + this.Mediator = mediator; + this.Title = "My Contacts"; + } + + + #endregion + + #region Properties + + #endregion + + public async Task Initialise(CancellationToken none) { + MerchantDetailsModel merchantDetails = this.ApplicationCache.GetMerchantDetails(); + + // TODO: handle a null + this.Contact = merchantDetails.Contact; + } +} \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountDetailsPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountDetailsPageViewModel.cs new file mode 100644 index 00000000..fb2c76ff --- /dev/null +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountDetailsPageViewModel.cs @@ -0,0 +1,84 @@ +namespace TransactionMobile.Maui.BusinessLogic.ViewModels.MyAccount; + +using Maui.UIServices; +using MediatR; +using MvvmHelpers; +using Services; +using TransactionMobile.Maui.BusinessLogic.Models; + +public class MyAccountDetailsPageViewModel : BaseViewModel +{ + private readonly INavigationService NavigationService; + + private readonly IApplicationCache ApplicationCache; + + private readonly IMediator Mediator; + + #region Constructors + + public MyAccountDetailsPageViewModel(INavigationService navigationService, IApplicationCache applicationCache, + IMediator mediator) + { + this.NavigationService = navigationService; + this.ApplicationCache = applicationCache; + this.Mediator = mediator; + this.Title = "My Details"; + } + + + #endregion + + #region Properties + + #endregion + + public async Task Initialise(CancellationToken none) + { + MerchantDetailsModel merchantDetails = this.ApplicationCache.GetMerchantDetails(); + + this.Balance = merchantDetails.Balance; + this.AvailableBalance = merchantDetails.AvailableBalance; + this.NextStatementDate = merchantDetails.NextStatementDate; + this.LastStatementDate = merchantDetails.LastStatementDate; + this.MerchantName = merchantDetails.MerchantName; + this.SettlementSchedule = merchantDetails.SettlementSchedule; + } + + private Decimal balance; + private Decimal availableBalance; + private String merchantName; + private DateTime nextStatementDate; + private DateTime lastStatementDate; + private String settlementSchedule; + + public Decimal Balance { + get => this.balance; + set => this.SetProperty(ref this.balance, value); + } + public Decimal AvailableBalance + { + get => this.availableBalance; + set => this.SetProperty(ref this.availableBalance, value); + } + public DateTime NextStatementDate + { + get => this.nextStatementDate; + set => this.SetProperty(ref this.nextStatementDate, value); + } + public DateTime LastStatementDate + { + get => this.lastStatementDate; + set => this.SetProperty(ref this.lastStatementDate, value); + } + public String SettlementSchedule + { + get => this.settlementSchedule; + set => this.SetProperty(ref this.settlementSchedule, value); + } + + public String MerchantName + { + get => this.merchantName; + set => this.SetProperty(ref this.merchantName, value); + } +} \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountPageViewModel.cs index 5ae481b0..99818941 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountPageViewModel.cs @@ -1,24 +1,43 @@ namespace TransactionMobile.Maui.BusinessLogic.ViewModels.MyAccount { using System.Windows.Input; + using Common; + using Maui.UIServices; + using MediatR; + using Microsoft.Extensions.Caching.Memory; + using Microsoft.Extensions.Primitives; + using Models; using MvvmHelpers; using MvvmHelpers.Commands; - using TransactionMobile.Maui.BusinessLogic.Services; - using TransactionMobile.Maui.UIServices; + using Requests; + using Services; + using Shared.Logger; public class MyAccountPageViewModel : BaseViewModel { - private readonly INavigationService NavigationService; + #region Fields private readonly IApplicationCache ApplicationCache; + private DateTime lastLogin; + + private readonly IMediator Mediator; + + private String merchantName; + + private readonly INavigationService NavigationService; + + #endregion + #region Constructors - public MyAccountPageViewModel(INavigationService navigationService,IApplicationCache applicationCache) - { + public MyAccountPageViewModel(INavigationService navigationService, + IApplicationCache applicationCache, + IMediator mediator) { this.NavigationService = navigationService; this.ApplicationCache = applicationCache; - this.LogoutCommand = new AsyncCommand(this.LogoutCommandExecute); + this.Mediator = mediator; + this.OptionSelectedCommand = new AsyncCommand>(this.OptionSelectedCommandExecute); this.Title = "My Account"; } @@ -26,20 +45,95 @@ public MyAccountPageViewModel(INavigationService navigationService,IApplicationC #region Properties - public ICommand LogoutCommand { get; set; } - + public DateTime LastLogin { + get => this.lastLogin; + set => this.SetProperty(ref this.lastLogin, value); + } + + public String MerchantName { + get => this.merchantName; + set => this.SetProperty(ref this.merchantName, value); + } + + public List MyAccountOptions { get; set; } + + public ICommand OptionSelectedCommand { get; set; } + #endregion #region Methods - private async Task LogoutCommandExecute() - { - Shared.Logger.Logger.LogInformation("LogoutCommand called"); + public async Task Initialise(CancellationToken cancellationToken) { + this.MyAccountOptions = new List { + new ListViewItem { + Title = "Addresses" + }, + new ListViewItem { + Title = "Contacts" + }, + new ListViewItem { + Title = "Account Info" + }, + new ListViewItem { + Title = "Logout" + } + }; + + GetMerchantDetailsRequest request = GetMerchantDetailsRequest.Create(); + + MerchantDetailsModel merchantDetailsModel = await this.Mediator.Send(request, cancellationToken); + this.MerchantName = merchantDetailsModel.MerchantName; + + DateTime expirationTime = DateTime.Now.AddMinutes(60); + CancellationChangeToken expirationToken = new CancellationChangeToken(new CancellationTokenSource(TimeSpan.FromMinutes(60)).Token); + MemoryCacheEntryOptions cacheEntryOptions = new MemoryCacheEntryOptions() + // Pin to cache. + .SetPriority(CacheItemPriority.NeverRemove) + // Set the actual expiration time + .SetAbsoluteExpiration(expirationTime) + // Force eviction to run + .AddExpirationToken(expirationToken); + + this.ApplicationCache.SetMerchantDetails(merchantDetailsModel, cacheEntryOptions); + + this.LastLogin = DateTime.Now; // TODO: might cache this in the application + } + + private async Task LogoutCommandExecute() { + Logger.LogInformation("LogoutCommand called"); this.ApplicationCache.SetAccessToken(null); - + await this.NavigationService.GoToLoginPage(); } - + + private async Task OptionSelectedCommandExecute(ItemSelected arg) { + AccountOptions selectedOption = (AccountOptions)arg.SelectedItemIndex; + + Task navigationTask = selectedOption switch { + AccountOptions.Addresses => this.NavigationService.GoToMyAccountAddresses(), + AccountOptions.Contacts => this.NavigationService.GoToMyAccountContacts(), + AccountOptions.AccountInfo => this.NavigationService.GoToMyAccountDetails(), + AccountOptions.Logout => this.LogoutCommandExecute() + }; + + await navigationTask; + } + + #endregion + + #region Others + + public enum AccountOptions + { + Addresses = 0, + + Contacts = 1, + + AccountInfo = 2, + + Logout = 3 + } + #endregion } } \ No newline at end of file diff --git a/TransactionMobile.Maui/App.xaml.cs b/TransactionMobile.Maui/App.xaml.cs index 22093bf7..a1315e08 100644 --- a/TransactionMobile.Maui/App.xaml.cs +++ b/TransactionMobile.Maui/App.xaml.cs @@ -9,6 +9,7 @@ namespace TransactionMobile.Maui; using Microsoft.Maui.Handlers; using Pages; using Pages.AppHome; +using Pages.MyAccount; using Pages.Support; using Pages.Transactions.Admin; using TransactionMobile.Maui.BusinessLogic.Services; @@ -139,6 +140,7 @@ public App() MainPage = new LoginPage(loginPageViewModel); } + // TODO: Investigate if this could be done automatically (maybe with exclusions for top level pages) Routing.RegisterRoute(nameof(MobileTopupSelectOperatorPage), typeof(MobileTopupSelectOperatorPage)); Routing.RegisterRoute(nameof(MobileTopupSelectProductPage), typeof(MobileTopupSelectProductPage)); Routing.RegisterRoute(nameof(MobileTopupPerformTopupPage), typeof(MobileTopupPerformTopupPage)); @@ -155,6 +157,10 @@ public App() Routing.RegisterRoute(nameof(LoginPage), typeof(LoginPage)); Routing.RegisterRoute(nameof(ViewLogsPage), typeof(ViewLogsPage)); + + Routing.RegisterRoute(nameof(MyAccountAddressesPage), typeof(MyAccountAddressesPage)); + Routing.RegisterRoute(nameof(MyAccountContactPage), typeof(MyAccountContactPage)); + Routing.RegisterRoute(nameof(MyAccountDetailsPage), typeof(MyAccountDetailsPage)); } } diff --git a/TransactionMobile.Maui/Extensions/MauiAppBuilderExtensions.cs b/TransactionMobile.Maui/Extensions/MauiAppBuilderExtensions.cs index e78d40e1..1ec7f0a0 100644 --- a/TransactionMobile.Maui/Extensions/MauiAppBuilderExtensions.cs +++ b/TransactionMobile.Maui/Extensions/MauiAppBuilderExtensions.cs @@ -203,7 +203,8 @@ public static MauiAppBuilder ConfigureRequestHandlers(this MauiAppBuilder builde builder.Services.AddSingleton>, MerchantRequestHandler>(); builder.Services.AddSingleton, MerchantRequestHandler>(); - + builder.Services.AddSingleton, MerchantRequestHandler>(); + builder.Services.AddSingleton, TransactionRequestHandler>(); builder.Services.AddSingleton, TransactionRequestHandler>(); builder.Services.AddSingleton, TransactionRequestHandler>(); @@ -240,6 +241,9 @@ public static MauiAppBuilder ConfigureViewModels(this MauiAppBuilder builder) builder.Services.AddTransient(); builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); builder.Services.AddTransient(); @@ -269,6 +273,9 @@ public static MauiAppBuilder ConfigurePages(this MauiAppBuilder builder) builder.Services.AddTransient(); builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); builder.Services.AddTransient(); diff --git a/TransactionMobile.Maui/Pages/MyAccount/MyAccountAddressesPage.xaml b/TransactionMobile.Maui/Pages/MyAccount/MyAccountAddressesPage.xaml new file mode 100644 index 00000000..684d3fa3 --- /dev/null +++ b/TransactionMobile.Maui/Pages/MyAccount/MyAccountAddressesPage.xaml @@ -0,0 +1,32 @@ + + + + + + + \ No newline at end of file diff --git a/TransactionMobile.Maui/Pages/MyAccount/MyAccountAddressesPage.xaml.cs b/TransactionMobile.Maui/Pages/MyAccount/MyAccountAddressesPage.xaml.cs new file mode 100644 index 00000000..f8431401 --- /dev/null +++ b/TransactionMobile.Maui/Pages/MyAccount/MyAccountAddressesPage.xaml.cs @@ -0,0 +1,20 @@ +namespace TransactionMobile.Maui.Pages.MyAccount; + +using BusinessLogic.ViewModels.MyAccount; + +public partial class MyAccountAddressesPage : ContentPage +{ + private MyAccountAddressPageViewModel viewModel => BindingContext as MyAccountAddressPageViewModel; + + public MyAccountAddressesPage(MyAccountAddressPageViewModel vm) + { + InitializeComponent(); + BindingContext = vm; + } + + protected override async void OnAppearing() + { + base.OnAppearing(); + await viewModel.Initialise(CancellationToken.None); + } +} \ No newline at end of file diff --git a/TransactionMobile.Maui/Pages/MyAccount/MyAccountContactPage.xaml b/TransactionMobile.Maui/Pages/MyAccount/MyAccountContactPage.xaml new file mode 100644 index 00000000..8b501424 --- /dev/null +++ b/TransactionMobile.Maui/Pages/MyAccount/MyAccountContactPage.xaml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/TransactionMobile.Maui/Pages/MyAccount/MyAccountContactPage.xaml.cs b/TransactionMobile.Maui/Pages/MyAccount/MyAccountContactPage.xaml.cs new file mode 100644 index 00000000..bfffe7f3 --- /dev/null +++ b/TransactionMobile.Maui/Pages/MyAccount/MyAccountContactPage.xaml.cs @@ -0,0 +1,20 @@ +namespace TransactionMobile.Maui.Pages.MyAccount; + +using BusinessLogic.ViewModels.MyAccount; + +public partial class MyAccountContactPage : ContentPage +{ + private MyAccountContactPageViewModel viewModel => BindingContext as MyAccountContactPageViewModel; + + public MyAccountContactPage(MyAccountContactPageViewModel vm) { + InitializeComponent(); + + BindingContext = vm; + + } + + protected override async void OnAppearing() { + base.OnAppearing(); + await viewModel.Initialise(CancellationToken.None); + } +} \ No newline at end of file diff --git a/TransactionMobile.Maui/Pages/MyAccount/MyAccountDetailsPage.xaml b/TransactionMobile.Maui/Pages/MyAccount/MyAccountDetailsPage.xaml new file mode 100644 index 00000000..6a2a073a --- /dev/null +++ b/TransactionMobile.Maui/Pages/MyAccount/MyAccountDetailsPage.xaml @@ -0,0 +1,29 @@ + + + + + + + \ No newline at end of file diff --git a/TransactionMobile.Maui/Pages/MyAccount/MyAccountDetailsPage.xaml.cs b/TransactionMobile.Maui/Pages/MyAccount/MyAccountDetailsPage.xaml.cs new file mode 100644 index 00000000..dd2615d7 --- /dev/null +++ b/TransactionMobile.Maui/Pages/MyAccount/MyAccountDetailsPage.xaml.cs @@ -0,0 +1,23 @@ +namespace TransactionMobile.Maui.Pages.MyAccount; + +using BusinessLogic.ViewModels.MyAccount; + +public partial class MyAccountDetailsPage : ContentPage +{ + + private MyAccountDetailsPageViewModel viewModel => BindingContext as MyAccountDetailsPageViewModel; + + public MyAccountDetailsPage(MyAccountDetailsPageViewModel vm) + { + InitializeComponent(); + + BindingContext = vm; + + } + + protected override async void OnAppearing() + { + base.OnAppearing(); + await viewModel.Initialise(CancellationToken.None); + } +} \ No newline at end of file diff --git a/TransactionMobile.Maui/Pages/MyAccount/MyAccountPage.xaml b/TransactionMobile.Maui/Pages/MyAccount/MyAccountPage.xaml index a02507dd..5654d22d 100644 --- a/TransactionMobile.Maui/Pages/MyAccount/MyAccountPage.xaml +++ b/TransactionMobile.Maui/Pages/MyAccount/MyAccountPage.xaml @@ -6,12 +6,16 @@ Shell.NavBarIsVisible="False"> - - -