From b7d34b6ba8dc28ffb269cf22e9dc321c82a04318 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Mon, 2 Nov 2026 15:29:54 +0000 Subject: [PATCH 1/3] wip --- .../FloatAggregateTests.cs | 2 +- .../MerchantStatementAggregateTests.cs | 4 +- .../ReconciliationAggregateTests.cs | 2 +- .../TransactionAggregateTests.cs | 2 +- .../FloatActivityAggregate.cs | 4 +- .../FloatAggregate.cs | 15 +- .../MerchantAggregate.cs | 18 +- .../MerchantDepositListAggregate.cs | 8 +- .../MerchantStatementAggregate.cs | 26 +- .../MerchantStatementForDateAggregate.cs | 20 +- .../Models/Deposit.cs | 2 +- .../Models/SettledFee.cs | 4 +- .../Models/Withdrawal.cs | 2 +- .../ReconciliationAggregate.cs | 4 +- .../SettlementAggregate.cs | 15 +- .../TransactionAggregate.cs | 27 +- .../VoucherAggregate.cs | 18 +- .../Extensions/ExtensionsTests.cs | 3 +- .../Mediator/DummyEstateManagementManager.cs | 2 +- .../Mediator/DummyTransactionDomainService.cs | 4 +- .../Mediator/DummyVoucherDomainService.cs | 2 +- .../VoucherManagementRequestHandlerTests.cs | 2 +- .../Services/TransactionDomainServiceTests.cs | 30 +- .../Common/Extensions.cs | 11 +- .../Common/TransactionHelpers.cs | 4 +- .../Manager/FeeCalculationManager.cs | 2 +- .../Manager/IFeeCalculationManager.cs | 2 +- .../Manager/ITransactionProcessorManager.cs | 2 +- .../Manager/TransactionProcessorManager.cs | 2 +- .../AgencyBanking/AgencyBankingProxy.cs | 2 +- .../AgencyBanking/BalanceEnquiryResponse.cs | 2 +- .../OperatorInterfaces/IOperatorProxy.cs | 2 +- .../OperatorInterfaces/OperatorResponse.cs | 2 +- .../PataPawaPostPay/PataPawaPostPayProxy.cs | 2 +- .../PataPawaPrePay/PataPawaPrePayProxy.cs | 10 +- .../SafaricomPinless/SafaricomPinlessProxy.cs | 4 +- .../VoucherManagementProxy.cs | 2 +- .../Requests/FloatActivityCommands.cs | 2 +- .../Requests/FloatCommands.cs | 4 +- .../Requests/MerchantQueries.cs | 2 +- .../Requests/MerchantStatementCommands.cs | 16 +- .../Requests/SettlementCommands.cs | 8 +- .../Requests/SettlementQueries.cs | 2 +- .../Requests/TransactionCommands.cs | 14 +- .../Requests/VoucherCommands.cs | 4 +- .../Services/IdGenerationService.cs | 6 +- .../Services/MerchantDomainService.cs | 2 +- .../MerchantStatementDomainService.cs | 20 +- .../Services/SettlementDomainService.cs | 2 +- .../Services/TransactionDomainService.cs | 8 +- .../Services/VoucherDomainService.cs | 4 +- .../ITransactionProcessorClient.cs | 18 +- .../TransactionProcessorClient.cs | 13 +- .../CreateFloatForContractProductRequest.cs | 46 - .../ProcessSettlementResponse.cs | 6 - .../Contract/AddProductToContractRequest.cs | 4 - ...ansactionFeeForProductToContractRequest.cs | 4 - .../Requests/Estate/AssignOperatorRequest.cs | 4 - .../Requests/Float/CreateFloatRequest.cs | 20 + .../Float/RecordFloatCreditPurchaseRequest.cs | 28 + .../Requests/Merchant/Address.cs | 4 - .../Merchant/AssignOperatorRequest.cs | 4 - .../Requests/Merchant/Contact.cs | 5 - .../Merchant/CreateMerchantRequest.cs | 4 - .../GenerateMerchantStatementRequest.cs | 6 +- .../Merchant/MakeMerchantDepositRequest.cs | 8 +- .../Merchant/MakeMerchantWithdrawalRequest.cs | 9 +- .../Merchant/MerchantOpeningRequest.cs | 36 + .../Requests/Merchant/OpeningHours.cs | 17 + .../Merchant/UpdateMerchantRequest.cs | 69 - .../CreateMerchantScheduleRequest.cs | 31 - .../MerchantScheduleMonthRequest.cs | 23 + .../UpdateMerchantScheduleRequest.cs | 17 + .../Operator/CreateOperatorRequest.cs | 4 - .../Operator/UpdateOperatorRequest.cs | 5 - .../Requests/RequestWithHostDateTime.cs | 9 + .../Transaction}/LogonTransactionRequest.cs | 6 +- .../Transaction}/OperatorTotalRequest.cs | 6 +- .../Transaction}/ReconciliationRequest.cs | 9 +- .../Transaction}/SaleTransactionRequest.cs | 6 +- .../Transaction/TransactionRequest.cs | 33 + .../Voucher}/IssueVoucherRequest.cs | 14 +- .../Voucher}/RedeemVoucherRequest.cs | 7 +- .../Responses/File/FileDetailsResponse.cs | 4 +- .../MerchantBalanceChangedEntryResponse.cs | 4 +- .../Merchant}/MerchantBalanceResponse.cs | 2 +- .../Responses/Merchant/MerchantResponse.cs | 2 +- .../Merchant/OpeningHoursResponse.cs | 16 + .../Settlement/ProcessSettlementResponse.cs | 6 + .../Settlement/SettlementFeeResponse.cs | 2 +- .../Settlement/SettlementResponse.cs | 2 +- .../Transaction}/LogonTransactionResponse.cs | 2 +- .../Transaction}/ReconciliationResponse.cs | 2 +- .../Transaction}/SaleTransactionResponse.cs | 2 +- .../Transaction/TransactionResponse.cs} | 40 +- .../Voucher}/GetVoucherResponse.cs | 10 +- .../Voucher}/IssueVoucherResponse.cs | 4 +- .../Voucher}/RedeemVoucherResponse.cs | 4 +- .../SettlementResponse.cs | 2 +- ...actionProcessor.DataTransferObjects.csproj | 2 +- .../Entities/Calendar.cs | 2 +- .../Entities/Estate.cs | 2 +- .../Entities/EstateSecurityUser.cs | 2 +- .../Entities/Event.cs | 2 +- .../Entities/File.cs | 4 +- .../Entities/FileImportLog.cs | 4 +- .../Entities/FileImportLogFile.cs | 4 +- .../Entities/Float.cs | 4 +- .../Entities/FloatActivity.cs | 4 +- .../Entities/Merchant.cs | 8 +- .../Entities/MerchantAddress.cs | 2 +- .../Entities/MerchantBalanceChangedEntry.cs | 2 +- .../MerchantBalanceProjectionState.cs | 8 +- .../Entities/MerchantContact.cs | 2 +- .../Entities/MerchantDevice.cs | 2 +- .../Entities/MerchantSecurityUser.cs | 2 +- .../Entities/MerchantSettlementFee.cs | 2 +- .../Entities/Reconciliation.cs | 4 +- .../Entities/Settlement.cs | 4 +- .../Entities/StatementHeader.cs | 14 +- .../Entities/StatementLine.cs | 4 +- .../Entities/Summary/SettlementSummary.cs | 10 +- .../Entities/TransactionTimings.cs | 8 +- .../Entities/Transactions.cs | 4 +- .../Entities/Voucher.cs | 16 +- ...338_DateTime_to_DateTimeOffset.Designer.cs | 1710 +++++++++++++++++ ...261102135338_DateTime_to_DateTimeOffset.cs | 667 +++++++ ...ManagementSqlServerContextModelSnapshot.cs | 200 +- .../MerchantBalanceHistoryEntry.cs | 2 +- .../ViewEntities/SettlementView.cs | 2 +- .../DatabaseTestFixture.cs | 2 +- .../FileImportLogEventTests.cs | 4 +- .../FloatEventTests.cs | 6 +- .../StatementEventTests.cs | 4 +- .../TransactionEventTests.cs | 8 +- .../FloatActivityDomainEvents.cs | 4 +- .../FloatDomainEvents.cs | 6 +- .../MerchantDomainEvents.cs | 12 +- .../MerchantStatementDomainEvents.cs | 22 +- .../ReconciliationDomainEvents.cs | 10 +- .../SettlementDomainEvents.cs | 8 +- .../TransactionDomainEvents.cs | 37 +- .../VoucherDomainEvents.cs | 6 +- .../EstateDetails.cs | 1 + .../SpecflowExtensions.cs | 2 + .../TransactionProcessorSteps.cs | 4 + .../Common/SpecflowExtensionsTests.cs | 11 +- .../Common/TestingContext.cs | 6 +- .../Shared/SharedSteps.cs | 8 +- TransactionProcessor.Models/CalculatedFee.cs | 4 +- .../IssueVoucherResponse.cs | 2 +- .../Merchant/Deposit.cs | 2 +- .../Merchant/Merchant.cs | 4 +- .../Merchant/MerchantStatementForDate.cs | 16 +- .../Merchant/MerchantStatementLine.cs | 2 +- .../Merchant/Withdrawal.cs | 2 +- .../RedeemVoucherResponse.cs | 2 +- .../Settlement/SettlementFeeModel.cs | 2 +- .../Settlement/SettlementModel.cs | 4 +- TransactionProcessor.Models/Transaction.cs | 2 +- TransactionProcessor.Models/Voucher.cs | 8 +- .../ProjectionHandlerTests.cs | 2 +- .../Models/MerchantBalanceChangedEntry.cs | 2 +- .../ITransactionProcessorReadRepository.cs | 4 +- .../MerchantBalanceStateRepository.cs | 2 +- .../TransactionProcessorReadRepository.cs | 4 +- .../Repository/VoucherStateRepository.cs | 50 +- .../State/MerchantBalanceState.cs | 8 +- .../State/VoucherState.cs | 24 +- ...TransactionProcessorReadModelRepository.cs | 30 +- .../TransactionControllerTests.cs | 2 + .../Factories/ModelFactoryTests.cs | 13 +- .../HandlerTests/TransactionHandlersTests.cs | 2 +- .../HandlerTests/WebHandlersTests.cs | 2 + .../Endpoints/MerchantEndpoints.cs | 1 - .../Endpoints/TransactionEndpoints.cs | 2 +- .../Endpoints/VoucherEndpoints.cs | 2 +- .../Factories/ModelFactory.cs | 10 +- .../Handlers/FloatHandlers.cs | 2 +- .../Handlers/MerchantHandlers.cs | 10 +- .../Handlers/SettlementHandlers.cs | 4 +- .../Handlers/TransactionHandlers.cs | 11 +- .../Handlers/VoucherHandlers.cs | 4 +- 183 files changed, 3194 insertions(+), 849 deletions(-) delete mode 100644 TransactionProcessor.DataTransferObjects/CreateFloatForContractProductRequest.cs delete mode 100644 TransactionProcessor.DataTransferObjects/ProcessSettlementResponse.cs create mode 100644 TransactionProcessor.DataTransferObjects/Requests/Float/CreateFloatRequest.cs create mode 100644 TransactionProcessor.DataTransferObjects/Requests/Float/RecordFloatCreditPurchaseRequest.cs create mode 100644 TransactionProcessor.DataTransferObjects/Requests/Merchant/MerchantOpeningRequest.cs create mode 100644 TransactionProcessor.DataTransferObjects/Requests/Merchant/OpeningHours.cs create mode 100644 TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/MerchantScheduleMonthRequest.cs create mode 100644 TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/UpdateMerchantScheduleRequest.cs create mode 100644 TransactionProcessor.DataTransferObjects/Requests/RequestWithHostDateTime.cs rename TransactionProcessor.DataTransferObjects/{ => Requests/Transaction}/LogonTransactionRequest.cs (91%) rename TransactionProcessor.DataTransferObjects/{ => Requests/Transaction}/OperatorTotalRequest.cs (91%) rename TransactionProcessor.DataTransferObjects/{ => Requests/Transaction}/ReconciliationRequest.cs (93%) rename TransactionProcessor.DataTransferObjects/{ => Requests/Transaction}/SaleTransactionRequest.cs (95%) create mode 100644 TransactionProcessor.DataTransferObjects/Requests/Transaction/TransactionRequest.cs rename TransactionProcessor.DataTransferObjects/{ => Requests/Voucher}/IssueVoucherRequest.cs (90%) rename TransactionProcessor.DataTransferObjects/{ => Requests/Voucher}/RedeemVoucherRequest.cs (81%) rename TransactionProcessor.DataTransferObjects/{ => Responses/Merchant}/MerchantBalanceChangedEntryResponse.cs (91%) rename TransactionProcessor.DataTransferObjects/{ => Responses/Merchant}/MerchantBalanceResponse.cs (91%) create mode 100644 TransactionProcessor.DataTransferObjects/Responses/Merchant/OpeningHoursResponse.cs create mode 100644 TransactionProcessor.DataTransferObjects/Responses/Settlement/ProcessSettlementResponse.cs rename TransactionProcessor.DataTransferObjects/{ => Responses/Transaction}/LogonTransactionResponse.cs (88%) rename TransactionProcessor.DataTransferObjects/{ => Responses/Transaction}/ReconciliationResponse.cs (88%) rename TransactionProcessor.DataTransferObjects/{ => Responses/Transaction}/SaleTransactionResponse.cs (92%) rename TransactionProcessor.DataTransferObjects/{DataTransferObject.cs => Responses/Transaction/TransactionResponse.cs} (50%) rename TransactionProcessor.DataTransferObjects/{ => Responses/Voucher}/GetVoucherResponse.cs (83%) rename TransactionProcessor.DataTransferObjects/{ => Responses/Voucher}/IssueVoucherResponse.cs (84%) rename TransactionProcessor.DataTransferObjects/{ => Responses/Voucher}/RedeemVoucherResponse.cs (81%) create mode 100644 TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.Designer.cs create mode 100644 TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.cs diff --git a/TransactionProcessor.Aggregates.Tests/FloatAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/FloatAggregateTests.cs index 460e20ca..aa409721 100644 --- a/TransactionProcessor.Aggregates.Tests/FloatAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/FloatAggregateTests.cs @@ -102,7 +102,7 @@ public void FloatAggregate_RecordCreditPurchase_DuplicateCreditPurchase_ErrorThr { Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId); aggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime); - DateTime purchaseDateTime = DateTime.Now; + DateTimeOffset purchaseDateTime = DateTimeOffset.Now; aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900); Result result = aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900); diff --git a/TransactionProcessor.Aggregates.Tests/MerchantStatementAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/MerchantStatementAggregateTests.cs index 1866dcfc..7b5d63f8 100644 --- a/TransactionProcessor.Aggregates.Tests/MerchantStatementAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/MerchantStatementAggregateTests.cs @@ -30,7 +30,7 @@ public void MerchantStatementAggregate_RecordActivityDateOnStatement_ActivityDat MerchantStatement merchantStatement = merchantStatementAggregate.GetStatement(); merchantStatement.IsCreated.ShouldBe(merchantStatement.IsCreated); - List<(Guid merchantStatementForDateId, DateTime activityDate)>? activityDates = merchantStatement.GetActivityDates(); + List<(Guid merchantStatementForDateId, DateTimeOffset activityDate)>? activityDates = merchantStatement.GetActivityDates(); activityDates.ShouldNotBeNull(); activityDates.ShouldNotBeEmpty(); activityDates.Count.ShouldBe(1); @@ -50,7 +50,7 @@ public void MerchantStatementAggregate_RecordActivityDateOnStatement_DuplicateAc MerchantStatement merchantStatement = merchantStatementAggregate.GetStatement(); merchantStatement.IsCreated.ShouldBe(merchantStatement.IsCreated); - List<(Guid merchantStatementForDateId, DateTime activityDate)>? activityDates = merchantStatement.GetActivityDates(); + List<(Guid merchantStatementForDateId, DateTimeOffset activityDate)>? activityDates = merchantStatement.GetActivityDates(); activityDates.ShouldNotBeNull(); activityDates.ShouldNotBeEmpty(); activityDates.Count.ShouldBe(1); diff --git a/TransactionProcessor.Aggregates.Tests/ReconciliationAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/ReconciliationAggregateTests.cs index 2da9f1aa..06e2490d 100644 --- a/TransactionProcessor.Aggregates.Tests/ReconciliationAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/ReconciliationAggregateTests.cs @@ -42,7 +42,7 @@ public void ReconciliationAggregate_StartReconciliation_InvalidData_ErrorThrown( { ReconciliationAggregate reconciliationAggregate = ReconciliationAggregate.Create(TestData.TransactionId); - DateTime transactionDateTime = validDateTime ? TestData.TransactionDateTime : DateTime.MinValue; + DateTimeOffset transactionDateTime = validDateTime ? TestData.TransactionDateTime : DateTime.MinValue; Guid estateId = validEstateId ? TestData.EstateId : Guid.Empty; Guid merchantId = validMerchantId ? TestData.MerchantId : Guid.Empty; diff --git a/TransactionProcessor.Aggregates.Tests/TransactionAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/TransactionAggregateTests.cs index 570d3c79..ea740bff 100644 --- a/TransactionProcessor.Aggregates.Tests/TransactionAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/TransactionAggregateTests.cs @@ -127,7 +127,7 @@ public void TransactionAggregate_StartTransaction_InvalidData_ErrorThrown(Boolea Boolean validEstateId, Boolean validMerchantId, String deviceIdentifier) { - DateTime transactionDateTime = validTransactionDateTime ? TestData.TransactionDateTime : DateTime.MinValue; + DateTimeOffset transactionDateTime = validTransactionDateTime ? TestData.TransactionDateTime : DateTime.MinValue; Guid estateId = validEstateId ? TestData.EstateId : Guid.Empty; Guid merchantId = validMerchantId ? TestData.MerchantId : Guid.Empty; diff --git a/TransactionProcessor.Aggregates/FloatActivityAggregate.cs b/TransactionProcessor.Aggregates/FloatActivityAggregate.cs index 004f48a0..f9ef0318 100644 --- a/TransactionProcessor.Aggregates/FloatActivityAggregate.cs +++ b/TransactionProcessor.Aggregates/FloatActivityAggregate.cs @@ -25,7 +25,7 @@ public static void PlayEvent(this FloatActivityAggregate aggregate, public static Result RecordCreditPurchase(this FloatActivityAggregate aggregate, Guid estateId, - DateTime activityDateTime, + DateTimeOffset activityDateTime, Decimal creditAmount, Guid creditId) { @@ -41,7 +41,7 @@ public static Result RecordCreditPurchase(this FloatActivityAggregate aggregate, public static Result RecordTransactionAgainstFloat(this FloatActivityAggregate aggregate, Guid estateId, - DateTime activityDateTime, + DateTimeOffset activityDateTime, Decimal transactionAmount, Guid transactionId) { diff --git a/TransactionProcessor.Aggregates/FloatAggregate.cs b/TransactionProcessor.Aggregates/FloatAggregate.cs index 14ad61e8..6b68fb02 100644 --- a/TransactionProcessor.Aggregates/FloatAggregate.cs +++ b/TransactionProcessor.Aggregates/FloatAggregate.cs @@ -1,7 +1,6 @@ using System.Diagnostics.CodeAnalysis; using Shared.DomainDrivenDesign.EventSourcing; using Shared.EventStore.Aggregate; -using Shared.General; using SimpleResults; using TransactionProcessor.DomainEvents; @@ -34,7 +33,7 @@ public static void PlayEvent(this FloatAggregate aggregate, FloatDomainEvents.Fl public static Result CreateFloat(this FloatAggregate aggregate, Guid estateId, - DateTime createdDateTime) + DateTimeOffset createdDateTime) { if (aggregate.IsCreated) { return Result.Success(); // Idempotent @@ -48,7 +47,7 @@ public static Result CreateFloat(this FloatAggregate aggregate, return Result.Success(); } - public static Result RecordCreditPurchase(this FloatAggregate aggregate, DateTime creditPurchasedDate, Decimal amount, Decimal costPrice) + public static Result RecordCreditPurchase(this FloatAggregate aggregate, DateTimeOffset creditPurchasedDate, Decimal amount, Decimal costPrice) { Result result = aggregate.ValidateFloatIsAlreadyCreated(); if (result.IsFailed) { @@ -81,7 +80,7 @@ public static Result ValidateFloatIsAlreadyCreated(this FloatAggregate aggregate } public static Result ValidateCreditIsNotADuplicate(this FloatAggregate aggregate, - DateTime creditPurchasedDate, + DateTimeOffset creditPurchasedDate, Decimal amount, Decimal costPrice) { Boolean isDuplicate = aggregate.Credits.Any(c => c.costPrice == costPrice && c.amount == amount && c.creditPurchasedDate == creditPurchasedDate); @@ -115,7 +114,7 @@ protected override Object GetMetadata() [ExcludeFromCodeCoverage] public FloatAggregate() { - this.Credits = new List<(DateTime creditPurchasedDate, Decimal amount, Decimal costPrice)>(); + this.Credits = new List<(DateTimeOffset creditPurchasedDate, Decimal amount, Decimal costPrice)>(); } private FloatAggregate(Guid aggregateId) @@ -124,15 +123,15 @@ private FloatAggregate(Guid aggregateId) throw new ArgumentNullException(nameof(aggregateId)); this.AggregateId = aggregateId; - this.Credits = new List<(DateTime creditPurchasedDate, Decimal amount, Decimal costPrice)>(); + this.Credits = new List<(DateTimeOffset creditPurchasedDate, Decimal amount, Decimal costPrice)>(); } - internal List<(DateTime creditPurchasedDate, Decimal amount, Decimal costPrice)> Credits; + internal List<(DateTimeOffset creditPurchasedDate, Decimal amount, Decimal costPrice)> Credits; public Boolean IsCreated { get; internal set; } public Guid EstateId { get; internal set; } - public DateTime CreatedDateTime { get; internal set; } + public DateTimeOffset CreatedDateTime { get; internal set; } public Int32 NumberOfCreditPurchases { get; internal set; } diff --git a/TransactionProcessor.Aggregates/MerchantAggregate.cs b/TransactionProcessor.Aggregates/MerchantAggregate.cs index 60970c83..95f5c518 100644 --- a/TransactionProcessor.Aggregates/MerchantAggregate.cs +++ b/TransactionProcessor.Aggregates/MerchantAggregate.cs @@ -441,13 +441,13 @@ private static void PopulateOpeningHours(this MerchantAggregate aggregate, } } - static DateTime CalculateNextSettlementDate(this MerchantAggregate aggregate, - SettlementSchedule settlementSchedule) { - DateTime nextSettlementDate = DateTime.MinValue; + static DateTimeOffset CalculateNextSettlementDate(this MerchantAggregate aggregate, + SettlementSchedule settlementSchedule) { + DateTimeOffset nextSettlementDate = DateTimeOffset.MinValue; if (settlementSchedule != SettlementSchedule.Immediate) { // Calculate next settlement date - DateTime dateForCalculation = aggregate.NextSettlementDueDate; - if (dateForCalculation == DateTime.MinValue) { + DateTimeOffset dateForCalculation = aggregate.NextSettlementDueDate; + if (dateForCalculation == DateTimeOffset.MinValue) { // No date set previously so use current date as start point dateForCalculation = DateTime.Now.Date; } @@ -476,7 +476,7 @@ public static Result SetSettlementSchedule(this MerchantAggregate aggregate, if (aggregate.SettlementSchedule == settlementSchedule) return Result.Success(); - DateTime nextSettlementDate = CalculateNextSettlementDate(aggregate, settlementSchedule); + DateTimeOffset nextSettlementDate = CalculateNextSettlementDate(aggregate, settlementSchedule); MerchantDomainEvents.SettlementScheduleChangedEvent settlementScheduleChangedEvent = new(aggregate.AggregateId, aggregate.EstateId, (Int32)settlementSchedule, nextSettlementDate); @@ -526,7 +526,7 @@ public static Result Create(this MerchantAggregate aggregate, aggregate.ApplyAndAppend(contactAddedEvent); - DateTime nextSettlementDate = CalculateNextSettlementDate(aggregate, settlementSchedule); + DateTimeOffset nextSettlementDate = CalculateNextSettlementDate(aggregate, settlementSchedule); MerchantDomainEvents.SettlementScheduleChangedEvent settlementScheduleChangedEvent = new(aggregate.AggregateId, aggregate.EstateId, (Int32)settlementSchedule, nextSettlementDate); @@ -903,9 +903,9 @@ private MerchantAggregate(Guid aggregateId) #region Properties - public DateTime DateCreated { get; internal set; } + public DateTimeOffset DateCreated { get; internal set; } - public DateTime NextSettlementDueDate { get; internal set; } + public DateTimeOffset NextSettlementDueDate { get; internal set; } public Guid EstateId { get; internal set; } diff --git a/TransactionProcessor.Aggregates/MerchantDepositListAggregate.cs b/TransactionProcessor.Aggregates/MerchantDepositListAggregate.cs index 3d2804d3..4c41925e 100644 --- a/TransactionProcessor.Aggregates/MerchantDepositListAggregate.cs +++ b/TransactionProcessor.Aggregates/MerchantDepositListAggregate.cs @@ -15,7 +15,7 @@ public static class MerchantDepositListAggregateExtensions{ public static Result Create(this MerchantDepositListAggregate aggregate, MerchantAggregate merchantAggregate, - DateTime dateCreated){ + DateTimeOffset dateCreated){ Result result = aggregate.EnsureMerchantHasBeenCreated(merchantAggregate); if (result.IsFailed) return result; @@ -62,7 +62,7 @@ public static List GetWithdrawals(this MerchantDepositListAggregate public static Result MakeDeposit(this MerchantDepositListAggregate aggregate, MerchantDepositSource source, String reference, - DateTime depositDateTime, + DateTimeOffset depositDateTime, PositiveMoney amount){ String depositData = $"{depositDateTime:yyyyMMdd hh:mm:ss.fff}-{reference}-{amount:N2}-{source}"; Guid depositId = aggregate.GenerateGuidFromString(depositData); @@ -94,7 +94,7 @@ public static Result MakeDeposit(this MerchantDepositListAggregate aggregate, } public static Result MakeWithdrawal(this MerchantDepositListAggregate aggregate, - DateTime withdrawalDateTime, + DateTimeOffset withdrawalDateTime, PositiveMoney amount){ String depositData = $"{withdrawalDateTime.ToString("yyyyMMdd hh:mm:ss.fff")}-{amount:N2}"; Guid withdrawalId = aggregate.GenerateGuidFromString(depositData); @@ -223,7 +223,7 @@ private MerchantDepositListAggregate(Guid aggregateId){ #region Properties - public DateTime DateCreated{ get; internal set; } + public DateTimeOffset DateCreated{ get; internal set; } public Guid EstateId{ get; internal set; } diff --git a/TransactionProcessor.Aggregates/MerchantStatementAggregate.cs b/TransactionProcessor.Aggregates/MerchantStatementAggregate.cs index fdd2213e..8c764ba8 100644 --- a/TransactionProcessor.Aggregates/MerchantStatementAggregate.cs +++ b/TransactionProcessor.Aggregates/MerchantStatementAggregate.cs @@ -15,16 +15,16 @@ public record MerchantStatementAggregate : Aggregate { #region Fields - internal DateTime StatementDate; + internal DateTimeOffset StatementDate; - internal DateTime EmailedDateTime; - internal DateTime BuiltDateTime; + internal DateTimeOffset EmailedDateTime; + internal DateTimeOffset BuiltDateTime; internal Guid EmailMessageId; internal Guid EstateId; - internal DateTime GeneratedDateTime; + internal DateTimeOffset GeneratedDateTime; internal Boolean HasBeenEmailed; @@ -35,7 +35,7 @@ public record MerchantStatementAggregate : Aggregate internal Guid MerchantId; - internal List<(Guid merchantStatementForDateId, DateTime activityDate)> ActivityDates; + internal List<(Guid merchantStatementForDateId, DateTimeOffset activityDate)> ActivityDates; internal List MerchantStatementSummaries; #endregion @@ -124,11 +124,11 @@ public static void PlayEvent(this MerchantStatementAggregate aggregate, public static Result RecordActivityDateOnStatement(this MerchantStatementAggregate aggregate, Guid statementId, - DateTime statementDate, + DateTimeOffset statementDate, Guid estateId, Guid merchantId, Guid merchantStatementForDateId, - DateTime activityDate) + DateTimeOffset activityDate) { if (aggregate.IsCreated == false) { if (statementId == Guid.Empty) @@ -168,7 +168,7 @@ public static MerchantStatement GetStatement(this MerchantStatementAggregate agg IsBuilt = aggregate.IsBuilt }; - foreach ((Guid merchantStatementForDateId, DateTime activityDate) aggregateActivityDate in aggregate.ActivityDates) { + foreach ((Guid merchantStatementForDateId, DateTimeOffset activityDate) aggregateActivityDate in aggregate.ActivityDates) { merchantStatement.AddStatementActivityDate(aggregateActivityDate.merchantStatementForDateId, aggregateActivityDate.activityDate); } @@ -180,7 +180,7 @@ public static MerchantStatement GetStatement(this MerchantStatementAggregate agg } public static Result BuildStatement(this MerchantStatementAggregate aggregate, - DateTime builtDateTime, + DateTimeOffset builtDateTime, String statementData) { if (aggregate.IsBuilt) @@ -198,7 +198,7 @@ public static Result BuildStatement(this MerchantStatementAggregate aggregate, } public static Result EmailStatement(this MerchantStatementAggregate aggregate, - DateTime emailedDateTime, + DateTimeOffset emailedDateTime, Guid messageId) { if (aggregate.HasBeenEmailed) { return Result.Success(); @@ -216,7 +216,7 @@ public static Result EmailStatement(this MerchantStatementAggregate aggregate, } public static Result GenerateStatement(this MerchantStatementAggregate aggregate, - DateTime generatedDateTime) + DateTimeOffset generatedDateTime) { if (aggregate.IsGenerated) return Result.Success(); @@ -250,7 +250,7 @@ private static Result EnsureStatementHasBeenBuilt(this MerchantStatementAggregat } public static Result AddDailySummaryRecord(this MerchantStatementAggregate aggregate, - DateTime activityDate, + DateTimeOffset activityDate, MerchantStatementSummaryTotals summaryTotals) { if (aggregate.MerchantStatementSummaries.Any(s => s.ActivityDate == activityDate)) { return Result.Success(); @@ -275,7 +275,7 @@ public static Result AddDailySummaryRecord(this MerchantStatementAggregate aggre } } - public record MerchantStatementSummary(DateTime ActivityDate, Int32 NumberOfTransactions, Decimal ValueOfTransactions, Int32 NumberOfSettledFees, Decimal ValueOfSettledFees); + public record MerchantStatementSummary(DateTimeOffset ActivityDate, Int32 NumberOfTransactions, Decimal ValueOfTransactions, Int32 NumberOfSettledFees, Decimal ValueOfSettledFees); public record MerchantStatementSummaryTotals(Int32 NumberOfTransactions, Decimal ValueOfTransactions, Int32 NumberOfSettledFees, diff --git a/TransactionProcessor.Aggregates/MerchantStatementForDateAggregate.cs b/TransactionProcessor.Aggregates/MerchantStatementForDateAggregate.cs index 58eec227..57948d1b 100644 --- a/TransactionProcessor.Aggregates/MerchantStatementForDateAggregate.cs +++ b/TransactionProcessor.Aggregates/MerchantStatementForDateAggregate.cs @@ -20,7 +20,7 @@ public static class MerchantStatementForDateAggregateExtensions public static Result AddSettledFeeToStatement(this MerchantStatementForDateAggregate aggregate, Guid merchantStatementId, - DateTime statementDate, + DateTimeOffset statementDate, Guid eventId, Guid estateId, Guid merchantId, @@ -39,7 +39,7 @@ public static Result AddSettledFeeToStatement(this MerchantStatementForDateAggre public static Result AddDepositToStatement(this MerchantStatementForDateAggregate aggregate, Guid merchantStatementId, - DateTime statementDate, + DateTimeOffset statementDate, Guid eventId, Guid estateId, Guid merchantId, @@ -59,7 +59,7 @@ public static Result AddDepositToStatement(this MerchantStatementForDateAggregat public static Result AddWithdrawalToStatement(this MerchantStatementForDateAggregate aggregate, Guid merchantStatementId, - DateTime statementDate, + DateTimeOffset statementDate, Guid eventId, Guid estateId, Guid merchantId, @@ -79,7 +79,7 @@ public static Result AddWithdrawalToStatement(this MerchantStatementForDateAggre public static Result AddTransactionToStatement(this MerchantStatementForDateAggregate aggregate, Guid merchantStatementId, - DateTime statementDate, + DateTimeOffset statementDate, Guid eventId, Guid estateId, Guid merchantId, @@ -106,8 +106,8 @@ public static Result AddTransactionToStatement(this MerchantStatementForDateAggr private static Result CreateStatementForDate(this MerchantStatementForDateAggregate aggregate, Guid merchantStatementId, - DateTime activityDate, - DateTime statementDate, + DateTimeOffset activityDate, + DateTimeOffset statementDate, Guid estateId, Guid merchantId) { @@ -200,7 +200,7 @@ private static void PopulateStatementLines(this MerchantStatementForDate merchan private static void AddStatementLines(this MerchantStatementForDate merchantStatement, IEnumerable source, Func amountSelector, - Func dateTimeSelector, + Func dateTimeSelector, Int32 lineType) { foreach (T item in source) @@ -210,7 +210,7 @@ private static void AddStatementLines(this MerchantStatementForDate merchantS } private static MerchantStatementLine CreateStatementLine(Decimal amount, - DateTime dateTime, + DateTimeOffset dateTime, Int32 lineType) => new() { Amount = amount, @@ -224,7 +224,7 @@ public record MerchantStatementForDateAggregate : Aggregate { #region Fields - internal DateTime ActivityDate; + internal DateTimeOffset ActivityDate; internal Guid EstateId; internal Boolean IsCreated; internal Guid MerchantId; @@ -233,7 +233,7 @@ public record MerchantStatementForDateAggregate : Aggregate internal readonly List Deposits; internal readonly List Withdrawals; internal Guid MerchantStatementId; - internal DateTime StatementDate; + internal DateTimeOffset StatementDate; #endregion #region Constructors diff --git a/TransactionProcessor.Aggregates/Models/Deposit.cs b/TransactionProcessor.Aggregates/Models/Deposit.cs index 5ab1c999..3c23967e 100644 --- a/TransactionProcessor.Aggregates/Models/Deposit.cs +++ b/TransactionProcessor.Aggregates/Models/Deposit.cs @@ -7,6 +7,6 @@ namespace TransactionProcessor.Aggregates.Models internal record Deposit(Guid DepositId, MerchantDepositSource Source, String Reference, - DateTime DepositDateTime, + DateTimeOffset DepositDateTime, Decimal Amount); } \ No newline at end of file diff --git a/TransactionProcessor.Aggregates/Models/SettledFee.cs b/TransactionProcessor.Aggregates/Models/SettledFee.cs index 405e8d19..f26a9696 100644 --- a/TransactionProcessor.Aggregates/Models/SettledFee.cs +++ b/TransactionProcessor.Aggregates/Models/SettledFee.cs @@ -3,10 +3,10 @@ namespace TransactionProcessor.Aggregates.Models { [ExcludeFromCodeCoverage] - public record SettledFee(Guid SettledFeeId, Guid TransactionId, DateTime DateTime, Decimal Amount); + public record SettledFee(Guid SettledFeeId, Guid TransactionId, DateTimeOffset DateTime, Decimal Amount); [ExcludeFromCodeCoverage] - public record Transaction(Guid TransactionId, DateTime DateTime, Decimal Amount); + public record Transaction(Guid TransactionId, DateTimeOffset DateTime, Decimal Amount); } \ No newline at end of file diff --git a/TransactionProcessor.Aggregates/Models/Withdrawal.cs b/TransactionProcessor.Aggregates/Models/Withdrawal.cs index aaf90490..93bccdd2 100644 --- a/TransactionProcessor.Aggregates/Models/Withdrawal.cs +++ b/TransactionProcessor.Aggregates/Models/Withdrawal.cs @@ -4,6 +4,6 @@ namespace TransactionProcessor.Aggregates.Models { [ExcludeFromCodeCoverage] internal record Withdrawal(Guid WithdrawalId, - DateTime WithdrawalDateTime, + DateTimeOffset WithdrawalDateTime, Decimal Amount); } \ No newline at end of file diff --git a/TransactionProcessor.Aggregates/ReconciliationAggregate.cs b/TransactionProcessor.Aggregates/ReconciliationAggregate.cs index 378e573b..b9196baa 100644 --- a/TransactionProcessor.Aggregates/ReconciliationAggregate.cs +++ b/TransactionProcessor.Aggregates/ReconciliationAggregate.cs @@ -50,7 +50,7 @@ private static Result CheckReconciliationNotAlreadyCompleted(this Reconciliation } public static Result StartReconciliation(this ReconciliationAggregate aggregate, - DateTime transactionDateTime, + DateTimeOffset transactionDateTime, Guid estateId, Guid merchantId) { if (estateId == Guid.Empty) @@ -210,7 +210,7 @@ private ReconciliationAggregate(Guid aggregateId) public Decimal TransactionValue { get; internal set; } - public DateTime TransactionDateTime { get; internal set; } + public DateTimeOffset TransactionDateTime { get; internal set; } public static ReconciliationAggregate Create(Guid aggregateId) { diff --git a/TransactionProcessor.Aggregates/SettlementAggregate.cs b/TransactionProcessor.Aggregates/SettlementAggregate.cs index 0b89ec9f..b5d40b60 100644 --- a/TransactionProcessor.Aggregates/SettlementAggregate.cs +++ b/TransactionProcessor.Aggregates/SettlementAggregate.cs @@ -11,10 +11,9 @@ namespace TransactionProcessor.Aggregates using System.Linq; using Shared.DomainDrivenDesign.EventSourcing; using Shared.EventStore.Aggregate; - using Shared.General; - + public static class SettlementAggregateExtensions{ - public static Result StartProcessing(this SettlementAggregate aggregate, DateTime dateTime){ + public static Result StartProcessing(this SettlementAggregate aggregate, DateTimeOffset dateTime){ Result result = aggregate.CheckHasBeenCreated(); if (result.IsFailed) @@ -46,7 +45,7 @@ public static Result ManuallyComplete(this SettlementAggregate aggregate){ return Result.Success(); } - public static Result MarkFeeAsSettled(this SettlementAggregate aggregate, Guid merchantId, Guid transactionId, Guid feeId, DateTime settledDate) + public static Result MarkFeeAsSettled(this SettlementAggregate aggregate, Guid merchantId, Guid transactionId, Guid feeId, DateTimeOffset settledDate) { (Guid transactionId, Guid merchantId, CalculatedFee calculatedFee) pendingFee = GetPendingFee(aggregate, merchantId, transactionId, feeId); @@ -82,7 +81,7 @@ private static (Guid transactionId, Guid merchantId, CalculatedFee calculatedFee } private static SettlementDomainEvents.MerchantFeeSettledEvent CreateMerchantFeeSettledEvent(SettlementAggregate aggregate, (Guid transactionId, Guid merchantId, CalculatedFee calculatedFee) feeDetails, - DateTime settledDate){ + DateTimeOffset settledDate){ SettlementDomainEvents.MerchantFeeSettledEvent merchantFeeSettledEvent = new SettlementDomainEvents.MerchantFeeSettledEvent(aggregate.AggregateId, aggregate.EstateId, feeDetails.merchantId, @@ -175,7 +174,7 @@ public static Result AddFee(this SettlementAggregate aggregate, } public static Result Create(this SettlementAggregate aggregate, Guid estateId,Guid merchantId, - DateTime settlementDate) + DateTimeOffset settlementDate) { if (aggregate.IsCreated) return Result.Success(); @@ -316,13 +315,13 @@ private SettlementAggregate(Guid aggregateId) public Boolean IsCreated { get; internal set; } - public DateTime SettlementDate { get; internal set; } + public DateTimeOffset SettlementDate { get; internal set; } public Boolean SettlementComplete { get; internal set; } public Boolean ProcessingStarted { get; internal set; } - public DateTime ProcessingStartedDateTime { get; internal set; } + public DateTimeOffset ProcessingStartedDateTime { get; internal set; } #endregion #region Methods diff --git a/TransactionProcessor.Aggregates/TransactionAggregate.cs b/TransactionProcessor.Aggregates/TransactionAggregate.cs index 25269a4f..aa59c367 100644 --- a/TransactionProcessor.Aggregates/TransactionAggregate.cs +++ b/TransactionProcessor.Aggregates/TransactionAggregate.cs @@ -211,10 +211,9 @@ public static Result AddProductDetails(this TransactionAggregate aggregate, Guid } public static Result AddFeePendingSettlement(this TransactionAggregate aggregate, CalculatedFee calculatedFee, - DateTime settlementDueDate) + DateTimeOffset settlementDueDate) { - if (calculatedFee == null) - { + if (calculatedFee == null) { return Result.Invalid("Calculated fee cannot be null"); } @@ -255,7 +254,7 @@ public static Result AddFeePendingSettlement(this TransactionAggregate aggregate } public static Result AddSettledFee(this TransactionAggregate aggregate, CalculatedFee calculatedFee, - DateTime settledDateTime, Guid settlementId) + DateTimeOffset settledDateTime, Guid settlementId) { if (calculatedFee == null) { return Result.Invalid("Calculated fee cannot be null"); @@ -401,10 +400,10 @@ public static Result CompleteTransaction(this TransactionAggregate aggregate) } public static Result RecordTransactionTimings(this TransactionAggregate aggregate, - DateTime TransactionStartedDateTime, - DateTime? OperatorCommunicationsStartedEvent, - DateTime? OperatorCommunicationsCompletedEvent, - DateTime TransactionCompletedDateTime) { + DateTimeOffset TransactionStartedDateTime, + DateTimeOffset? OperatorCommunicationsStartedEvent, + DateTimeOffset? OperatorCommunicationsCompletedEvent, + DateTimeOffset TransactionCompletedDateTime) { TransactionDomainEvents.TransactionTimingsAddedToTransactionEvent transactionTimingsAddedToTransactionEvent = new (aggregate.AggregateId, aggregate.EstateId, @@ -501,7 +500,7 @@ public static Result RequestEmailReceiptResend(this TransactionAggregate aggrega } public static Result StartTransaction(this TransactionAggregate aggregate, - DateTime transactionDateTime, + DateTimeOffset transactionDateTime, String transactionNumber, TransactionType transactionType, String transactionReference, @@ -535,7 +534,7 @@ public static Result StartTransaction(this TransactionAggregate aggregate, return Result.Success(); } - private static Result ValidateStartTransactionArguments(DateTime transactionDateTime, + private static Result ValidateStartTransactionArguments(DateTimeOffset transactionDateTime, String transactionNumber, TransactionType transactionType, String transactionReference, @@ -563,10 +562,10 @@ private static Result ValidateContext(TransactionStartContext transactionStartCo return Result.Success(); } - private static Result ValidateCoreFields(DateTime dateTime, string number, string reference, TransactionType transactionType) + private static Result ValidateCoreFields(DateTimeOffset dateTime, string number, string reference, TransactionType transactionType) { - if (dateTime == DateTime.MinValue) - return Result.Invalid($"Transaction Date Time must not be [{DateTime.MinValue}]"); + if (dateTime == DateTimeOffset.MinValue) + return Result.Invalid($"Transaction Date Time must not be [{DateTimeOffset.MinValue}]"); if (string.IsNullOrEmpty(number)) return Result.Invalid("Transaction Number must not be null or empty"); @@ -982,7 +981,7 @@ private TransactionAggregate(Guid aggregateId) { public Decimal? TotalCost { get; internal set; } - public DateTime TransactionDateTime { get; internal set; } + public DateTimeOffset TransactionDateTime { get; internal set; } public String TransactionNumber { get; internal set; } diff --git a/TransactionProcessor.Aggregates/VoucherAggregate.cs b/TransactionProcessor.Aggregates/VoucherAggregate.cs index 50ab6785..70991197 100644 --- a/TransactionProcessor.Aggregates/VoucherAggregate.cs +++ b/TransactionProcessor.Aggregates/VoucherAggregate.cs @@ -31,13 +31,13 @@ public static Result Generate(this VoucherAggregate aggregate, Guid operatorId, Guid estateId, Guid transactionId, - DateTime generatedDateTime, + DateTimeOffset generatedDateTime, Decimal value) { if (aggregate.IsGenerated) return Result.Success(); - if (generatedDateTime == DateTime.MinValue) + if (generatedDateTime == DateTimeOffset.MinValue) return Result.Invalid("Generated Date Time must be set"); if (operatorId == Guid.Empty) return Result.Invalid("Operator Id must not be an empty Guid"); @@ -50,7 +50,7 @@ public static Result Generate(this VoucherAggregate aggregate, // Do the generate process here... String voucherCode = aggregate.GenerateVoucherCode(); - DateTime expiryDateTime = generatedDateTime.AddDays(30); // Default to a 30 day expiry for now... + DateTimeOffset expiryDateTime = generatedDateTime.AddDays(30); // Default to a 30 day expiry for now... String message = string.Empty; VoucherDomainEvents.VoucherGeneratedEvent voucherGeneratedEvent = @@ -88,7 +88,7 @@ public static TransactionProcessor.Models.Voucher GetVoucher(this VoucherAggrega public static Result Issue(this VoucherAggregate aggregate, String recipientEmail, String recipientMobile, - DateTime issuedDateTime) + DateTimeOffset issuedDateTime) { if (aggregate.IsIssued) return Result.Success(); @@ -108,7 +108,7 @@ public static Result Issue(this VoucherAggregate aggregate, return Result.Success(); } - public static Result Redeem(this VoucherAggregate aggregate, DateTime redeemedDateTime) + public static Result Redeem(this VoucherAggregate aggregate, DateTimeOffset redeemedDateTime) { Result result = aggregate.CheckIfVoucherHasBeenGenerated(); if (result.IsFailed) @@ -213,7 +213,7 @@ public record VoucherAggregate : Aggregate internal Guid EstateId; - internal DateTime ExpiryDate; + internal DateTimeOffset ExpiryDate; internal Boolean IsGenerated; @@ -221,11 +221,11 @@ public record VoucherAggregate : Aggregate internal Boolean IsRedeemed; - internal DateTime IssuedDateTime; + internal DateTimeOffset IssuedDateTime; - internal DateTime GeneratedDateTime; + internal DateTimeOffset GeneratedDateTime; - internal DateTime RedeemedDateTime; + internal DateTimeOffset RedeemedDateTime; internal String Message; diff --git a/TransactionProcessor.BusinessLogic.Tests/Extensions/ExtensionsTests.cs b/TransactionProcessor.BusinessLogic.Tests/Extensions/ExtensionsTests.cs index 03544e86..6eaf9ec8 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Extensions/ExtensionsTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Extensions/ExtensionsTests.cs @@ -1,4 +1,5 @@ -using System; +using Shared.Extensions; +using System; namespace TransactionProcessor.BusinessLogic.Tests.Extensions { diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs index 4be0f8b8..9dba88c8 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs @@ -101,7 +101,7 @@ public async Task>> GetSettlements(Guid estateId, public async Task> GetPendingSettlement(Guid estateId, Guid merchantId, - DateTime settlementDate, + DateTimeOffset settlementDate, CancellationToken cancellationToken) { return Result.Success(new PendingSettlementModel()); } diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyTransactionDomainService.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyTransactionDomainService.cs index 1218fe1f..a54517ac 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyTransactionDomainService.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyTransactionDomainService.cs @@ -77,8 +77,8 @@ public async Task AddMerchantBalanceChangedEntry(MerchantBalanceChangedE public async Task>> GetMerchantBalanceHistory(Guid estateId, Guid merchantId, - DateTime startDate, - DateTime endDate, + DateTimeOffset startDate, + DateTimeOffset endDate, CancellationToken cancellationToken) { return Result.Success(); } diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyVoucherDomainService.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyVoucherDomainService.cs index c9763b15..3b920b43 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyVoucherDomainService.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyVoucherDomainService.cs @@ -19,7 +19,7 @@ public async Task> IssueVoucher(VoucherCommands.Iss public async Task> RedeemVoucher(Guid estateId, String voucherCode, - DateTime redeemedDateTime, + DateTimeOffset redeemedDateTime, CancellationToken cancellationToken) { return Result.Success(new RedeemVoucherResponse()); } diff --git a/TransactionProcessor.BusinessLogic.Tests/RequestHandler/VoucherManagementRequestHandlerTests.cs b/TransactionProcessor.BusinessLogic.Tests/RequestHandler/VoucherManagementRequestHandlerTests.cs index 19d08f71..b13cd588 100644 --- a/TransactionProcessor.BusinessLogic.Tests/RequestHandler/VoucherManagementRequestHandlerTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/RequestHandler/VoucherManagementRequestHandlerTests.cs @@ -41,7 +41,7 @@ public async Task VoucherManagementRequestHandler_RedeemVoucherRequest_IsHandled { IVoucherDomainServiceImposter voucherDomainService = new(); IVoucherManagementManagerImposter voucherManagementManager = new(); - voucherDomainService.RedeemVoucher(Arg.Any(), Arg.Any(), Arg.Any(), + voucherDomainService.RedeemVoucher(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()).ReturnsAsync(TestData.RedeemVoucherResponse); VoucherManagementRequestHandler handler = new VoucherManagementRequestHandler(voucherDomainService.Instance(), voucherManagementManager.Instance()); diff --git a/TransactionProcessor.BusinessLogic.Tests/Services/TransactionDomainServiceTests.cs b/TransactionProcessor.BusinessLogic.Tests/Services/TransactionDomainServiceTests.cs index 05b787b3..d8301512 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Services/TransactionDomainServiceTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Services/TransactionDomainServiceTests.cs @@ -240,7 +240,7 @@ public async Task TransactionDomainService_ProcessSaleTransaction_DeclinedByOper this.OperatorProxy.ProcessSaleMessage(Arg.Any(), Arg.Any(), Arg.Any(), - Arg.Any(), + Arg.Any(), Arg.Any(), Arg>.Any(), Arg.Any()).ReturnsAsync(new Result{Data = new OperatorResponse{ @@ -293,7 +293,7 @@ public async Task TransactionDomainService_ProcessSaleTransaction_OperatorProxyT Arg.Any(), Arg.Any()).ReturnsAsync(Result.Success(new TransactionValidationResult(TransactionResponseCode.Success, "SUCCESS"))); - this.OperatorProxy.ProcessSaleMessage(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg>.Any(), Arg.Any()).Throws(new Exception()); + this.OperatorProxy.ProcessSaleMessage(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg>.Any(), Arg.Any()).Throws(new Exception()); TransactionCommands.ProcessSaleTransactionCommand command = new TransactionCommands.ProcessSaleTransactionCommand(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.DeviceIdentifier, TestData.TransactionTypeSale.ToString(), @@ -341,7 +341,7 @@ public async Task TransactionDomainService_ProcessSaleTransaction_TransactionIsP this.OperatorProxy.ProcessSaleMessage(Arg.Any(), Arg.Any(), Arg.Any(), - Arg.Any(), + Arg.Any(), Arg.Any(), Arg>.Any(), Arg.Any()).ReturnsAsync(new OperatorResponse{ @@ -403,7 +403,7 @@ public async Task TransactionDomainService_ProcessSaleTransaction_NoFloatFound_T this.OperatorProxy.ProcessSaleMessage(Arg.Any(), Arg.Any(), Arg.Any(), - Arg.Any(), + Arg.Any(), Arg.Any(), Arg>.Any(), Arg.Any()).ReturnsAsync(new OperatorResponse @@ -570,9 +570,9 @@ public async Task TransactionDomainService_RequireFeeCalculation_ReturnsTrue() [InlineData(SettlementSchedule.Monthly, "2024-05-01", "2024-06-01")] public async Task TransactionDomainService_CalculateSettlementDate_CorrectDateReturned(SettlementSchedule settlementSchedule, String completedDateString, String expectedDateString){ - DateTime completedDate = DateTime.ParseExact(completedDateString, "yyyy-MM-dd", null); - DateTime expectedDate = DateTime.ParseExact(expectedDateString, "yyyy-MM-dd", null); - DateTime result = TransactionHelpers.CalculateSettlementDate(settlementSchedule, completedDate); + DateTimeOffset completedDate = DateTimeOffset.ParseExact(completedDateString, "yyyy-MM-dd", null); + DateTimeOffset expectedDate = DateTimeOffset.ParseExact(expectedDateString, "yyyy-MM-dd", null); + DateTimeOffset result = TransactionHelpers.CalculateSettlementDate(settlementSchedule, completedDate); result.Date.ShouldBe(expectedDate.Date); } @@ -584,7 +584,7 @@ public async Task TransactionDomainService_CalculateFeesForTransaction_FeesCalcu .ReturnsAsync(TestData.Aggregates.MerchantAggregateWithOperator()); this.SecurityServiceClient.GetToken(Arg.Any(), Arg.Any(), Arg.Any()).ReturnsAsync(Result.Success(TestData.GetTokenResponse())); this.AggregateService.Get(Arg.Any(), Arg.Any()).ReturnsAsync(TestData.Aggregates.CreatedContractAggregateWithAProductAndTransactionFee(CalculationType.Fixed, FeeType.Merchant)); - this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedMerchantFees); + this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedMerchantFees); TransactionCommands.CalculateFeesForTransactionCommand command = new(TestData.TransactionId, TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); @@ -600,7 +600,7 @@ public async Task TransactionDomainService_CalculateFeesForTransaction_MerchantW this.AggregateService.Get(Arg.Any(), Arg.Any()).ReturnsAsync(TestData.Aggregates.MerchantAggregateWithEverything(SettlementSchedule.Immediate)); this.SecurityServiceClient.GetToken(Arg.Any(), Arg.Any(), Arg.Any()).ReturnsAsync(Result.Success(TestData.GetTokenResponse())); this.AggregateService.Get(Arg.Any(), Arg.Any()).ReturnsAsync(TestData.Aggregates.CreatedContractAggregateWithAProductAndTransactionFee(CalculationType.Fixed, FeeType.Merchant)); - this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedMerchantFees); + this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedMerchantFees); TransactionCommands.CalculateFeesForTransactionCommand command = new(TestData.TransactionId, TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); @@ -617,7 +617,7 @@ public async Task TransactionDomainService_CalculateFeesForTransaction_NonMercha .ReturnsAsync(TestData.Aggregates.MerchantAggregateWithOperator()); this.SecurityServiceClient.GetToken(Arg.Any(), Arg.Any(), Arg.Any()).ReturnsAsync(Result.Success(TestData.GetTokenResponse())); this.AggregateService.Get(Arg.Any(), Arg.Any()).ReturnsAsync(TestData.Aggregates.CreatedContractAggregateWithAProductAndTransactionFee(CalculationType.Fixed, FeeType.ServiceProvider)); - this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedServiceProviderFees); + this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedServiceProviderFees); TransactionCommands.CalculateFeesForTransactionCommand command = new(TestData.TransactionId, TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); @@ -633,7 +633,7 @@ public async Task TransactionDomainService_CalculateFeesForTransaction_Transacti this.AggregateService.Get(Arg.Any(), Arg.Any()).ReturnsAsync(TestData.Aggregates.MerchantAggregateWithOperator()); this.SecurityServiceClient.GetToken(Arg.Any(), Arg.Any(), Arg.Any()).ReturnsAsync(Result.Success(TestData.GetTokenResponse())); - this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedServiceProviderFees); + this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedServiceProviderFees); TransactionCommands.CalculateFeesForTransactionCommand command = new(TestData.TransactionId, TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); @@ -652,7 +652,7 @@ public async Task TransactionDomainService_CalculateFeesForTransaction_NoFeesRet .ReturnsAsync(TestData.Aggregates.MerchantAggregateWithOperator()); this.SecurityServiceClient.GetToken(Arg.Any(), Arg.Any(), Arg.Any()).ReturnsAsync(Result.Success(TestData.GetTokenResponse())); - this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedServiceProviderFees); + this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedServiceProviderFees); TransactionCommands.CalculateFeesForTransactionCommand command = new(TestData.TransactionId, TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); @@ -867,7 +867,7 @@ public async Task TransactionDomainService_ProcessSaleTransaction_SaveFailed_Res this.OperatorProxy.ProcessSaleMessage(Arg.Any(), Arg.Any(), Arg.Any(), - Arg.Any(), + Arg.Any(), Arg.Any(), Arg>.Any(), Arg.Any()).ReturnsAsync(new OperatorResponse { @@ -909,7 +909,7 @@ public async Task TransactionDomainService_CalculateFeesForTransaction_MerchantS this.AggregateService.Get(Arg.Any(), Arg.Any()) .ReturnsAsync(TestData.Aggregates.EmptyMerchantAggregate()); this.AggregateService.Get(Arg.Any(), Arg.Any()).ReturnsAsync(TestData.Aggregates.CreatedContractAggregateWithAProductAndTransactionFee(CalculationType.Fixed, FeeType.Merchant)); - this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedMerchantFees); + this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedMerchantFees); TransactionCommands.CalculateFeesForTransactionCommand command = new(TestData.TransactionId, TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); @@ -925,7 +925,7 @@ public async Task TransactionDomainService_CalculateFeesForTransaction_SaveFaile this.AggregateService.Get(Arg.Any(), Arg.Any()) .ReturnsAsync(TestData.Aggregates.MerchantAggregateWithOperator()); this.AggregateService.Get(Arg.Any(), Arg.Any()).ReturnsAsync(TestData.Aggregates.CreatedContractAggregateWithAProductAndTransactionFee(CalculationType.Fixed, FeeType.Merchant)); - this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedMerchantFees); + this.FeeCalculationManager.CalculateFees(Arg>.Any(), Arg.Any(), Arg.Any()).Returns(TestData.CalculatedMerchantFees); TransactionCommands.CalculateFeesForTransactionCommand command = new(TestData.TransactionId, TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); diff --git a/TransactionProcessor.BusinessLogic/Common/Extensions.cs b/TransactionProcessor.BusinessLogic/Common/Extensions.cs index c318043a..62a926cd 100644 --- a/TransactionProcessor.BusinessLogic/Common/Extensions.cs +++ b/TransactionProcessor.BusinessLogic/Common/Extensions.cs @@ -17,10 +17,9 @@ namespace TransactionProcessor.BusinessLogic.Common [ExcludeFromCodeCoverage] public static class Helpers { - public static Guid CalculateSettlementAggregateId(DateTime settlementDate, - Guid merchantId, - Guid estateId) - { + public static Guid CalculateSettlementAggregateId(DateTimeOffset settlementDate, + Guid merchantId, + Guid estateId) { Guid aggregateId = GuidCalculator.Combine(estateId, merchantId, settlementDate.ToGuid()); return aggregateId; } @@ -84,7 +83,7 @@ public static T ExtractFieldFromMetadata(this Dictionary addi return default(T); } - public static Guid ToGuid(this DateTime dt) + public static Guid ToGuid(this DateTimeOffset dt) { var bytes = BitConverter.GetBytes(dt.Ticks); @@ -93,7 +92,7 @@ public static Guid ToGuid(this DateTime dt) return new Guid(bytes); } - public static DateTime ToDateTime(this Guid guid) + public static DateTimeOffset ToDateTimeOffset(this Guid guid) { var bytes = guid.ToByteArray(); diff --git a/TransactionProcessor.BusinessLogic/Common/TransactionHelpers.cs b/TransactionProcessor.BusinessLogic/Common/TransactionHelpers.cs index 51ca44c6..8a5c72c3 100644 --- a/TransactionProcessor.BusinessLogic/Common/TransactionHelpers.cs +++ b/TransactionProcessor.BusinessLogic/Common/TransactionHelpers.cs @@ -29,8 +29,8 @@ public static string GenerateAuthCode() return hex.Substring(0, 8); } - public static DateTime CalculateSettlementDate(Models.Merchant.SettlementSchedule merchantSettlementSchedule, - DateTime completeDateTime) + public static DateTimeOffset CalculateSettlementDate(Models.Merchant.SettlementSchedule merchantSettlementSchedule, + DateTimeOffset completeDateTime) { if (merchantSettlementSchedule == Models.Merchant.SettlementSchedule.Weekly) { diff --git a/TransactionProcessor.BusinessLogic/Manager/FeeCalculationManager.cs b/TransactionProcessor.BusinessLogic/Manager/FeeCalculationManager.cs index 25a637a8..690286c7 100644 --- a/TransactionProcessor.BusinessLogic/Manager/FeeCalculationManager.cs +++ b/TransactionProcessor.BusinessLogic/Manager/FeeCalculationManager.cs @@ -22,7 +22,7 @@ public class FeeCalculationManager : IFeeCalculationManager /// public List CalculateFees(List feeList, Decimal transactionAmount, - DateTime calculationDateTime = new DateTime()) + DateTimeOffset calculationDateTime = new DateTimeOffset()) { List calculatedFees = new List(); diff --git a/TransactionProcessor.BusinessLogic/Manager/IFeeCalculationManager.cs b/TransactionProcessor.BusinessLogic/Manager/IFeeCalculationManager.cs index a53b8abe..89937117 100644 --- a/TransactionProcessor.BusinessLogic/Manager/IFeeCalculationManager.cs +++ b/TransactionProcessor.BusinessLogic/Manager/IFeeCalculationManager.cs @@ -20,7 +20,7 @@ public interface IFeeCalculationManager /// List CalculateFees(List feeList, Decimal transactionAmount, - DateTime calculationDateTime = new DateTime()); + DateTimeOffset calculationDateTime = new DateTimeOffset()); #endregion } diff --git a/TransactionProcessor.BusinessLogic/Manager/ITransactionProcessorManager.cs b/TransactionProcessor.BusinessLogic/Manager/ITransactionProcessorManager.cs index e89d9f15..7b897ef9 100644 --- a/TransactionProcessor.BusinessLogic/Manager/ITransactionProcessorManager.cs +++ b/TransactionProcessor.BusinessLogic/Manager/ITransactionProcessorManager.cs @@ -70,7 +70,7 @@ Task>> GetSettlements(Guid estateId, Task> GetPendingSettlement(Guid estateId, Guid merchantId, - DateTime settlementDate, + DateTimeOffset settlementDate, CancellationToken cancellationToken); #endregion diff --git a/TransactionProcessor.BusinessLogic/Manager/TransactionProcessorManager.cs b/TransactionProcessor.BusinessLogic/Manager/TransactionProcessorManager.cs index e5b90391..25d5270e 100644 --- a/TransactionProcessor.BusinessLogic/Manager/TransactionProcessorManager.cs +++ b/TransactionProcessor.BusinessLogic/Manager/TransactionProcessorManager.cs @@ -309,7 +309,7 @@ public async Task>> GetSettlements(Guid estateId, public async Task> GetPendingSettlement(Guid estateId, Guid merchantId, - DateTime settlementDate, + DateTimeOffset settlementDate, CancellationToken cancellationToken) { Guid aggregateId = Helpers.CalculateSettlementAggregateId(settlementDate, merchantId, estateId); diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/AgencyBanking/AgencyBankingProxy.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/AgencyBanking/AgencyBankingProxy.cs index 7a5ce771..00127d35 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/AgencyBanking/AgencyBankingProxy.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/AgencyBanking/AgencyBankingProxy.cs @@ -37,7 +37,7 @@ public async Task> ProcessLogonMessage(CancellationToke public async Task> ProcessSaleMessage(Guid transactionId, Guid operatorId, Merchant merchant, - DateTime transactionDateTime, + DateTimeOffset transactionDateTime, String transactionReference, Dictionary additionalTransactionMetadata, CancellationToken cancellationToken) { diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/AgencyBanking/BalanceEnquiryResponse.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/AgencyBanking/BalanceEnquiryResponse.cs index 1d035326..b2f1e25d 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/AgencyBanking/BalanceEnquiryResponse.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/AgencyBanking/BalanceEnquiryResponse.cs @@ -84,7 +84,7 @@ public class MiniStatementResponse public class MiniStatementItem { - public DateTime TransactionDate { get; set; } + public DateTimeOffset TransactionDate { get; set; } public string TransactionType { get; set; } diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/IOperatorProxy.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/IOperatorProxy.cs index 7afa6f9d..95610311 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/IOperatorProxy.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/IOperatorProxy.cs @@ -18,7 +18,7 @@ public interface IOperatorProxy Task> ProcessSaleMessage(Guid transactionId, Guid operatorId, Models.Merchant.Merchant merchant, - DateTime transactionDateTime, + DateTimeOffset transactionDateTime, String transactionReference, Dictionary additionalTransactionMetadata, CancellationToken cancellationToken); diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/OperatorResponse.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/OperatorResponse.cs index 2b063f00..ed221ae1 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/OperatorResponse.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/OperatorResponse.cs @@ -29,7 +29,7 @@ public class OperatorResponse public class OperatorStatementLine { - public DateTime TransactionDate { get; set; } + public DateTimeOffset TransactionDate { get; set; } public string TransactionType { get; set; } diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPostPay/PataPawaPostPayProxy.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPostPay/PataPawaPostPayProxy.cs index a6f58bba..e4339c37 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPostPay/PataPawaPostPayProxy.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPostPay/PataPawaPostPayProxy.cs @@ -86,7 +86,7 @@ private void PostEvictionCallback(Object key, public async Task> ProcessSaleMessage(Guid transactionId, Guid operatorId, Models.Merchant.Merchant merchant, - DateTime transactionDateTime, + DateTimeOffset transactionDateTime, String transactionReference, Dictionary additionalTransactionMetadata, CancellationToken cancellationToken) { diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPrePay/PataPawaPrePayProxy.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPrePay/PataPawaPrePayProxy.cs index 5d7c7c85..086b5e7e 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPrePay/PataPawaPrePayProxy.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPrePay/PataPawaPrePayProxy.cs @@ -72,7 +72,7 @@ public async Task> ProcessLogonMessage(CancellationToke } public async Task> ProcessSaleMessage(Guid transactionId, Guid operatorId, - Models.Merchant.Merchant merchant, DateTime transactionDateTime, String transactionReference, Dictionary additionalTransactionMetadata, CancellationToken cancellationToken){ + Models.Merchant.Merchant merchant, DateTimeOffset transactionDateTime, String transactionReference, Dictionary additionalTransactionMetadata, CancellationToken cancellationToken){ // Get the logon response for the operator OperatorResponse logonResponse = this.MemoryCache.Get("PataPawaPrePayLogon"); if (logonResponse == null) { @@ -291,12 +291,12 @@ private void PostEvictionCallback(Object key, } } - public class DateTimeSpaceConverter : JsonConverter + public class DateTimeSpaceConverter : JsonConverter { private static readonly string[] AcceptedFormats = new[] { "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd H:mm:ss", "yyyy-MM-ddTHH:mm:ss", "yyyy-MM-ddTHH:mm:ss.FFFFFFFK", "o" // ISO 8601 round-trip }; - public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType == JsonTokenType.Null) { @@ -314,7 +314,7 @@ public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, Jso return dtExact; // Fall back to general parse - if (DateTime.TryParse(s, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out var dt)) + if (DateTimeOffset.TryParse(s, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out var dt)) return dt; throw new JsonException($"Unable to parse DateTime: '{s}'."); @@ -329,7 +329,7 @@ public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, Jso throw new JsonException($"Unexpected token parsing DateTime. Token: {reader.TokenType}"); } - public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) { // Write in the same "space" format so round-trip matches your input writer.WriteStringValue(value.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture)); diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/SafaricomPinless/SafaricomPinlessProxy.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/SafaricomPinless/SafaricomPinlessProxy.cs index 7f49a283..bf7c790e 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/SafaricomPinless/SafaricomPinlessProxy.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/SafaricomPinless/SafaricomPinlessProxy.cs @@ -73,7 +73,7 @@ public async Task> ProcessLogonMessage(CancellationToke public async Task> ProcessSaleMessage(Guid transactionId, Guid operatorId, Models.Merchant.Merchant merchant, - DateTime transactionDateTime, + DateTimeOffset transactionDateTime, String transactionReference, Dictionary additionalTransactionMetadata, CancellationToken cancellationToken) @@ -144,7 +144,7 @@ public async Task> ProcessSaleMessage(Guid transactionI /// The customer msisdn. /// The transaction amount. /// - private String BuildRequest(DateTime transactionDateTime, + private String BuildRequest(DateTimeOffset transactionDateTime, String externalReference, String customerMsisdn, Decimal transactionAmount) diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/VoucherManagement/VoucherManagementProxy.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/VoucherManagement/VoucherManagementProxy.cs index 97cf19ab..21f93306 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/VoucherManagement/VoucherManagementProxy.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/VoucherManagement/VoucherManagementProxy.cs @@ -33,7 +33,7 @@ public async Task> ProcessLogonMessage(CancellationToke public async Task> ProcessSaleMessage(Guid transactionId, Guid operatorId, Models.Merchant.Merchant merchant, - DateTime transactionDateTime, + DateTimeOffset transactionDateTime, String transactionReference, Dictionary additionalTransactionMetadata, CancellationToken cancellationToken) diff --git a/TransactionProcessor.BusinessLogic/Requests/FloatActivityCommands.cs b/TransactionProcessor.BusinessLogic/Requests/FloatActivityCommands.cs index 590a39c2..b1f0b2de 100644 --- a/TransactionProcessor.BusinessLogic/Requests/FloatActivityCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/FloatActivityCommands.cs @@ -7,7 +7,7 @@ namespace TransactionProcessor.BusinessLogic.Requests; [ExcludeFromCodeCoverage] public record FloatActivityCommands { - public record RecordCreditPurchaseCommand(Guid EstateId, Guid FloatId, DateTime CreditPurchasedDateTime, Decimal Amount, Guid CreditId) : IRequest; + public record RecordCreditPurchaseCommand(Guid EstateId, Guid FloatId, DateTimeOffset CreditPurchasedDateTime, Decimal Amount, Guid CreditId) : IRequest; public record RecordTransactionCommand(Guid EstateId, Guid TransactionId) : IRequest; } \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic/Requests/FloatCommands.cs b/TransactionProcessor.BusinessLogic/Requests/FloatCommands.cs index f5a026b8..d8cc7022 100644 --- a/TransactionProcessor.BusinessLogic/Requests/FloatCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/FloatCommands.cs @@ -9,11 +9,11 @@ namespace TransactionProcessor.BusinessLogic.Requests; public record FloatCommands { public record CreateFloatCommand(Guid EstateId, Guid FloatId, - DateTime CreateDateTime) : IRequest; + DateTimeOffset CreateDateTime) : IRequest; public record RecordCreditPurchaseForFloatCommand(Guid EstateId, Guid FloatId, Decimal CreditAmount, Decimal CostPrice, - DateTime PurchaseDateTime) : IRequest; + DateTimeOffset PurchaseDateTime) : IRequest; } \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic/Requests/MerchantQueries.cs b/TransactionProcessor.BusinessLogic/Requests/MerchantQueries.cs index c63d37fc..c2a76aec 100644 --- a/TransactionProcessor.BusinessLogic/Requests/MerchantQueries.cs +++ b/TransactionProcessor.BusinessLogic/Requests/MerchantQueries.cs @@ -15,7 +15,7 @@ public record GetMerchantBalanceQuery(Guid EstateId, Guid MerchantId) : IRequest public record GetMerchantLiveBalanceQuery(Guid MerchantId) : IRequest>; - public record GetMerchantBalanceHistoryQuery(Guid EstateId, Guid MerchantId, DateTime StartDate, DateTime EndDate) + public record GetMerchantBalanceHistoryQuery(Guid EstateId, Guid MerchantId, DateTimeOffset StartDate, DateTimeOffset EndDate) : IRequest>>; public record GetMerchantQuery(Guid EstateId, Guid MerchantId) : IRequest>; diff --git a/TransactionProcessor.BusinessLogic/Requests/MerchantStatementCommands.cs b/TransactionProcessor.BusinessLogic/Requests/MerchantStatementCommands.cs index 74e47743..355d27e1 100644 --- a/TransactionProcessor.BusinessLogic/Requests/MerchantStatementCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/MerchantStatementCommands.cs @@ -10,7 +10,7 @@ namespace TransactionProcessor.BusinessLogic.Requests; public record MerchantStatementCommands { public record AddTransactionToMerchantStatementCommand(Guid EstateId, Guid MerchantId, - DateTime TransactionDateTime, + DateTimeOffset TransactionDateTime, Money? TransactionAmount, Boolean IsAuthorised, Guid TransactionId) : IRequest; @@ -18,14 +18,14 @@ public record AddTransactionToMerchantStatementCommand(Guid EstateId, public record AddDepositToMerchantStatementCommand(Guid EstateId, Guid MerchantId, Guid DepositId, - String Reference, - DateTime DepositDateTime, + String Reference, + DateTimeOffset DepositDateTime, PositiveMoney Amount) : IRequest; public record AddWithdrawalToMerchantStatementCommand(Guid EstateId, Guid MerchantId, - Guid WithdrawalId, - DateTime WithdrawalDateTime, + Guid WithdrawalId, + DateTimeOffset WithdrawalDateTime, PositiveMoney Amount) : IRequest; public record BuildMerchantStatementCommand(Guid EstateId, @@ -38,7 +38,7 @@ public record EmailMerchantStatementCommand(Guid EstateId, public record AddSettledFeeToMerchantStatementCommand(Guid EstateId, Guid MerchantId, - DateTime SettledDateTime, + DateTimeOffset SettledDateTime, PositiveMoney SettledAmount, Guid TransactionId, Guid SettledFeeId) : IRequest; @@ -46,7 +46,7 @@ public record AddSettledFeeToMerchantStatementCommand(Guid EstateId, public record RecordActivityDateOnMerchantStatementCommand(Guid EstateId, Guid MerchantId, Guid MerchantStatementId, - DateTime StatementDate, + DateTimeOffset StatementDate, Guid MerchantStatementForDateId, - DateTime StatementActivityDate) : IRequest; + DateTimeOffset StatementActivityDate) : IRequest; } \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic/Requests/SettlementCommands.cs b/TransactionProcessor.BusinessLogic/Requests/SettlementCommands.cs index c55c1162..65aff1a0 100644 --- a/TransactionProcessor.BusinessLogic/Requests/SettlementCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/SettlementCommands.cs @@ -7,18 +7,18 @@ namespace TransactionProcessor.BusinessLogic.Requests; [ExcludeFromCodeCoverage] public record SettlementCommands { - public record ProcessSettlementCommand(DateTime SettlementDate, Guid MerchantId, Guid EstateId) + public record ProcessSettlementCommand(DateTimeOffset SettlementDate, Guid MerchantId, Guid EstateId) : IRequest>; public record AddMerchantFeePendingSettlementCommand(Guid TransactionId, Decimal CalculatedValue, - DateTime FeeCalculatedDateTime, + DateTimeOffset FeeCalculatedDateTime, CalculationType FeeCalculationType, Guid FeeId, Decimal FeeValue, - DateTime SettlementDueDate, + DateTimeOffset SettlementDueDate, Guid MerchantId, Guid EstateId) : IRequest; - public record AddSettledFeeToSettlementCommand(DateTime SettledDate, Guid MerchantId, Guid EstateId, Guid FeeId, Guid TransactionId) : IRequest; + public record AddSettledFeeToSettlementCommand(DateTimeOffset SettledDate, Guid MerchantId, Guid EstateId, Guid FeeId, Guid TransactionId) : IRequest; } \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic/Requests/SettlementQueries.cs b/TransactionProcessor.BusinessLogic/Requests/SettlementQueries.cs index 8ac52dce..74736ec7 100644 --- a/TransactionProcessor.BusinessLogic/Requests/SettlementQueries.cs +++ b/TransactionProcessor.BusinessLogic/Requests/SettlementQueries.cs @@ -9,7 +9,7 @@ namespace TransactionProcessor.BusinessLogic.Requests; [ExcludeFromCodeCoverage] public record SettlementQueries { - public record GetPendingSettlementQuery(DateTime SettlementDate, Guid MerchantId, Guid EstateId) + public record GetPendingSettlementQuery(DateTimeOffset SettlementDate, Guid MerchantId, Guid EstateId) : IRequest>; public record GetSettlementQuery(Guid EstateId, Guid MerchantId, Guid SettlementId) : IRequest>; diff --git a/TransactionProcessor.BusinessLogic/Requests/TransactionCommands.cs b/TransactionProcessor.BusinessLogic/Requests/TransactionCommands.cs index 479de742..190bfbd8 100644 --- a/TransactionProcessor.BusinessLogic/Requests/TransactionCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/TransactionCommands.cs @@ -15,16 +15,16 @@ public record ProcessLogonTransactionCommand(Guid TransactionId, Guid MerchantId, String DeviceIdentifier, String TransactionType, - DateTime TransactionDateTime, + DateTimeOffset TransactionDateTime, String TransactionNumber, - DateTime TransactionReceivedDateTime) + DateTimeOffset TransactionReceivedDateTime) : IRequest>; public record ProcessReconciliationCommand(Guid TransactionId, Guid EstateId, Guid MerchantId, String DeviceIdentifier, - DateTime TransactionDateTime, + DateTimeOffset TransactionDateTime, Int32 TransactionCount, Decimal TransactionValue) : IRequest>; @@ -34,7 +34,7 @@ public record ProcessSaleTransactionCommand(Guid TransactionId, Guid MerchantId, String DeviceIdentifier, String TransactionType, - DateTime TransactionDateTime, + DateTimeOffset TransactionDateTime, String TransactionNumber, Guid OperatorId, String CustomerEmailAddress, @@ -42,14 +42,14 @@ public record ProcessSaleTransactionCommand(Guid TransactionId, Guid ContractId, Guid ProductId, Int32 TransactionSource, - DateTime TransactionReceivedDateTime) + DateTimeOffset TransactionReceivedDateTime) : IRequest>; public record ResendTransactionReceiptCommand(Guid TransactionId, Guid EstateId) : IRequest; - public record CalculateFeesForTransactionCommand(Guid TransactionId, DateTime CompletedDateTime, Guid EstateId, Guid MerchantId) : IRequest; + public record CalculateFeesForTransactionCommand(Guid TransactionId, DateTimeOffset CompletedDateTime, Guid EstateId, Guid MerchantId) : IRequest; - public record AddSettledMerchantFeeCommand(Guid TransactionId, Decimal CalculatedValue, DateTime FeeCalculatedDateTime, CalculationType FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTime SettledDateTime, Guid SettlementId) : IRequest; + public record AddSettledMerchantFeeCommand(Guid TransactionId, Decimal CalculatedValue, DateTimeOffset FeeCalculatedDateTime, CalculationType FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTimeOffset SettledDateTime, Guid SettlementId) : IRequest; public record SendCustomerEmailReceiptCommand(Guid EstateId, Guid TransactionId, Guid EventId, String CustomerEmailAddress) : IRequest; public record ResendCustomerEmailReceiptCommand(Guid EstateId, Guid TransactionId) : IRequest; diff --git a/TransactionProcessor.BusinessLogic/Requests/VoucherCommands.cs b/TransactionProcessor.BusinessLogic/Requests/VoucherCommands.cs index c60bd198..f3dcb7a1 100644 --- a/TransactionProcessor.BusinessLogic/Requests/VoucherCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/VoucherCommands.cs @@ -12,11 +12,11 @@ public record IssueVoucherCommand(Guid VoucherId, Guid OperatorId, Guid EstateId, Guid TransactionId, - DateTime IssuedDateTime, + DateTimeOffset IssuedDateTime, Decimal Value, String RecipientEmail, String RecipientMobile) : IRequest>; - public record RedeemVoucherCommand(Guid EstateId, String VoucherCode, DateTime RedeemedDateTime) + public record RedeemVoucherCommand(Guid EstateId, String VoucherCode, DateTimeOffset RedeemedDateTime) : IRequest>; } \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic/Services/IdGenerationService.cs b/TransactionProcessor.BusinessLogic/Services/IdGenerationService.cs index f8d90863..1115c49b 100644 --- a/TransactionProcessor.BusinessLogic/Services/IdGenerationService.cs +++ b/TransactionProcessor.BusinessLogic/Services/IdGenerationService.cs @@ -31,7 +31,7 @@ public class IdGenerationService public static Guid GenerateEventId(Object o) => IdGenerationService.GenerateUniqueId(o); - public static Guid GenerateFloatActivityAggregateId(Guid estateId, Guid floatId, DateTime dateTime) => + public static Guid GenerateFloatActivityAggregateId(Guid estateId, Guid floatId, DateTimeOffset dateTime) => IdGenerationService.GenerateUniqueId(new { estateId, @@ -39,7 +39,7 @@ public static Guid GenerateFloatActivityAggregateId(Guid estateId, Guid floatId, dateTime }); - public static Guid GenerateMerchantStatementForDateAggregateId(Guid estateId, Guid merchantId, DateTime nextStatementDateTime, DateTime activityDateTime) => + public static Guid GenerateMerchantStatementForDateAggregateId(Guid estateId, Guid merchantId, DateTimeOffset nextStatementDateTime, DateTimeOffset activityDateTime) => IdGenerationService.GenerateUniqueId(new { estateId, @@ -48,7 +48,7 @@ public static Guid GenerateMerchantStatementForDateAggregateId(Guid estateId, Gu activityDate = activityDateTime.Date }); - public static Guid GenerateMerchantStatementAggregateId(Guid estateId, Guid merchantId, DateTime nextStatementDateTime) => + public static Guid GenerateMerchantStatementAggregateId(Guid estateId, Guid merchantId, DateTimeOffset nextStatementDateTime) => IdGenerationService.GenerateUniqueId(new { estateId, diff --git a/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs b/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs index 04ff132f..3ab325fc 100644 --- a/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs @@ -191,7 +191,7 @@ private MerchantDepositSource ConvertDepositSource(DataTransferObjects.Requests. private Result EnsureMerchantDepositListCreated(MerchantDepositListAggregate merchantDepositListAggregate, MerchantAggregate merchantAggregate, - DateTime depositDateTime) { + DateTimeOffset depositDateTime) { if (merchantDepositListAggregate.IsCreated) { return Result.Success(); } diff --git a/TransactionProcessor.BusinessLogic/Services/MerchantStatementDomainService.cs b/TransactionProcessor.BusinessLogic/Services/MerchantStatementDomainService.cs index 4f67d098..03a2222e 100644 --- a/TransactionProcessor.BusinessLogic/Services/MerchantStatementDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/MerchantStatementDomainService.cs @@ -68,7 +68,7 @@ public async Task AddSettledFeeToStatement(MerchantStatementCommands.Add { try { // Work out the next statement date - DateTime nextStatementDate = CalculateStatementDate(command.SettledDateTime); + DateTimeOffset nextStatementDate = CalculateStatementDate(command.SettledDateTime); Guid merchantStatementId = IdGenerationService.GenerateMerchantStatementAggregateId(command.EstateId, command.MerchantId, nextStatementDate); Guid merchantStatementForDateId = IdGenerationService.GenerateMerchantStatementForDateAggregateId(command.EstateId, command.MerchantId, nextStatementDate, command.SettledDateTime); @@ -101,18 +101,18 @@ public async Task AddSettledFeeToStatement(MerchantStatementCommands.Add } } - internal static DateTime CalculateStatementDate(DateTime eventDateTime) + internal static DateTimeOffset CalculateStatementDate(DateTimeOffset eventDateTime) { - DateTime calculatedDateTime = eventDateTime.Date.AddMonths(1); + DateTimeOffset calculatedDateTime = eventDateTime.Date.AddMonths(1); - return new DateTime(calculatedDateTime.Year, calculatedDateTime.Month, 1); + return new DateTimeOffset(calculatedDateTime.Year, calculatedDateTime.Month, 1,0,0,0,TimeSpan.Zero); } public async Task GenerateStatement(MerchantCommands.GenerateMerchantStatementCommand command, CancellationToken cancellationToken) { try { // Need to rebuild the date time from the command as the Kind is Utc which is different from the date time used to generate the statement id - DateTime dt = new DateTime(command.RequestDto.MerchantStatementDate.Year, command.RequestDto.MerchantStatementDate.Month, command.RequestDto.MerchantStatementDate.Day); + DateTimeOffset dt = new DateTimeOffset(new DateTime(command.RequestDto.MerchantStatementDate.Year, command.RequestDto.MerchantStatementDate.Month, command.RequestDto.MerchantStatementDate.Day),TimeSpan.Zero); Guid merchantStatementId = IdGenerationService.GenerateMerchantStatementAggregateId(command.EstateId, command.MerchantId, dt); Result getMerchantStatementResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.GetLatest(merchantStatementId, ct), merchantStatementId, cancellationToken); @@ -122,10 +122,10 @@ public async Task GenerateStatement(MerchantCommands.GenerateMerchantSta MerchantStatementAggregate merchantStatementAggregate = getMerchantStatementResult.Data; MerchantStatement statement = merchantStatementAggregate.GetStatement(); - List<(Guid merchantStatementForDateId, DateTime activityDate)> activityDates = statement.GetActivityDates(); + List<(Guid merchantStatementForDateId, DateTimeOffset activityDate)> activityDates = statement.GetActivityDates(); List statementForDateAggregates = new(); - foreach ((Guid merchantStatementForDateId, DateTime activityDate) activityDate in activityDates) { + foreach ((Guid merchantStatementForDateId, DateTimeOffset activityDate) activityDate in activityDates) { Result statementForDateResult = await this.AggregateService.GetLatest(activityDate.merchantStatementForDateId, cancellationToken); if (statementForDateResult.IsFailed) return ResultHelpers.CreateFailure(statementForDateResult); @@ -348,7 +348,7 @@ public async Task AddDepositToStatement(MerchantStatementCommands.AddDep try { // Work out the next statement date - DateTime nextStatementDate = CalculateStatementDate(command.DepositDateTime.Date); + DateTimeOffset nextStatementDate = CalculateStatementDate(command.DepositDateTime.Date); Guid merchantStatementId = IdGenerationService.GenerateMerchantStatementAggregateId(command.EstateId, command.MerchantId, nextStatementDate); Guid merchantStatementForDateId = IdGenerationService.GenerateMerchantStatementForDateAggregateId(command.EstateId, command.MerchantId, nextStatementDate, command.DepositDateTime.Date); @@ -389,7 +389,7 @@ public async Task AddWithdrawalToStatement(MerchantStatementCommands.Add try { // Work out the next statement date - DateTime nextStatementDate = CalculateStatementDate(command.WithdrawalDateTime.Date); + DateTimeOffset nextStatementDate = CalculateStatementDate(command.WithdrawalDateTime.Date); Guid merchantStatementId = IdGenerationService.GenerateMerchantStatementAggregateId(command.EstateId, command.MerchantId, nextStatementDate); Guid merchantStatementForDateId = IdGenerationService.GenerateMerchantStatementForDateAggregateId(command.EstateId, command.MerchantId, nextStatementDate, command.WithdrawalDateTime.Date); @@ -437,7 +437,7 @@ public async Task AddTransactionToStatement(MerchantStatementCommands.Ad return Result.Success(); // Work out the next statement date - DateTime nextStatementDate = CalculateStatementDate(command.TransactionDateTime); + DateTimeOffset nextStatementDate = CalculateStatementDate(command.TransactionDateTime); Guid merchantStatementId = IdGenerationService.GenerateMerchantStatementAggregateId(command.EstateId, command.MerchantId, nextStatementDate); Guid merchantStatementForDateId = IdGenerationService.GenerateMerchantStatementForDateAggregateId(command.EstateId, command.MerchantId, nextStatementDate, command.TransactionDateTime); diff --git a/TransactionProcessor.BusinessLogic/Services/SettlementDomainService.cs b/TransactionProcessor.BusinessLogic/Services/SettlementDomainService.cs index 7b7a881f..9a4371ef 100644 --- a/TransactionProcessor.BusinessLogic/Services/SettlementDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/SettlementDomainService.cs @@ -101,7 +101,7 @@ private async Task> ProcessSettlementInternal(SettlementCommands.Pr } private async Task> ProcessSettlementFees(List<(Guid transactionId, Guid merchantId, CalculatedFee calculatedFee)> feesToBeSettled, - DateTime settlementDate, + DateTimeOffset settlementDate, Guid settlementAggregateId, CancellationToken cancellationToken) { List failedResults = new(); diff --git a/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs b/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs index 5cc13c54..f95bc871 100644 --- a/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs @@ -363,7 +363,7 @@ private void ApplyNonMerchantFees(TransactionAggregate transactionAggregate, private Result ApplyMerchantFees(TransactionAggregate transactionAggregate, Merchant merchant, IEnumerable calculatedFees, - DateTime completedDateTime, + DateTimeOffset completedDateTime, Guid merchantId, Guid estateId) { foreach (CalculatedFee calculatedFee in calculatedFees) { @@ -378,10 +378,10 @@ private Result ApplyMerchantFees(TransactionAggregate transactionAggregate, private Result ApplyMerchantFee(TransactionAggregate transactionAggregate, Merchant merchant, CalculatedFee calculatedFee, - DateTime completedDateTime, + DateTimeOffset completedDateTime, Guid merchantId, Guid estateId) { - DateTime settlementDate = TransactionHelpers.CalculateSettlementDate(merchant.SettlementSchedule, completedDateTime); + DateTimeOffset settlementDate = TransactionHelpers.CalculateSettlementDate(merchant.SettlementSchedule, completedDateTime); Result stateResult = transactionAggregate.AddFeePendingSettlement(calculatedFee, settlementDate); if (stateResult.IsFailed) @@ -453,7 +453,7 @@ private async Task> GetMerchant(Guid merchantId, private async Task> ProcessMessageWithOperator(Models.Merchant.Merchant merchant, Guid transactionId, - DateTime transactionDateTime, + DateTimeOffset transactionDateTime, Guid operatorId, Dictionary additionalTransactionMetadata, String transactionReference, diff --git a/TransactionProcessor.BusinessLogic/Services/VoucherDomainService.cs b/TransactionProcessor.BusinessLogic/Services/VoucherDomainService.cs index ddc0fc1f..440b829a 100644 --- a/TransactionProcessor.BusinessLogic/Services/VoucherDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/VoucherDomainService.cs @@ -29,7 +29,7 @@ Task> IssueVoucher(VoucherCommands.IssueVoucherComm Task> RedeemVoucher(Guid estateId, String voucherCode, - DateTime redeemedDateTime, + DateTimeOffset redeemedDateTime, CancellationToken cancellationToken); #endregion @@ -102,7 +102,7 @@ public async Task> IssueVoucher(VoucherCommands.Iss public async Task> RedeemVoucher(Guid estateId, String voucherCode, - DateTime redeemedDateTime, + DateTimeOffset redeemedDateTime, CancellationToken cancellationToken) { try diff --git a/TransactionProcessor.Client/ITransactionProcessorClient.cs b/TransactionProcessor.Client/ITransactionProcessorClient.cs index b1c7f6bf..3c833dfc 100644 --- a/TransactionProcessor.Client/ITransactionProcessorClient.cs +++ b/TransactionProcessor.Client/ITransactionProcessorClient.cs @@ -10,13 +10,17 @@ using TransactionProcessor.DataTransferObjects.Responses.Operator; using AssignOperatorRequest = TransactionProcessor.DataTransferObjects.Requests.Estate.AssignOperatorRequest; -namespace TransactionProcessor.Client -{ +namespace TransactionProcessor.Client { using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using DataTransferObjects; + using TransactionProcessor.DataTransferObjects.Requests.Float; + using TransactionProcessor.DataTransferObjects.Requests.Transaction; + using TransactionProcessor.DataTransferObjects.Requests.Voucher; + using TransactionProcessor.DataTransferObjects.Responses.Transaction; + using TransactionProcessor.DataTransferObjects.Responses.Voucher; public interface ITransactionProcessorClient { @@ -34,14 +38,14 @@ Task> PerformTransaction(String accessToken, LogonTransactionRequest transactionRequest, CancellationToken cancellationToken); - Task> GetSettlementByDate(String accessToken, - DateTime settlementDate, + Task> GetSettlementByDate(String accessToken, + DateTimeOffset settlementDate, Guid estateId, Guid merchantId, CancellationToken cancellationToken); Task ProcessSettlement(String accessToken, - DateTime settlementDate, + DateTimeOffset settlementDate, Guid estateId, Guid merchantId, CancellationToken cancellationToken); @@ -60,8 +64,8 @@ Task> GetMerchantBalance(String accessToken, Task>> GetMerchantBalanceHistory(String accessToken, Guid estateId, Guid merchantId, - DateTime startDate, - DateTime endDate, + DateTimeOffset startDate, + DateTimeOffset endDate, CancellationToken cancellationToken); Task> GetVoucherByCode(String accessToken, diff --git a/TransactionProcessor.Client/TransactionProcessorClient.cs b/TransactionProcessor.Client/TransactionProcessorClient.cs index 44a36a4c..0e112214 100644 --- a/TransactionProcessor.Client/TransactionProcessorClient.cs +++ b/TransactionProcessor.Client/TransactionProcessorClient.cs @@ -20,6 +20,11 @@ namespace TransactionProcessor.Client; using ClientProxyBase; using DataTransferObjects; using Shared.Results; +using TransactionProcessor.DataTransferObjects.Requests.Float; +using TransactionProcessor.DataTransferObjects.Requests.Transaction; +using TransactionProcessor.DataTransferObjects.Requests.Voucher; +using TransactionProcessor.DataTransferObjects.Responses.Transaction; +using TransactionProcessor.DataTransferObjects.Responses.Voucher; public class TransactionProcessorClient : ClientProxyBase, ITransactionProcessorClient { #region Fields @@ -178,8 +183,8 @@ public async Task> GetMerchantBalance(String acc public async Task>> GetMerchantBalanceHistory(String accessToken, Guid estateId, Guid merchantId, - DateTime startDate, - DateTime endDate, + DateTimeOffset startDate, + DateTimeOffset endDate, CancellationToken cancellationToken) { String requestUri = this.BuildRequestUrl($"/api/estates/{estateId}/merchants/{merchantId}/balancehistory?startDate={startDate:yyyy-MM-dd}&endDate={endDate:yyyy-MM-dd}"); @@ -200,7 +205,7 @@ public async Task>> GetMerchant } public async Task> GetSettlementByDate(String accessToken, - DateTime settlementDate, + DateTimeOffset settlementDate, Guid estateId, Guid merchantId, CancellationToken cancellationToken) { @@ -332,7 +337,7 @@ public async Task> PerformTransaction(String acce } public async Task ProcessSettlement(String accessToken, - DateTime settlementDate, + DateTimeOffset settlementDate, Guid estateId, Guid merchantId, CancellationToken cancellationToken) { diff --git a/TransactionProcessor.DataTransferObjects/CreateFloatForContractProductRequest.cs b/TransactionProcessor.DataTransferObjects/CreateFloatForContractProductRequest.cs deleted file mode 100644 index f731e677..00000000 --- a/TransactionProcessor.DataTransferObjects/CreateFloatForContractProductRequest.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; - -namespace TransactionProcessor.DataTransferObjects{ - - /// - /// Float identifier and creation timestamp. - /// - /// {"floatId":"00000000-0000-0000-0000-000000000166","createDateTime":"2026-01-15T10:30:00Z"} - public class CreateFloatRequest{ - - /// - /// Identifier of the float. - /// - public Guid FloatId { get; set; } - - /// - /// Date and time the float was created. - /// - public DateTime CreateDateTime{ get; set; } - } - - /// - /// Float credit amount, cost price, and purchase timestamp. - /// - /// {"floatId":"00000000-0000-0000-0000-000000000166","purchaseDateTime":"2026-01-15T10:30:00Z","creditAmount":42.5,"costPrice":42.5} - public class RecordFloatCreditPurchaseRequest{ - /// - /// Identifier of the float. - /// - public Guid FloatId { get; set; } - - /// - /// Date and time of the credit purchase. - /// - public DateTime PurchaseDateTime { get; set; } - - /// - /// Amount of credit added to the float. - /// - public Decimal CreditAmount { get; set; } - /// - /// Cost of purchasing the float credit. - /// - public Decimal CostPrice { get; set; } - } -} diff --git a/TransactionProcessor.DataTransferObjects/ProcessSettlementResponse.cs b/TransactionProcessor.DataTransferObjects/ProcessSettlementResponse.cs deleted file mode 100644 index a9d41371..00000000 --- a/TransactionProcessor.DataTransferObjects/ProcessSettlementResponse.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace TransactionProcessor.DataTransferObjects -{ - internal class ProcessSettlementResponse - { - } -} diff --git a/TransactionProcessor.DataTransferObjects/Requests/Contract/AddProductToContractRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Contract/AddProductToContractRequest.cs index ecb37f2a..dc5b2eb7 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Contract/AddProductToContractRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Contract/AddProductToContractRequest.cs @@ -9,8 +9,6 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Contract /// {"displayText":"Example description","productName":"Example Name","value":42.5,"productType":0} public class AddProductToContractRequest { - #region Properties - /// /// Text shown to a user for this product. /// @@ -30,7 +28,5 @@ public class AddProductToContractRequest /// Category of product being added. /// public ProductType ProductType { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Contract/AddTransactionFeeForProductToContractRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Contract/AddTransactionFeeForProductToContractRequest.cs index f252ae22..4485b539 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Contract/AddTransactionFeeForProductToContractRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Contract/AddTransactionFeeForProductToContractRequest.cs @@ -9,8 +9,6 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Contract /// {"calculationType":0,"description":"Example description","feeType":0,"value":42.5} public class AddTransactionFeeForProductToContractRequest { - #region Properties - /// /// Method used to calculate the fee value. /// @@ -30,7 +28,5 @@ public class AddTransactionFeeForProductToContractRequest /// Monetary value associated with the product or fee. /// public Decimal Value { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Estate/AssignOperatorRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Estate/AssignOperatorRequest.cs index d5fb63d5..f2da4b1d 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Estate/AssignOperatorRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Estate/AssignOperatorRequest.cs @@ -11,13 +11,9 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Estate [ExcludeFromCodeCoverage] public class AssignOperatorRequest { - #region Properties - /// /// Operator associated with the operation. /// public Guid OperatorId { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Float/CreateFloatRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Float/CreateFloatRequest.cs new file mode 100644 index 00000000..bffe0733 --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Requests/Float/CreateFloatRequest.cs @@ -0,0 +1,20 @@ +using System; + +namespace TransactionProcessor.DataTransferObjects.Requests.Float; + +/// +/// Float identifier and creation timestamp. +/// +/// {"floatId":"00000000-0000-0000-0000-000000000166","createDateTime":"2026-01-15T10:30:00Z"} +public class CreateFloatRequest{ + + /// + /// Identifier of the float. + /// + public Guid FloatId { get; set; } + + /// + /// Date and time the float was created. + /// + public DateTimeOffset CreateDateTime { get; set; } +} \ No newline at end of file diff --git a/TransactionProcessor.DataTransferObjects/Requests/Float/RecordFloatCreditPurchaseRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Float/RecordFloatCreditPurchaseRequest.cs new file mode 100644 index 00000000..a64d5fd4 --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Requests/Float/RecordFloatCreditPurchaseRequest.cs @@ -0,0 +1,28 @@ +using System; + +namespace TransactionProcessor.DataTransferObjects.Requests.Float; + +/// +/// Float credit amount, cost price, and purchase timestamp. +/// +/// {"floatId":"00000000-0000-0000-0000-000000000166","purchaseDateTime":"2026-01-15T10:30:00Z","creditAmount":42.5,"costPrice":42.5} +public class RecordFloatCreditPurchaseRequest { + /// + /// Identifier of the float. + /// + public Guid FloatId { get; set; } + + /// + /// Date and time of the credit purchase. + /// + public DateTimeOffset PurchaseDateTime { get; set; } + + /// + /// Amount of credit added to the float. + /// + public Decimal CreditAmount { get; set; } + /// + /// Cost of purchasing the float credit. + /// + public Decimal CostPrice { get; set; } +} diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/Address.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/Address.cs index 55621e41..f7d2f7b3 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/Address.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/Address.cs @@ -9,8 +9,6 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant /// {"addressLine1":"123 Example Street","addressLine2":"123 Example Street","addressLine3":"123 Example Street","addressLine4":"123 Example Street","country":"US","postalCode":"10001","region":"Example City","town":"Example City"} public class Address { - #region Properties - /// /// First line of the postal address. /// @@ -49,7 +47,5 @@ public class Address /// Town or city for the address. /// public String Town { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/AssignOperatorRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/AssignOperatorRequest.cs index 9ac48985..43758737 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/AssignOperatorRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/AssignOperatorRequest.cs @@ -10,8 +10,6 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant [ExcludeFromCodeCoverage] public class AssignOperatorRequest { - #region Properties - /// /// Merchant number used when this operator is assigned. /// @@ -26,7 +24,5 @@ public class AssignOperatorRequest /// Terminal number used when this operator is assigned. /// public String TerminalNumber { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/Contact.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/Contact.cs index 21ee746f..e1003c5d 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/Contact.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/Contact.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel.DataAnnotations; namespace TransactionProcessor.DataTransferObjects.Requests.Merchant { @@ -9,8 +8,6 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant /// {"contactName":"Example Name","emailAddress":"customer@example.com","phoneNumber":"+15550100"} public class Contact { - #region Properties - /// /// Name of the contact person. /// @@ -25,7 +22,5 @@ public class Contact /// Telephone number for the contact person. /// public String PhoneNumber { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/CreateMerchantRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/CreateMerchantRequest.cs index 0c445a04..53a3eeff 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/CreateMerchantRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/CreateMerchantRequest.cs @@ -10,8 +10,6 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant /// {"address":{"addressLine1":"123 Example Street","addressLine2":"123 Example Street","addressLine3":"123 Example Street","addressLine4":"123 Example Street","country":"US","postalCode":"10001","region":"Example City","town":"Example City"},"contact":{"contactName":"Example Name","emailAddress":"customer@example.com","phoneNumber":"+15550100"},"name":"Example Name","settlementSchedule":0,"merchantId":"00000000-0000-0000-0000-000000000227","createdDateTime":"2026-01-15T10:30:00Z"} public class CreateMerchantRequest { - #region Properties - /// /// Postal address for the merchant. /// @@ -41,7 +39,5 @@ public class CreateMerchantRequest /// Optional merchant creation timestamp. /// public DateTime? CreatedDateTime { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/GenerateMerchantStatementRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/GenerateMerchantStatementRequest.cs index b923c14d..cd183d34 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/GenerateMerchantStatementRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/GenerateMerchantStatementRequest.cs @@ -8,13 +8,9 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant /// {"merchantStatementDate":"2026-01-15T10:30:00Z"} public class GenerateMerchantStatementRequest { - #region Properties - /// /// Statement date for the statement to generate. /// - public DateTime MerchantStatementDate { get; set; } - - #endregion + public DateTimeOffset MerchantStatementDate { get; set; } } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantDepositRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantDepositRequest.cs index a4284e43..bd2e6200 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantDepositRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantDepositRequest.cs @@ -8,9 +8,7 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant /// /// {"amount":42.5,"depositDateTime":"2026-01-15T10:30:00Z","reference":"REF-2026-001"} [ExcludeFromCodeCoverage] - public class MakeMerchantDepositRequest - { - #region Properties + public class MakeMerchantDepositRequest { /// /// Monetary amount of the deposit or withdrawal. @@ -20,13 +18,11 @@ public class MakeMerchantDepositRequest /// /// Date and time the deposit was made. /// - public DateTime DepositDateTime { get; set; } + public DateTimeOffset DepositDateTime { get; set; } /// /// External or user-supplied reference for the deposit or withdrawal. /// public String Reference { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantWithdrawalRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantWithdrawalRequest.cs index f23b3de6..c0d4d24a 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantWithdrawalRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantWithdrawalRequest.cs @@ -8,10 +8,7 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant /// /// {"amount":42.5,"withdrawalDateTime":"2026-01-15T10:30:00Z","reference":"REF-2026-001"} [ExcludeFromCodeCoverage] - public class MakeMerchantWithdrawalRequest - { - #region Properties - + public class MakeMerchantWithdrawalRequest { /// /// Monetary amount of the deposit or withdrawal. /// @@ -20,13 +17,11 @@ public class MakeMerchantWithdrawalRequest /// /// Date and time the withdrawal was made. /// - public DateTime WithdrawalDateTime { get; set; } + public DateTimeOffset WithdrawalDateTime { get; set; } /// /// External or user-supplied reference for the deposit or withdrawal. /// public String Reference { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/MerchantOpeningRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MerchantOpeningRequest.cs new file mode 100644 index 00000000..516dd5a6 --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MerchantOpeningRequest.cs @@ -0,0 +1,36 @@ +namespace TransactionProcessor.DataTransferObjects.Requests.Merchant; + +/// +/// Opening and closing times for each day of the merchant week. +/// +/// {"sunday":{"opening":"example","closing":"example"},"monday":{"opening":"example","closing":"example"},"tuesday":{"opening":"example","closing":"example"},"wednesday":{"opening":"example","closing":"example"},"thursday":{"opening":"example","closing":"example"},"friday":{"opening":"example","closing":"example"},"saturday":{"opening":"example","closing":"example"}} +public class MerchantOpeningRequest { + /// + /// Opening and closing times for Sunday. + /// + public OpeningHours Sunday { get; set; } + /// + /// Opening and closing times for Monday. + /// + public OpeningHours Monday { get; set; } + /// + /// Opening and closing times for Tuesday. + /// + public OpeningHours Tuesday { get; set; } + /// + /// Opening and closing times for Wednesday. + /// + public OpeningHours Wednesday { get; set; } + /// + /// Opening and closing times for Thursday. + /// + public OpeningHours Thursday { get; set; } + /// + /// Opening and closing times for Friday. + /// + public OpeningHours Friday { get; set; } + /// + /// Opening and closing times for Saturday. + /// + public OpeningHours Saturday { get; set; } +} \ No newline at end of file diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/OpeningHours.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/OpeningHours.cs new file mode 100644 index 00000000..89332910 --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/OpeningHours.cs @@ -0,0 +1,17 @@ +namespace TransactionProcessor.DataTransferObjects.Requests.Merchant; + +/// +/// Opening and closing time for one day. +/// +/// {"opening":"example","closing":"example"} +public class OpeningHours +{ + /// + /// Local opening time for the day, represented as a string. + /// + public string Opening { get; set; } + /// + /// Local closing time for the day, represented as a string. + /// + public string Closing { get; set; } +} \ No newline at end of file diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/UpdateMerchantRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/UpdateMerchantRequest.cs index 14d032ba..b1295fc5 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/UpdateMerchantRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/UpdateMerchantRequest.cs @@ -9,7 +9,6 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant /// {"name":"Example Name","settlementSchedule":0} public class UpdateMerchantRequest { - #region Properties /// /// Display name for the estate, merchant, or operator. /// @@ -19,73 +18,5 @@ public class UpdateMerchantRequest /// Settlement schedule assigned to the merchant. /// public SettlementSchedule SettlementSchedule { get; set; } - - #endregion - } - - /// - /// Opening and closing times for each day of the merchant week. - /// - /// {"sunday":{"opening":"example","closing":"example"},"monday":{"opening":"example","closing":"example"},"tuesday":{"opening":"example","closing":"example"},"wednesday":{"opening":"example","closing":"example"},"thursday":{"opening":"example","closing":"example"},"friday":{"opening":"example","closing":"example"},"saturday":{"opening":"example","closing":"example"}} - public class MerchantOpeningRequest { - /// - /// Opening and closing times for Sunday. - /// - public OpeningHours Sunday { get; set; } - /// - /// Opening and closing times for Monday. - /// - public OpeningHours Monday { get; set; } - /// - /// Opening and closing times for Tuesday. - /// - public OpeningHours Tuesday { get; set; } - /// - /// Opening and closing times for Wednesday. - /// - public OpeningHours Wednesday { get; set; } - /// - /// Opening and closing times for Thursday. - /// - public OpeningHours Thursday { get; set; } - /// - /// Opening and closing times for Friday. - /// - public OpeningHours Friday { get; set; } - /// - /// Opening and closing times for Saturday. - /// - public OpeningHours Saturday { get; set; } - } - - - /// - /// Opening and closing time for one day. - /// - /// {"opening":"example","closing":"example"} - public class OpeningHours - { - /// - /// Local opening time for the day, represented as a string. - /// - public string Opening { get; set; } - /// - /// Local closing time for the day, represented as a string. - /// - public string Closing { get; set; } - } - /// Data transfer object for OpeningHoursResponse. - /// {"opening":"example","closing":"example"} - - public class OpeningHoursResponse - { - /// - /// Local opening time for the day, represented as a string. - /// - public string Opening { get; set; } - /// - /// Local closing time for the day, represented as a string. - /// - public string Closing { get; set; } } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/CreateMerchantScheduleRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/CreateMerchantScheduleRequest.cs index 9fb51674..95f2bb6a 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/CreateMerchantScheduleRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/CreateMerchantScheduleRequest.cs @@ -21,35 +21,4 @@ public class CreateMerchantScheduleRequest /// public List Months { get; set; } = []; } - - /// - /// Monthly closure-day definitions to apply to an existing merchant schedule. - /// - /// {"months":[{"month":1,"closedDays":[]}]} - [ExcludeFromCodeCoverage] - public class UpdateMerchantScheduleRequest - { - /// - /// Month entries that define closure days. - /// - public List Months { get; set; } = []; - } - - /// - /// One schedule month and the day numbers on which the merchant is closed. - /// - /// {"month":1,"closedDays":[]} - [ExcludeFromCodeCoverage] - public class MerchantScheduleMonthRequest - { - /// - /// Calendar month number. - /// - public Int32 Month { get; set; } - - /// - /// Day numbers in the month when the merchant is closed. - /// - public List ClosedDays { get; set; } = []; - } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/MerchantScheduleMonthRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/MerchantScheduleMonthRequest.cs new file mode 100644 index 00000000..d08d8d74 --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/MerchantScheduleMonthRequest.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +namespace TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; + +/// +/// One schedule month and the day numbers on which the merchant is closed. +/// +/// {"month":1,"closedDays":[]} +[ExcludeFromCodeCoverage] +public class MerchantScheduleMonthRequest +{ + /// + /// Calendar month number. + /// + public Int32 Month { get; set; } + + /// + /// Day numbers in the month when the merchant is closed. + /// + public List ClosedDays { get; set; } = []; +} \ No newline at end of file diff --git a/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/UpdateMerchantScheduleRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/UpdateMerchantScheduleRequest.cs new file mode 100644 index 00000000..6e7f6a6c --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/UpdateMerchantScheduleRequest.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +namespace TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; + +/// +/// Monthly closure-day definitions to apply to an existing merchant schedule. +/// +/// {"months":[{"month":1,"closedDays":[]}]} +[ExcludeFromCodeCoverage] +public class UpdateMerchantScheduleRequest +{ + /// + /// Month entries that define closure days. + /// + public List Months { get; set; } = []; +} \ No newline at end of file diff --git a/TransactionProcessor.DataTransferObjects/Requests/Operator/CreateOperatorRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Operator/CreateOperatorRequest.cs index 305ca84e..60d5a34e 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Operator/CreateOperatorRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Operator/CreateOperatorRequest.cs @@ -11,8 +11,6 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Operator [ExcludeFromCodeCoverage] public class CreateOperatorRequest { - #region Properties - /// /// Display name for the estate, merchant, or operator. /// @@ -32,7 +30,5 @@ public class CreateOperatorRequest /// Whether a custom terminal number is required for this operator. /// public Boolean? RequireCustomTerminalNumber { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Operator/UpdateOperatorRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Operator/UpdateOperatorRequest.cs index 8999f09a..862c6f69 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Operator/UpdateOperatorRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Operator/UpdateOperatorRequest.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; namespace TransactionProcessor.DataTransferObjects.Requests.Operator{ @@ -10,8 +9,6 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Operator{ [ExcludeFromCodeCoverage] public class UpdateOperatorRequest { - #region Properties - /// /// Display name for the estate, merchant, or operator. /// @@ -26,7 +23,5 @@ public class UpdateOperatorRequest /// Whether a custom terminal number is required for this operator. /// public Boolean? RequireCustomTerminalNumber { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/RequestWithHostDateTime.cs b/TransactionProcessor.DataTransferObjects/Requests/RequestWithHostDateTime.cs new file mode 100644 index 00000000..591eeeb7 --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Requests/RequestWithHostDateTime.cs @@ -0,0 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace TransactionProcessor.DataTransferObjects.Requests; + +public class RequestWithHostDateTime { + public DateTimeOffset HostDateTime { get; set; } +} diff --git a/TransactionProcessor.DataTransferObjects/LogonTransactionRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Transaction/LogonTransactionRequest.cs similarity index 91% rename from TransactionProcessor.DataTransferObjects/LogonTransactionRequest.cs rename to TransactionProcessor.DataTransferObjects/Requests/Transaction/LogonTransactionRequest.cs index 1e78f0df..d2de249c 100644 --- a/TransactionProcessor.DataTransferObjects/LogonTransactionRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Transaction/LogonTransactionRequest.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Requests.Transaction { using System; using System.Diagnostics.CodeAnalysis; @@ -10,8 +10,6 @@ namespace TransactionProcessor.DataTransferObjects [ExcludeFromCodeCoverage] public class LogonTransactionRequest : TransactionRequest { - #region Properties - /// /// Identifier assigned to the terminal device submitting the logon. /// @@ -26,7 +24,5 @@ public class LogonTransactionRequest : TransactionRequest /// Transaction type reported by the terminal. /// public String TransactionType { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/OperatorTotalRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Transaction/OperatorTotalRequest.cs similarity index 91% rename from TransactionProcessor.DataTransferObjects/OperatorTotalRequest.cs rename to TransactionProcessor.DataTransferObjects/Requests/Transaction/OperatorTotalRequest.cs index 958b36ef..1e0e4a8d 100644 --- a/TransactionProcessor.DataTransferObjects/OperatorTotalRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Transaction/OperatorTotalRequest.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Requests.Transaction { using System; using System.Diagnostics.CodeAnalysis; @@ -8,8 +8,6 @@ namespace TransactionProcessor.DataTransferObjects [ExcludeFromCodeCoverage] public class OperatorTotalRequest { - #region Properties - /// /// Contract associated with the product or transaction. /// @@ -29,7 +27,5 @@ public class OperatorTotalRequest /// Total value of transactions included in the reconciliation. /// public Decimal TransactionValue { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/ReconciliationRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Transaction/ReconciliationRequest.cs similarity index 93% rename from TransactionProcessor.DataTransferObjects/ReconciliationRequest.cs rename to TransactionProcessor.DataTransferObjects/Requests/Transaction/ReconciliationRequest.cs index c9c6225f..80e5503d 100644 --- a/TransactionProcessor.DataTransferObjects/ReconciliationRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Transaction/ReconciliationRequest.cs @@ -1,9 +1,8 @@ -namespace TransactionProcessor.DataTransferObjects -{ +namespace TransactionProcessor.DataTransferObjects.Requests.Transaction { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - + /// /// Terminal transaction totals and optional per-operator/per-contract breakdown. /// @@ -11,8 +10,6 @@ namespace TransactionProcessor.DataTransferObjects [ExcludeFromCodeCoverage] public class ReconciliationRequest : TransactionRequest { - #region Properties - /// /// Identifier assigned to the terminal device submitting the reconciliation. /// @@ -32,7 +29,5 @@ public class ReconciliationRequest : TransactionRequest /// Total value of transactions included in the reconciliation. /// public Decimal TransactionValue { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/SaleTransactionRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Transaction/SaleTransactionRequest.cs similarity index 95% rename from TransactionProcessor.DataTransferObjects/SaleTransactionRequest.cs rename to TransactionProcessor.DataTransferObjects/Requests/Transaction/SaleTransactionRequest.cs index b4fb5817..cc1f5d0a 100644 --- a/TransactionProcessor.DataTransferObjects/SaleTransactionRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Transaction/SaleTransactionRequest.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Requests.Transaction { using System; using System.Collections.Generic; @@ -11,8 +11,6 @@ namespace TransactionProcessor.DataTransferObjects [ExcludeFromCodeCoverage] public class SaleTransactionRequest : TransactionRequest { - #region Properties - /// /// Optional key/value metadata to include with the transaction. /// @@ -52,7 +50,5 @@ public class SaleTransactionRequest : TransactionRequest /// Numeric transaction source code; omitted values default to online source code 1. /// public Int32? TransactionSource { get; set; } - - #endregion } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Transaction/TransactionRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Transaction/TransactionRequest.cs new file mode 100644 index 00000000..9c2f1a5d --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Requests/Transaction/TransactionRequest.cs @@ -0,0 +1,33 @@ +using System; +using System.Diagnostics.CodeAnalysis; + +namespace TransactionProcessor.DataTransferObjects.Requests.Transaction; + +/// +/// Shared estate, merchant, transaction timestamp, and transaction type fields. +/// +/// {"estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example"} +[ExcludeFromCodeCoverage] +public class TransactionRequest + +{ + /// + /// Estate that owns or scopes this operation. + /// + public Guid EstateId { get; set; } + + /// + /// Merchant associated with the transaction. + /// + public Guid MerchantId { get; set; } + + /// + /// Date and time when the transaction occurred at the terminal. + /// + public DateTimeOffset TransactionDateTime { get; set; } + + /// + /// Transaction type reported by the terminal. + /// + public String TransactionType { get; set; } +} diff --git a/TransactionProcessor.DataTransferObjects/IssueVoucherRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Voucher/IssueVoucherRequest.cs similarity index 90% rename from TransactionProcessor.DataTransferObjects/IssueVoucherRequest.cs rename to TransactionProcessor.DataTransferObjects/Requests/Voucher/IssueVoucherRequest.cs index 31584a35..35a10165 100644 --- a/TransactionProcessor.DataTransferObjects/IssueVoucherRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Voucher/IssueVoucherRequest.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Requests.Voucher { using System; /// Data transfer object for IssueVoucherRequest. @@ -8,23 +8,23 @@ public class IssueVoucherRequest { /// The operator identifier. public String OperatorIdentifier { get; set; } + /// The estate id. - public Guid EstateId { get; set; } + /// The transaction id. - public Guid TransactionId { get; set; } + /// The value. - public Decimal Value { get; set; } + /// The recipient email. - public String RecipientEmail { get; set; } + /// The recipient mobile. - public String RecipientMobile { get; set; } + /// The issued date time. - public DateTime? IssuedDateTime { get; set; } } } diff --git a/TransactionProcessor.DataTransferObjects/RedeemVoucherRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Voucher/RedeemVoucherRequest.cs similarity index 81% rename from TransactionProcessor.DataTransferObjects/RedeemVoucherRequest.cs rename to TransactionProcessor.DataTransferObjects/Requests/Voucher/RedeemVoucherRequest.cs index fe298fa0..cafc737c 100644 --- a/TransactionProcessor.DataTransferObjects/RedeemVoucherRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Voucher/RedeemVoucherRequest.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Requests.Voucher { using System; @@ -6,8 +6,7 @@ namespace TransactionProcessor.DataTransferObjects /// Voucher code and estate to redeem, with an optional redemption timestamp. /// /// {"voucherCode":"VOUCHER-2026-001","estateId":"00000000-0000-0000-0000-000000000023","redeemedDateTime":"2026-01-15T10:30:00Z"} - public class RedeemVoucherRequest - { + public class RedeemVoucherRequest { /// /// Code printed on or assigned to the voucher. /// @@ -21,6 +20,6 @@ public class RedeemVoucherRequest /// /// Optional date and time when the voucher was redeemed; omitted values use the current local time. /// - public DateTime? RedeemedDateTime { get; set; } + public DateTimeOffset? RedeemedDateTime { get; set; } } } diff --git a/TransactionProcessor.DataTransferObjects/Responses/File/FileDetailsResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/File/FileDetailsResponse.cs index 7c15fa53..f8ed4b98 100644 --- a/TransactionProcessor.DataTransferObjects/Responses/File/FileDetailsResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/File/FileDetailsResponse.cs @@ -10,10 +10,10 @@ public class FileDetailsResponse{ public Guid FileId{ get; set; } /// The file received date. - public DateTime FileReceivedDate{ get; set; } + public DateTimeOffset FileReceivedDate { get; set; } /// The file received date time. - public DateTime FileReceivedDateTime{ get; set; } + public DateTimeOffset FileReceivedDateTime { get; set; } /// The file line details. public List FileLineDetails{ get; set; } diff --git a/TransactionProcessor.DataTransferObjects/MerchantBalanceChangedEntryResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantBalanceChangedEntryResponse.cs similarity index 91% rename from TransactionProcessor.DataTransferObjects/MerchantBalanceChangedEntryResponse.cs rename to TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantBalanceChangedEntryResponse.cs index 073a3869..9510a5dd 100644 --- a/TransactionProcessor.DataTransferObjects/MerchantBalanceChangedEntryResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantBalanceChangedEntryResponse.cs @@ -1,6 +1,6 @@ using System; -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Responses.Merchant { using System.Diagnostics.CodeAnalysis; @@ -24,7 +24,7 @@ public class MerchantBalanceChangedEntryResponse public Decimal ChangeAmount { get; set; } /// The date time. - public DateTime DateTime { get; set; } + public DateTimeOffset DateTime { get; set; } /// The reference. public String Reference { get; set; } diff --git a/TransactionProcessor.DataTransferObjects/MerchantBalanceResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantBalanceResponse.cs similarity index 91% rename from TransactionProcessor.DataTransferObjects/MerchantBalanceResponse.cs rename to TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantBalanceResponse.cs index ea336ab2..eac9030b 100644 --- a/TransactionProcessor.DataTransferObjects/MerchantBalanceResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantBalanceResponse.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Responses.Merchant { using System; using System.Diagnostics.CodeAnalysis; diff --git a/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantResponse.cs index c4a0c8f7..bff38dc0 100644 --- a/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantResponse.cs @@ -41,7 +41,7 @@ public class MerchantResponse public String MerchantReference { get; set; } /// The next statement date. - public DateTime NextStatementDate { get; set; } + public DateTimeOffset NextStatementDate { get; set; } /// The operators. public List Operators { get; set; } diff --git a/TransactionProcessor.DataTransferObjects/Responses/Merchant/OpeningHoursResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Merchant/OpeningHoursResponse.cs new file mode 100644 index 00000000..97e3f96f --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Responses/Merchant/OpeningHoursResponse.cs @@ -0,0 +1,16 @@ +namespace TransactionProcessor.DataTransferObjects.Responses.Merchant; + +/// Data transfer object for OpeningHoursResponse. +/// {"opening":"example","closing":"example"} + +public class OpeningHoursResponse +{ + /// + /// Local opening time for the day, represented as a string. + /// + public string Opening { get; set; } + /// + /// Local closing time for the day, represented as a string. + /// + public string Closing { get; set; } +} \ No newline at end of file diff --git a/TransactionProcessor.DataTransferObjects/Responses/Settlement/ProcessSettlementResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Settlement/ProcessSettlementResponse.cs new file mode 100644 index 00000000..4756e081 --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Responses/Settlement/ProcessSettlementResponse.cs @@ -0,0 +1,6 @@ +namespace TransactionProcessor.DataTransferObjects.Responses.Settlement +{ + internal class ProcessSettlementResponse + { + } +} diff --git a/TransactionProcessor.DataTransferObjects/Responses/Settlement/SettlementFeeResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Settlement/SettlementFeeResponse.cs index 81db2e07..f521d3be 100644 --- a/TransactionProcessor.DataTransferObjects/Responses/Settlement/SettlementFeeResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Settlement/SettlementFeeResponse.cs @@ -27,7 +27,7 @@ public class SettlementFeeResponse public String MerchantName { get; set; } /// The settlement date. - public DateTime SettlementDate { get; set; } + public DateTimeOffset SettlementDate { get; set; } /// The settlement id. public Guid SettlementId { get; set; } diff --git a/TransactionProcessor.DataTransferObjects/Responses/Settlement/SettlementResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Settlement/SettlementResponse.cs index 2c34dfd4..00792c2c 100644 --- a/TransactionProcessor.DataTransferObjects/Responses/Settlement/SettlementResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Settlement/SettlementResponse.cs @@ -29,7 +29,7 @@ public SettlementResponse() public Int32 NumberOfFeesSettled { get; set; } /// The settlement date. - public DateTime SettlementDate { get; set; } + public DateTimeOffset SettlementDate { get; set; } /// The settlement fees. public List SettlementFees { get; set; } diff --git a/TransactionProcessor.DataTransferObjects/LogonTransactionResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Transaction/LogonTransactionResponse.cs similarity index 88% rename from TransactionProcessor.DataTransferObjects/LogonTransactionResponse.cs rename to TransactionProcessor.DataTransferObjects/Responses/Transaction/LogonTransactionResponse.cs index 2ab0246d..4a0067ac 100644 --- a/TransactionProcessor.DataTransferObjects/LogonTransactionResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Transaction/LogonTransactionResponse.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Responses.Transaction { using System; using System.Diagnostics.CodeAnalysis; diff --git a/TransactionProcessor.DataTransferObjects/ReconciliationResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Transaction/ReconciliationResponse.cs similarity index 88% rename from TransactionProcessor.DataTransferObjects/ReconciliationResponse.cs rename to TransactionProcessor.DataTransferObjects/Responses/Transaction/ReconciliationResponse.cs index f77e1adb..4f17aa6e 100644 --- a/TransactionProcessor.DataTransferObjects/ReconciliationResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Transaction/ReconciliationResponse.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Responses.Transaction { using System; using System.Diagnostics.CodeAnalysis; diff --git a/TransactionProcessor.DataTransferObjects/SaleTransactionResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Transaction/SaleTransactionResponse.cs similarity index 92% rename from TransactionProcessor.DataTransferObjects/SaleTransactionResponse.cs rename to TransactionProcessor.DataTransferObjects/Responses/Transaction/SaleTransactionResponse.cs index 63c2e774..08660cb6 100644 --- a/TransactionProcessor.DataTransferObjects/SaleTransactionResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Transaction/SaleTransactionResponse.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Responses.Transaction { using System; using System.Collections.Generic; diff --git a/TransactionProcessor.DataTransferObjects/DataTransferObject.cs b/TransactionProcessor.DataTransferObjects/Responses/Transaction/TransactionResponse.cs similarity index 50% rename from TransactionProcessor.DataTransferObjects/DataTransferObject.cs rename to TransactionProcessor.DataTransferObjects/Responses/Transaction/TransactionResponse.cs index 3940cea9..aa42aba0 100644 --- a/TransactionProcessor.DataTransferObjects/DataTransferObject.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Transaction/TransactionResponse.cs @@ -1,41 +1,7 @@ -namespace TransactionProcessor.DataTransferObjects -{ - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - - /// - /// Shared estate, merchant, transaction timestamp, and transaction type fields. - /// - /// {"estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example"} - [ExcludeFromCodeCoverage] - public class TransactionRequest - { - #region Properties - - /// - /// Estate that owns or scopes this operation. - /// - public Guid EstateId { get; set; } - - /// - /// Merchant associated with the transaction. - /// - public Guid MerchantId { get; set; } - - /// - /// Date and time when the transaction occurred at the terminal. - /// - public DateTime TransactionDateTime { get; set; } - - /// - /// Transaction type reported by the terminal. - /// - public String TransactionType { get; set; } - - #endregion - } +using System; +namespace TransactionProcessor.DataTransferObjects.Responses.Transaction +{ /// /// Shared estate, merchant, response status, transaction identifier, and transaction type fields. /// diff --git a/TransactionProcessor.DataTransferObjects/GetVoucherResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Voucher/GetVoucherResponse.cs similarity index 83% rename from TransactionProcessor.DataTransferObjects/GetVoucherResponse.cs rename to TransactionProcessor.DataTransferObjects/Responses/Voucher/GetVoucherResponse.cs index 2e829f94..0976ad1c 100644 --- a/TransactionProcessor.DataTransferObjects/GetVoucherResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Voucher/GetVoucherResponse.cs @@ -1,6 +1,6 @@ using System; -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Responses.Voucher { /// /// Voucher identity, value, balance, lifecycle status, dates, and associated transaction. @@ -12,7 +12,7 @@ public class GetVoucherResponse public Guid VoucherId { get; set; } /// The expiry date. - public DateTime ExpiryDate { get; set; } + public DateTimeOffset ExpiryDate { get; set; } /// The value. public Decimal Value { get; set; } @@ -32,13 +32,13 @@ public class GetVoucherResponse public Boolean IsRedeemed { get; set; } /// The issued date time. - public DateTime IssuedDateTime { get; set; } + public DateTimeOffset IssuedDateTime { get; set; } /// The generated date time. - public DateTime GeneratedDateTime { get; set; } + public DateTimeOffset GeneratedDateTime { get; set; } /// The redeemed date time. - public DateTime RedeemedDateTime { get; set; } + public DateTimeOffset RedeemedDateTime { get; set; } /// The transaction id. public Guid TransactionId { get; set; } diff --git a/TransactionProcessor.DataTransferObjects/IssueVoucherResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Voucher/IssueVoucherResponse.cs similarity index 84% rename from TransactionProcessor.DataTransferObjects/IssueVoucherResponse.cs rename to TransactionProcessor.DataTransferObjects/Responses/Voucher/IssueVoucherResponse.cs index 52db38a5..a2405b3a 100644 --- a/TransactionProcessor.DataTransferObjects/IssueVoucherResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Voucher/IssueVoucherResponse.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Responses.Voucher { using System; /// Data transfer object for IssueVoucherResponse. @@ -10,7 +10,7 @@ public class IssueVoucherResponse public Guid VoucherId { get; set; } /// The expiry date. - public DateTime ExpiryDate { get; set; } + public DateTimeOffset ExpiryDate { get; set; } /// The voucher code. public String VoucherCode { get; set; } diff --git a/TransactionProcessor.DataTransferObjects/RedeemVoucherResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Voucher/RedeemVoucherResponse.cs similarity index 81% rename from TransactionProcessor.DataTransferObjects/RedeemVoucherResponse.cs rename to TransactionProcessor.DataTransferObjects/Responses/Voucher/RedeemVoucherResponse.cs index c53a55db..5fdb0532 100644 --- a/TransactionProcessor.DataTransferObjects/RedeemVoucherResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Voucher/RedeemVoucherResponse.cs @@ -1,4 +1,4 @@ -namespace TransactionProcessor.DataTransferObjects +namespace TransactionProcessor.DataTransferObjects.Responses.Voucher { using System; /// @@ -8,7 +8,7 @@ namespace TransactionProcessor.DataTransferObjects public class RedeemVoucherResponse { /// The expiry date. - public DateTime ExpiryDate { get; set; } + public DateTimeOffset ExpiryDate { get; set; } /// The voucher code. public String VoucherCode { get; set; } diff --git a/TransactionProcessor.DataTransferObjects/SettlementResponse.cs b/TransactionProcessor.DataTransferObjects/SettlementResponse.cs index a9d54a5e..b9fb0692 100644 --- a/TransactionProcessor.DataTransferObjects/SettlementResponse.cs +++ b/TransactionProcessor.DataTransferObjects/SettlementResponse.cs @@ -17,7 +17,7 @@ public class SettlementResponse public Guid MerchantId { get; set; } /// The settlement date. - public DateTime SettlementDate { get; set; } + public DateTimeOffset SettlementDate { get; set; } /// The number of fees pending settlement. public Int32 NumberOfFeesPendingSettlement { get; set; } diff --git a/TransactionProcessor.DataTransferObjects/TransactionProcessor.DataTransferObjects.csproj b/TransactionProcessor.DataTransferObjects/TransactionProcessor.DataTransferObjects.csproj index 3de819ad..4c0ea0a0 100644 --- a/TransactionProcessor.DataTransferObjects/TransactionProcessor.DataTransferObjects.csproj +++ b/TransactionProcessor.DataTransferObjects/TransactionProcessor.DataTransferObjects.csproj @@ -12,7 +12,7 @@ - + diff --git a/TransactionProcessor.Database/Entities/Calendar.cs b/TransactionProcessor.Database/Entities/Calendar.cs index b6fe07dc..c6799843 100644 --- a/TransactionProcessor.Database/Entities/Calendar.cs +++ b/TransactionProcessor.Database/Entities/Calendar.cs @@ -12,7 +12,7 @@ public class Calendar #region Properties [Key] - public DateTime Date { get; set; } + public DateOnly Date { get; set; } public String DayOfWeek { get; set; } diff --git a/TransactionProcessor.Database/Entities/Estate.cs b/TransactionProcessor.Database/Entities/Estate.cs index 1f742606..8f238195 100644 --- a/TransactionProcessor.Database/Entities/Estate.cs +++ b/TransactionProcessor.Database/Entities/Estate.cs @@ -10,7 +10,7 @@ public class Estate { #region Properties - public DateTime CreatedDateTime { get; set; } + public DateTimeOffset CreatedDateTime { get; set; } public Guid EstateId { get; set; } diff --git a/TransactionProcessor.Database/Entities/EstateSecurityUser.cs b/TransactionProcessor.Database/Entities/EstateSecurityUser.cs index 96a4f979..927c0f7e 100644 --- a/TransactionProcessor.Database/Entities/EstateSecurityUser.cs +++ b/TransactionProcessor.Database/Entities/EstateSecurityUser.cs @@ -9,7 +9,7 @@ namespace TransactionProcessor.Database.Entities public class EstateSecurityUser { #region Properties - public DateTime CreatedDateTime { get; set; } + public DateTimeOffset CreatedDateTime { get; set; } public String EmailAddress { get; set; } diff --git a/TransactionProcessor.Database/Entities/Event.cs b/TransactionProcessor.Database/Entities/Event.cs index 1d167294..22a79afb 100644 --- a/TransactionProcessor.Database/Entities/Event.cs +++ b/TransactionProcessor.Database/Entities/Event.cs @@ -6,7 +6,7 @@ public class Event { [Column(TypeName = "date")] - public DateTime Date { get; set; } + public DateOnly Date { get; set; } public Guid EventId { get; set; } public String Type { get; set; } } diff --git a/TransactionProcessor.Database/Entities/File.cs b/TransactionProcessor.Database/Entities/File.cs index b262581a..ecca5232 100644 --- a/TransactionProcessor.Database/Entities/File.cs +++ b/TransactionProcessor.Database/Entities/File.cs @@ -21,9 +21,9 @@ public class File public Guid FileProfileId { get; set; } - public DateTime FileReceivedDateTime { get; set; } + public DateTimeOffset FileReceivedDateTime { get; set; } - public DateTime FileReceivedDate { get; set; } + public DateOnly FileReceivedDate { get; set; } public Guid MerchantId { get; set; } diff --git a/TransactionProcessor.Database/Entities/FileImportLog.cs b/TransactionProcessor.Database/Entities/FileImportLog.cs index 6358f0c6..f71b2c4c 100644 --- a/TransactionProcessor.Database/Entities/FileImportLog.cs +++ b/TransactionProcessor.Database/Entities/FileImportLog.cs @@ -15,8 +15,8 @@ public class FileImportLog public Guid FileImportLogId { get; set; } - public DateTime ImportLogDateTime { get; set; } + public DateTimeOffset ImportLogDateTime { get; set; } - public DateTime ImportLogDate { get; set; } + public DateOnly ImportLogDate { get; set; } } } diff --git a/TransactionProcessor.Database/Entities/FileImportLogFile.cs b/TransactionProcessor.Database/Entities/FileImportLogFile.cs index b01b1fde..49bd0713 100644 --- a/TransactionProcessor.Database/Entities/FileImportLogFile.cs +++ b/TransactionProcessor.Database/Entities/FileImportLogFile.cs @@ -16,9 +16,9 @@ public class FileImportLogFile public Guid FileProfileId { get; set; } - public DateTime FileUploadedDateTime { get; set; } + public DateTimeOffset FileUploadedDateTime { get; set; } - public DateTime FileUploadedDate { get; set; } + public DateOnly FileUploadedDate { get; set; } public Guid MerchantId { get; set; } diff --git a/TransactionProcessor.Database/Entities/Float.cs b/TransactionProcessor.Database/Entities/Float.cs index 4262316c..b293afbe 100644 --- a/TransactionProcessor.Database/Entities/Float.cs +++ b/TransactionProcessor.Database/Entities/Float.cs @@ -6,7 +6,7 @@ public class Float public Guid EstateId { get; set; } - public DateTime CreatedDateTime { get; set; } - public DateTime CreatedDate { get; set; } + public DateTimeOffset CreatedDateTime { get; set; } + public DateOnly CreatedDate { get; set; } } } diff --git a/TransactionProcessor.Database/Entities/FloatActivity.cs b/TransactionProcessor.Database/Entities/FloatActivity.cs index 269e5cd4..87b33b3c 100644 --- a/TransactionProcessor.Database/Entities/FloatActivity.cs +++ b/TransactionProcessor.Database/Entities/FloatActivity.cs @@ -3,8 +3,8 @@ public class FloatActivity{ public Guid FloatId { get; set; } public Guid EventId { get; set; } - public DateTime ActivityDate { get; set; } - public DateTime ActivityDateTime { get; set; } + public DateOnly ActivityDate { get; set; } + public DateTimeOffset ActivityDateTime { get; set; } public String CreditOrDebit { get; set; } public Decimal Amount { get; set; } public Decimal CostPrice { get; set; } diff --git a/TransactionProcessor.Database/Entities/Merchant.cs b/TransactionProcessor.Database/Entities/Merchant.cs index cc9d0525..e899353a 100644 --- a/TransactionProcessor.Database/Entities/Merchant.cs +++ b/TransactionProcessor.Database/Entities/Merchant.cs @@ -10,7 +10,7 @@ public class Merchant { #region Properties - public DateTime CreatedDateTime { get; set; } + public DateTimeOffset CreatedDateTime { get; set; } public Guid EstateId { get; set; } @@ -25,11 +25,11 @@ public class Merchant public String? Reference { get; set; } - public DateTime LastStatementGenerated { get; set; } + public DateTimeOffset LastStatementGenerated { get; set; } - public DateTime LastSaleDate { get; set; } + public DateOnly LastSaleDate { get; set; } - public DateTime LastSaleDateTime { get; set; } + public DateTimeOffset LastSaleDateTime { get; set; } #endregion } diff --git a/TransactionProcessor.Database/Entities/MerchantAddress.cs b/TransactionProcessor.Database/Entities/MerchantAddress.cs index dfbd9a34..3866daa7 100644 --- a/TransactionProcessor.Database/Entities/MerchantAddress.cs +++ b/TransactionProcessor.Database/Entities/MerchantAddress.cs @@ -22,7 +22,7 @@ public class MerchantAddress public String? Country { get; set; } - public DateTime CreatedDateTime { get; set; } + public DateTimeOffset CreatedDateTime { get; set; } public Guid MerchantId { get; set; } diff --git a/TransactionProcessor.Database/Entities/MerchantBalanceChangedEntry.cs b/TransactionProcessor.Database/Entities/MerchantBalanceChangedEntry.cs index 2a1a6cb4..f9fdeebf 100644 --- a/TransactionProcessor.Database/Entities/MerchantBalanceChangedEntry.cs +++ b/TransactionProcessor.Database/Entities/MerchantBalanceChangedEntry.cs @@ -6,7 +6,7 @@ public class MerchantBalanceChangedEntry{ public Guid AggregateId{ get; set; } public Guid CauseOfChangeId{ get; set; } public Decimal ChangeAmount{ get; set; } - public DateTime DateTime{ get; set; } + public DateTimeOffset DateTime { get; set; } public String DebitOrCredit{ get; set; } public Guid EstateId{ get; set; } public Guid MerchantId{ get; set; } diff --git a/TransactionProcessor.Database/Entities/MerchantBalanceProjectionState.cs b/TransactionProcessor.Database/Entities/MerchantBalanceProjectionState.cs index 1af1011e..2ecb2bd1 100644 --- a/TransactionProcessor.Database/Entities/MerchantBalanceProjectionState.cs +++ b/TransactionProcessor.Database/Entities/MerchantBalanceProjectionState.cs @@ -23,10 +23,10 @@ public class MerchantBalanceProjectionState public Int32 FeeCount { get; set; } public Decimal ValueOfFees { get; set; } - public DateTime LastDeposit { get; set; } - public DateTime LastWithdrawal { get; set; } - public DateTime LastSale { get; set; } - public DateTime LastFee { get; set; } + public DateTimeOffset LastDeposit { get; set; } + public DateTimeOffset LastWithdrawal { get; set; } + public DateTimeOffset LastSale { get; set; } + public DateTimeOffset LastFee { get; set; } public Int32 StartedTransactionCount { get; set; } public Int32 CompletedTransactionCount { get; set; } diff --git a/TransactionProcessor.Database/Entities/MerchantContact.cs b/TransactionProcessor.Database/Entities/MerchantContact.cs index dfb5bebc..36f6e114 100644 --- a/TransactionProcessor.Database/Entities/MerchantContact.cs +++ b/TransactionProcessor.Database/Entities/MerchantContact.cs @@ -12,7 +12,7 @@ public class MerchantContact public Guid ContactId { get; set; } - public DateTime CreatedDateTime { get; set; } + public DateTimeOffset CreatedDateTime { get; set; } public String? EmailAddress { get; set; } diff --git a/TransactionProcessor.Database/Entities/MerchantDevice.cs b/TransactionProcessor.Database/Entities/MerchantDevice.cs index 05514ccd..40da83e5 100644 --- a/TransactionProcessor.Database/Entities/MerchantDevice.cs +++ b/TransactionProcessor.Database/Entities/MerchantDevice.cs @@ -10,7 +10,7 @@ public class MerchantDevice { #region Properties - public DateTime CreatedDateTime { get; set; } + public DateTimeOffset CreatedDateTime { get; set; } public Guid DeviceId { get; set; } diff --git a/TransactionProcessor.Database/Entities/MerchantSecurityUser.cs b/TransactionProcessor.Database/Entities/MerchantSecurityUser.cs index 331d967b..986c879f 100644 --- a/TransactionProcessor.Database/Entities/MerchantSecurityUser.cs +++ b/TransactionProcessor.Database/Entities/MerchantSecurityUser.cs @@ -10,7 +10,7 @@ public class MerchantSecurityUser { #region Properties - public DateTime CreatedDateTime { get; set; } + public DateTimeOffset CreatedDateTime { get; set; } public String EmailAddress { get; set; } diff --git a/TransactionProcessor.Database/Entities/MerchantSettlementFee.cs b/TransactionProcessor.Database/Entities/MerchantSettlementFee.cs index 3a792e40..27d9b36d 100644 --- a/TransactionProcessor.Database/Entities/MerchantSettlementFee.cs +++ b/TransactionProcessor.Database/Entities/MerchantSettlementFee.cs @@ -9,7 +9,7 @@ public class MerchantSettlementFee public Decimal CalculatedValue { get; set; } - public DateTime FeeCalculatedDateTime { get; set; } + public DateTimeOffset FeeCalculatedDateTime { get; set; } public Guid ContractProductTransactionFeeId { get; set; } diff --git a/TransactionProcessor.Database/Entities/Reconciliation.cs b/TransactionProcessor.Database/Entities/Reconciliation.cs index f379cdd8..035aaa01 100644 --- a/TransactionProcessor.Database/Entities/Reconciliation.cs +++ b/TransactionProcessor.Database/Entities/Reconciliation.cs @@ -21,9 +21,9 @@ public class Reconciliation public Int32 TransactionCount { get; set; } - public DateTime TransactionDate { get; set; } + public DateOnly TransactionDate { get; set; } - public DateTime TransactionDateTime { get; set; } + public DateTimeOffset TransactionDateTime { get; set; } public Guid TransactionId { get; set; } diff --git a/TransactionProcessor.Database/Entities/Settlement.cs b/TransactionProcessor.Database/Entities/Settlement.cs index 1c30e1dd..d0fc73f6 100644 --- a/TransactionProcessor.Database/Entities/Settlement.cs +++ b/TransactionProcessor.Database/Entities/Settlement.cs @@ -11,11 +11,11 @@ public class Settlement public Guid MerchantId { get; set; } public Boolean ProcessingStarted { get; set; } - public DateTime ProcessingStartedDateTIme { get; set; } + public DateTimeOffset ProcessingStartedDateTIme { get; set; } public Boolean IsCompleted { get; set; } - public DateTime SettlementDate { get; set; } + public DateOnly SettlementDate { get; set; } public Guid SettlementId { get; set; } diff --git a/TransactionProcessor.Database/Entities/StatementHeader.cs b/TransactionProcessor.Database/Entities/StatementHeader.cs index 471ea228..393b5cdb 100644 --- a/TransactionProcessor.Database/Entities/StatementHeader.cs +++ b/TransactionProcessor.Database/Entities/StatementHeader.cs @@ -12,13 +12,13 @@ public class StatementHeader public Guid MerchantId { get; set; } - public DateTime StatementCreatedDate { get; set; } - - public DateTime StatementGeneratedDate { get; set; } - - public DateTime StatementCreatedDateTime { get; set; } - - public DateTime StatementGeneratedDateTime { get; set; } + public DateOnly StatementCreatedDate { get; set; } + + public DateOnly StatementGeneratedDate { get; set; } + + public DateTimeOffset StatementCreatedDateTime { get; set; } + + public DateTimeOffset StatementGeneratedDateTime { get; set; } } } diff --git a/TransactionProcessor.Database/Entities/StatementLine.cs b/TransactionProcessor.Database/Entities/StatementLine.cs index 980e4a36..669cfe37 100644 --- a/TransactionProcessor.Database/Entities/StatementLine.cs +++ b/TransactionProcessor.Database/Entities/StatementLine.cs @@ -7,9 +7,9 @@ public class StatementLine { public Guid StatementId { get; set; } - public DateTime ActivityDateTime { get; set; } + public DateTimeOffset ActivityDateTime { get; set; } - public DateTime ActivityDate { get; set; } + public DateOnly ActivityDate { get; set; } public Int32 ActivityType { get; set; } diff --git a/TransactionProcessor.Database/Entities/Summary/SettlementSummary.cs b/TransactionProcessor.Database/Entities/Summary/SettlementSummary.cs index c1e1ebde..7cf1964d 100644 --- a/TransactionProcessor.Database/Entities/Summary/SettlementSummary.cs +++ b/TransactionProcessor.Database/Entities/Summary/SettlementSummary.cs @@ -4,7 +4,7 @@ public class SettlementSummary { public bool IsCompleted { get; set; } public bool IsSettled { get; set; } - public DateTime SettlementDate { get; set; } + public DateOnly SettlementDate { get; set; } public int MerchantReportingId { get; set; } public int OperatorReportingId { get; set; } public int ContractProductReportingId { get; set; } @@ -27,8 +27,8 @@ public class TodayTransaction public bool IsCompleted { get; set; } public string ResponseCode { get; set; } public string ResponseMessage { get; set; } - public DateTime TransactionDate { get; set; } - public DateTime TransactionDateTime { get; set; } + public DateOnly TransactionDate { get; set; } + public DateTimeOffset TransactionDateTime { get; set; } public string TransactionNumber { get; set; } public string TransactionReference { get; set; } public TimeSpan TransactionTime { get; set; } @@ -52,8 +52,8 @@ public class TransactionHistory public bool IsCompleted { get; set; } public string ResponseCode { get; set; } public string ResponseMessage { get; set; } - public DateTime TransactionDate { get; set; } - public DateTime TransactionDateTime { get; set; } + public DateOnly TransactionDate { get; set; } + public DateTimeOffset TransactionDateTime { get; set; } public string TransactionNumber { get; set; } public string TransactionReference { get; set; } public TimeSpan TransactionTime { get; set; } diff --git a/TransactionProcessor.Database/Entities/TransactionTimings.cs b/TransactionProcessor.Database/Entities/TransactionTimings.cs index bcd052e2..986b2ce5 100644 --- a/TransactionProcessor.Database/Entities/TransactionTimings.cs +++ b/TransactionProcessor.Database/Entities/TransactionTimings.cs @@ -5,10 +5,10 @@ namespace TransactionProcessor.Database.Entities; [Table("transactiontimings")] public class TransactionTimings { public Guid TransactionId { get; set; } - public DateTime TransactionStartedDateTime { get; set; } - public DateTime? OperatorCommunicationsStartedDateTime { get; set; } - public DateTime? OperatorCommunicationsCompletedDateTime { get; set; } - public DateTime TransactionCompletedDateTime { get; set; } + public DateTimeOffset TransactionStartedDateTime { get; set; } + public DateTimeOffset? OperatorCommunicationsStartedDateTime { get; set; } + public DateTimeOffset? OperatorCommunicationsCompletedDateTime { get; set; } + public DateTimeOffset TransactionCompletedDateTime { get; set; } public Double TotalTransactionInMilliseconds { get; set; } public Double OperatorCommunicationsDurationInMilliseconds { get; set; } public Double TransactionProcessingDurationInMilliseconds { get; set; } diff --git a/TransactionProcessor.Database/Entities/Transactions.cs b/TransactionProcessor.Database/Entities/Transactions.cs index 258974aa..46ddaa90 100644 --- a/TransactionProcessor.Database/Entities/Transactions.cs +++ b/TransactionProcessor.Database/Entities/Transactions.cs @@ -31,9 +31,9 @@ public class Transaction public String? ResponseMessage { get; set; } - public DateTime TransactionDate { get; set; } + public DateOnly TransactionDate { get; set; } - public DateTime TransactionDateTime { get; set; } + public DateTimeOffset TransactionDateTime { get; set; } public Guid TransactionId { get; set; } diff --git a/TransactionProcessor.Database/Entities/Voucher.cs b/TransactionProcessor.Database/Entities/Voucher.cs index 4b06d240..8dbe1b6c 100644 --- a/TransactionProcessor.Database/Entities/Voucher.cs +++ b/TransactionProcessor.Database/Entities/Voucher.cs @@ -11,8 +11,8 @@ public class VoucherProjectionState { #region Properties - public DateTime ExpiryDate { get; set; } - public DateTime ExpiryDateTime { get; set; } + public DateOnly ExpiryDate { get; set; } + public DateTimeOffset ExpiryDateTime { get; set; } public Boolean IsGenerated { get; set; } @@ -34,17 +34,17 @@ public class VoucherProjectionState public Guid EstateId { get; set; } public Guid TransactionId { get; set; } - public DateTime GenerateDateTime { get; set; } + public DateTimeOffset GenerateDateTime { get; set; } - public DateTime IssuedDateTime { get; set; } + public DateTimeOffset IssuedDateTime { get; set; } - public DateTime RedeemedDateTime { get; set; } + public DateTimeOffset RedeemedDateTime { get; set; } - public DateTime GenerateDate { get; set; } + public DateOnly GenerateDate { get; set; } - public DateTime IssuedDate { get; set; } + public DateOnly IssuedDate { get; set; } - public DateTime RedeemedDate { get; set; } + public DateOnly RedeemedDate { get; set; } [Timestamp] public Byte[] Timestamp { get; set; } public String Barcode { get; set; } diff --git a/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.Designer.cs b/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.Designer.cs new file mode 100644 index 00000000..c9240b42 --- /dev/null +++ b/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.Designer.cs @@ -0,0 +1,1710 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TransactionProcessor.Database.Contexts; + +#nullable disable + +namespace TransactionProcessor.Database.Migrations.SqlServer +{ + [DbContext(typeof(EstateManagementContext))] + [Migration("20261102135338_DateTime_to_DateTimeOffset")] + partial class DateTime_to_DateTimeOffset + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Calendar", b => + { + b.Property("Date") + .HasColumnType("date"); + + b.Property("DayOfWeek") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DayOfWeekNumber") + .HasColumnType("int"); + + b.Property("DayOfWeekShort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MonthNameLong") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MonthNameShort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MonthNumber") + .HasColumnType("int"); + + b.Property("WeekNumber") + .HasColumnType("int"); + + b.Property("WeekNumberString") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Year") + .HasColumnType("int"); + + b.Property("YearWeekNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Date"); + + b.ToTable("calendar"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Contract", b => + { + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ContractReportingId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("EstateId", "OperatorId", "ContractId"); + + b.ToTable("contract"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.ContractProduct", b => + { + b.Property("ContractProductReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ContractProductReportingId")); + + b.Property("ContractId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayText") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProductName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProductType") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ContractProductReportingId"); + + b.HasIndex("ContractProductId", "ContractId") + .IsUnique(); + + b.ToTable("contractproduct"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.ContractProductTransactionFee", b => + { + b.Property("ContractProductTransactionFeeReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ContractProductTransactionFeeReportingId")); + + b.Property("CalculationType") + .HasColumnType("int"); + + b.Property("ContractProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractProductTransactionFeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FeeType") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("Value") + .HasColumnType("decimal(18,4)"); + + b.HasKey("ContractProductTransactionFeeReportingId"); + + b.HasIndex("ContractProductTransactionFeeId", "ContractProductId") + .IsUnique(); + + b.ToTable("contractproducttransactionfee"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Estate", b => + { + b.Property("EstateReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("EstateReportingId")); + + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.HasKey("EstateReportingId"); + + b.HasIndex("EstateId") + .IsUnique(); + + b.ToTable("estate"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.EstateOperator", b => + { + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.HasKey("EstateId", "OperatorId"); + + b.ToTable("estateoperator"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.EstateSecurityUser", b => + { + b.Property("SecurityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("SecurityUserId", "EstateId"); + + b.ToTable("estatesecurityuser"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.File", b => + { + b.Property("FileReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("FileReportingId")); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileImportLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileLocation") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FileProfileId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileReceivedDate") + .HasColumnType("date"); + + b.Property("FileReceivedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("FileReportingId"); + + b.HasIndex("FileId") + .IsUnique(); + + b.ToTable("file"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FileFormatHandler", b => + { + b.Property("FileFormatHandlerId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("FileFormatHandlerId"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("FileFormatHandlers"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FileImportLog", b => + { + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileImportLogReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("FileImportLogReportingId")); + + b.Property("FileImportLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ImportLogDate") + .HasColumnType("date"); + + b.Property("ImportLogDateTime") + .HasColumnType("datetimeoffset"); + + b.HasKey("EstateId", "FileImportLogReportingId"); + + b.HasIndex("EstateId", "FileImportLogId") + .IsUnique(); + + b.ToTable("fileimportlog"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FileImportLogFile", b => + { + b.Property("FileImportLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b.Property("FilePath") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FileProfileId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileUploadedDate") + .HasColumnType("date"); + + b.Property("FileUploadedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("OriginalFileName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("FileImportLogId", "FileId"); + + b.ToTable("fileimportlogfile"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FileLine", b => + { + b.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b.Property("LineNumber") + .HasColumnType("int"); + + b.Property("FileLineData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("FileId", "LineNumber"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("FileId", "LineNumber")); + + b.ToTable("fileline"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FileProfileConfiguration", b => + { + b.Property("FileProfileId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FileFormatHandlerId") + .HasColumnType("uniqueidentifier"); + + b.Property("LineTerminator") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ListeningDirectory") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("RequestTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("FileProfileId"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("FileProfileConfigurations"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Float", b => + { + b.Property("FloatId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDate") + .HasColumnType("date"); + + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("FloatId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("FloatId"), false); + + b.HasIndex("CreatedDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("CreatedDate")); + + b.ToTable("Floats"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FloatActivity", b => + { + b.Property("EventId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ActivityDate") + .HasColumnType("date"); + + b.Property("ActivityDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("CostPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("CreditOrDebit") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FloatId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("EventId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("EventId"), false); + + b.HasIndex("ActivityDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ActivityDate")); + + b.ToTable("FloatActivity"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Merchant", b => + { + b.Property("MerchantReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("MerchantReportingId")); + + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastSaleDate") + .HasColumnType("date"); + + b.Property("LastSaleDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("LastStatementGenerated") + .HasColumnType("datetimeoffset"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("SettlementSchedule") + .HasColumnType("int"); + + b.HasKey("MerchantReportingId"); + + b.HasIndex("EstateId", "MerchantId") + .IsUnique(); + + b.ToTable("merchant"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantAddress", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("AddressId") + .HasColumnType("uniqueidentifier"); + + b.Property("AddressLine1") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("AddressLine2") + .HasColumnType("nvarchar(max)"); + + b.Property("AddressLine3") + .HasColumnType("nvarchar(max)"); + + b.Property("AddressLine4") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("PostalCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Region") + .HasColumnType("nvarchar(max)"); + + b.Property("Town") + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId", "AddressId"); + + b.ToTable("merchantaddress"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantContact", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContactId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("EmailAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId", "ContactId"); + + b.ToTable("merchantcontact"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantContract", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.HasKey("MerchantId", "ContractId"); + + b.ToTable("MerchantContracts"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantDevice", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeviceId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("DeviceIdentifier") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.HasKey("MerchantId", "DeviceId"); + + b.ToTable("merchantdevice"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantOpeningHours", b => + { + b.Property("MerchantId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FridayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("FridayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("MondayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("MondayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("SaturdayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("SaturdayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("SundayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("SundayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("ThursdayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("ThursdayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("TuesdayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("TuesdayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("WednesdayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("WednesdayOpening") + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId"); + + b.ToTable("merchantopeninghours"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantOperator", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("MerchantNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TerminalNumber") + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId", "OperatorId"); + + b.ToTable("merchantoperator"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantSchedule", b => + { + b.Property("MerchantScheduleId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("MerchantScheduleId"); + + b.HasIndex("MerchantId", "Year") + .IsUnique(); + + b.ToTable("merchantschedule"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantScheduleMonth", b => + { + b.Property("MerchantScheduleId") + .HasColumnType("uniqueidentifier"); + + b.Property("Month") + .HasColumnType("int"); + + b.Property("ClosedDays") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantScheduleId", "Month"); + + b.ToTable("merchantschedulemonth"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantSecurityUser", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SecurityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId", "SecurityUserId"); + + b.ToTable("merchantsecurityuser"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantSettlementFee", b => + { + b.Property("SettlementId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractProductTransactionFeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("CalculatedValue") + .HasColumnType("decimal(18,2)"); + + b.Property("FeeCalculatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("FeeValue") + .HasColumnType("decimal(18,2)"); + + b.Property("IsSettled") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("SettlementId", "TransactionId", "ContractProductTransactionFeeId"); + + b.ToTable("merchantsettlementfee"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Operator", b => + { + b.Property("OperatorReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("OperatorReportingId")); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("RequireCustomMerchantNumber") + .HasColumnType("bit"); + + b.Property("RequireCustomTerminalNumber") + .HasColumnType("bit"); + + b.HasKey("OperatorReportingId"); + + b.HasIndex("OperatorId") + .IsUnique(); + + b.ToTable("operator"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Reconciliation", b => + { + b.Property("TransactionReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("TransactionReportingId")); + + b.Property("DeviceIdentifier") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAuthorised") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ResponseCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionCount") + .HasColumnType("int"); + + b.Property("TransactionDate") + .HasColumnType("date"); + + b.Property("TransactionDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionTime") + .HasColumnType("time"); + + b.Property("TransactionValue") + .HasColumnType("decimal(18,2)"); + + b.HasKey("TransactionReportingId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("TransactionReportingId"), false); + + b.HasIndex("TransactionDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionDate")); + + b.HasIndex("TransactionId", "MerchantId") + .IsUnique(); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionId", "MerchantId"), false); + + b.ToTable("reconciliation"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.RequestType", b => + { + b.Property("RequestTypeId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("RequestTypeId"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("RequestTypes"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.ResponseCodes", b => + { + b.Property("ResponseCode") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ResponseCode")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ResponseCode"); + + b.ToTable("responsecodes"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Settlement", b => + { + b.Property("SettlementReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("SettlementReportingId")); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProcessingStarted") + .HasColumnType("bit"); + + b.Property("ProcessingStartedDateTIme") + .HasColumnType("datetimeoffset"); + + b.Property("SettlementDate") + .HasColumnType("date"); + + b.Property("SettlementId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("SettlementReportingId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("SettlementReportingId"), false); + + b.HasIndex("SettlementDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("SettlementDate")); + + b.HasIndex("EstateId", "SettlementId") + .IsUnique(); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("EstateId", "SettlementId"), false); + + b.ToTable("settlement"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.StatementHeader", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("StatementId") + .HasColumnType("uniqueidentifier"); + + b.Property("StatementCreatedDate") + .HasColumnType("date"); + + b.Property("StatementCreatedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("StatementGeneratedDate") + .HasColumnType("date"); + + b.Property("StatementGeneratedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("StatementReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("StatementReportingId")); + + b.HasKey("MerchantId", "StatementId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("MerchantId", "StatementId"), false); + + b.HasIndex("StatementGeneratedDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("StatementGeneratedDate")); + + b.ToTable("statementheader"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.StatementLine", b => + { + b.Property("StatementId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("ActivityDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("ActivityType") + .HasColumnType("int"); + + b.Property("ActivityDate") + .HasColumnType("date"); + + b.Property("ActivityDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("InAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("OutAmount") + .HasColumnType("decimal(18,2)"); + + b.HasKey("StatementId", "TransactionId", "ActivityDateTime", "ActivityType"); + + b.ToTable("statementline"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Summary.SettlementSummary", b => + { + b.Property("ContractProductReportingId") + .HasColumnType("int"); + + b.Property("FeeCount") + .HasColumnType("int"); + + b.Property("FeeValue") + .HasColumnType("decimal(18,2)"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("IsSettled") + .HasColumnType("bit"); + + b.Property("MerchantReportingId") + .HasColumnType("int"); + + b.Property("OperatorReportingId") + .HasColumnType("int"); + + b.Property("SalesCount") + .HasColumnType("int"); + + b.Property("SalesValue") + .HasColumnType("decimal(18,2)"); + + b.Property("SettlementDate") + .HasColumnType("date"); + + b.HasIndex("SettlementDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("SettlementDate")); + + b.HasIndex("SettlementDate", "MerchantReportingId", "OperatorReportingId", "ContractProductReportingId", "IsCompleted", "IsSettled") + .IsUnique(); + + b.ToTable("SettlementSummary"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Summary.TodayTransaction", b => + { + b.Property("AuthorisationCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ContractProductReportingId") + .HasColumnType("int"); + + b.Property("ContractReportingId") + .HasColumnType("int"); + + b.Property("DeviceIdentifier") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Hour") + .HasColumnType("int"); + + b.Property("IsAuthorised") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantReportingId") + .HasColumnType("int"); + + b.Property("OperatorReportingId") + .HasColumnType("int"); + + b.Property("ResponseCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseMessage") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("TransactionDate") + .HasColumnType("date"); + + b.Property("TransactionDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReportingId") + .HasColumnType("int"); + + b.Property("TransactionSource") + .HasColumnType("int"); + + b.Property("TransactionTime") + .HasColumnType("time"); + + b.Property("TransactionType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasIndex("TransactionDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionDate")); + + b.HasIndex("TransactionId") + .IsUnique(); + + b.ToTable("TodayTransactions"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Summary.TransactionHistory", b => + { + b.Property("AuthorisationCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ContractProductReportingId") + .HasColumnType("int"); + + b.Property("ContractReportingId") + .HasColumnType("int"); + + b.Property("DeviceIdentifier") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Hour") + .HasColumnType("int"); + + b.Property("IsAuthorised") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantReportingId") + .HasColumnType("int"); + + b.Property("OperatorReportingId") + .HasColumnType("int"); + + b.Property("ResponseCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseMessage") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("TransactionDate") + .HasColumnType("date"); + + b.Property("TransactionDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReportingId") + .HasColumnType("int"); + + b.Property("TransactionSource") + .HasColumnType("int"); + + b.Property("TransactionTime") + .HasColumnType("time"); + + b.Property("TransactionType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasIndex("TransactionDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionDate")); + + b.HasIndex("TransactionId") + .IsUnique(); + + b.ToTable("TransactionHistory"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Transaction", b => + { + b.Property("TransactionReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("TransactionReportingId")); + + b.Property("AuthorisationCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ContractId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeviceIdentifier") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAuthorised") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ResponseCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("TransactionDate") + .HasColumnType("date"); + + b.Property("TransactionDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReference") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionSource") + .HasColumnType("int"); + + b.Property("TransactionTime") + .HasColumnType("time"); + + b.Property("TransactionType") + .HasColumnType("nvarchar(max)"); + + b.HasKey("TransactionReportingId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("TransactionReportingId"), false); + + b.HasIndex("TransactionDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionDate")); + + b.HasIndex("TransactionId") + .IsUnique(); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionId"), false); + + b.ToTable("transaction"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.TransactionAdditionalRequestData", b => + { + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("Amount") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerAccountNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("Metadata") + .HasColumnType("nvarchar(max)"); + + b.HasKey("TransactionId"); + + b.ToTable("transactionadditionalrequestdata"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.TransactionAdditionalResponseData", b => + { + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("Metadata") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReportingId") + .HasColumnType("int"); + + b.HasKey("TransactionId"); + + b.ToTable("transactionadditionalresponsedata"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.TransactionTimings", b => + { + b.Property("TransactionId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorCommunicationsCompletedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("OperatorCommunicationsDurationInMilliseconds") + .HasColumnType("float"); + + b.Property("OperatorCommunicationsStartedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("TotalTransactionInMilliseconds") + .HasColumnType("float"); + + b.Property("TransactionCompletedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("TransactionProcessingDurationInMilliseconds") + .HasColumnType("float"); + + b.Property("TransactionStartedDateTime") + .HasColumnType("datetimeoffset"); + + b.HasKey("TransactionId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("TransactionId"), false); + + b.ToTable("transactiontimings"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.VoucherProjectionState", b => + { + b.Property("VoucherId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Barcode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpiryDate") + .HasColumnType("date"); + + b.Property("ExpiryDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("GenerateDate") + .HasColumnType("date"); + + b.Property("GenerateDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("IsGenerated") + .HasColumnType("bit"); + + b.Property("IsIssued") + .HasColumnType("bit"); + + b.Property("IsRedeemed") + .HasColumnType("bit"); + + b.Property("IssuedDate") + .HasColumnType("date"); + + b.Property("IssuedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("OperatorIdentifier") + .HasColumnType("nvarchar(max)"); + + b.Property("RecipientEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("RecipientMobile") + .HasColumnType("nvarchar(max)"); + + b.Property("RedeemedDate") + .HasColumnType("date"); + + b.Property("RedeemedDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("Timestamp") + .IsConcurrencyToken() + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("rowversion"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("decimal(18,2)"); + + b.Property("VoucherCode") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("VoucherId"); + + b.HasIndex("TransactionId"); + + b.HasIndex("VoucherCode"); + + b.ToTable("voucherprojectionstate"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.ViewEntities.SettlementView", b => + { + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("CalculatedValue") + .HasColumnType("decimal(18,2)"); + + b.Property("DayOfWeek") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("FeeDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("IsSettled") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("MerchantName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Month") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MonthNumber") + .HasColumnType("int"); + + b.Property("OperatorIdentifier") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SettlementDate") + .HasColumnType("datetimeoffset"); + + b.Property("SettlementId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("WeekNumber") + .HasColumnType("int"); + + b.Property("YearNumber") + .HasColumnType("int"); + + b.ToTable((string)null); + + b.ToView("uvwSettlements", (string)null); + }); + + modelBuilder.Entity("TransactionProcessor.ProjectionEngine.Database.Database.Entities.Event", b => + { + b.Property("EventId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(450)"); + + b.Property("Date") + .HasColumnType("date"); + + b.HasKey("EventId", "Type"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("EventId", "Type")); + + b.ToTable("Events"); + }); + + modelBuilder.Entity("TransactionProcessor.ProjectionEngine.Database.Database.Entities.MerchantBalanceChangedEntry", b => + { + b.Property("AggregateId") + .HasColumnType("uniqueidentifier"); + + b.Property("OriginalEventId") + .HasColumnType("uniqueidentifier"); + + b.Property("CauseOfChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("ChangeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("DateTime") + .HasColumnType("datetimeoffset"); + + b.Property("DebitOrCredit") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("AggregateId", "OriginalEventId"); + + b.ToTable("MerchantBalanceChangedEntry"); + }); + + modelBuilder.Entity("TransactionProcessor.ProjectionEngine.Database.Database.Entities.MerchantBalanceProjectionState", b => + { + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorisedSales") + .HasColumnType("decimal(18,2)"); + + b.Property("AvailableBalance") + .HasColumnType("decimal(18,2)"); + + b.Property("Balance") + .HasColumnType("decimal(18,2)"); + + b.Property("CompletedTransactionCount") + .HasColumnType("int"); + + b.Property("DeclinedSales") + .HasColumnType("decimal(18,2)"); + + b.Property("DepositCount") + .HasColumnType("int"); + + b.Property("FeeCount") + .HasColumnType("int"); + + b.Property("LastDeposit") + .HasColumnType("datetimeoffset"); + + b.Property("LastFee") + .HasColumnType("datetimeoffset"); + + b.Property("LastSale") + .HasColumnType("datetimeoffset"); + + b.Property("LastWithdrawal") + .HasColumnType("datetimeoffset"); + + b.Property("MerchantName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SaleCount") + .HasColumnType("int"); + + b.Property("StartedTransactionCount") + .HasColumnType("int"); + + b.Property("Timestamp") + .IsConcurrencyToken() + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("rowversion"); + + b.Property("TotalDeposited") + .HasColumnType("decimal(18,2)"); + + b.Property("TotalWithdrawn") + .HasColumnType("decimal(18,2)"); + + b.Property("ValueOfFees") + .HasColumnType("decimal(18,2)"); + + b.Property("WithdrawalCount") + .HasColumnType("int"); + + b.HasKey("EstateId", "MerchantId"); + + b.ToTable("MerchantBalanceProjectionState"); + }); + + modelBuilder.Entity("TransactionProcessor.ProjectionEngine.Database.Database.ViewEntities.MerchantBalanceHistoryViewEntry", b => + { + b.Property("Balance") + .HasColumnType("decimal(18,2)"); + + b.Property("ChangeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("DebitOrCredit") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EntryDateTime") + .HasColumnType("datetimeoffset"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("OriginalEventId") + .HasColumnType("uniqueidentifier"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.ToTable((string)null); + + b.ToView("uvwMerchantBalanceHistory", (string)null); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.cs b/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.cs new file mode 100644 index 00000000..8172a481 --- /dev/null +++ b/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.cs @@ -0,0 +1,667 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace TransactionProcessor.Database.Migrations.SqlServer +{ + /// + public partial class DateTime_to_DateTimeOffset : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "RedeemedDateTime", + table: "voucherprojectionstate", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "RedeemedDate", + table: "voucherprojectionstate", + type: "date", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "IssuedDateTime", + table: "voucherprojectionstate", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "GenerateDateTime", + table: "voucherprojectionstate", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "ExpiryDateTime", + table: "voucherprojectionstate", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "TransactionStartedDateTime", + table: "transactiontimings", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "TransactionCompletedDateTime", + table: "transactiontimings", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "OperatorCommunicationsStartedDateTime", + table: "transactiontimings", + type: "datetimeoffset", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "OperatorCommunicationsCompletedDateTime", + table: "transactiontimings", + type: "datetimeoffset", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "TransactionDateTime", + table: "TransactionHistory", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "TransactionDateTime", + table: "transaction", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "TransactionDateTime", + table: "TodayTransactions", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.DropPrimaryKey( + name: "PK_statementline", + table: "statementline"); + + migrationBuilder.AlterColumn( + name: "ActivityDateTime", + table: "statementline", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AddPrimaryKey( + name: "PK_statementline", + table: "statementline", + columns: new[] { "StatementId", "TransactionId", "ActivityDateTime", "ActivityType" }); + + migrationBuilder.AlterColumn( + name: "StatementGeneratedDateTime", + table: "statementheader", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "StatementCreatedDateTime", + table: "statementheader", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "ProcessingStartedDateTIme", + table: "settlement", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "TransactionDateTime", + table: "reconciliation", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "FeeCalculatedDateTime", + table: "merchantsettlementfee", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchantsecurityuser", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchantdevice", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchantcontact", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "LastWithdrawal", + table: "MerchantBalanceProjectionState", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "LastSale", + table: "MerchantBalanceProjectionState", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "LastFee", + table: "MerchantBalanceProjectionState", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "LastDeposit", + table: "MerchantBalanceProjectionState", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "DateTime", + table: "MerchantBalanceChangedEntry", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchantaddress", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "LastStatementGenerated", + table: "merchant", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "LastSaleDateTime", + table: "merchant", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchant", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "Floats", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "ActivityDateTime", + table: "FloatActivity", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "FileUploadedDateTime", + table: "fileimportlogfile", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "ImportLogDateTime", + table: "fileimportlog", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "FileReceivedDateTime", + table: "file", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "estatesecurityuser", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "estate", + type: "datetimeoffset", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.DropPrimaryKey( + name: "PK_calendar", + table: "calendar"); + + migrationBuilder.AlterColumn( + name: "Date", + table: "calendar", + type: "date", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AddPrimaryKey( + name: "PK_calendar", + table: "calendar", + column: "Date"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "RedeemedDateTime", + table: "voucherprojectionstate", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "RedeemedDate", + table: "voucherprojectionstate", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateOnly), + oldType: "date"); + + migrationBuilder.AlterColumn( + name: "IssuedDateTime", + table: "voucherprojectionstate", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "GenerateDateTime", + table: "voucherprojectionstate", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "ExpiryDateTime", + table: "voucherprojectionstate", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "TransactionStartedDateTime", + table: "transactiontimings", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "TransactionCompletedDateTime", + table: "transactiontimings", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "OperatorCommunicationsStartedDateTime", + table: "transactiontimings", + type: "datetime2", + nullable: true, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "OperatorCommunicationsCompletedDateTime", + table: "transactiontimings", + type: "datetime2", + nullable: true, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "TransactionDateTime", + table: "TransactionHistory", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "TransactionDateTime", + table: "transaction", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "TransactionDateTime", + table: "TodayTransactions", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.DropPrimaryKey( + name: "PK_statementline", + table: "statementline"); + + migrationBuilder.AlterColumn( + name: "ActivityDateTime", + table: "statementline", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AddPrimaryKey( + name: "PK_statementline", + table: "statementline", + columns: new[] { "StatementId", "TransactionId", "ActivityDateTime", "ActivityType" }); + + migrationBuilder.AlterColumn( + name: "StatementGeneratedDateTime", + table: "statementheader", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "StatementCreatedDateTime", + table: "statementheader", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "ProcessingStartedDateTIme", + table: "settlement", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "TransactionDateTime", + table: "reconciliation", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "FeeCalculatedDateTime", + table: "merchantsettlementfee", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchantsecurityuser", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchantdevice", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchantcontact", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "LastWithdrawal", + table: "MerchantBalanceProjectionState", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "LastSale", + table: "MerchantBalanceProjectionState", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "LastFee", + table: "MerchantBalanceProjectionState", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "LastDeposit", + table: "MerchantBalanceProjectionState", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "DateTime", + table: "MerchantBalanceChangedEntry", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchantaddress", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "LastStatementGenerated", + table: "merchant", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "LastSaleDateTime", + table: "merchant", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "merchant", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "Floats", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "ActivityDateTime", + table: "FloatActivity", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "FileUploadedDateTime", + table: "fileimportlogfile", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "ImportLogDateTime", + table: "fileimportlog", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "FileReceivedDateTime", + table: "file", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "estatesecurityuser", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.AlterColumn( + name: "CreatedDateTime", + table: "estate", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTimeOffset), + oldType: "datetimeoffset"); + + migrationBuilder.DropPrimaryKey( + name: "PK_calendar", + table: "calendar"); + + migrationBuilder.AlterColumn( + name: "Date", + table: "calendar", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateOnly), + oldType: "date"); + + migrationBuilder.AddPrimaryKey( + name: "PK_calendar", + table: "calendar", + column: "Date"); + } + } +} diff --git a/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs b/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs index 9b7fb1e9..aa81679d 100644 --- a/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs +++ b/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs @@ -17,15 +17,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "10.0.12") + .HasAnnotation("ProductVersion", "10.0.14") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); modelBuilder.Entity("TransactionProcessor.Database.Entities.Calendar", b => { - b.Property("Date") - .HasColumnType("datetime2"); + b.Property("Date") + .HasColumnType("date"); b.Property("DayOfWeek") .IsRequired() @@ -176,8 +176,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("EstateReportingId")); - b.Property("CreatedDateTime") - .HasColumnType("datetime2"); + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); b.Property("EstateId") .HasColumnType("uniqueidentifier"); @@ -221,8 +221,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("EstateId") .HasColumnType("uniqueidentifier"); - b.Property("CreatedDateTime") - .HasColumnType("datetime2"); + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); b.Property("EmailAddress") .IsRequired() @@ -257,11 +257,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("FileProfileId") .HasColumnType("uniqueidentifier"); - b.Property("FileReceivedDate") + b.Property("FileReceivedDate") .HasColumnType("date"); - b.Property("FileReceivedDateTime") - .HasColumnType("datetime2"); + b.Property("FileReceivedDateTime") + .HasColumnType("datetimeoffset"); b.Property("IsCompleted") .HasColumnType("bit"); @@ -312,11 +312,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("FileImportLogId") .HasColumnType("uniqueidentifier"); - b.Property("ImportLogDate") + b.Property("ImportLogDate") .HasColumnType("date"); - b.Property("ImportLogDateTime") - .HasColumnType("datetime2"); + b.Property("ImportLogDateTime") + .HasColumnType("datetimeoffset"); b.HasKey("EstateId", "FileImportLogReportingId"); @@ -341,11 +341,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("FileProfileId") .HasColumnType("uniqueidentifier"); - b.Property("FileUploadedDate") + b.Property("FileUploadedDate") .HasColumnType("date"); - b.Property("FileUploadedDateTime") - .HasColumnType("datetime2"); + b.Property("FileUploadedDateTime") + .HasColumnType("datetimeoffset"); b.Property("MerchantId") .HasColumnType("uniqueidentifier"); @@ -429,11 +429,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); - b.Property("CreatedDate") + b.Property("CreatedDate") .HasColumnType("date"); - b.Property("CreatedDateTime") - .HasColumnType("datetime2"); + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); b.Property("EstateId") .HasColumnType("uniqueidentifier"); @@ -455,11 +455,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); - b.Property("ActivityDate") + b.Property("ActivityDate") .HasColumnType("date"); - b.Property("ActivityDateTime") - .HasColumnType("datetime2"); + b.Property("ActivityDateTime") + .HasColumnType("datetimeoffset"); b.Property("Amount") .HasColumnType("decimal(18,2)"); @@ -493,20 +493,20 @@ protected override void BuildModel(ModelBuilder modelBuilder) SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("MerchantReportingId")); - b.Property("CreatedDateTime") - .HasColumnType("datetime2"); + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); b.Property("EstateId") .HasColumnType("uniqueidentifier"); - b.Property("LastSaleDate") + b.Property("LastSaleDate") .HasColumnType("date"); - b.Property("LastSaleDateTime") - .HasColumnType("datetime2"); + b.Property("LastSaleDateTime") + .HasColumnType("datetimeoffset"); - b.Property("LastStatementGenerated") - .HasColumnType("datetime2"); + b.Property("LastStatementGenerated") + .HasColumnType("datetimeoffset"); b.Property("MerchantId") .HasColumnType("uniqueidentifier"); @@ -553,8 +553,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Country") .HasColumnType("nvarchar(max)"); - b.Property("CreatedDateTime") - .HasColumnType("datetime2"); + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); b.Property("PostalCode") .HasColumnType("nvarchar(max)"); @@ -578,8 +578,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ContactId") .HasColumnType("uniqueidentifier"); - b.Property("CreatedDateTime") - .HasColumnType("datetime2"); + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); b.Property("EmailAddress") .HasColumnType("nvarchar(max)"); @@ -620,8 +620,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("DeviceId") .HasColumnType("uniqueidentifier"); - b.Property("CreatedDateTime") - .HasColumnType("datetime2"); + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); b.Property("DeviceIdentifier") .IsRequired() @@ -762,8 +762,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("SecurityUserId") .HasColumnType("uniqueidentifier"); - b.Property("CreatedDateTime") - .HasColumnType("datetime2"); + b.Property("CreatedDateTime") + .HasColumnType("datetimeoffset"); b.Property("EmailAddress") .IsRequired() @@ -788,8 +788,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CalculatedValue") .HasColumnType("decimal(18,2)"); - b.Property("FeeCalculatedDateTime") - .HasColumnType("datetime2"); + b.Property("FeeCalculatedDateTime") + .HasColumnType("datetimeoffset"); b.Property("FeeValue") .HasColumnType("decimal(18,2)"); @@ -866,11 +866,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("TransactionCount") .HasColumnType("int"); - b.Property("TransactionDate") + b.Property("TransactionDate") .HasColumnType("date"); - b.Property("TransactionDateTime") - .HasColumnType("datetime2"); + b.Property("TransactionDateTime") + .HasColumnType("datetimeoffset"); b.Property("TransactionId") .HasColumnType("uniqueidentifier"); @@ -952,10 +952,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ProcessingStarted") .HasColumnType("bit"); - b.Property("ProcessingStartedDateTIme") - .HasColumnType("datetime2"); + b.Property("ProcessingStartedDateTIme") + .HasColumnType("datetimeoffset"); - b.Property("SettlementDate") + b.Property("SettlementDate") .HasColumnType("date"); b.Property("SettlementId") @@ -985,17 +985,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("StatementId") .HasColumnType("uniqueidentifier"); - b.Property("StatementCreatedDate") + b.Property("StatementCreatedDate") .HasColumnType("date"); - b.Property("StatementCreatedDateTime") - .HasColumnType("datetime2"); + b.Property("StatementCreatedDateTime") + .HasColumnType("datetimeoffset"); - b.Property("StatementGeneratedDate") + b.Property("StatementGeneratedDate") .HasColumnType("date"); - b.Property("StatementGeneratedDateTime") - .HasColumnType("datetime2"); + b.Property("StatementGeneratedDateTime") + .HasColumnType("datetimeoffset"); b.Property("StatementReportingId") .ValueGeneratedOnAdd() @@ -1022,13 +1022,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("TransactionId") .HasColumnType("uniqueidentifier"); - b.Property("ActivityDateTime") - .HasColumnType("datetime2"); + b.Property("ActivityDateTime") + .HasColumnType("datetimeoffset"); b.Property("ActivityType") .HasColumnType("int"); - b.Property("ActivityDate") + b.Property("ActivityDate") .HasColumnType("date"); b.Property("ActivityDescription") @@ -1074,7 +1074,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("SalesValue") .HasColumnType("decimal(18,2)"); - b.Property("SettlementDate") + b.Property("SettlementDate") .HasColumnType("date"); b.HasIndex("SettlementDate"); @@ -1129,11 +1129,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("TransactionAmount") .HasColumnType("decimal(18,2)"); - b.Property("TransactionDate") + b.Property("TransactionDate") .HasColumnType("date"); - b.Property("TransactionDateTime") - .HasColumnType("datetime2"); + b.Property("TransactionDateTime") + .HasColumnType("datetimeoffset"); b.Property("TransactionId") .HasColumnType("uniqueidentifier"); @@ -1211,11 +1211,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("TransactionAmount") .HasColumnType("decimal(18,2)"); - b.Property("TransactionDate") + b.Property("TransactionDate") .HasColumnType("date"); - b.Property("TransactionDateTime") - .HasColumnType("datetime2"); + b.Property("TransactionDateTime") + .HasColumnType("datetimeoffset"); b.Property("TransactionId") .HasColumnType("uniqueidentifier"); @@ -1292,11 +1292,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("TransactionAmount") .HasColumnType("decimal(18,2)"); - b.Property("TransactionDate") + b.Property("TransactionDate") .HasColumnType("date"); - b.Property("TransactionDateTime") - .HasColumnType("datetime2"); + b.Property("TransactionDateTime") + .HasColumnType("datetimeoffset"); b.Property("TransactionId") .HasColumnType("uniqueidentifier"); @@ -1373,26 +1373,26 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); - b.Property("OperatorCommunicationsCompletedDateTime") - .HasColumnType("datetime2"); + b.Property("OperatorCommunicationsCompletedDateTime") + .HasColumnType("datetimeoffset"); b.Property("OperatorCommunicationsDurationInMilliseconds") .HasColumnType("float"); - b.Property("OperatorCommunicationsStartedDateTime") - .HasColumnType("datetime2"); + b.Property("OperatorCommunicationsStartedDateTime") + .HasColumnType("datetimeoffset"); b.Property("TotalTransactionInMilliseconds") .HasColumnType("float"); - b.Property("TransactionCompletedDateTime") - .HasColumnType("datetime2"); + b.Property("TransactionCompletedDateTime") + .HasColumnType("datetimeoffset"); b.Property("TransactionProcessingDurationInMilliseconds") .HasColumnType("float"); - b.Property("TransactionStartedDateTime") - .HasColumnType("datetime2"); + b.Property("TransactionStartedDateTime") + .HasColumnType("datetimeoffset"); b.HasKey("TransactionId"); @@ -1414,17 +1414,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("EstateId") .HasColumnType("uniqueidentifier"); - b.Property("ExpiryDate") + b.Property("ExpiryDate") .HasColumnType("date"); - b.Property("ExpiryDateTime") - .HasColumnType("datetime2"); + b.Property("ExpiryDateTime") + .HasColumnType("datetimeoffset"); - b.Property("GenerateDate") + b.Property("GenerateDate") .HasColumnType("date"); - b.Property("GenerateDateTime") - .HasColumnType("datetime2"); + b.Property("GenerateDateTime") + .HasColumnType("datetimeoffset"); b.Property("IsGenerated") .HasColumnType("bit"); @@ -1435,11 +1435,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsRedeemed") .HasColumnType("bit"); - b.Property("IssuedDate") + b.Property("IssuedDate") .HasColumnType("date"); - b.Property("IssuedDateTime") - .HasColumnType("datetime2"); + b.Property("IssuedDateTime") + .HasColumnType("datetimeoffset"); b.Property("OperatorIdentifier") .HasColumnType("nvarchar(max)"); @@ -1450,11 +1450,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("RecipientMobile") .HasColumnType("nvarchar(max)"); - b.Property("RedeemedDate") - .HasColumnType("datetime2"); + b.Property("RedeemedDate") + .HasColumnType("date"); - b.Property("RedeemedDateTime") - .HasColumnType("datetime2"); + b.Property("RedeemedDateTime") + .HasColumnType("datetimeoffset"); b.Property("Timestamp") .IsConcurrencyToken() @@ -1524,8 +1524,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("SettlementDate") - .HasColumnType("datetime2"); + b.Property("SettlementDate") + .HasColumnType("datetimeoffset"); b.Property("SettlementId") .HasColumnType("uniqueidentifier"); @@ -1552,7 +1552,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Type") .HasColumnType("nvarchar(450)"); - b.Property("Date") + b.Property("Date") .HasColumnType("date"); b.HasKey("EventId", "Type"); @@ -1576,8 +1576,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ChangeAmount") .HasColumnType("decimal(18,2)"); - b.Property("DateTime") - .HasColumnType("datetime2"); + b.Property("DateTime") + .HasColumnType("datetimeoffset"); b.Property("DebitOrCredit") .IsRequired() @@ -1627,17 +1627,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("FeeCount") .HasColumnType("int"); - b.Property("LastDeposit") - .HasColumnType("datetime2"); + b.Property("LastDeposit") + .HasColumnType("datetimeoffset"); - b.Property("LastFee") - .HasColumnType("datetime2"); + b.Property("LastFee") + .HasColumnType("datetimeoffset"); - b.Property("LastSale") - .HasColumnType("datetime2"); + b.Property("LastSale") + .HasColumnType("datetimeoffset"); - b.Property("LastWithdrawal") - .HasColumnType("datetime2"); + b.Property("LastWithdrawal") + .HasColumnType("datetimeoffset"); b.Property("MerchantName") .IsRequired() @@ -1684,8 +1684,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("EntryDateTime") - .HasColumnType("datetime2"); + b.Property("EntryDateTime") + .HasColumnType("datetimeoffset"); b.Property("MerchantId") .HasColumnType("uniqueidentifier"); diff --git a/TransactionProcessor.Database/ViewEntities/MerchantBalanceHistoryEntry.cs b/TransactionProcessor.Database/ViewEntities/MerchantBalanceHistoryEntry.cs index deafe675..164ac3bd 100644 --- a/TransactionProcessor.Database/ViewEntities/MerchantBalanceHistoryEntry.cs +++ b/TransactionProcessor.Database/ViewEntities/MerchantBalanceHistoryEntry.cs @@ -8,7 +8,7 @@ public class MerchantBalanceHistoryViewEntry public Decimal ChangeAmount { get; set; } - public DateTime EntryDateTime { get; set; } + public DateTimeOffset EntryDateTime { get; set; } public String Reference { get; set; } diff --git a/TransactionProcessor.Database/ViewEntities/SettlementView.cs b/TransactionProcessor.Database/ViewEntities/SettlementView.cs index 9bc59a21..bf0ae608 100644 --- a/TransactionProcessor.Database/ViewEntities/SettlementView.cs +++ b/TransactionProcessor.Database/ViewEntities/SettlementView.cs @@ -70,7 +70,7 @@ public class SettlementView /// public String OperatorIdentifier { get; set; } - public DateTime SettlementDate { get; set; } + public DateTimeOffset SettlementDate { get; set; } public Guid SettlementId { get; set; } diff --git a/TransactionProcessor.DatabaseTests/DatabaseTestFixture.cs b/TransactionProcessor.DatabaseTests/DatabaseTestFixture.cs index 597e727a..659d8697 100644 --- a/TransactionProcessor.DatabaseTests/DatabaseTestFixture.cs +++ b/TransactionProcessor.DatabaseTests/DatabaseTestFixture.cs @@ -38,7 +38,7 @@ public string GetLocalConnectionString(string databaseName) { int? databaseHostPort = this.dockerHelper.GetHostPort(ContainerType.SqlServer); - return $"server=localhost,{databaseHostPort};database={databaseName};user id={BaseTest.SqlCredentials.usename};password={BaseTest.SqlCredentials.password};Encrypt=false"; + return $"server=127.0.0.1,{databaseHostPort};database={databaseName};user id={BaseTest.SqlCredentials.usename};password={BaseTest.SqlCredentials.password};Encrypt=false"; } private NlogLogger CreateLogger() diff --git a/TransactionProcessor.DatabaseTests/FileImportLogEventTests.cs b/TransactionProcessor.DatabaseTests/FileImportLogEventTests.cs index 78885255..0f1b6a24 100644 --- a/TransactionProcessor.DatabaseTests/FileImportLogEventTests.cs +++ b/TransactionProcessor.DatabaseTests/FileImportLogEventTests.cs @@ -42,7 +42,7 @@ public async Task AddFileImportLog_FileImportLogIsAdded() var fileImportLog = await context.FileImportLogs.SingleOrDefaultAsync(f => f.FileImportLogId == TestData.DomainEvents.ImportLogCreatedEvent.FileImportLogId, TestContext.Current.CancellationToken); fileImportLog.ShouldNotBeNull(); fileImportLog.EstateId.ShouldBe(TestData.DomainEvents.ImportLogCreatedEvent.EstateId); - fileImportLog.ImportLogDate.ShouldBe(TestData.DomainEvents.ImportLogCreatedEvent.ImportLogDateTime.Date); + fileImportLog.ImportLogDate.ShouldBe(DateOnly.FromDateTime(TestData.DomainEvents.ImportLogCreatedEvent.ImportLogDateTime.Date)); } [Fact] @@ -91,7 +91,7 @@ public async Task AddFile_FileIsAdded() file.EstateId.ShouldBe(TestData.DomainEvents.FileCreatedEvent.EstateId); file.MerchantId.ShouldBe(TestData.DomainEvents.FileCreatedEvent.MerchantId); file.FileLocation.ShouldBe(TestData.DomainEvents.FileCreatedEvent.FileLocation); - file.FileReceivedDate.ShouldBe(TestData.DomainEvents.FileCreatedEvent.FileReceivedDateTime.Date); + file.FileReceivedDate.ShouldBe(DateOnly.FromDateTime(TestData.DomainEvents.FileCreatedEvent.FileReceivedDateTime.Date)); file.IsCompleted.ShouldBeFalse(); } diff --git a/TransactionProcessor.DatabaseTests/FloatEventTests.cs b/TransactionProcessor.DatabaseTests/FloatEventTests.cs index 02b5a70e..1c578fc7 100644 --- a/TransactionProcessor.DatabaseTests/FloatEventTests.cs +++ b/TransactionProcessor.DatabaseTests/FloatEventTests.cs @@ -22,7 +22,7 @@ public async Task CreateFloat_FloatIsAdded() Float? floatRecord = await context.Floats.SingleOrDefaultAsync(f => f.FloatId == TestData.DomainEvents.FloatCreatedForContractProductEvent.FloatId, TestContext.Current.CancellationToken); floatRecord.ShouldNotBeNull(); floatRecord.EstateId.ShouldBe(TestData.DomainEvents.FloatCreatedForContractProductEvent.EstateId); - floatRecord.CreatedDate.ShouldBe(TestData.FloatCreatedDateTime.Date); + floatRecord.CreatedDate.ShouldBe(DateOnly.FromDateTime(TestData.FloatCreatedDateTime.Date)); floatRecord.CreatedDateTime.ShouldBe(TestData.FloatCreatedDateTime); } @@ -59,7 +59,7 @@ public async Task CreateFloatActivity_CreditPurchaseIsAdded() FloatActivity? floatActivity = await context.FloatActivity.SingleOrDefaultAsync(f => f.EventId == @event.EventId, TestContext.Current.CancellationToken); floatActivity.ShouldNotBeNull(); floatActivity.FloatId.ShouldBe(@event.FloatId); - floatActivity.ActivityDate.ShouldBe(TestData.CreditPurchasedDateTime.Date); + floatActivity.ActivityDate.ShouldBe(DateOnly.FromDateTime(TestData.CreditPurchasedDateTime.Date)); floatActivity.ActivityDateTime.ShouldBe(TestData.CreditPurchasedDateTime); floatActivity.Amount.ShouldBe(TestData.FloatCreditAmount); floatActivity.CostPrice.ShouldBe(TestData.FloatCreditCostPrice); @@ -105,7 +105,7 @@ public async Task CreateFloatActivity_FloatDecreaseIsAdded() FloatActivity? floatActivity = await context.FloatActivity.SingleOrDefaultAsync(f => f.EventId == @event.EventId, TestContext.Current.CancellationToken); floatActivity.ShouldNotBeNull(); floatActivity.FloatId.ShouldBe(@event.FloatId); - floatActivity.ActivityDate.ShouldBe(TestData.TransactionDateTime1.Date); + floatActivity.ActivityDate.ShouldBe(DateOnly.FromDateTime(TestData.TransactionDateTime1.Date)); floatActivity.ActivityDateTime.ShouldBe(TestData.TransactionDateTime1); floatActivity.Amount.ShouldBe(TestData.FloatCreditAmount); floatActivity.CostPrice.ShouldBe(0); diff --git a/TransactionProcessor.DatabaseTests/StatementEventTests.cs b/TransactionProcessor.DatabaseTests/StatementEventTests.cs index 72365cdf..f34aefa3 100644 --- a/TransactionProcessor.DatabaseTests/StatementEventTests.cs +++ b/TransactionProcessor.DatabaseTests/StatementEventTests.cs @@ -19,7 +19,7 @@ public async Task CreateStatement_StatementIsAdded() EstateManagementContext context = this.GetContext(); StatementHeader? statement = await context.StatementHeaders.SingleOrDefaultAsync(c => c.StatementId == TestData.DomainEvents.StatementCreatedEvent.MerchantStatementId, TestContext.Current.CancellationToken); statement.ShouldNotBeNull(); - statement.StatementCreatedDate.ShouldBe(TestData.DomainEvents.StatementCreatedEvent.StatementDate.Date); + statement.StatementCreatedDate.ShouldBe(DateOnly.FromDateTime(TestData.DomainEvents.StatementCreatedEvent.StatementDate.Date)); statement.StatementCreatedDateTime.ShouldBe(TestData.DomainEvents.StatementCreatedEvent.StatementDate); } [Fact] @@ -43,7 +43,7 @@ public async Task MarkStatementAsGenerated_StatementIsUpdated() EstateManagementContext context = this.GetContext(); StatementHeader? statement = await context.StatementHeaders.SingleOrDefaultAsync(c => c.StatementId == TestData.DomainEvents.StatementCreatedEvent.MerchantStatementId, TestContext.Current.CancellationToken); statement.ShouldNotBeNull(); - statement.StatementGeneratedDate.ShouldBe(TestData.DomainEvents.StatementGeneratedEvent.DateGenerated); + statement.StatementGeneratedDate.ShouldBe(DateOnly.FromDateTime(TestData.DomainEvents.StatementGeneratedEvent.DateGenerated.DateTime)); } } diff --git a/TransactionProcessor.DatabaseTests/TransactionEventTests.cs b/TransactionProcessor.DatabaseTests/TransactionEventTests.cs index 7d8f6ccb..5bf90ab9 100644 --- a/TransactionProcessor.DatabaseTests/TransactionEventTests.cs +++ b/TransactionProcessor.DatabaseTests/TransactionEventTests.cs @@ -59,7 +59,7 @@ public async Task StartTransaction_TransactionIsAdded() Transaction? transaction = await context.Transactions.SingleOrDefaultAsync(t => t.TransactionId == TestData.DomainEvents.TransactionHasStartedEvent.TransactionId, TestContext.Current.CancellationToken); transaction.ShouldNotBeNull(); transaction.MerchantId.ShouldBe(TestData.DomainEvents.TransactionHasStartedEvent.MerchantId); - transaction.TransactionDate.ShouldBe(TestData.DomainEvents.TransactionHasStartedEvent.TransactionDateTime.Date); + transaction.TransactionDate.ShouldBe(DateOnly.FromDateTime(TestData.DomainEvents.TransactionHasStartedEvent.TransactionDateTime.Date)); transaction.TransactionDateTime.ShouldBe(TestData.DomainEvents.TransactionHasStartedEvent.TransactionDateTime); transaction.TransactionNumber.ShouldBe(TestData.DomainEvents.TransactionHasStartedEvent.TransactionNumber); transaction.TransactionReference.ShouldBe(TestData.DomainEvents.TransactionHasStartedEvent.TransactionReference); @@ -261,7 +261,7 @@ public async Task AddTransactionToStatement_StatementLineIsAdded() EstateManagementContext context = this.GetContext(); StatementLine? statementLine = await context.StatementLines.SingleOrDefaultAsync(s => s.StatementId == TestData.DomainEvents.TransactionAddedToStatementForDateEvent.MerchantStatementId && s.TransactionId == TestData.DomainEvents.TransactionAddedToStatementForDateEvent.TransactionId, TestContext.Current.CancellationToken); statementLine.ShouldNotBeNull(); - statementLine.ActivityDate.ShouldBe(TestData.DomainEvents.TransactionAddedToStatementForDateEvent.TransactionDateTime.Date); + statementLine.ActivityDate.ShouldBe(DateOnly.FromDateTime(TestData.DomainEvents.TransactionAddedToStatementForDateEvent.TransactionDateTime.Date)); statementLine.ActivityDateTime.ShouldBe(TestData.DomainEvents.TransactionAddedToStatementForDateEvent.TransactionDateTime); statementLine.ActivityDescription.ShouldBe($"{TestData.OperatorName} Transaction"); statementLine.ActivityType.ShouldBe(1); @@ -280,7 +280,7 @@ public async Task AddSettledFeeToStatement_StatementLineIsAdded() EstateManagementContext context = this.GetContext(); StatementLine? statementLine = await context.StatementLines.SingleOrDefaultAsync(s => s.StatementId == TestData.DomainEvents.SettledFeeAddedToStatementForDateEvent.MerchantStatementId && s.TransactionId == TestData.DomainEvents.SettledFeeAddedToStatementForDateEvent.TransactionId, TestContext.Current.CancellationToken); statementLine.ShouldNotBeNull(); - statementLine.ActivityDate.ShouldBe(TestData.DomainEvents.SettledFeeAddedToStatementForDateEvent.SettledDateTime.Date); + statementLine.ActivityDate.ShouldBe(DateOnly.FromDateTime(TestData.DomainEvents.SettledFeeAddedToStatementForDateEvent.SettledDateTime.Date)); statementLine.ActivityDateTime.ShouldBe(TestData.DomainEvents.SettledFeeAddedToStatementForDateEvent.SettledDateTime); statementLine.ActivityDescription.ShouldBe($"{TestData.OperatorName} Transaction Fee"); statementLine.ActivityType.ShouldBe(2); @@ -299,7 +299,7 @@ public async Task UpdateMerchant_TransactionCompletionUpdatesMerchantLastSale() EstateManagementContext context = this.GetContext(); Merchant? merchant = await context.Merchants.SingleOrDefaultAsync(m => m.MerchantId == TestData.DomainEvents.TransactionHasBeenCompletedEvent.MerchantId, TestContext.Current.CancellationToken); merchant.ShouldNotBeNull(); - merchant.LastSaleDate.ShouldBe(TestData.DomainEvents.TransactionHasBeenCompletedEvent.CompletedDateTime.Date); + merchant.LastSaleDate.ShouldBe(DateOnly.FromDateTime(TestData.DomainEvents.TransactionHasBeenCompletedEvent.CompletedDateTime.Date)); merchant.LastSaleDateTime.ShouldBe(TestData.DomainEvents.TransactionHasBeenCompletedEvent.CompletedDateTime); } } diff --git a/TransactionProcessor.DomainEvents/FloatActivityDomainEvents.cs b/TransactionProcessor.DomainEvents/FloatActivityDomainEvents.cs index b1fe5c0a..d14cd895 100644 --- a/TransactionProcessor.DomainEvents/FloatActivityDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/FloatActivityDomainEvents.cs @@ -5,6 +5,6 @@ namespace TransactionProcessor.DomainEvents; [ExcludeFromCodeCoverage] public class FloatActivityDomainEvents { - public record FloatAggregateCreditedEvent(Guid FloatId, Guid EstateId, DateTime ActivityDateTime, Decimal Amount, Guid CreditId) : DomainEvent(FloatId, Guid.NewGuid()); - public record FloatAggregateDebitedEvent(Guid FloatId, Guid EstateId, DateTime ActivityDateTime, Decimal Amount, Guid DebitId) : DomainEvent(FloatId, Guid.NewGuid()); + public record FloatAggregateCreditedEvent(Guid FloatId, Guid EstateId, DateTimeOffset ActivityDateTime, Decimal Amount, Guid CreditId) : DomainEvent(FloatId, Guid.NewGuid()); + public record FloatAggregateDebitedEvent(Guid FloatId, Guid EstateId, DateTimeOffset ActivityDateTime, Decimal Amount, Guid DebitId) : DomainEvent(FloatId, Guid.NewGuid()); } \ No newline at end of file diff --git a/TransactionProcessor.DomainEvents/FloatDomainEvents.cs b/TransactionProcessor.DomainEvents/FloatDomainEvents.cs index 6772bb09..3d75620e 100644 --- a/TransactionProcessor.DomainEvents/FloatDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/FloatDomainEvents.cs @@ -5,8 +5,8 @@ namespace TransactionProcessor.DomainEvents; [ExcludeFromCodeCoverage] public class FloatDomainEvents { - public record FloatCreatedEvent(Guid FloatId, Guid EstateId, DateTime CreatedDateTime) : DomainEvent(FloatId, Guid.NewGuid()); - public record FloatCreatedForContractProductEvent(Guid FloatId, Guid EstateId, Guid ContractId, Guid ProductId, DateTime CreatedDateTime) : DomainEvent(FloatId, Guid.NewGuid()); - public record FloatCreditPurchasedEvent(Guid FloatId, Guid EstateId, DateTime CreditPurchasedDateTime, Decimal Amount, Decimal CostPrice) : DomainEvent(FloatId, Guid.NewGuid()); + public record FloatCreatedEvent(Guid FloatId, Guid EstateId, DateTimeOffset CreatedDateTime) : DomainEvent(FloatId, Guid.NewGuid()); + public record FloatCreatedForContractProductEvent(Guid FloatId, Guid EstateId, Guid ContractId, Guid ProductId, DateTimeOffset CreatedDateTime) : DomainEvent(FloatId, Guid.NewGuid()); + public record FloatCreditPurchasedEvent(Guid FloatId, Guid EstateId, DateTimeOffset CreditPurchasedDateTime, Decimal Amount, Decimal CostPrice) : DomainEvent(FloatId, Guid.NewGuid()); public record FloatDecreasedByTransactionEvent(Guid FloatId, Guid EstateId, Guid TransactionId, Decimal Amount) : DomainEvent(FloatId, Guid.NewGuid()); } diff --git a/TransactionProcessor.DomainEvents/MerchantDomainEvents.cs b/TransactionProcessor.DomainEvents/MerchantDomainEvents.cs index 0a79d423..6dfbe690 100644 --- a/TransactionProcessor.DomainEvents/MerchantDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/MerchantDomainEvents.cs @@ -6,19 +6,19 @@ namespace TransactionProcessor.DomainEvents { [ExcludeFromCodeCoverage] public class MerchantDomainEvents { public record AddressAddedEvent(Guid MerchantId, Guid EstateId, Guid AddressId, String AddressLine1, String AddressLine2, String AddressLine3, String AddressLine4, String Town, String Region, String PostalCode, String Country) : DomainEvent(MerchantId, Guid.NewGuid()); - public record AutomaticDepositMadeEvent(Guid MerchantId, Guid EstateId, Guid DepositId, String Reference, DateTime DepositDateTime, Decimal Amount) : DomainEvent(MerchantId, Guid.NewGuid()); + public record AutomaticDepositMadeEvent(Guid MerchantId, Guid EstateId, Guid DepositId, String Reference, DateTimeOffset DepositDateTime, Decimal Amount) : DomainEvent(MerchantId, Guid.NewGuid()); public record ContactAddedEvent(Guid MerchantId, Guid EstateId, Guid ContactId, String ContactName, String ContactPhoneNumber, String ContactEmailAddress) : DomainEvent(MerchantId, Guid.NewGuid()); public record DeviceAddedToMerchantEvent(Guid MerchantId, Guid EstateId, Guid DeviceId, String DeviceIdentifier) : DomainEvent(MerchantId, Guid.NewGuid()); public record DeviceSwappedForMerchantEvent(Guid MerchantId, Guid EstateId, Guid DeviceId, Guid OriginalDeviceId, String NewDeviceIdentifier) : DomainEvent(MerchantId, Guid.NewGuid()); - public record ManualDepositMadeEvent(Guid MerchantId, Guid EstateId, Guid DepositId, String Reference, DateTime DepositDateTime, Decimal Amount) : DomainEvent(MerchantId, Guid.NewGuid()); - public record MerchantCreatedEvent(Guid MerchantId, Guid EstateId, String MerchantName, DateTime DateCreated) : DomainEvent(MerchantId, Guid.NewGuid()); - public record MerchantDepositListCreatedEvent(Guid MerchantId, Guid EstateId, DateTime DateCreated) : DomainEvent(MerchantId, Guid.NewGuid()); + public record ManualDepositMadeEvent(Guid MerchantId, Guid EstateId, Guid DepositId, String Reference, DateTimeOffset DepositDateTime, Decimal Amount) : DomainEvent(MerchantId, Guid.NewGuid()); + public record MerchantCreatedEvent(Guid MerchantId, Guid EstateId, String MerchantName, DateTimeOffset DateCreated) : DomainEvent(MerchantId, Guid.NewGuid()); + public record MerchantDepositListCreatedEvent(Guid MerchantId, Guid EstateId, DateTimeOffset DateCreated) : DomainEvent(MerchantId, Guid.NewGuid()); public record MerchantReferenceAllocatedEvent(Guid MerchantId, Guid EstateId, String MerchantReference) : DomainEvent(MerchantId, Guid.NewGuid()); public record OperatorAssignedToMerchantEvent(Guid MerchantId, Guid EstateId, Guid OperatorId, String Name, String MerchantNumber, String TerminalNumber) : DomainEvent(MerchantId, Guid.NewGuid()); public record OperatorRemovedFromMerchantEvent(Guid MerchantId, Guid EstateId, Guid OperatorId) : DomainEvent(MerchantId, Guid.NewGuid()); public record SecurityUserAddedToMerchantEvent(Guid MerchantId, Guid EstateId, Guid SecurityUserId, String EmailAddress) : DomainEvent(MerchantId, Guid.NewGuid()); - public record SettlementScheduleChangedEvent(Guid MerchantId, Guid EstateId, Int32 SettlementSchedule, DateTime NextSettlementDate) : DomainEvent(MerchantId, Guid.NewGuid()); - public record WithdrawalMadeEvent(Guid MerchantId, Guid EstateId, Guid WithdrawalId, DateTime WithdrawalDateTime, Decimal Amount) : DomainEvent(MerchantId, Guid.NewGuid()); + public record SettlementScheduleChangedEvent(Guid MerchantId, Guid EstateId, Int32 SettlementSchedule, DateTimeOffset NextSettlementDate) : DomainEvent(MerchantId, Guid.NewGuid()); + public record WithdrawalMadeEvent(Guid MerchantId, Guid EstateId, Guid WithdrawalId, DateTimeOffset WithdrawalDateTime, Decimal Amount) : DomainEvent(MerchantId, Guid.NewGuid()); public record ContractAddedToMerchantEvent(Guid MerchantId, Guid EstateId, Guid ContractId) : DomainEvent(MerchantId, Guid.NewGuid()); public record ContractRemovedFromMerchantEvent(Guid MerchantId, Guid EstateId, Guid ContractId) : DomainEvent(MerchantId, Guid.NewGuid()); public record ContractProductAddedToMerchantEvent(Guid MerchantId, Guid EstateId, Guid ContractId, Guid ContractProductId) : DomainEvent(MerchantId, Guid.NewGuid()); diff --git a/TransactionProcessor.DomainEvents/MerchantStatementDomainEvents.cs b/TransactionProcessor.DomainEvents/MerchantStatementDomainEvents.cs index 2efa4b2d..741fbbdf 100644 --- a/TransactionProcessor.DomainEvents/MerchantStatementDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/MerchantStatementDomainEvents.cs @@ -5,17 +5,17 @@ namespace TransactionProcessor.DomainEvents { [ExcludeFromCodeCoverage] public class MerchantStatementDomainEvents { - public record StatementGeneratedEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTime DateGenerated) : DomainEvent(MerchantStatementId, Guid.NewGuid()); + public record StatementGeneratedEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTimeOffset DateGenerated) : DomainEvent(MerchantStatementId, Guid.NewGuid()); - public record StatementBuiltEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTime DateBuilt, String statementData) : DomainEvent(MerchantStatementId, Guid.NewGuid()); + public record StatementBuiltEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTimeOffset DateBuilt, String statementData) : DomainEvent(MerchantStatementId, Guid.NewGuid()); - public record StatementEmailedEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTime DateEmailed, Guid MessageId) : DomainEvent(MerchantStatementId, Guid.NewGuid()); + public record StatementEmailedEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTimeOffset DateEmailed, Guid MessageId) : DomainEvent(MerchantStatementId, Guid.NewGuid()); - public record StatementCreatedEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTime StatementDate) : DomainEvent(MerchantStatementId, Guid.NewGuid()); + public record StatementCreatedEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTimeOffset StatementDate) : DomainEvent(MerchantStatementId, Guid.NewGuid()); - public record ActivityDateAddedToStatementEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, Guid MerchantStatementForDateId, DateTime ActivityDate) : DomainEvent(MerchantStatementId, Guid.NewGuid()); + public record ActivityDateAddedToStatementEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, Guid MerchantStatementForDateId, DateTimeOffset ActivityDate) : DomainEvent(MerchantStatementId, Guid.NewGuid()); - public record StatementSummaryForDateEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTime ActivityDate, Int32 LineNumber, + public record StatementSummaryForDateEvent(Guid MerchantStatementId, Guid EstateId, Guid MerchantId, DateTimeOffset ActivityDate, Int32 LineNumber, Int32 NumberOfTransactions, Decimal ValueOfTransactions, Int32 NumberOfSettledFees, Decimal ValueOfSettledFees, Int32 NumberOfDeposits, Decimal ValueOfDeposits, @@ -24,14 +24,14 @@ public record StatementSummaryForDateEvent(Guid MerchantStatementId, Guid Estate [ExcludeFromCodeCoverage] public class MerchantStatementForDateDomainEvents { - public record StatementCreatedForDateEvent(Guid MerchantStatementForDateId, DateTime ActivityDate, DateTime MerchantStatementDate, Guid MerchantStatementId, Guid EstateId, Guid MerchantId) : DomainEvent(MerchantStatementForDateId, Guid.NewGuid()); + public record StatementCreatedForDateEvent(Guid MerchantStatementForDateId, DateTimeOffset ActivityDate, DateTimeOffset MerchantStatementDate, Guid MerchantStatementId, Guid EstateId, Guid MerchantId) : DomainEvent(MerchantStatementForDateId, Guid.NewGuid()); - public record SettledFeeAddedToStatementForDateEvent(Guid MerchantStatementForDateId, Guid EventId, Guid EstateId, Guid MerchantId, Guid MerchantStatementId, Guid SettledFeeId, Guid TransactionId, DateTime SettledDateTime, Decimal SettledValue) : DomainEvent(MerchantStatementForDateId, EventId); + public record SettledFeeAddedToStatementForDateEvent(Guid MerchantStatementForDateId, Guid EventId, Guid EstateId, Guid MerchantId, Guid MerchantStatementId, Guid SettledFeeId, Guid TransactionId, DateTimeOffset SettledDateTime, Decimal SettledValue) : DomainEvent(MerchantStatementForDateId, EventId); - public record TransactionAddedToStatementForDateEvent(Guid MerchantStatementForDateId, Guid EventId, Guid EstateId, Guid MerchantId, Guid MerchantStatementId, Guid TransactionId, DateTime TransactionDateTime, Decimal TransactionValue) : DomainEvent(MerchantStatementForDateId, EventId); + public record TransactionAddedToStatementForDateEvent(Guid MerchantStatementForDateId, Guid EventId, Guid EstateId, Guid MerchantId, Guid MerchantStatementId, Guid TransactionId, DateTimeOffset TransactionDateTime, Decimal TransactionValue) : DomainEvent(MerchantStatementForDateId, EventId); - public record DepositAddedToStatementForDateEvent(Guid MerchantStatementForDateId, Guid EventId, Guid EstateId, Guid MerchantId, Guid MerchantStatementId, Guid DepositId, DateTime DepositDateTime, Decimal DepositAmount) : DomainEvent(MerchantStatementForDateId, EventId); - public record WithdrawalAddedToStatementForDateEvent(Guid MerchantStatementForDateId, Guid EventId, Guid EstateId, Guid MerchantId, Guid MerchantStatementId, Guid WithdrawalId, DateTime WithdrawalDateTime, Decimal WithdrawalAmount) : DomainEvent(MerchantStatementForDateId, EventId); + public record DepositAddedToStatementForDateEvent(Guid MerchantStatementForDateId, Guid EventId, Guid EstateId, Guid MerchantId, Guid MerchantStatementId, Guid DepositId, DateTimeOffset DepositDateTime, Decimal DepositAmount) : DomainEvent(MerchantStatementForDateId, EventId); + public record WithdrawalAddedToStatementForDateEvent(Guid MerchantStatementForDateId, Guid EventId, Guid EstateId, Guid MerchantId, Guid MerchantStatementId, Guid WithdrawalId, DateTimeOffset WithdrawalDateTime, Decimal WithdrawalAmount) : DomainEvent(MerchantStatementForDateId, EventId); } } \ No newline at end of file diff --git a/TransactionProcessor.DomainEvents/ReconciliationDomainEvents.cs b/TransactionProcessor.DomainEvents/ReconciliationDomainEvents.cs index 2dc60f9e..00f80fbf 100644 --- a/TransactionProcessor.DomainEvents/ReconciliationDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/ReconciliationDomainEvents.cs @@ -5,9 +5,9 @@ namespace TransactionProcessor.DomainEvents; [ExcludeFromCodeCoverage] public class ReconciliationDomainEvents { - public record OverallTotalsRecordedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Int32 TransactionCount, Decimal TransactionValue, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record ReconciliationHasBeenLocallyAuthorisedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record ReconciliationHasBeenLocallyDeclinedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record ReconciliationHasCompletedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record ReconciliationHasStartedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record OverallTotalsRecordedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Int32 TransactionCount, Decimal TransactionValue, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record ReconciliationHasBeenLocallyAuthorisedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record ReconciliationHasBeenLocallyDeclinedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record ReconciliationHasCompletedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record ReconciliationHasStartedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); } \ No newline at end of file diff --git a/TransactionProcessor.DomainEvents/SettlementDomainEvents.cs b/TransactionProcessor.DomainEvents/SettlementDomainEvents.cs index 26926d53..8d97c14c 100644 --- a/TransactionProcessor.DomainEvents/SettlementDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/SettlementDomainEvents.cs @@ -5,9 +5,9 @@ namespace TransactionProcessor.DomainEvents; [ExcludeFromCodeCoverage] public class SettlementDomainEvents { - public record MerchantFeeAddedPendingSettlementEvent(Guid SettlementId, Guid EstateId, Guid MerchantId, Guid TransactionId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTime FeeCalculatedDateTime) : DomainEvent(SettlementId, Guid.NewGuid()); - public record MerchantFeeSettledEvent(Guid SettlementId, Guid EstateId, Guid MerchantId, Guid TransactionId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTime FeeCalculatedDateTime, DateTime SettledDateTime) : DomainEvent(SettlementId, Guid.NewGuid()); + public record MerchantFeeAddedPendingSettlementEvent(Guid SettlementId, Guid EstateId, Guid MerchantId, Guid TransactionId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTimeOffset FeeCalculatedDateTime) : DomainEvent(SettlementId, Guid.NewGuid()); + public record MerchantFeeSettledEvent(Guid SettlementId, Guid EstateId, Guid MerchantId, Guid TransactionId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTimeOffset FeeCalculatedDateTime, DateTimeOffset SettledDateTime) : DomainEvent(SettlementId, Guid.NewGuid()); public record SettlementCompletedEvent(Guid SettlementId, Guid EstateId, Guid MerchantId) : DomainEvent(SettlementId, Guid.NewGuid()); - public record SettlementCreatedForDateEvent(Guid SettlementId, Guid EstateId, Guid MerchantId, DateTime SettlementDate) : DomainEvent(SettlementId, Guid.NewGuid()); - public record SettlementProcessingStartedEvent(Guid SettlementId, Guid EstateId, Guid MerchantId, DateTime ProcessingStartedDateTime) : DomainEvent(SettlementId, Guid.NewGuid()); + public record SettlementCreatedForDateEvent(Guid SettlementId, Guid EstateId, Guid MerchantId, DateTimeOffset SettlementDate) : DomainEvent(SettlementId, Guid.NewGuid()); + public record SettlementProcessingStartedEvent(Guid SettlementId, Guid EstateId, Guid MerchantId, DateTimeOffset ProcessingStartedDateTime) : DomainEvent(SettlementId, Guid.NewGuid()); } \ No newline at end of file diff --git a/TransactionProcessor.DomainEvents/TransactionDomainEvents.cs b/TransactionProcessor.DomainEvents/TransactionDomainEvents.cs index 837edc47..69e28706 100644 --- a/TransactionProcessor.DomainEvents/TransactionDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/TransactionDomainEvents.cs @@ -5,23 +5,22 @@ namespace TransactionProcessor.DomainEvents; [ExcludeFromCodeCoverage] public class TransactionDomainEvents { - public record CustomerEmailReceiptResendRequestedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record CustomerEmailReceiptRequestedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String CustomerEmailAddress, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record AdditionalRequestDataRecordedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid OperatorId, Dictionary AdditionalTransactionRequestMetadata, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record AdditionalResponseDataRecordedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid OperatorId, Dictionary AdditionalTransactionResponseMetadata, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record SettledMerchantFeeAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTime FeeCalculatedDateTime, DateTime SettledDateTime, Guid SettlementId, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record MerchantFeePendingSettlementAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTime FeeCalculatedDateTime, DateTime SettlementDueDate, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record ProductDetailsAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid ContractId, Guid ProductId, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record ServiceProviderFeeAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTime FeeCalculatedDateTime, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record TransactionAuthorisedByOperatorEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid OperatorId, String AuthorisationCode, String OperatorResponseCode, String OperatorResponseMessage, String OperatorTransactionId, String ResponseCode, String ResponseMessage, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record TransactionCostInformationRecordedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Decimal? UnitCostValue, Decimal? TotalCostValue, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record TransactionDeclinedByOperatorEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid OperatorId, String OperatorResponseCode, String OperatorResponseMessage, String ResponseCode, String ResponseMessage, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record TransactionHasBeenCompletedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, Boolean IsAuthorised, DateTime CompletedDateTime, Decimal? TransactionAmount, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record TransactionHasBeenLocallyAuthorisedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String AuthorisationCode, String ResponseCode, String ResponseMessage, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record TransactionHasBeenLocallyDeclinedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record TransactionHasStartedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTime TransactionDateTime, String TransactionNumber, String TransactionType, String TransactionReference, String DeviceIdentifier, Decimal? TransactionAmount) : DomainEvent(TransactionId, Guid.NewGuid()); - public record TransactionSourceAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Int32 TransactionSource, DateTime TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - - public record TransactionTimingsAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTime TransactionStartedDateTime, DateTime? OperatorCommunicationsStartedEvent, - DateTime? OperatorCommunicationsCompletedEvent, DateTime TransactionCompletedDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record CustomerEmailReceiptResendRequestedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record CustomerEmailReceiptRequestedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String CustomerEmailAddress, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record AdditionalRequestDataRecordedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid OperatorId, Dictionary AdditionalTransactionRequestMetadata, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record AdditionalResponseDataRecordedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid OperatorId, Dictionary AdditionalTransactionResponseMetadata, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record SettledMerchantFeeAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTimeOffset FeeCalculatedDateTime, DateTimeOffset SettledDateTime, Guid SettlementId, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record MerchantFeePendingSettlementAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTimeOffset FeeCalculatedDateTime, DateTimeOffset SettlementDueDate, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record ProductDetailsAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid ContractId, Guid ProductId, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record ServiceProviderFeeAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Decimal CalculatedValue, Int32 FeeCalculationType, Guid FeeId, Decimal FeeValue, DateTimeOffset FeeCalculatedDateTime, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionAuthorisedByOperatorEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid OperatorId, String AuthorisationCode, String OperatorResponseCode, String OperatorResponseMessage, String OperatorTransactionId, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionCostInformationRecordedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Decimal? UnitCostValue, Decimal? TotalCostValue, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionDeclinedByOperatorEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Guid OperatorId, String OperatorResponseCode, String OperatorResponseMessage, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionHasBeenCompletedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, Boolean IsAuthorised, DateTimeOffset CompletedDateTime, Decimal? TransactionAmount, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionHasBeenLocallyAuthorisedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String AuthorisationCode, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionHasBeenLocallyDeclinedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionHasStartedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionDateTime, String TransactionNumber, String TransactionType, String TransactionReference, String DeviceIdentifier, Decimal? TransactionAmount) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionSourceAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Int32 TransactionSource, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionTimingsAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionStartedDateTime, DateTimeOffset? OperatorCommunicationsStartedEvent, + DateTimeOffset? OperatorCommunicationsCompletedEvent, DateTimeOffset TransactionCompletedDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); } \ No newline at end of file diff --git a/TransactionProcessor.DomainEvents/VoucherDomainEvents.cs b/TransactionProcessor.DomainEvents/VoucherDomainEvents.cs index dc602fa3..72f39d8b 100644 --- a/TransactionProcessor.DomainEvents/VoucherDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/VoucherDomainEvents.cs @@ -6,7 +6,7 @@ namespace TransactionProcessor.DomainEvents; [ExcludeFromCodeCoverage] public class VoucherDomainEvents { public record BarcodeAddedEvent(Guid VoucherId, Guid EstateId, String Barcode) : DomainEvent(VoucherId, Guid.NewGuid()); - public record VoucherFullyRedeemedEvent(Guid VoucherId, Guid EstateId, DateTime RedeemedDateTime) : DomainEvent(VoucherId, Guid.NewGuid()); - public record VoucherGeneratedEvent(Guid VoucherId, Guid EstateId, Guid TransactionId, DateTime GeneratedDateTime, Guid OperatorId, Decimal Value, String VoucherCode, DateTime ExpiryDateTime, String Message) : DomainEvent(VoucherId, Guid.NewGuid()); - public record VoucherIssuedEvent(Guid VoucherId, Guid EstateId, DateTime IssuedDateTime, String RecipientEmail, String RecipientMobile) : DomainEvent(VoucherId, Guid.NewGuid()); + public record VoucherFullyRedeemedEvent(Guid VoucherId, Guid EstateId, DateTimeOffset RedeemedDateTime) : DomainEvent(VoucherId, Guid.NewGuid()); + public record VoucherGeneratedEvent(Guid VoucherId, Guid EstateId, Guid TransactionId, DateTimeOffset GeneratedDateTime, Guid OperatorId, Decimal Value, String VoucherCode, DateTimeOffset ExpiryDateTime, String Message) : DomainEvent(VoucherId, Guid.NewGuid()); + public record VoucherIssuedEvent(Guid VoucherId, Guid EstateId, DateTimeOffset IssuedDateTime, String RecipientEmail, String RecipientMobile) : DomainEvent(VoucherId, Guid.NewGuid()); } \ No newline at end of file diff --git a/TransactionProcessor.IntegrationTesting.Helpers/EstateDetails.cs b/TransactionProcessor.IntegrationTesting.Helpers/EstateDetails.cs index 1899e15b..652a2253 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/EstateDetails.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/EstateDetails.cs @@ -1,6 +1,7 @@ using Shared.Serialisation; using TransactionProcessor.DataTransferObjects; using TransactionProcessor.DataTransferObjects.Responses.Contract; +using TransactionProcessor.DataTransferObjects.Responses.Transaction; namespace TransactionProcessor.IntegrationTesting.Helpers { diff --git a/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs b/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs index 98c58acc..08366f37 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs @@ -15,6 +15,8 @@ namespace TransactionProcessor.IntegrationTesting.Helpers; using DataTransferObjects; using Reqnroll; using Shared.General; +using TransactionProcessor.DataTransferObjects.Requests.Transaction; +using TransactionProcessor.DataTransferObjects.Responses.Transaction; using AssignOperatorToEstateRequest = DataTransferObjects.Requests.Estate.AssignOperatorRequest; using AssignOperatorToMerchantRequest = DataTransferObjects.Requests.Merchant.AssignOperatorRequest; diff --git a/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs b/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs index 842668a9..4079317b 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs @@ -24,7 +24,11 @@ namespace TransactionProcessor.IntegrationTesting.Helpers; using DataTransferObjects; using Shared.IntegrationTesting; using Shouldly; +using TransactionProcessor.DataTransferObjects.Requests.Transaction; +using TransactionProcessor.DataTransferObjects.Requests.Voucher; using TransactionProcessor.DataTransferObjects.Responses.Merchant; +using TransactionProcessor.DataTransferObjects.Responses.Transaction; +using TransactionProcessor.DataTransferObjects.Responses.Voucher; public class TransactionProcessorSteps { diff --git a/TransactionProcessor.IntegrationTests/Common/SpecflowExtensionsTests.cs b/TransactionProcessor.IntegrationTests/Common/SpecflowExtensionsTests.cs index 52c06896..e8d40cc5 100644 --- a/TransactionProcessor.IntegrationTests/Common/SpecflowExtensionsTests.cs +++ b/TransactionProcessor.IntegrationTests/Common/SpecflowExtensionsTests.cs @@ -4,6 +4,7 @@ using Shouldly; using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects; +using TransactionProcessor.DataTransferObjects.Requests.Transaction; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.DataTransferObjects.Responses.Merchant; using TransactionProcessor.IntegrationTesting.Helpers; @@ -75,15 +76,7 @@ public void ToSettlementDetails_RejectsMultipleRows() Should.Throw(() => table.Rows.ToSettlementDetails("Test Estate", new List { estate })); Should.Throw(() => table.Rows.ToSettlementDetails("Test Estate", "Test Merchant", new List { estate })); } - - [Test] - public void TestingContext_AddVoucher_DoesNotThrow() - { - TestingContext context = new(); - - Should.NotThrow(() => context.AddVoucher((new IssueVoucherRequest(), new IssueVoucherResponse()))); - } - + [Test] public void EstateDetails_AddMerchant_RejectsDuplicateMerchantId() { diff --git a/TransactionProcessor.IntegrationTests/Common/TestingContext.cs b/TransactionProcessor.IntegrationTests/Common/TestingContext.cs index 78ba120f..8c85aed1 100644 --- a/TransactionProcessor.IntegrationTests/Common/TestingContext.cs +++ b/TransactionProcessor.IntegrationTests/Common/TestingContext.cs @@ -1,8 +1,7 @@ using TransactionProcessor.DataTransferObjects.Responses.Merchant; using TransactionProcessor.IntegrationTesting.Helpers; -namespace TransactionProcessor.IntegrationTests.Common -{ +namespace TransactionProcessor.IntegrationTests.Common { using System; using System.Collections.Generic; using System.Linq; @@ -13,6 +12,9 @@ namespace TransactionProcessor.IntegrationTests.Common using global::Shared.Logger; using Reqnroll; using Shouldly; + using TransactionProcessor.DataTransferObjects.Requests.Voucher; + using TransactionProcessor.DataTransferObjects.Responses.Transaction; + using TransactionProcessor.DataTransferObjects.Responses.Voucher; using Retry = IntegrationTests.Retry; /// diff --git a/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs b/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs index 7af463a0..5a362f18 100644 --- a/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs +++ b/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs @@ -8,14 +8,14 @@ using TransactionProcessor.DataTransferObjects.Requests.Merchant; using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Requests.Operator; +using TransactionProcessor.DataTransferObjects.Requests.Transaction; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.DataTransferObjects.Responses.Merchant; using TransactionProcessor.DataTransferObjects.Responses.Operator; using TransactionProcessor.ProjectionEngine.Projections; using TransactionProcessor.ProjectionEngine.State; -namespace TransactionProcessor.IntegrationTests.Shared -{ +namespace TransactionProcessor.IntegrationTests.Shared { using Common; using DataTransferObjects; using IntegrationTesting.Helpers; @@ -27,10 +27,12 @@ namespace TransactionProcessor.IntegrationTests.Shared using System.Text.Json; using System.Threading; using System.Threading.Tasks; + using TransactionProcessor.DataTransferObjects.Responses.Transaction; + using TransactionProcessor.DataTransferObjects.Responses.Voucher; using AssignOperatorRequest = DataTransferObjects.Requests.Estate.AssignOperatorRequest; using ClientDetails = Common.ClientDetails; using ReqnrollExtensions = IntegrationTesting.Helpers.ReqnrollExtensions; - + [Scope(Tag = "shared")] public partial class SharedSteps { diff --git a/TransactionProcessor.Models/CalculatedFee.cs b/TransactionProcessor.Models/CalculatedFee.cs index 7cb19693..61f46f9c 100644 --- a/TransactionProcessor.Models/CalculatedFee.cs +++ b/TransactionProcessor.Models/CalculatedFee.cs @@ -35,7 +35,7 @@ public class CalculatedFee /// /// The fee calculated date time. /// - public DateTime FeeCalculatedDateTime { get; set; } + public DateTimeOffset FeeCalculatedDateTime { get; set; } /// /// Gets or sets the fee identifier. @@ -63,7 +63,7 @@ public class CalculatedFee public Boolean IsSettled{ get; set; } - public DateTime SettlementDueDate { get; set; } + public DateTimeOffset SettlementDueDate { get; set; } #endregion } diff --git a/TransactionProcessor.Models/IssueVoucherResponse.cs b/TransactionProcessor.Models/IssueVoucherResponse.cs index 5567e5e7..3ecf0ca9 100644 --- a/TransactionProcessor.Models/IssueVoucherResponse.cs +++ b/TransactionProcessor.Models/IssueVoucherResponse.cs @@ -6,7 +6,7 @@ public class IssueVoucherResponse { public Guid VoucherId { get; set; } - public DateTime ExpiryDate { get; set; } + public DateTimeOffset ExpiryDate { get; set; } public String VoucherCode { get; set; } diff --git a/TransactionProcessor.Models/Merchant/Deposit.cs b/TransactionProcessor.Models/Merchant/Deposit.cs index ef0366f9..15dc6c1b 100644 --- a/TransactionProcessor.Models/Merchant/Deposit.cs +++ b/TransactionProcessor.Models/Merchant/Deposit.cs @@ -8,7 +8,7 @@ public class Deposit public Decimal Amount { get; set; } - public DateTime DepositDateTime { get; set; } + public DateTimeOffset DepositDateTime { get; set; } public Guid DepositId { get; set; } diff --git a/TransactionProcessor.Models/Merchant/Merchant.cs b/TransactionProcessor.Models/Merchant/Merchant.cs index 6b81c7d3..b2f67322 100644 --- a/TransactionProcessor.Models/Merchant/Merchant.cs +++ b/TransactionProcessor.Models/Merchant/Merchant.cs @@ -34,9 +34,9 @@ public class Merchant public SettlementSchedule SettlementSchedule { get; set; } - public DateTime NextSettlementDueDate { get; set; } + public DateTimeOffset NextSettlementDueDate { get; set; } - public DateTime NextStatementDate { get; set; } + public DateTimeOffset NextStatementDate { get; set; } public Dictionary OpeningHours { get; set; } diff --git a/TransactionProcessor.Models/Merchant/MerchantStatementForDate.cs b/TransactionProcessor.Models/Merchant/MerchantStatementForDate.cs index 98481b5d..fe104115 100644 --- a/TransactionProcessor.Models/Merchant/MerchantStatementForDate.cs +++ b/TransactionProcessor.Models/Merchant/MerchantStatementForDate.cs @@ -30,8 +30,8 @@ public MerchantStatementForDate() public Guid MerchantId { get; set; } public Guid MerchantStatementId { get; set; } public Guid MerchantStatementForDateId { get; set; } - public DateTime StatementDate { get; set; } - public DateTime ActivityDate { get; set; } + public DateTimeOffset StatementDate { get; set; } + public DateTimeOffset ActivityDate { get; set; } #endregion @@ -63,7 +63,7 @@ public class MerchantStatement { #region Fields - private readonly List<(Guid merchantStatementForDateId, DateTime activityDate)> StatementActivityDates; + private readonly List<(Guid merchantStatementForDateId, DateTimeOffset activityDate)> StatementActivityDates; #endregion @@ -86,8 +86,8 @@ public MerchantStatement() public Boolean HasBeenEmailed { get; set; } public Guid MerchantId { get; set; } public Guid MerchantStatementId { get; set; } - public DateTime StatementDate { get; set; } - public DateTime BuiltDateTime { get; set; } + public DateTimeOffset StatementDate { get; set; } + public DateTimeOffset BuiltDateTime { get; set; } #endregion #region Methods @@ -96,12 +96,12 @@ public MerchantStatement() /// Adds the statement line. /// /// The statement line. - public void AddStatementActivityDate(Guid merchantStatementForDateId, DateTime activityDate) + public void AddStatementActivityDate(Guid merchantStatementForDateId, DateTimeOffset activityDate) { this.StatementActivityDates.Add((merchantStatementForDateId, activityDate)); } - public List<(Guid merchantStatementForDateId, DateTime activityDate)> GetActivityDates() + public List<(Guid merchantStatementForDateId, DateTimeOffset activityDate)> GetActivityDates() { return this.StatementActivityDates.OrderBy(s => s.activityDate).ToList(); } @@ -114,7 +114,7 @@ public void AddStatementActivityDate(Guid merchantStatementForDateId, DateTime a return result.OrderBy(s => s.lineNumber).ToList(); } - public void AddStatementDailySummary(DateTime activityDate, Decimal transactionAmount,Decimal feeAmount) { + public void AddStatementDailySummary(DateTimeOffset activityDate, Decimal transactionAmount,Decimal feeAmount) { // Build statement lines var lineNumber = this.StatementLines.Count; MerchantStatementLine transactionLine = new() { diff --git a/TransactionProcessor.Models/Merchant/MerchantStatementLine.cs b/TransactionProcessor.Models/Merchant/MerchantStatementLine.cs index c7d4a2d4..ff61774b 100644 --- a/TransactionProcessor.Models/Merchant/MerchantStatementLine.cs +++ b/TransactionProcessor.Models/Merchant/MerchantStatementLine.cs @@ -22,7 +22,7 @@ public class MerchantStatementLine /// /// The date time. /// - public DateTime DateTime { get; set; } + public DateTimeOffset DateTime { get; set; } /// /// Gets or sets the description. diff --git a/TransactionProcessor.Models/Merchant/Withdrawal.cs b/TransactionProcessor.Models/Merchant/Withdrawal.cs index e5631edc..b5b0c197 100644 --- a/TransactionProcessor.Models/Merchant/Withdrawal.cs +++ b/TransactionProcessor.Models/Merchant/Withdrawal.cs @@ -8,7 +8,7 @@ public class Withdrawal public Decimal Amount { get; set; } - public DateTime WithdrawalDateTime { get; set; } + public DateTimeOffset WithdrawalDateTime { get; set; } public Guid WithdrawalId { get; set; } diff --git a/TransactionProcessor.Models/RedeemVoucherResponse.cs b/TransactionProcessor.Models/RedeemVoucherResponse.cs index b6f61da3..7634c526 100644 --- a/TransactionProcessor.Models/RedeemVoucherResponse.cs +++ b/TransactionProcessor.Models/RedeemVoucherResponse.cs @@ -12,7 +12,7 @@ public class RedeemVoucherResponse /// /// The expiry date. /// - public DateTime ExpiryDate { get; set; } + public DateTimeOffset ExpiryDate { get; set; } /// /// Gets or sets the remaining balance. diff --git a/TransactionProcessor.Models/Settlement/SettlementFeeModel.cs b/TransactionProcessor.Models/Settlement/SettlementFeeModel.cs index bbd98087..52d35d60 100644 --- a/TransactionProcessor.Models/Settlement/SettlementFeeModel.cs +++ b/TransactionProcessor.Models/Settlement/SettlementFeeModel.cs @@ -18,7 +18,7 @@ public class SettlementFeeModel public String MerchantName { get; set; } - public DateTime SettlementDate { get; set; } + public DateTimeOffset SettlementDate { get; set; } public Guid SettlementId { get; set; } diff --git a/TransactionProcessor.Models/Settlement/SettlementModel.cs b/TransactionProcessor.Models/Settlement/SettlementModel.cs index 158fcb79..853674e4 100644 --- a/TransactionProcessor.Models/Settlement/SettlementModel.cs +++ b/TransactionProcessor.Models/Settlement/SettlementModel.cs @@ -22,7 +22,7 @@ public SettlementModel() public Int32 NumberOfFeesSettled { get; set; } - public DateTime SettlementDate { get; set; } + public DateTimeOffset SettlementDate { get; set; } public List SettlementFees { get; set; } @@ -37,7 +37,7 @@ public class PendingSettlementModel { public Guid EstateId { get; set; } public Guid MerchantId { get; set; } - public DateTime SettlementDate { get; set; } + public DateTimeOffset SettlementDate { get; set; } public Int32 NumberOfFeesPendingSettlement { get; set; } public Int32 NumberOfFeesSettled { get; set; } diff --git a/TransactionProcessor.Models/Transaction.cs b/TransactionProcessor.Models/Transaction.cs index ea8572f2..afbc3d8b 100644 --- a/TransactionProcessor.Models/Transaction.cs +++ b/TransactionProcessor.Models/Transaction.cs @@ -92,7 +92,7 @@ public class Transaction /// /// The transaction date time. /// - public DateTime TransactionDateTime { get; set; } + public DateTimeOffset TransactionDateTime { get; set; } /// /// Gets or sets the transaction number. diff --git a/TransactionProcessor.Models/Voucher.cs b/TransactionProcessor.Models/Voucher.cs index c5546bbe..b83903ea 100644 --- a/TransactionProcessor.Models/Voucher.cs +++ b/TransactionProcessor.Models/Voucher.cs @@ -28,7 +28,7 @@ public class Voucher /// /// The expiry date. /// - public DateTime ExpiryDate { get; set; } + public DateTimeOffset ExpiryDate { get; set; } /// /// Gets a value indicating whether this instance is generated. @@ -60,21 +60,21 @@ public class Voucher /// /// The issued date time. /// - public DateTime IssuedDateTime { get; set; } + public DateTimeOffset IssuedDateTime { get; set; } /// /// Gets or sets the generated date time. /// /// /// The generated date time. /// - public DateTime GeneratedDateTime { get; set; } + public DateTimeOffset GeneratedDateTime { get; set; } /// /// Gets or sets the redeemed date time. /// /// /// The redeemed date time. /// - public DateTime RedeemedDateTime { get; set; } + public DateTimeOffset RedeemedDateTime { get; set; } /// /// Gets the message. diff --git a/TransactionProcessor.ProjectionEngine.Tests/ProjectionHandlerTests.cs b/TransactionProcessor.ProjectionEngine.Tests/ProjectionHandlerTests.cs index 7b4162cb..598a1508 100644 --- a/TransactionProcessor.ProjectionEngine.Tests/ProjectionHandlerTests.cs +++ b/TransactionProcessor.ProjectionEngine.Tests/ProjectionHandlerTests.cs @@ -319,6 +319,6 @@ public Task AddMerchantBalanceChangedEntry(MerchantBalanceChangedEntry e return Task.FromResult(AddResult); } - public Task>> GetMerchantBalanceHistory(Guid estateId, Guid merchantId, DateTime startDate, DateTime endDate, CancellationToken cancellationToken) => + public Task>> GetMerchantBalanceHistory(Guid estateId, Guid merchantId, DateTimeOffset startDate, DateTimeOffset endDate, CancellationToken cancellationToken) => Task.FromResult(new Result>()); } diff --git a/TransactionProcessor.ProjectionEngine/Models/MerchantBalanceChangedEntry.cs b/TransactionProcessor.ProjectionEngine/Models/MerchantBalanceChangedEntry.cs index af59a193..79e48409 100644 --- a/TransactionProcessor.ProjectionEngine/Models/MerchantBalanceChangedEntry.cs +++ b/TransactionProcessor.ProjectionEngine/Models/MerchantBalanceChangedEntry.cs @@ -9,7 +9,7 @@ public class MerchantBalanceChangedEntry{ public Decimal Balance{ get; set; } public Guid CauseOfChangeId{ get; set; } public Decimal ChangeAmount{ get; set; } - public DateTime DateTime{ get; set; } + public DateTimeOffset DateTime{ get; set; } public String DebitOrCredit{ get; set; } public Guid EstateId{ get; set; } public Guid MerchantId{ get; set; } diff --git a/TransactionProcessor.ProjectionEngine/Repository/ITransactionProcessorReadRepository.cs b/TransactionProcessor.ProjectionEngine/Repository/ITransactionProcessorReadRepository.cs index b45f698c..e99e7fd4 100644 --- a/TransactionProcessor.ProjectionEngine/Repository/ITransactionProcessorReadRepository.cs +++ b/TransactionProcessor.ProjectionEngine/Repository/ITransactionProcessorReadRepository.cs @@ -10,7 +10,7 @@ public interface ITransactionProcessorReadRepository Task>> GetMerchantBalanceHistory(Guid estateId, Guid merchantId, - DateTime startDate, - DateTime endDate, + DateTimeOffset startDate, + DateTimeOffset endDate, CancellationToken cancellationToken); } \ No newline at end of file diff --git a/TransactionProcessor.ProjectionEngine/Repository/MerchantBalanceStateRepository.cs b/TransactionProcessor.ProjectionEngine/Repository/MerchantBalanceStateRepository.cs index 6a6ccc97..88c84bae 100644 --- a/TransactionProcessor.ProjectionEngine/Repository/MerchantBalanceStateRepository.cs +++ b/TransactionProcessor.ProjectionEngine/Repository/MerchantBalanceStateRepository.cs @@ -28,7 +28,7 @@ public static Event Create(String type, IDomainEvent domainEvent) { return new() { EventId = domainEvent.EventId, - Date = domainEvent.EventTimestamp.Date.Date, + Date = DateOnly.FromDateTime(domainEvent.EventTimestamp.Date), Type = type }; } diff --git a/TransactionProcessor.ProjectionEngine/Repository/TransactionProcessorReadRepository.cs b/TransactionProcessor.ProjectionEngine/Repository/TransactionProcessorReadRepository.cs index 4b558c14..cff5744f 100644 --- a/TransactionProcessor.ProjectionEngine/Repository/TransactionProcessorReadRepository.cs +++ b/TransactionProcessor.ProjectionEngine/Repository/TransactionProcessorReadRepository.cs @@ -63,8 +63,8 @@ public async Task AddMerchantBalanceChangedEntry(MerchantBalanceChangedE public async Task>> GetMerchantBalanceHistory(Guid estateId, Guid merchantId, - DateTime startDate, - DateTime endDate, + DateTimeOffset startDate, + DateTimeOffset endDate, CancellationToken cancellationToken) { using ResolvedDbContext? resolvedContext = this.Resolver.Resolve(EstateManagementDatabaseName, estateId.ToString()); await using EstateManagementContext context = resolvedContext.Context; diff --git a/TransactionProcessor.ProjectionEngine/Repository/VoucherStateRepository.cs b/TransactionProcessor.ProjectionEngine/Repository/VoucherStateRepository.cs index 5d100716..cbd3fed8 100644 --- a/TransactionProcessor.ProjectionEngine/Repository/VoucherStateRepository.cs +++ b/TransactionProcessor.ProjectionEngine/Repository/VoucherStateRepository.cs @@ -31,7 +31,7 @@ public static Event Create(String type, return new() { EventId = domainEvent.EventId, - Date = domainEvent.EventTimestamp.Date.Date, + Date = DateOnly.FromDateTime(domainEvent.EventTimestamp.Date), Type = type }; } @@ -96,30 +96,30 @@ public async Task> Save(VoucherState state, return state; } - private static VoucherProjectionState CreateVoucherProjectionState(VoucherState state){ - VoucherProjectionState entity = new(){ - EstateId = state.EstateId, - Timestamp = state.Version, - VoucherCode = state.VoucherCode, - TransactionId = state.TransactionId, - Barcode = String.IsNullOrEmpty(state.Barcode) ? "" : state.Barcode, - VoucherId = state.VoucherId, - Value = state.Value, - OperatorIdentifier = state.OperatorIdentifier, - ExpiryDate = state.ExpiryDate, - ExpiryDateTime = state.ExpiryDateTime, - GenerateDate = state.GenerateDate, - GenerateDateTime = state.GenerateDateTime, - IsGenerated = state.IsGenerated, - IsIssued = state.IsIssued, - IsRedeemed = state.IsRedeemed, - IssuedDate = state.IssuedDate, - IssuedDateTime = state.IssuedDateTime, - RecipientEmail = state.RecipientEmail, - RecipientMobile = state.RecipientMobile, - RedeemedDate = state.RedeemedDate, - RedeemedDateTime = state.RedeemedDateTime - }; + private static VoucherProjectionState CreateVoucherProjectionState(VoucherState state) { + VoucherProjectionState entity = new() { + EstateId = state.EstateId, + Timestamp = state.Version, + VoucherCode = state.VoucherCode, + TransactionId = state.TransactionId, + Barcode = String.IsNullOrEmpty(state.Barcode) ? String.Empty : state.Barcode, + VoucherId = state.VoucherId, + Value = state.Value, + OperatorIdentifier = state.OperatorIdentifier, + ExpiryDate = state.ExpiryDate, + ExpiryDateTime = state.ExpiryDateTime, + GenerateDate = state.GenerateDate, + GenerateDateTime = state.GenerateDateTime, + IsGenerated = state.IsGenerated, + IsIssued = state.IsIssued, + IsRedeemed = state.IsRedeemed, + IssuedDate = state.IssuedDate, + IssuedDateTime = state.IssuedDateTime, + RecipientEmail = state.RecipientEmail, + RecipientMobile = state.RecipientMobile, + RedeemedDate = state.RedeemedDate, + RedeemedDateTime = state.RedeemedDateTime + }; return entity; } diff --git a/TransactionProcessor.ProjectionEngine/State/MerchantBalanceState.cs b/TransactionProcessor.ProjectionEngine/State/MerchantBalanceState.cs index a5cc5849..82b6c4b4 100644 --- a/TransactionProcessor.ProjectionEngine/State/MerchantBalanceState.cs +++ b/TransactionProcessor.ProjectionEngine/State/MerchantBalanceState.cs @@ -23,10 +23,10 @@ public record MerchantBalanceState : Shared.EventStore.ProjectionEngine.State public Int32 FeeCount { get; init; } public Decimal ValueOfFees { get; init; } - public DateTime LastDeposit { get; init; } - public DateTime LastWithdrawal { get; init; } - public DateTime LastSale { get; init; } - public DateTime LastFee { get; init; } + public DateTimeOffset LastDeposit { get; init; } + public DateTimeOffset LastWithdrawal { get; init; } + public DateTimeOffset LastSale { get; init; } + public DateTimeOffset LastFee { get; init; } public Int32 StartedTransactionCount { get; init; } public Int32 CompletedTransactionCount { get; init; } diff --git a/TransactionProcessor.ProjectionEngine/State/VoucherState.cs b/TransactionProcessor.ProjectionEngine/State/VoucherState.cs index 6967899e..fbf0e6b0 100644 --- a/TransactionProcessor.ProjectionEngine/State/VoucherState.cs +++ b/TransactionProcessor.ProjectionEngine/State/VoucherState.cs @@ -14,9 +14,9 @@ state with{ EstateId = @event.EstateId, IsGenerated = true, Value = @event.Value, - ExpiryDate = @event.ExpiryDateTime.Date, + ExpiryDate = DateOnly.FromDateTime(@event.ExpiryDateTime.Date), ExpiryDateTime = @event.ExpiryDateTime, - GenerateDate = @event.GeneratedDateTime.Date, + GenerateDate = DateOnly.FromDateTime(@event.GeneratedDateTime.Date), GenerateDateTime = @event.GeneratedDateTime, OperatorIdentifier = @event.OperatorId.ToString(), }; @@ -31,7 +31,7 @@ state with{ public static VoucherState HandleVoucherIssuedEvent(this VoucherState state, VoucherDomainEvents.VoucherIssuedEvent @event) => state with{ IsIssued = true, - IssuedDate = @event.IssuedDateTime.Date, + IssuedDate = DateOnly.FromDateTime(@event.IssuedDateTime.Date), IssuedDateTime = @event.IssuedDateTime, RecipientEmail = @event.RecipientEmail, RecipientMobile = @event.RecipientMobile @@ -42,7 +42,7 @@ state with{ public static VoucherState HandleVoucherFullyRedeemedEvent(this VoucherState state, VoucherDomainEvents.VoucherFullyRedeemedEvent @event) => state with{ IsFullyRedeemed = true, - RedeemedDate = @event.RedeemedDateTime.Date, + RedeemedDate = DateOnly.FromDateTime(@event.RedeemedDateTime.Date), RedeemedDateTime = @event.RedeemedDateTime, IsRedeemed = true }; @@ -50,8 +50,8 @@ state with{ public record VoucherState : Shared.EventStore.ProjectionEngine.State { - public DateTime ExpiryDate { get; init; } - public DateTime ExpiryDateTime { get; init; } + public DateOnly ExpiryDate { get; init; } + public DateTimeOffset ExpiryDateTime { get; init; } public Boolean IsGenerated { get; init; } @@ -75,17 +75,17 @@ public record VoucherState : Shared.EventStore.ProjectionEngine.State public Guid TransactionId { get; init; } - public DateTime GenerateDateTime { get; init; } + public DateTimeOffset GenerateDateTime { get; init; } - public DateTime IssuedDateTime { get; init; } + public DateTimeOffset IssuedDateTime { get; init; } - public DateTime RedeemedDateTime { get; init; } + public DateTimeOffset RedeemedDateTime { get; init; } - public DateTime GenerateDate { get; init; } + public DateOnly GenerateDate { get; init; } - public DateTime IssuedDate { get; init; } + public DateOnly IssuedDate { get; init; } - public DateTime RedeemedDate { get; init; } + public DateOnly RedeemedDate { get; init; } public String Barcode { get; init; } diff --git a/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs b/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs index c160492c..e1768f40 100644 --- a/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs +++ b/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs @@ -1288,7 +1288,7 @@ public async Task CreateFloat(FloatDomainEvents.FloatCreatedEvent domain Database.Entities.Float floatRecord = new Database.Entities.Float { - CreatedDate = domainEvent.CreatedDateTime.Date, + CreatedDate = DateOnly.FromDateTime(domainEvent.CreatedDateTime.Date), CreatedDateTime = domainEvent.CreatedDateTime, EstateId = domainEvent.EstateId, FloatId = domainEvent.FloatId, @@ -1310,7 +1310,7 @@ public async Task CreateFloatActivity(FloatDomainEvents.FloatCreditPurch FloatActivity floatActivity = new FloatActivity { - ActivityDate = domainEvent.CreditPurchasedDateTime.Date, + ActivityDate = DateOnly.FromDateTime(domainEvent.CreditPurchasedDateTime.Date), ActivityDateTime = domainEvent.CreditPurchasedDateTime, Amount = domainEvent.Amount, CostPrice = domainEvent.CostPrice, @@ -1370,7 +1370,7 @@ public async Task CreateSettlement(SettlementDomainEvents.SettlementCrea EstateId = domainEvent.EstateId, MerchantId = domainEvent.MerchantId, IsCompleted = false, - SettlementDate = domainEvent.SettlementDate.Date, + SettlementDate = DateOnly.FromDateTime(domainEvent.SettlementDate.Date), SettlementId = domainEvent.SettlementId }; @@ -1565,7 +1565,7 @@ public async Task StartReconciliation(ReconciliationDomainEvents.Reconci Database.Entities.Reconciliation reconciliation = new Database.Entities.Reconciliation { MerchantId = domainEvent.MerchantId, - TransactionDate = domainEvent.TransactionDateTime.Date, + TransactionDate = DateOnly.FromDateTime(domainEvent.TransactionDateTime.Date), TransactionDateTime = domainEvent.TransactionDateTime, TransactionTime = domainEvent.TransactionDateTime.TimeOfDay, TransactionId = domainEvent.TransactionId, @@ -1584,7 +1584,7 @@ public async Task StartTransaction(TransactionDomainEvents.TransactionHa Database.Entities.Transaction t = new Database.Entities.Transaction { MerchantId = domainEvent.MerchantId, - TransactionDate = domainEvent.TransactionDateTime.Date, + TransactionDate = DateOnly.FromDateTime(domainEvent.TransactionDateTime.Date), TransactionDateTime = domainEvent.TransactionDateTime, TransactionTime = domainEvent.TransactionDateTime.TimeOfDay, TransactionId = domainEvent.TransactionId, @@ -1632,7 +1632,7 @@ public async Task UpdateMerchant(TransactionDomainEvents.TransactionHasB if (domainEvent.CompletedDateTime > merchant.LastSaleDateTime) { - merchant.LastSaleDate = domainEvent.CompletedDateTime.Date; + merchant.LastSaleDate = DateOnly.FromDateTime(domainEvent.CompletedDateTime.Date); merchant.LastSaleDateTime = domainEvent.CompletedDateTime; } @@ -1916,7 +1916,7 @@ public async Task MarkStatementAsGenerated(StatementGeneratedEvent domai return ResultHelpers.CreateFailure(getLoadStatementHeaderResult); var statementHeader = getLoadStatementHeaderResult.Data; - statementHeader.StatementGeneratedDate = domainEvent.DateGenerated; + statementHeader.StatementGeneratedDate = DateOnly.FromDateTime(domainEvent.DateGenerated.DateTime); return await context.SaveChangesAsync(cancellationToken); } @@ -1930,7 +1930,7 @@ public async Task CreateStatement(StatementCreatedEvent domainEvent, { MerchantId = domainEvent.MerchantId, StatementCreatedDateTime = domainEvent.StatementDate, - StatementCreatedDate = domainEvent.StatementDate.Date, + StatementCreatedDate = DateOnly.FromDateTime(domainEvent.StatementDate.Date), StatementId = domainEvent.MerchantStatementId }; @@ -1955,7 +1955,7 @@ public async Task AddFile(FileCreatedEvent domainEvent, FileProfileId = domainEvent.FileProfileId, FileLocation = domainEvent.FileLocation, FileReceivedDateTime = domainEvent.FileReceivedDateTime, - FileReceivedDate = domainEvent.FileReceivedDateTime.Date + FileReceivedDate = DateOnly.FromDateTime(domainEvent.FileReceivedDateTime.Date) }; await context.Files.AddAsync(file, cancellationToken); @@ -1974,7 +1974,7 @@ public async Task AddFileImportLog(ImportLogCreatedEvent domainEvent, EstateId = domainEvent.EstateId, FileImportLogId = domainEvent.FileImportLogId, ImportLogDateTime = domainEvent.ImportLogDateTime, - ImportLogDate = domainEvent.ImportLogDateTime.Date + ImportLogDate = DateOnly.FromDateTime(domainEvent.ImportLogDateTime.Date) }; await context.FileImportLogs.AddAsync(fileImportLog, cancellationToken); @@ -2015,7 +2015,7 @@ public async Task AddFileToImportLog(FileAddedToImportLogEvent domainEve FilePath = domainEvent.FilePath, FileProfileId = domainEvent.FileProfileId, FileUploadedDateTime = domainEvent.FileUploadedDateTime, - FileUploadedDate = domainEvent.FileUploadedDateTime.Date, + FileUploadedDate = DateOnly.FromDateTime(domainEvent.FileUploadedDateTime.Date), OriginalFileName = domainEvent.OriginalFileName, UserId = domainEvent.UserId }; @@ -2193,8 +2193,8 @@ public async Task>> GetSettlements(Guid estateId, using ResolvedDbContext? resolvedContext = this.Resolver.Resolve(EstateManagementDatabaseName, estateId.ToString()); await using EstateManagementContext context = resolvedContext.Context; - DateTime queryStartDate = DateTime.ParseExact(startDate, "yyyyMMdd", null); - DateTime queryEndDate = DateTime.ParseExact(endDate, "yyyyMMdd", null); + DateTimeOffset queryStartDate = DateTimeOffset.ParseExact(startDate, "yyyyMMdd", null); + DateTimeOffset queryEndDate = DateTimeOffset.ParseExact(endDate, "yyyyMMdd", null); IQueryable query = context.SettlementsView.Where(t => t.EstateId == estateId && t.SettlementDate >= queryStartDate.Date && t.SettlementDate <= queryEndDate.Date) @@ -2272,7 +2272,7 @@ public async Task AddTransactionToStatement(MerchantStatementForDateDoma { StatementId = domainEvent.MerchantStatementId, ActivityDateTime = domainEvent.TransactionDateTime, - ActivityDate = domainEvent.TransactionDateTime.Date, + ActivityDate = DateOnly.FromDateTime(domainEvent.TransactionDateTime.Date), ActivityDescription = $"{@operator.Name} Transaction", ActivityType = 1, // Transaction TransactionId = domainEvent.TransactionId, @@ -2305,7 +2305,7 @@ public async Task AddSettledFeeToStatement(MerchantStatementForDateDomai { StatementId = domainEvent.MerchantStatementId, ActivityDateTime = domainEvent.SettledDateTime, - ActivityDate = domainEvent.SettledDateTime.Date, + ActivityDate = DateOnly.FromDateTime(domainEvent.SettledDateTime.Date), ActivityDescription = $"{@operator.Name} Transaction Fee", ActivityType = 2, // Transaction Fee TransactionId = domainEvent.TransactionId, diff --git a/TransactionProcessor.Tests/ControllerTests/TransactionControllerTests.cs b/TransactionProcessor.Tests/ControllerTests/TransactionControllerTests.cs index a7b0fa5a..3f0c6e2b 100644 --- a/TransactionProcessor.Tests/ControllerTests/TransactionControllerTests.cs +++ b/TransactionProcessor.Tests/ControllerTests/TransactionControllerTests.cs @@ -14,6 +14,8 @@ namespace TransactionProcessor.Tests.ControllerTests { using System.Threading; using System.Threading.Tasks; using TransactionProcessor.BusinessLogic.OperatorInterfaces.PataPawaPrePay; + using TransactionProcessor.DataTransferObjects.Requests.Transaction; + using TransactionProcessor.DataTransferObjects.Responses.Transaction; using Xunit; [Collection("TestCollection")] diff --git a/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs b/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs index 7d801c8f..450131ac 100644 --- a/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs +++ b/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs @@ -15,12 +15,13 @@ using ContractProductTransactionFee = TransactionProcessor.DataTransferObjects.Responses.Contract.ContractProductTransactionFee; using ProductType = TransactionProcessor.DataTransferObjects.Responses.Contract.ProductType; -namespace TransactionProcessor.Tests.Factories -{ +namespace TransactionProcessor.Tests.Factories { using DataTransferObjects; using Models; using Shouldly; using Testing; + using TransactionProcessor.DataTransferObjects.Responses.Transaction; + using TransactionProcessor.DataTransferObjects.Responses.Voucher; using TransactionProcessor.Factories; using Xunit; using IssueVoucherResponse = Models.IssueVoucherResponse; @@ -265,7 +266,7 @@ public void ModelFactory_ProcessReconciliationTransactionResponse_NullInput_IsCo public void ModelFactory_ConvertFrom_IssueVoucherResponse_IsConverted() { IssueVoucherResponse model = TestData.IssueVoucherResponse; - DataTransferObjects.IssueVoucherResponse dto = ModelFactory.ConvertFrom(model); + DataTransferObjects.Responses.Voucher.IssueVoucherResponse dto = ModelFactory.ConvertFrom(model); dto.ShouldNotBeNull(); dto.ExpiryDate.ShouldBe(model.ExpiryDate); @@ -278,7 +279,7 @@ public void ModelFactory_ConvertFrom_IssueVoucherResponse_IsConverted() public void ModelFactory_ConvertFrom_IssueVoucherResponse_NullInput_IsConverted() { IssueVoucherResponse model = null; - DataTransferObjects.IssueVoucherResponse dto = ModelFactory.ConvertFrom(model); + DataTransferObjects.Responses.Voucher.IssueVoucherResponse dto = ModelFactory.ConvertFrom(model); dto.ShouldBeNull(); } @@ -319,7 +320,7 @@ public void ModelFactory_ConvertFrom_RedeemVoucherResponse_IsConverted() { RedeemVoucherResponse model = TestData.RedeemVoucherResponse; - DataTransferObjects.RedeemVoucherResponse dto = ModelFactory.ConvertFrom(model); + DataTransferObjects.Responses.Voucher.RedeemVoucherResponse dto = ModelFactory.ConvertFrom(model); dto.ShouldNotBeNull(); dto.ExpiryDate.ShouldBe(model.ExpiryDate); dto.VoucherCode.ShouldBe(model.VoucherCode); @@ -330,7 +331,7 @@ public void ModelFactory_ConvertFrom_RedeemVoucherResponse_IsConverted() public void ModelFactory_ConvertFrom_RedeemVoucherResponse_NullInput_IsConverted() { RedeemVoucherResponse model = null; - DataTransferObjects.RedeemVoucherResponse result = ModelFactory.ConvertFrom(model); + DataTransferObjects.Responses.Voucher.RedeemVoucherResponse result = ModelFactory.ConvertFrom(model); result.ShouldBeNull(); } diff --git a/TransactionProcessor.Tests/HandlerTests/TransactionHandlersTests.cs b/TransactionProcessor.Tests/HandlerTests/TransactionHandlersTests.cs index c7721aeb..465c4bf4 100644 --- a/TransactionProcessor.Tests/HandlerTests/TransactionHandlersTests.cs +++ b/TransactionProcessor.Tests/HandlerTests/TransactionHandlersTests.cs @@ -9,10 +9,10 @@ using Shouldly; using SimpleResults; using TransactionProcessor.BusinessLogic.Requests; -using TransactionProcessor.DataTransferObjects; using TransactionProcessor.Handlers; using TransactionProcessor.Models; using Xunit; +using TransactionProcessor.DataTransferObjects.Requests.Transaction; namespace TransactionProcessor.Tests.HandlerTests { diff --git a/TransactionProcessor.Tests/HandlerTests/WebHandlersTests.cs b/TransactionProcessor.Tests/HandlerTests/WebHandlersTests.cs index e75310d7..7893b1d6 100644 --- a/TransactionProcessor.Tests/HandlerTests/WebHandlersTests.cs +++ b/TransactionProcessor.Tests/HandlerTests/WebHandlersTests.cs @@ -11,9 +11,11 @@ using TransactionProcessor.DataTransferObjects; using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects.Requests.Estate; +using TransactionProcessor.DataTransferObjects.Requests.Float; using TransactionProcessor.DataTransferObjects.Requests.Merchant; using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Requests.Operator; +using TransactionProcessor.DataTransferObjects.Requests.Voucher; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.Handlers; using TransactionProcessor.Models; diff --git a/TransactionProcessor/Endpoints/MerchantEndpoints.cs b/TransactionProcessor/Endpoints/MerchantEndpoints.cs index 8f15a58e..c7312250 100644 --- a/TransactionProcessor/Endpoints/MerchantEndpoints.cs +++ b/TransactionProcessor/Endpoints/MerchantEndpoints.cs @@ -4,7 +4,6 @@ using Shared.Authorisation; using System.Diagnostics.CodeAnalysis; using TransactionProcessor.Handlers; -using TransactionProcessor.DataTransferObjects; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.DataTransferObjects.Responses.Merchant; using System.Collections.Generic; diff --git a/TransactionProcessor/Endpoints/TransactionEndpoints.cs b/TransactionProcessor/Endpoints/TransactionEndpoints.cs index 6c479593..4f12e26a 100644 --- a/TransactionProcessor/Endpoints/TransactionEndpoints.cs +++ b/TransactionProcessor/Endpoints/TransactionEndpoints.cs @@ -4,7 +4,7 @@ using Shared.Authorisation; using System.Diagnostics.CodeAnalysis; using TransactionProcessor.Handlers; -using TransactionProcessor.DataTransferObjects; +using TransactionProcessor.DataTransferObjects.Responses.Transaction; namespace TransactionProcessor.Endpoints { diff --git a/TransactionProcessor/Endpoints/VoucherEndpoints.cs b/TransactionProcessor/Endpoints/VoucherEndpoints.cs index 54e6e603..8019de19 100644 --- a/TransactionProcessor/Endpoints/VoucherEndpoints.cs +++ b/TransactionProcessor/Endpoints/VoucherEndpoints.cs @@ -5,7 +5,7 @@ using Shared.Authorisation; using System.Diagnostics.CodeAnalysis; using TransactionProcessor.Handlers; -using TransactionProcessor.DataTransferObjects; +using TransactionProcessor.DataTransferObjects.Responses.Voucher; namespace TransactionProcessor.Endpoints { diff --git a/TransactionProcessor/Factories/ModelFactory.cs b/TransactionProcessor/Factories/ModelFactory.cs index 94f0e361..dfd7d180 100644 --- a/TransactionProcessor/Factories/ModelFactory.cs +++ b/TransactionProcessor/Factories/ModelFactory.cs @@ -5,19 +5,21 @@ using TransactionProcessor.DataTransferObjects.Responses.Estate; using TransactionProcessor.DataTransferObjects.Responses.Merchant; using TransactionProcessor.DataTransferObjects.Responses.Operator; +using TransactionProcessor.DataTransferObjects.Responses.Voucher; using ProductType = TransactionProcessor.DataTransferObjects.Responses.Contract.ProductType; -namespace TransactionProcessor.Factories -{ +namespace TransactionProcessor.Factories { using System; using System.Collections.Generic; using DataTransferObjects; using Models; + using TransactionProcessor.DataTransferObjects.Responses.Transaction; + using TransactionProcessor.DataTransferObjects.Responses.Voucher; using TransactionProcessor.Models.Estate; using TransactionProcessor.Models.Merchant; using CalculationType = DataTransferObjects.Responses.Contract.CalculationType; - using IssueVoucherResponse = DataTransferObjects.IssueVoucherResponse; - using RedeemVoucherResponse = DataTransferObjects.RedeemVoucherResponse; + using IssueVoucherResponse = IssueVoucherResponse; + using RedeemVoucherResponse = RedeemVoucherResponse; /// /// diff --git a/TransactionProcessor/Handlers/FloatHandlers.cs b/TransactionProcessor/Handlers/FloatHandlers.cs index c4b9961b..d2de2847 100644 --- a/TransactionProcessor/Handlers/FloatHandlers.cs +++ b/TransactionProcessor/Handlers/FloatHandlers.cs @@ -6,8 +6,8 @@ using SimpleResults; using Shared.Results.Web; using TransactionProcessor.BusinessLogic.Requests; -using TransactionProcessor.DataTransferObjects; using TransactionProcessor.Factories; +using TransactionProcessor.DataTransferObjects.Requests.Float; namespace TransactionProcessor.Handlers { diff --git a/TransactionProcessor/Handlers/MerchantHandlers.cs b/TransactionProcessor/Handlers/MerchantHandlers.cs index a3549f63..4be56a00 100644 --- a/TransactionProcessor/Handlers/MerchantHandlers.cs +++ b/TransactionProcessor/Handlers/MerchantHandlers.cs @@ -10,6 +10,8 @@ using TransactionProcessor.DataTransferObjects; using TransactionProcessor.DataTransferObjects.Requests.Merchant; using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; +using TransactionProcessor.DataTransferObjects.Responses; +using TransactionProcessor.DataTransferObjects.Responses.Merchant; using TransactionProcessor.Factories; using TransactionProcessor.Models.Contract; using TransactionProcessor.ProjectionEngine.Models; @@ -49,15 +51,15 @@ public static async Task GetMerchantBalanceHistory(IMediator mediator, HttpContext ctx, Guid estateId, Guid merchantId, - DateTime startDate, - DateTime endDate, + DateTimeOffset startDate, + DateTimeOffset endDate, CancellationToken cancellationToken) { MerchantQueries.GetMerchantBalanceHistoryQuery query = new(estateId, merchantId, startDate, endDate); Result> result = await mediator.Send(query, cancellationToken); return ResponseFactory.FromResult(result, r => { - List response = new(); - r.ForEach(h => response.Add(new TransactionProcessor.DataTransferObjects.MerchantBalanceChangedEntryResponse { + List response = new(); + r.ForEach(h => response.Add(new MerchantBalanceChangedEntryResponse { Balance = h.Balance, MerchantId = h.MerchantId, EstateId = h.EstateId, diff --git a/TransactionProcessor/Handlers/SettlementHandlers.cs b/TransactionProcessor/Handlers/SettlementHandlers.cs index 9f7a7718..52afc1b8 100644 --- a/TransactionProcessor/Handlers/SettlementHandlers.cs +++ b/TransactionProcessor/Handlers/SettlementHandlers.cs @@ -16,7 +16,7 @@ namespace TransactionProcessor.Handlers { public static class SettlementHandlers { - public static async Task GetPendingSettlement(IMediator mediator, HttpContext ctx, DateTime settlementDate, [FromRoute] Guid estateId, Guid merchantId, CancellationToken cancellationToken) + public static async Task GetPendingSettlement(IMediator mediator, HttpContext ctx, DateTimeOffset settlementDate, [FromRoute] Guid estateId, Guid merchantId, CancellationToken cancellationToken) { SettlementQueries.GetPendingSettlementQuery query = new(settlementDate, merchantId, estateId); Result getPendingSettlementResult = await mediator.Send(query, cancellationToken); @@ -32,7 +32,7 @@ public static async Task GetPendingSettlement(IMediator mediator, HttpC }); } - public static async Task ProcessSettlement(IMediator mediator, HttpContext ctx, DateTime settlementDate, Guid estateId, Guid merchantId, CancellationToken cancellationToken) + public static async Task ProcessSettlement(IMediator mediator, HttpContext ctx, DateTimeOffset settlementDate, Guid estateId, Guid merchantId, CancellationToken cancellationToken) { SettlementCommands.ProcessSettlementCommand command = new(settlementDate, merchantId, estateId); Result result = await mediator.Send(command, cancellationToken); diff --git a/TransactionProcessor/Handlers/TransactionHandlers.cs b/TransactionProcessor/Handlers/TransactionHandlers.cs index e9b9e0c2..8c9f8ac1 100644 --- a/TransactionProcessor/Handlers/TransactionHandlers.cs +++ b/TransactionProcessor/Handlers/TransactionHandlers.cs @@ -6,10 +6,11 @@ using SimpleResults; using Shared.Results.Web; using Shared.Results; -using TransactionProcessor.DataTransferObjects; using TransactionProcessor.Factories; using TransactionProcessor.BusinessLogic.Requests; using TransactionProcessor.Models; +using TransactionProcessor.DataTransferObjects.Requests.Transaction; +using TransactionProcessor.DataTransferObjects.Responses.Transaction; namespace TransactionProcessor.Handlers { @@ -17,7 +18,7 @@ public static class TransactionHandlers { public static async Task PerformSaleTransaction(IMediator mediator, HttpContext ctx, SaleTransactionRequest transactionRequest, CancellationToken cancellationToken) { - DateTime transactionReceivedDateTime = DateTime.Now; + DateTimeOffset transactionReceivedDateTime = DateTime.Now; Result transactionResult = await ProcessSpecificMessage(mediator, transactionRequest, transactionReceivedDateTime, cancellationToken); @@ -26,7 +27,7 @@ public static async Task PerformSaleTransaction(IMediator mediator, Htt public static async Task PerformLogonTransaction(IMediator mediator, HttpContext ctx, LogonTransactionRequest transactionRequest, CancellationToken cancellationToken) { - DateTime transactionReceivedDateTime = DateTime.Now; + DateTimeOffset transactionReceivedDateTime = DateTime.Now; Result transactionResult = await ProcessSpecificMessage(mediator, transactionRequest, transactionReceivedDateTime, cancellationToken); @@ -52,7 +53,7 @@ public static async Task ResendTransactionReceipt(IMediator mediator, H } // Helpers copied from controller logic - private static async Task> ProcessSpecificMessage(IMediator mediator, LogonTransactionRequest logon, DateTime transactionReceivedDateTime, CancellationToken cancellationToken) + private static async Task> ProcessSpecificMessage(IMediator mediator, LogonTransactionRequest logon, DateTimeOffset transactionReceivedDateTime, CancellationToken cancellationToken) { Guid transactionId = Guid.NewGuid(); @@ -73,7 +74,7 @@ private static async Task> ProcessSpecificMessa return ModelFactory.ConvertFrom(result.Data); } - private static async Task> ProcessSpecificMessage(IMediator mediator, SaleTransactionRequest sale, DateTime transactionReceivedDateTime, CancellationToken cancellationToken) + private static async Task> ProcessSpecificMessage(IMediator mediator, SaleTransactionRequest sale, DateTimeOffset transactionReceivedDateTime, CancellationToken cancellationToken) { Guid transactionId = Guid.NewGuid(); diff --git a/TransactionProcessor/Handlers/VoucherHandlers.cs b/TransactionProcessor/Handlers/VoucherHandlers.cs index 4358e976..b49a536c 100644 --- a/TransactionProcessor/Handlers/VoucherHandlers.cs +++ b/TransactionProcessor/Handlers/VoucherHandlers.cs @@ -6,8 +6,8 @@ using SimpleResults; using Shared.Results.Web; using TransactionProcessor.BusinessLogic.Requests; -using TransactionProcessor.DataTransferObjects; using TransactionProcessor.Factories; +using TransactionProcessor.DataTransferObjects.Requests.Voucher; namespace TransactionProcessor.Handlers { @@ -15,7 +15,7 @@ public static class VoucherHandlers { public static async Task RedeemVoucher(IMediator mediator, HttpContext ctx, RedeemVoucherRequest redeemVoucherRequest, CancellationToken cancellationToken) { - DateTime redeemedDateTime = redeemVoucherRequest.RedeemedDateTime.HasValue ? redeemVoucherRequest.RedeemedDateTime.Value : DateTime.Now; + DateTimeOffset redeemedDateTime = redeemVoucherRequest.RedeemedDateTime.HasValue ? redeemVoucherRequest.RedeemedDateTime.Value : DateTime.Now; VoucherCommands.RedeemVoucherCommand command = new(redeemVoucherRequest.EstateId, redeemVoucherRequest.VoucherCode, redeemedDateTime); Result result = await mediator.Send(command, cancellationToken); From 53308645c2865117f86e4d07f42c17c87266f8c2 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Mon, 2 Nov 2026 21:37:55 +0000 Subject: [PATCH 2/3] Swap over date times --- .../FloatAggregateTests.cs | 16 +- .../MerchantDepositListAggregateTests.cs | 62 +++++--- .../ReconciliationAggregateTests.cs | 38 ++--- .../TransactionAggregateTests.cs | 144 +++++++++--------- .../VoucherAggregateTests.cs | 10 +- .../FloatAggregate.cs | 4 +- .../MerchantAggregate.cs | 4 +- .../MerchantDepositListAggregate.cs | 17 ++- .../ReconciliationAggregate.cs | 5 +- .../SettlementAggregate.cs | 2 +- .../TransactionAggregate.cs | 4 +- .../VoucherAggregate.cs | 4 +- .../TransactionDomainEventHandlerTests.cs | 2 +- .../Mediator/DummyVoucherDomainService.cs | 4 +- .../VoucherManagementRequestHandlerTests.cs | 2 +- .../Services/FloatDomainServiceTests.cs | 12 +- .../Services/TransactionDomainServiceTests.cs | 24 +-- .../Services/VoucherDomainServiceTests.cs | 20 +-- .../Common/TransactionHelpers.cs | 2 +- .../MerchantDomainEventHandler.cs | 2 +- .../Manager/FeeCalculationManager.cs | 4 +- .../VoucherManagementProxy.cs | 2 +- .../VoucherManagementRequestHandler.cs | 2 +- .../Requests/FloatCommands.cs | 12 +- .../Requests/TransactionCommands.cs | 7 +- .../Requests/VoucherCommands.cs | 9 +- .../Services/FloatDomainService.cs | 5 +- .../Services/MerchantDomainService.cs | 6 +- .../MerchantStatementDomainService.cs | 6 +- .../Services/SettlementDomainService.cs | 4 +- .../Services/TransactionDomainService.cs | 20 +-- .../Services/VoucherDomainService.cs | 20 ++- .../Float/RecordFloatCreditPurchaseRequest.cs | 6 +- .../Merchant/CreateMerchantRequest.cs | 2 +- .../Merchant/MakeMerchantDepositRequest.cs | 6 +- .../Merchant/MakeMerchantWithdrawalRequest.cs | 6 +- .../Requests/RequestWithHostDateTime.cs | 10 +- .../Transaction/LogonTransactionRequest.cs | 4 +- .../Transaction/ReconciliationRequest.cs | 4 +- .../Transaction/SaleTransactionRequest.cs | 4 +- .../Transaction/TransactionRequest.cs | 8 +- .../Requests/Voucher/IssueVoucherRequest.cs | 30 ---- .../Requests/Voucher/RedeemVoucherRequest.cs | 6 +- .../FloatEventTests.cs | 6 +- .../DateTimeOffsetSecondsConverter.cs | 25 +++ .../FloatDomainEvents.cs | 2 +- .../MerchantDomainEvents.cs | 6 +- .../ReconciliationDomainEvents.cs | 4 +- .../TransactionDomainEvents.cs | 4 +- .../VoucherDomainEvents.cs | 4 +- .../Common/TestingContext.cs | 9 -- .../MerchantBalanceProjectionTests.cs | 3 +- .../TestData.cs | 18 ++- TransactionProcessor.Testing/TestData.cs | 66 +++++--- .../HandlerTests/WebHandlersTests.cs | 14 +- .../Bootstrapper/ClientRegistry.cs | 2 +- .../Handlers/FloatHandlers.cs | 7 +- .../Handlers/MerchantHandlers.cs | 9 +- .../Handlers/TransactionHandlers.cs | 34 ++--- .../Handlers/VoucherHandlers.cs | 3 +- 60 files changed, 401 insertions(+), 376 deletions(-) delete mode 100644 TransactionProcessor.DataTransferObjects/Requests/Voucher/IssueVoucherRequest.cs create mode 100644 TransactionProcessor.DomainEvents/DateTimeOffsetSecondsConverter.cs diff --git a/TransactionProcessor.Aggregates.Tests/FloatAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/FloatAggregateTests.cs index aa409721..d4b8462c 100644 --- a/TransactionProcessor.Aggregates.Tests/FloatAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/FloatAggregateTests.cs @@ -45,7 +45,7 @@ public void FloatAggregate_RecordCreditPurchase_CreditPurchaseIsRecorded() { Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId); aggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime); - Result result = aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900); + Result result = aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900, DateTime.Now); result.IsSuccess.ShouldBeTrue(); aggregate.NumberOfCreditPurchases.ShouldBe(1); aggregate.TotalCostPrice.ShouldBe(900); @@ -58,7 +58,7 @@ public void FloatAggregate_RecordCreditPurchase_FloatNotCreated_ErrorThrown() { Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId); - Result result = aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900); + Result result = aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900, DateTime.Now); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); @@ -69,7 +69,7 @@ public void FloatAggregate_RecordCreditPurchase_MultipleCreditPurchases_AllCredi { Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId); aggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime); - aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900); + aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900, DateTime.Now); aggregate.NumberOfCreditPurchases.ShouldBe(1); aggregate.TotalCostPrice.ShouldBe(900); @@ -78,7 +78,7 @@ public void FloatAggregate_RecordCreditPurchase_MultipleCreditPurchases_AllCredi Decimal roundedUnitCostPrice= aggregate.GetUnitCostPrice(); roundedUnitCostPrice.ShouldBe(0.900m); - aggregate.RecordCreditPurchase(DateTime.Now, 2000, 1750); + aggregate.RecordCreditPurchase(DateTime.Now, 2000, 1750, DateTime.Now); aggregate.NumberOfCreditPurchases.ShouldBe(2); aggregate.TotalCostPrice.ShouldBe(2650); @@ -87,7 +87,7 @@ public void FloatAggregate_RecordCreditPurchase_MultipleCreditPurchases_AllCredi roundedUnitCostPrice.ShouldBe(0.8833m); aggregate.TotalCreditPurchases.ShouldBe(3000); - aggregate.RecordCreditPurchase(DateTime.Now, 20000, 16000); + aggregate.RecordCreditPurchase(DateTime.Now, 20000, 16000, DateTime.Now); aggregate.NumberOfCreditPurchases.ShouldBe(3); aggregate.TotalCostPrice.ShouldBe(18650); @@ -103,9 +103,9 @@ public void FloatAggregate_RecordCreditPurchase_DuplicateCreditPurchase_ErrorThr Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId); aggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime); DateTimeOffset purchaseDateTime = DateTimeOffset.Now; - aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900); + aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900, DateTime.Now); - Result result = aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900); + Result result = aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900, DateTime.Now); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); @@ -118,7 +118,7 @@ public void FloatAggregate_GetTotalCostPrice_TotalCostReturned() Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId); aggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime); DateTime purchaseDateTime = DateTime.Now; - aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900); + aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900, DateTime.Now); Decimal totalCost = aggregate.GetTotalCostPrice(10); diff --git a/TransactionProcessor.Aggregates.Tests/MerchantDepositListAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/MerchantDepositListAggregateTests.cs index d50adab2..8c5bbd22 100644 --- a/TransactionProcessor.Aggregates.Tests/MerchantDepositListAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/MerchantDepositListAggregateTests.cs @@ -71,7 +71,8 @@ public void MerchantDepositListAggregate_MakeDeposit_AutomaticDepositSource_Depo Result result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceAutomatic, TestData.DepositReference, TestData.DepositDateTime, - TestData.DepositAmount); + TestData.DepositAmount, + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); List depositListModel = merchantDepositListAggregate.GetDeposits(); @@ -91,7 +92,7 @@ public void MerchantDepositListAggregate_MakeDeposit_DepositMade() { MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - Result result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, TestData.DepositReference, TestData.DepositDateTime, TestData.DepositAmount); + Result result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, TestData.DepositReference, TestData.DepositDateTime, TestData.DepositAmount, TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); List depositListModel = merchantDepositListAggregate.GetDeposits(); @@ -115,7 +116,7 @@ public void MerchantDepositListAggregate_MakeDeposit_DepositSourceNotSet_ErrorTh Result result = merchantDepositListAggregate.MakeDeposit(MerchantDepositSource.NotSet, TestData.DepositReference, TestData.DepositDateTime, - TestData.DepositAmount); + TestData.DepositAmount, TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -133,7 +134,7 @@ public void MerchantDepositListAggregate_MakeDeposit_DepositSourceInvalid_ErrorT Result result = merchantDepositListAggregate.MakeDeposit((MerchantDepositSource)99, TestData.DepositReference, TestData.DepositDateTime, - TestData.DepositAmount); + TestData.DepositAmount, TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -147,14 +148,15 @@ public void MerchantDepositListAggregate_MakeDeposit_DuplicateDeposit_ErrorThrow MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, TestData.DepositReference, TestData.DepositDateTime, TestData.DepositAmount); + merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, TestData.DepositReference, TestData.DepositDateTime, TestData.DepositAmount, TestData.HostDateTime); List depositListModel = merchantDepositListAggregate.GetDeposits(); depositListModel.ShouldHaveSingleItem(); Result result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, TestData.DepositReference, TestData.DepositDateTime, - TestData.DepositAmount); + TestData.DepositAmount, + TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -166,7 +168,8 @@ public void MerchantDepositListAggregate_MakeDeposit_MerchantDepositListNotCreat Result result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, TestData.DepositReference, TestData.DepositDateTime, - TestData.DepositAmount); + TestData.DepositAmount, + TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -180,12 +183,13 @@ public void MerchantDepositListAggregate_MakeDeposit_TwoDeposits_BothDepositsMad MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - Result result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, TestData.DepositReference, TestData.DepositDateTime, TestData.DepositAmount); + Result result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, TestData.DepositReference, TestData.DepositDateTime, TestData.DepositAmount, TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, TestData.DepositReference2, TestData.DepositDateTime2, - TestData.DepositAmount2); + TestData.DepositAmount2, + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); List depositListModel = merchantDepositListAggregate.GetDeposits(); @@ -204,12 +208,14 @@ public void MerchantDepositListAggregate_MakeDeposit_TwoDepositsOneMonthApartSam Result result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, "Test Data Gen Deposit", new DateTime(2021, 1, 1, 0, 0, 0), - PositiveMoney.Create(Money.Create(650.00m))); + PositiveMoney.Create(Money.Create(650.00m)), + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, "Test Data Gen Deposit", new DateTime(2021, 2, 1, 0, 0, 0), - PositiveMoney.Create(Money.Create(650.00m))); + PositiveMoney.Create(Money.Create(650.00m)), + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); List depositListModel = merchantDepositListAggregate.GetDeposits(); @@ -228,12 +234,12 @@ public void MerchantDepositListAggregate_MakeDeposit_TwoDepositsSameDetailsApart Result result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, "Test Data Gen Deposit", new DateTime(2021, 1, 1, 0, 0, 0), - PositiveMoney.Create(Money.Create(650.00m))); + PositiveMoney.Create(Money.Create(650.00m)), TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); result = merchantDepositListAggregate.MakeDeposit(TestData.MerchantDepositSourceManual, "Test Data Gen Deposit", new DateTime(2021, 1, 1, 0, 0, 0), - PositiveMoney.Create(Money.Create(934.00m))); + PositiveMoney.Create(Money.Create(934.00m)), TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); List depositListModel = merchantDepositListAggregate.GetDeposits(); @@ -249,12 +255,14 @@ public void MerchantDepositListAggregate_MakeWithdrawal_DuplicateWithdrawal_Erro MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount); + merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount, + TestData.HostDateTime); List withdrawalListModel = merchantDepositListAggregate.GetWithdrawals(); withdrawalListModel.ShouldHaveSingleItem(); - Result result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount); + Result result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount, + TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -263,7 +271,8 @@ public void MerchantDepositListAggregate_MakeWithdrawal_DuplicateWithdrawal_Erro public void MerchantDepositListAggregate_MakeWithdrawal_MerchantDepositListNotCreated_ErrorThrown() { MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); - Result result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount); + Result result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount, + TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -277,10 +286,12 @@ public void MerchantDepositListAggregate_MakeWithdrawal_TwoWithdrawals_BothWithd MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - Result result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount); + Result result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount, + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); - result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime2, TestData.WithdrawalAmount2); + result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime2, TestData.WithdrawalAmount2, + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); List withdrawalListModel = merchantDepositListAggregate.GetWithdrawals(); @@ -296,9 +307,11 @@ public void MerchantDepositListAggregate_MakeWithdrawal_TwoWithdrawalsOneMonthAp MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - Result result = merchantDepositListAggregate.MakeWithdrawal(new DateTime(2021, 1, 1, 0, 0, 0), PositiveMoney.Create(Money.Create(650.00m))); + Result result = merchantDepositListAggregate.MakeWithdrawal(new DateTime(2021, 1, 1, 0, 0, 0), PositiveMoney.Create(Money.Create(650.00m)), + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); - result = merchantDepositListAggregate.MakeWithdrawal(new DateTime(2021, 2, 1, 0, 0, 0), PositiveMoney.Create(Money.Create(650.00m))); + result = merchantDepositListAggregate.MakeWithdrawal(new DateTime(2021, 2, 1, 0, 0, 0), PositiveMoney.Create(Money.Create(650.00m)), + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); List withdrawalListModel = merchantDepositListAggregate.GetWithdrawals(); @@ -314,9 +327,11 @@ public void MerchantDepositListAggregate_MakeWithdrawal_TwoWithdrawalsSameDetail MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - Result result = merchantDepositListAggregate.MakeWithdrawal(new DateTime(2021, 1, 1, 0, 0, 0), PositiveMoney.Create(Money.Create(650.00m))); + Result result = merchantDepositListAggregate.MakeWithdrawal(new DateTime(2021, 1, 1, 0, 0, 0), PositiveMoney.Create(Money.Create(650.00m)), + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); - result = merchantDepositListAggregate.MakeWithdrawal(new DateTime(2021, 1, 1, 0, 0, 0), PositiveMoney.Create(Money.Create(934.00m))); + result = merchantDepositListAggregate.MakeWithdrawal(new DateTime(2021, 1, 1, 0, 0, 0), PositiveMoney.Create(Money.Create(934.00m)), + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); List withdrawalListModel = merchantDepositListAggregate.GetWithdrawals(); @@ -332,7 +347,8 @@ public void MerchantDepositListAggregate_MakeWithdrawal_WithdrawalMade() { MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - Result result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount); + Result result = merchantDepositListAggregate.MakeWithdrawal(TestData.WithdrawalDateTime, TestData.WithdrawalAmount, + TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); List withdrawalListModel = merchantDepositListAggregate.GetWithdrawals(); diff --git a/TransactionProcessor.Aggregates.Tests/ReconciliationAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/ReconciliationAggregateTests.cs index 06e2490d..8e590c48 100644 --- a/TransactionProcessor.Aggregates.Tests/ReconciliationAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/ReconciliationAggregateTests.cs @@ -24,7 +24,7 @@ public void ReconciliationAggregate_StartReconciliation_ReconciliationIsStarted( { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); reconciliationAggregate.HasBeenStarted.ShouldBeTrue(); @@ -46,7 +46,7 @@ public void ReconciliationAggregate_StartReconciliation_InvalidData_ErrorThrown( Guid estateId = validEstateId ? TestData.EstateId : Guid.Empty; Guid merchantId = validMerchantId ? TestData.MerchantId : Guid.Empty; - Result result = reconciliationAggregate.StartReconciliation(transactionDateTime, estateId, merchantId); + Result result = reconciliationAggregate.StartReconciliation(transactionDateTime, estateId, merchantId, TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -56,9 +56,9 @@ public void ReconciliationAggregate_StartReconciliation_ReconciliationAlreadySta { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); - Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); } @@ -67,12 +67,12 @@ public void ReconciliationAggregate_StartReconciliation_ReconciliationAlreadyCom { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage); reconciliationAggregate.CompleteReconciliation(); - Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); result.IsSuccess.ShouldBeTrue(); } @@ -81,7 +81,7 @@ public void ReconciliationAggregate_RecordOverallTotals_OverallTotalsAreRecorded { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); Result result = reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); result.IsSuccess.ShouldBeTrue(); @@ -105,7 +105,7 @@ public void ReconciliationAggregate_RecordOverallTotals_ReconciliationAlreadyCom { ReconciliationAggregate reconciliationAggregate = ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage); reconciliationAggregate.CompleteReconciliation(); @@ -121,7 +121,7 @@ public void ReconciliationAggregate_Authorise_ReconciliationIsAuthorised() { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); Result result = reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage); result.IsSuccess.ShouldBeTrue(); @@ -146,7 +146,7 @@ public void ReconciliationAggregate_Authorise_ReconciliationAlreadyAuthorised_No { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage); @@ -159,7 +159,7 @@ public void ReconciliationAggregate_Authorise_ReconciliationAlreadyDeclined_Erro { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); reconciliationAggregate.Decline(TestData.ResponseCode, TestData.ResponseMessage); @@ -172,7 +172,7 @@ public void ReconciliationAggregate_Authorise_ReconciliationAlreadyCompleted_Err { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage); reconciliationAggregate.CompleteReconciliation(); @@ -186,7 +186,7 @@ public void ReconciliationAggregate_Decline_ReconciliationIsDeclined() { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); Result result = reconciliationAggregate.Decline(TestData.ResponseCode, TestData.ResponseMessage); result.IsSuccess.ShouldBeTrue(); @@ -211,7 +211,7 @@ public void ReconciliationAggregate_Decline_ReconciliationAlreadyAuthorised_Erro { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage); @@ -224,7 +224,7 @@ public void ReconciliationAggregate_Decline_ReconciliationAlreadyDecline_NoError { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); reconciliationAggregate.Decline(TestData.ResponseCode, TestData.ResponseMessage); @@ -237,7 +237,7 @@ public void ReconciliationAggregate_Decline_ReconciliationAlreadyCompleted_NoErr { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); reconciliationAggregate.Decline(TestData.ResponseCode, TestData.ResponseMessage); reconciliationAggregate.CompleteReconciliation(); @@ -253,7 +253,7 @@ public void ReconciliationAggregate_CompleteReconciliation_ReconciliationIsCompl { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); if (isAuthorised) { @@ -286,7 +286,7 @@ public void ReconciliationAggregate_CompleteReconciliation_NotAuthorisedOrDeclin { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); Result result = reconciliationAggregate.CompleteReconciliation(); @@ -301,7 +301,7 @@ public void ReconciliationAggregate_CompleteReconciliation_ReconciliationAlready { Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId); - reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId); + reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime); reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); if (isAuthorised) { diff --git a/TransactionProcessor.Aggregates.Tests/TransactionAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/TransactionAggregateTests.cs index ea740bff..324fb04b 100644 --- a/TransactionProcessor.Aggregates.Tests/TransactionAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/TransactionAggregateTests.cs @@ -25,7 +25,7 @@ public void TransactionAggregate_CanBeCreated_IsCreated(){ [InlineData(TransactionType.Sale)] public void TransactionAggregate_StartTransaction_TransactionIsStarted(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); result.IsSuccess.ShouldBeTrue(); transactionAggregate.IsStarted.ShouldBeTrue(); @@ -46,7 +46,7 @@ public void TransactionAggregate_StartTransaction_TransactionIsStarted(Transacti [InlineData(TransactionType.Logon)] public void TransactionAggregate_StartTransaction_NullAmount_TransactionIsStarted(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, null); + Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, null); result.IsSuccess.ShouldBeTrue(); transactionAggregate.IsStarted.ShouldBeTrue(); @@ -68,9 +68,9 @@ public void TransactionAggregate_StartTransaction_NullAmount_TransactionIsStarte [InlineData(TransactionType.Sale)] public void TransactionAggregate_StartTransaction_TransactionAlreadyStarted_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); - Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -80,7 +80,7 @@ public void TransactionAggregate_StartTransaction_TransactionAlreadyStarted_Erro [InlineData(TransactionType.Sale)] public void TransactionAggregate_StartTransaction_TransactionAlreadyCompleted_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); if (transactionType == TransactionType.Logon){ transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); @@ -97,7 +97,7 @@ public void TransactionAggregate_StartTransaction_TransactionAlreadyCompleted_Er transactionAggregate.CompleteTransaction(); - Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -133,7 +133,7 @@ public void TransactionAggregate_StartTransaction_InvalidData_ErrorThrown(Boolea Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - Result result = transactionAggregate.StartTransaction(transactionDateTime, transactionNumber, transactionType, transactionReference, new TransactionStartContext { EstateId = estateId, MerchantId = merchantId, DeviceIdentifier = deviceIdentifier }, TestData.TransactionAmount); + Result result = transactionAggregate.StartTransaction(transactionDateTime, TestData.HostDateTime, transactionNumber, transactionType, transactionReference, new TransactionStartContext { EstateId = estateId, MerchantId = merchantId, DeviceIdentifier = deviceIdentifier }, TestData.TransactionAmount); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -142,7 +142,7 @@ public void TransactionAggregate_StartTransaction_InvalidData_ErrorThrown(Boolea public void TransactionAggregate_StartTransaction_NullContext_ErrorThrown() { Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, null, TestData.TransactionAmount); + Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, null, TestData.TransactionAmount); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -156,7 +156,7 @@ public void TransactionAggregate_StartTransaction_NonOnlineSaleWithoutDeviceIden String deviceIdentifier) { Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, + Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, @@ -177,7 +177,7 @@ public void TransactionAggregate_StartTransaction_NonOnlineSaleWithoutDeviceIden public void TransactionAggregate_StartTransaction_OnlineSaleWithoutDeviceIdentifier_ErrorThrown(String deviceIdentifier) { Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, + Result result = transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, @@ -197,7 +197,7 @@ public void TransactionAggregate_StartTransaction_OnlineSaleWithoutDeviceIdentif [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddProductDetails_ProductDetailsAdded(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); Result result = transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); result.IsSuccess.ShouldBeTrue(); @@ -212,7 +212,7 @@ public void TransactionAggregate_AddProductDetails_ProductDetailsAdded(Transacti [InlineData(TransactionSource.FileImport)] public void TransactionAggregate_AddTransactionSource_TransactionSourceAdded(TransactionSource transactionSource){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); Result result = transactionAggregate.AddTransactionSource(transactionSource); @@ -224,7 +224,7 @@ public void TransactionAggregate_AddTransactionSource_TransactionSourceAdded(Tra [Fact] public void TransactionAggregate_AddTransactionSource_InvalidSource_ErrorThrown(){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); Result result = transactionAggregate.AddTransactionSource((TransactionSource)99); @@ -237,7 +237,7 @@ public void TransactionAggregate_AddTransactionSource_InvalidSource_ErrorThrown( [InlineData(TransactionSource.FileImport)] public void TransactionAggregate_AddTransactionSource_SourceAlreadySet_NoErrorThrown(TransactionSource transactionSource){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AddTransactionSource(transactionSource); @@ -249,7 +249,7 @@ public void TransactionAggregate_AddTransactionSource_SourceAlreadySet_NoErrorTh [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddProductDetails_InvalidContractId_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); Result result = transactionAggregate.AddProductDetails(Guid.Empty, TestData.ProductId); result.IsFailed.ShouldBeTrue(); @@ -260,7 +260,7 @@ public void TransactionAggregate_AddProductDetails_InvalidContractId_ErrorThrown [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddProductDetails_InvalidProductId_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); Result result = transactionAggregate.AddProductDetails(TestData.ContractId, Guid.Empty); result.IsFailed.ShouldBeTrue(); @@ -271,7 +271,7 @@ public void TransactionAggregate_AddProductDetails_InvalidProductId_ErrorThrown( [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddProductDetails_ProductDetailsAlreadyAdded_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); @@ -294,7 +294,7 @@ public void TransactionAggregate_AddProductDetails_TransactionNotStarted_ErrorTh [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddProductDetails_TransactionAlreadyCompleted_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); @@ -323,7 +323,7 @@ public void TransactionAggregate_AddProductDetails_TransactionAlreadyCompleted_E [InlineData(TransactionType.Logon)] public void TransactionAggregate_AuthoriseTransactionLocally_TransactionIsAuthorised(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); Result result = transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); result.IsSuccess.ShouldBeTrue(); @@ -350,7 +350,7 @@ public void TransactionAggregate_AuthoriseTransactionLocally_TransactionNotStart [InlineData(TransactionType.Logon)] public void TransactionAggregate_AuthoriseTransactionLocally_TransactionAlreadyAuthorisedLocally_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); Result result = transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, @@ -364,7 +364,7 @@ public void TransactionAggregate_AuthoriseTransactionLocally_TransactionAlreadyA [InlineData(TransactionType.Logon)] public void TransactionAggregate_AuthoriseTransactionLocally_TransactionAlreadyAuthorised_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); Result result = transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, @@ -378,7 +378,7 @@ public void TransactionAggregate_AuthoriseTransactionLocally_TransactionAlreadyA [InlineData(TransactionType.Sale)] public void TransactionAggregate_AuthoriseTransactionLocally_TransactionCannotBeLocallyAuthorised_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); Result result = transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, @@ -394,7 +394,7 @@ public void TransactionAggregate_AuthoriseTransactionLocally_TransactionCannotBe [InlineData(TransactionType.Sale)] public void TransactionAggregate_AuthoriseTransaction_TransactionIsAuthorised(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -424,7 +424,7 @@ public void TransactionAggregate_AuthoriseTransaction_TransactionNotStarted_Erro [InlineData(TransactionType.Sale)] public void TransactionAggregate_AuthoriseTransaction_TransactionAlreadyAuthorised_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -441,7 +441,7 @@ public void TransactionAggregate_AuthoriseTransaction_TransactionAlreadyAuthoris [InlineData(TransactionType.Sale)] public void TransactionAggregate_DeclineTransactionLocally_TransactionIsDeclined(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -471,7 +471,7 @@ public void TransactionAggregate_DeclineTransactionLocally_TransactionNotStarted [InlineData(TransactionType.Logon)] public void TransactionAggregate_DeclineTransactionLocally_TransactionAlreadyAuthorisedLocally_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); Result result = transactionAggregate.DeclineTransactionLocally(TestData.ResponseCode, TestData.ResponseMessage); @@ -484,7 +484,7 @@ public void TransactionAggregate_DeclineTransactionLocally_TransactionAlreadyAut [InlineData(TransactionType.Sale)] public void TransactionAggregate_DeclineTransactionLocally_TransactionAlreadyAuthorised_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -501,7 +501,7 @@ public void TransactionAggregate_DeclineTransactionLocally_TransactionAlreadyAut [InlineData(TransactionType.Sale)] public void TransactionAggregate_DeclineTransactionLocally_TransactionAlreadyDeclinedLocally_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -518,7 +518,7 @@ public void TransactionAggregate_DeclineTransactionLocally_TransactionAlreadyDec [InlineData(TransactionType.Sale)] public void TransactionAggregate_DeclineTransactionLocally_TransactionAlreadyDeclined_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -535,7 +535,7 @@ public void TransactionAggregate_DeclineTransactionLocally_TransactionAlreadyDec [InlineData(TransactionType.Sale)] public void TransactionAggregate_DeclineTransaction_TransactionIsDeclined(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -581,7 +581,7 @@ public void TransactionAggregate_DeclineTransaction_TransactionNotStarted_ErrorT [InlineData(TransactionType.Sale)] public void TransactionAggregate_DeclineTransaction_TransactionAlreadyAuthorised_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -598,7 +598,7 @@ public void TransactionAggregate_DeclineTransaction_TransactionAlreadyAuthorised [InlineData(TransactionType.Sale)] public void TransactionAggregate_DeclineTransaction_TransactionAlreadyDeclinedLocally_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -615,7 +615,7 @@ public void TransactionAggregate_DeclineTransaction_TransactionAlreadyDeclinedLo [InlineData(TransactionType.Sale)] public void TransactionAggregate_DeclineTransaction_TransactionAlreadyDeclined_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -632,7 +632,7 @@ public void TransactionAggregate_DeclineTransaction_TransactionAlreadyDeclined_E [InlineData(TransactionType.Sale)] public void TransactionAggregate_CompleteTransaction_TransactionIsCompleted(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType == TransactionType.Logon){ transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); @@ -660,7 +660,7 @@ public void TransactionAggregate_CompleteTransaction_TransactionNotStarted_Error [InlineData(TransactionType.Sale)] public void TransactionAggregate_CompleteTransaction_TransactionNotAuthorised_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -675,7 +675,7 @@ public void TransactionAggregate_CompleteTransaction_TransactionNotAuthorised_Er [InlineData(TransactionType.Sale)] public void TransactionAggregate_CompleteTransaction_TransactionAlreadyCompleted_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType == TransactionType.Logon){ transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); @@ -697,7 +697,7 @@ public void TransactionAggregate_CompleteTransaction_TransactionAlreadyCompleted [InlineData(TransactionType.Sale)] public void TransactionAggregate_RecordAdditionalRequestData_RequestDataRecorded(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -722,7 +722,7 @@ public void TransactionAggregate_RecordAdditionalRequestData_TransactionNotStart [InlineData(TransactionType.Sale)] public void TransactionAggregate_RecordAdditionalRequestData_AdditionalRequestDataAlreadyRecorded_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -739,7 +739,7 @@ public void TransactionAggregate_RecordAdditionalRequestData_AdditionalRequestDa [InlineData(TransactionType.Sale)] public void TransactionAggregate_RecordAdditionalRequestData_AlreadyAuthorised_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -763,7 +763,7 @@ public void TransactionAggregate_RecordAdditionalRequestData_AlreadyAuthorised_E [InlineData(TransactionType.Sale)] public void TransactionAggregate_RecordAdditionalRequestData_AlreadyDeclined_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -787,7 +787,7 @@ public void TransactionAggregate_RecordAdditionalRequestData_AlreadyDeclined_Err [InlineData(TransactionType.Sale)] public void TransactionAggregate_RecordAdditionalRequestData_AlreadyCompleted_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -815,7 +815,7 @@ public void TransactionAggregate_RecordAdditionalRequestData_AlreadyCompleted_Er [InlineData(TransactionType.Sale)] public void TransactionAggregate_RecordAdditionalResponseData_ResponseDataRecorded(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -848,7 +848,7 @@ public void TransactionAggregate_RecordAdditionalResponseData_TransactionNotStar [InlineData(TransactionType.Sale)] public void TransactionAggregate_RecordAdditionalResponseData_AdditionalResponseDataAlreadyRecorded_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -873,7 +873,7 @@ public void TransactionAggregate_RecordAdditionalResponseData_AdditionalResponse [InlineData(TransactionType.Sale)] public void TransactionAggregate_RecordAdditionalResponseData_AlreadyCompleted_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); if (transactionType != TransactionType.Logon){ transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); } @@ -897,7 +897,7 @@ public void TransactionAggregate_RecordAdditionalResponseData_AlreadyCompleted_E [Fact] public void TransactionAggregate_RequestEmailReceipt_CustomerEmailReceiptHasBeenRequested(){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.RecordAdditionalRequestData(TestData.OperatorId, TestData.AdditionalTransactionMetaDataForMobileTopup()); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -914,7 +914,7 @@ public void TransactionAggregate_RequestEmailReceipt_CustomerEmailReceiptHasBeen [Fact] public void TransactionAggregate_RequestEmailReceipt_TransactionNotCompleted_ErrorThrown(){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.RecordAdditionalRequestData(TestData.OperatorId, TestData.AdditionalTransactionMetaDataForMobileTopup()); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -928,7 +928,7 @@ public void TransactionAggregate_RequestEmailReceipt_TransactionNotCompleted_Err [Fact] public void TransactionAggregate_RequestEmailReceipt_EmailReceiptAlreadyRequested_ErrorThrown(){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.RecordAdditionalRequestData(TestData.OperatorId, TestData.AdditionalTransactionMetaDataForMobileTopup()); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -945,7 +945,7 @@ public void TransactionAggregate_RequestEmailReceipt_EmailReceiptAlreadyRequeste [Fact] public void TransactionAggregate_RequestEmailReceiptResend_CustomerEmailReceiptHasBeenRequested(){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.RecordAdditionalRequestData(TestData.OperatorId, TestData.AdditionalTransactionMetaDataForMobileTopup()); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -962,7 +962,7 @@ public void TransactionAggregate_RequestEmailReceiptResend_CustomerEmailReceiptH [Fact] public void TransactionAggregate_RequestEmailReceiptResend_ReceiptNotSent_ErrorThrown(){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.RecordAdditionalRequestData(TestData.OperatorId, TestData.AdditionalTransactionMetaDataForMobileTopup()); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -977,7 +977,7 @@ public void TransactionAggregate_RequestEmailReceiptResend_ReceiptNotSent_ErrorT [InlineData(TransactionType.Sale, FeeType.ServiceProvider)] public void TransactionAggregate_AddFee_FeeDetailsAdded(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1004,7 +1004,7 @@ public void TransactionAggregate_AddFee_FeeDetailsAdded(TransactionType transact [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddFee_NullFee_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1020,7 +1020,7 @@ public void TransactionAggregate_AddFee_NullFee_ErrorThrown(TransactionType tran [InlineData(TransactionType.Sale, FeeType.Merchant)] public void TransactionAggregate_AddFee_TransactionNotAuthorised_ErrorThrown(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.DeclineTransaction(TestData.OperatorId, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.ResponseCode, TestData.ResponseMessage); @@ -1047,7 +1047,7 @@ private CalculatedFee GetCalculatedFeeToAdd(FeeType feeType){ [InlineData(TransactionType.Sale, FeeType.ServiceProvider)] public void TransactionAggregate_AddFee_TransactionNotCompleted_ErrorThrown(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1061,7 +1061,7 @@ public void TransactionAggregate_AddFee_TransactionNotCompleted_ErrorThrown(Tran [InlineData(TransactionType.Sale, FeeType.ServiceProvider)] public void TransactionAggregate_AddFee_FeeAlreadyAdded_NoErrorThrown(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1078,7 +1078,7 @@ public void TransactionAggregate_AddFee_FeeAlreadyAdded_NoErrorThrown(Transactio [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddFee_UnsupportedFeeType_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1094,7 +1094,7 @@ public void TransactionAggregate_AddFee_UnsupportedFeeType_ErrorThrown(Transacti [InlineData(FeeType.Merchant)] public void TransactionAggregate_AddFee_LogonTransaction_ErrorThrown(FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); transactionAggregate.CompleteTransaction(); @@ -1108,7 +1108,7 @@ public void TransactionAggregate_AddFee_LogonTransaction_ErrorThrown(FeeType fee [InlineData(TransactionType.Sale, FeeType.Merchant)] public void TransactionAggregate_AddSettledFee_FeeDetailsAdded(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1135,7 +1135,7 @@ public void TransactionAggregate_AddSettledFee_FeeDetailsAdded(TransactionType t [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddSettledFee_NullFee_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1150,7 +1150,7 @@ public void TransactionAggregate_AddSettledFee_NullFee_ErrorThrown(TransactionTy [InlineData(TransactionType.Sale, FeeType.Merchant)] public void TransactionAggregate_AddSettledFee_TransactionNotAuthorised_ErrorThrown(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.DeclineTransaction(TestData.OperatorId, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.ResponseCode, TestData.ResponseMessage); @@ -1165,7 +1165,7 @@ public void TransactionAggregate_AddSettledFee_TransactionNotAuthorised_ErrorThr [InlineData(TransactionType.Sale, FeeType.Merchant)] public void TransactionAggregate_AddSettledFee_TransactionNotCompleted_ErrorThrown(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1179,7 +1179,7 @@ public void TransactionAggregate_AddSettledFee_TransactionNotCompleted_ErrorThro [InlineData(TransactionType.Sale, FeeType.Merchant)] public void TransactionAggregate_AddSettledFee_FeeNotAlreadyAdded_NoErrorThrown(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1198,7 +1198,7 @@ public void TransactionAggregate_AddSettledFee_FeeNotAlreadyAdded_NoErrorThrown( [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddSettledFee_UnsupportedFeeType_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1215,7 +1215,7 @@ public void TransactionAggregate_AddSettledFee_UnsupportedFeeType_ErrorThrown(Tr [InlineData(FeeType.Merchant)] public void TransactionAggregate_AddSettledFee_LogonTransaction_ErrorThrown(FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); transactionAggregate.CompleteTransaction(); @@ -1229,7 +1229,7 @@ public void TransactionAggregate_AddSettledFee_LogonTransaction_ErrorThrown(FeeT [InlineData(TransactionType.Sale, FeeType.Merchant)] public void TransactionAggregate_AddFeePendingSettlement_FeeDetailsAdded(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1256,7 +1256,7 @@ public void TransactionAggregate_AddFeePendingSettlement_FeeDetailsAdded(Transac [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddFeePendingSettlement_NullFee_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1272,7 +1272,7 @@ public void TransactionAggregate_AddFeePendingSettlement_NullFee_ErrorThrown(Tra [InlineData(TransactionType.Sale, FeeType.Merchant)] public void TransactionAggregate_AddFeePendingSettlement_TransactionNotAuthorised_ErrorThrown(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.DeclineTransaction(TestData.OperatorId, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.ResponseCode, TestData.ResponseMessage); @@ -1288,7 +1288,7 @@ public void TransactionAggregate_AddFeePendingSettlement_TransactionNotAuthorise [InlineData(TransactionType.Sale, FeeType.ServiceProvider)] public void TransactionAggregate_AddFeePendingSettlement_TransactionNotCompleted_ErrorThrown(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1302,7 +1302,7 @@ public void TransactionAggregate_AddFeePendingSettlement_TransactionNotCompleted [InlineData(TransactionType.Sale, FeeType.Merchant)] public void TransactionAggregate_AddFeePendingSettlement_FeeAlreadyAdded_NoErrorThrown(TransactionType transactionType, FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1318,7 +1318,7 @@ public void TransactionAggregate_AddFeePendingSettlement_FeeAlreadyAdded_NoError [InlineData(TransactionType.Sale)] public void TransactionAggregate_AddFeePendingSettlement_UnsupportedFeeType_ErrorThrown(TransactionType transactionType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, transactionType, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.OperatorAuthorisationCode, TestData.OperatorResponseCode, TestData.OperatorResponseMessage, TestData.OperatorTransactionId, TestData.ResponseCode, TestData.ResponseMessage); @@ -1334,7 +1334,7 @@ public void TransactionAggregate_AddFeePendingSettlement_UnsupportedFeeType_Erro [InlineData(FeeType.Merchant)] public void TransactionAggregate_AddFeePendingSettlement_LogonTransaction_ErrorThrown(FeeType feeType){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); transactionAggregate.CompleteTransaction(); @@ -1358,7 +1358,7 @@ public void TransactionAggregate_AddFeePendingSettlement_LogonTransaction_ErrorT public void TransactionAggregate_RecordCostPrice_SaleTransaction_CostPriceRecorded(Decimal unitCost, Decimal totalCost, Decimal? expectedUnitCost, Decimal? expectedTotalCost, Boolean expectedCostsCalculated) { Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); Result result = transactionAggregate.RecordCostPrice(unitCost, totalCost); result.IsSuccess.ShouldBeTrue(); @@ -1371,7 +1371,7 @@ public void TransactionAggregate_RecordCostPrice_SaleTransaction_CostPriceRecord [Fact] public void TransactionAggregate_RecordCostPrice_SaleTransaction_CostAlreadyRecorded(){ Aggregates.TransactionAggregate transactionAggregate = Aggregates.TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.RecordCostPrice(TestData.UnitCostPrice, TestData.TotalCostPrice); diff --git a/TransactionProcessor.Aggregates.Tests/VoucherAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/VoucherAggregateTests.cs index 7089b9fd..d792122a 100644 --- a/TransactionProcessor.Aggregates.Tests/VoucherAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/VoucherAggregateTests.cs @@ -207,7 +207,7 @@ public void VoucherAggregate_Redeem_VoucherIsRedeemed() Aggregates.VoucherAggregate aggregate = Aggregates.VoucherAggregate.Create(TestData.VoucherId); aggregate.Generate(TestData.OperatorId, TestData.EstateId, TestData.TransactionId, TestData.GeneratedDateTime, TestData.Value); aggregate.Issue(TestData.RecipientEmail, TestData.RecipientMobile, TestData.IssuedDateTime); - aggregate.Redeem(TestData.RedeemedDateTime); + aggregate.Redeem(TestData.RedeemedDateTime, TestData.HostDateTime); var voucher = aggregate.GetVoucher(); voucher.IsRedeemed.ShouldBeTrue(); @@ -218,7 +218,7 @@ public void VoucherAggregate_Redeem_VoucherNotGenerated_ErrorThrown() { Aggregates.VoucherAggregate aggregate = Aggregates.VoucherAggregate.Create(TestData.VoucherId); - Result result = aggregate.Redeem(TestData.RedeemedDateTime); + Result result = aggregate.Redeem(TestData.RedeemedDateTime, TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -229,7 +229,7 @@ public void VoucherAggregate_Redeem_VoucherNotIssued_ErrorThrown() Aggregates.VoucherAggregate aggregate = Aggregates.VoucherAggregate.Create(TestData.VoucherId); aggregate.Generate(TestData.OperatorId, TestData.EstateId, TestData.TransactionId, TestData.GeneratedDateTime, TestData.Value); - Result result = aggregate.Redeem(TestData.RedeemedDateTime); + Result result = aggregate.Redeem(TestData.RedeemedDateTime, TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } @@ -240,9 +240,9 @@ public void VoucherAggregate_Redeem_VoucherAlreadyRedeemed_ErrorThrown() Aggregates.VoucherAggregate aggregate = Aggregates.VoucherAggregate.Create(TestData.VoucherId); aggregate.Generate(TestData.OperatorId, TestData.EstateId, TestData.TransactionId, TestData.GeneratedDateTime, TestData.Value); aggregate.Issue(TestData.RecipientEmail, TestData.RecipientMobile, TestData.IssuedDateTime); - aggregate.Redeem(TestData.RedeemedDateTime); + aggregate.Redeem(TestData.RedeemedDateTime, TestData.HostDateTime); - Result result = aggregate.Redeem(TestData.RedeemedDateTime); + Result result = aggregate.Redeem(TestData.RedeemedDateTime, TestData.HostDateTime); result.IsFailed.ShouldBeTrue(); result.Status.ShouldBe(ResultStatus.Invalid); } diff --git a/TransactionProcessor.Aggregates/FloatAggregate.cs b/TransactionProcessor.Aggregates/FloatAggregate.cs index 6b68fb02..c556577e 100644 --- a/TransactionProcessor.Aggregates/FloatAggregate.cs +++ b/TransactionProcessor.Aggregates/FloatAggregate.cs @@ -47,7 +47,7 @@ public static Result CreateFloat(this FloatAggregate aggregate, return Result.Success(); } - public static Result RecordCreditPurchase(this FloatAggregate aggregate, DateTimeOffset creditPurchasedDate, Decimal amount, Decimal costPrice) + public static Result RecordCreditPurchase(this FloatAggregate aggregate, DateTimeOffset creditPurchasedDate, Decimal amount, Decimal costPrice, DateTimeOffset hostDateTime) { Result result = aggregate.ValidateFloatIsAlreadyCreated(); if (result.IsFailed) { @@ -59,7 +59,7 @@ public static Result RecordCreditPurchase(this FloatAggregate aggregate, DateTim } FloatDomainEvents.FloatCreditPurchasedEvent floatCreditPurchasedEvent = new(aggregate.AggregateId, aggregate.EstateId, - creditPurchasedDate, amount, costPrice); + creditPurchasedDate, amount, costPrice, hostDateTime); aggregate.ApplyAndAppend(floatCreditPurchasedEvent); diff --git a/TransactionProcessor.Aggregates/MerchantAggregate.cs b/TransactionProcessor.Aggregates/MerchantAggregate.cs index 95f5c518..f445ff15 100644 --- a/TransactionProcessor.Aggregates/MerchantAggregate.cs +++ b/TransactionProcessor.Aggregates/MerchantAggregate.cs @@ -449,7 +449,7 @@ static DateTimeOffset CalculateNextSettlementDate(this MerchantAggregate aggrega DateTimeOffset dateForCalculation = aggregate.NextSettlementDueDate; if (dateForCalculation == DateTimeOffset.MinValue) { // No date set previously so use current date as start point - dateForCalculation = DateTime.Now.Date; + dateForCalculation = DateTimeOffset.UtcNow.Date; } if (settlementSchedule == SettlementSchedule.Weekly) { @@ -488,7 +488,7 @@ public static Result SetSettlementSchedule(this MerchantAggregate aggregate, public static Result Create(this MerchantAggregate aggregate, Guid estateId, String merchantName, - DateTime dateCreated, + DateTimeOffset dateCreated, TransactionProcessor.Models.Merchant.Address address, TransactionProcessor.Models.Merchant.Contact contact, SettlementSchedule settlementSchedule) { diff --git a/TransactionProcessor.Aggregates/MerchantDepositListAggregate.cs b/TransactionProcessor.Aggregates/MerchantDepositListAggregate.cs index 4c41925e..1a32f5b0 100644 --- a/TransactionProcessor.Aggregates/MerchantDepositListAggregate.cs +++ b/TransactionProcessor.Aggregates/MerchantDepositListAggregate.cs @@ -63,7 +63,8 @@ public static Result MakeDeposit(this MerchantDepositListAggregate aggregate, MerchantDepositSource source, String reference, DateTimeOffset depositDateTime, - PositiveMoney amount){ + PositiveMoney amount, + DateTimeOffset hostDateTime) { String depositData = $"{depositDateTime:yyyyMMdd hh:mm:ss.fff}-{reference}-{amount:N2}-{source}"; Guid depositId = aggregate.GenerateGuidFromString(depositData); @@ -80,22 +81,23 @@ public static Result MakeDeposit(this MerchantDepositListAggregate aggregate, return result; if (source == MerchantDepositSource.Manual){ - MerchantDomainEvents.ManualDepositMadeEvent manualDepositMadeEvent = new(aggregate.AggregateId, aggregate.EstateId, depositId, reference, depositDateTime, amount.Value); + MerchantDomainEvents.ManualDepositMadeEvent manualDepositMadeEvent = new(aggregate.AggregateId, aggregate.EstateId, depositId, reference, depositDateTime, amount.Value, hostDateTime); aggregate.ApplyAndAppend(manualDepositMadeEvent); return Result.Success(); } - else if (source == MerchantDepositSource.Automatic){ - MerchantDomainEvents.AutomaticDepositMadeEvent automaticDepositMadeEvent = new(aggregate.AggregateId, aggregate.EstateId, depositId, reference, depositDateTime, amount.Value); + + if (source == MerchantDepositSource.Automatic){ + MerchantDomainEvents.AutomaticDepositMadeEvent automaticDepositMadeEvent = new(aggregate.AggregateId, aggregate.EstateId, depositId, reference, depositDateTime, amount.Value, hostDateTime); aggregate.ApplyAndAppend(automaticDepositMadeEvent); return Result.Success(); } - + return Result.Invalid("Invalid Deposit Source"); } public static Result MakeWithdrawal(this MerchantDepositListAggregate aggregate, DateTimeOffset withdrawalDateTime, - PositiveMoney amount){ + PositiveMoney amount, DateTimeOffset hostDateTime){ String depositData = $"{withdrawalDateTime.ToString("yyyyMMdd hh:mm:ss.fff")}-{amount:N2}"; Guid withdrawalId = aggregate.GenerateGuidFromString(depositData); @@ -106,7 +108,8 @@ public static Result MakeWithdrawal(this MerchantDepositListAggregate aggregate, if (result.IsFailed) return result; - MerchantDomainEvents.WithdrawalMadeEvent withdrawalMadeEvent = new(aggregate.AggregateId, aggregate.EstateId, withdrawalId, withdrawalDateTime, amount.Value); + MerchantDomainEvents.WithdrawalMadeEvent withdrawalMadeEvent = new(aggregate.AggregateId, aggregate.EstateId, withdrawalId, withdrawalDateTime, amount.Value, + hostDateTime); aggregate.ApplyAndAppend(withdrawalMadeEvent); return Result.Success(); diff --git a/TransactionProcessor.Aggregates/ReconciliationAggregate.cs b/TransactionProcessor.Aggregates/ReconciliationAggregate.cs index b9196baa..2c01e957 100644 --- a/TransactionProcessor.Aggregates/ReconciliationAggregate.cs +++ b/TransactionProcessor.Aggregates/ReconciliationAggregate.cs @@ -52,7 +52,8 @@ private static Result CheckReconciliationNotAlreadyCompleted(this Reconciliation public static Result StartReconciliation(this ReconciliationAggregate aggregate, DateTimeOffset transactionDateTime, Guid estateId, - Guid merchantId) { + Guid merchantId, + DateTimeOffset hostDateTime) { if (estateId == Guid.Empty) return Result.Invalid($"Estate Id must not be [{Guid.Empty}]"); if (merchantId == Guid.Empty) @@ -64,7 +65,7 @@ public static Result StartReconciliation(this ReconciliationAggregate aggregate, return Result.Success(); } - ReconciliationDomainEvents.ReconciliationHasStartedEvent reconciliationHasStartedEvent = new(aggregate.AggregateId, estateId, merchantId, transactionDateTime); + ReconciliationDomainEvents.ReconciliationHasStartedEvent reconciliationHasStartedEvent = new(aggregate.AggregateId, estateId, merchantId, transactionDateTime, hostDateTime); aggregate.ApplyAndAppend(reconciliationHasStartedEvent); diff --git a/TransactionProcessor.Aggregates/SettlementAggregate.cs b/TransactionProcessor.Aggregates/SettlementAggregate.cs index b5d40b60..3586d5f0 100644 --- a/TransactionProcessor.Aggregates/SettlementAggregate.cs +++ b/TransactionProcessor.Aggregates/SettlementAggregate.cs @@ -111,7 +111,7 @@ public static Result ImmediatelyMarkFeeAsSettled(this SettlementAggregate aggreg return Result.Success(); } - SettlementDomainEvents.MerchantFeeSettledEvent merchantFeeSettledEvent = CreateMerchantFeeSettledEvent(aggregate, pendingFee,DateTime.Now); + SettlementDomainEvents.MerchantFeeSettledEvent merchantFeeSettledEvent = CreateMerchantFeeSettledEvent(aggregate, pendingFee, DateTimeOffset.UtcNow); aggregate.ApplyAndAppend(merchantFeeSettledEvent); diff --git a/TransactionProcessor.Aggregates/TransactionAggregate.cs b/TransactionProcessor.Aggregates/TransactionAggregate.cs index aa59c367..1484b2ba 100644 --- a/TransactionProcessor.Aggregates/TransactionAggregate.cs +++ b/TransactionProcessor.Aggregates/TransactionAggregate.cs @@ -501,6 +501,7 @@ public static Result RequestEmailReceiptResend(this TransactionAggregate aggrega public static Result StartTransaction(this TransactionAggregate aggregate, DateTimeOffset transactionDateTime, + DateTimeOffset hostDateTime, String transactionNumber, TransactionType transactionType, String transactionReference, @@ -527,7 +528,8 @@ public static Result StartTransaction(this TransactionAggregate aggregate, transactionType.ToString(), transactionReference, transactionStartContext.DeviceIdentifier, - transactionAmount); + transactionAmount, + hostDateTime); aggregate.ApplyAndAppend(transactionHasStartedEvent); diff --git a/TransactionProcessor.Aggregates/VoucherAggregate.cs b/TransactionProcessor.Aggregates/VoucherAggregate.cs index 70991197..4088bb86 100644 --- a/TransactionProcessor.Aggregates/VoucherAggregate.cs +++ b/TransactionProcessor.Aggregates/VoucherAggregate.cs @@ -108,7 +108,7 @@ public static Result Issue(this VoucherAggregate aggregate, return Result.Success(); } - public static Result Redeem(this VoucherAggregate aggregate, DateTimeOffset redeemedDateTime) + public static Result Redeem(this VoucherAggregate aggregate, DateTimeOffset redeemedDateTime, DateTimeOffset hostDateTime) { Result result = aggregate.CheckIfVoucherHasBeenGenerated(); if (result.IsFailed) @@ -120,7 +120,7 @@ public static Result Redeem(this VoucherAggregate aggregate, DateTimeOffset rede if (result.IsFailed) return result; - VoucherDomainEvents.VoucherFullyRedeemedEvent voucherFullyRedeemedEvent = new(aggregate.AggregateId, aggregate.EstateId, redeemedDateTime); + VoucherDomainEvents.VoucherFullyRedeemedEvent voucherFullyRedeemedEvent = new(aggregate.AggregateId, aggregate.EstateId, redeemedDateTime, hostDateTime); aggregate.ApplyAndAppend(voucherFullyRedeemedEvent); diff --git a/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/TransactionDomainEventHandlerTests.cs b/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/TransactionDomainEventHandlerTests.cs index 44ea6132..0f07d33f 100644 --- a/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/TransactionDomainEventHandlerTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/TransactionDomainEventHandlerTests.cs @@ -57,7 +57,7 @@ public TransactionDomainEventHandlerTests(ITestOutputHelper testOutputHelper) : [InlineData(typeof(TransactionDomainEvents.CustomerEmailReceiptResendRequestedEvent))] public async Task TransactionDomainEventHandler_EventPassedIn_EventIsHandled(Type eventType) { DomainEvent domainEvent = eventType.Name switch { - nameof(FloatDomainEvents.FloatCreditPurchasedEvent) => new FloatDomainEvents.FloatCreditPurchasedEvent(TestData.FloatAggregateId, TestData.EstateId, TestData.CreditPurchasedDateTime, TestData.FloatCreditAmount, TestData.FloatCreditCostPrice), + nameof(FloatDomainEvents.FloatCreditPurchasedEvent) => new FloatDomainEvents.FloatCreditPurchasedEvent(TestData.FloatAggregateId, TestData.EstateId, TestData.CreditPurchasedDateTime, TestData.FloatCreditAmount, TestData.FloatCreditCostPrice, TestData.HostDateTime), nameof(TransactionDomainEvents.TransactionCostInformationRecordedEvent) => TestData.TransactionCostInformationRecordedEvent, nameof(TransactionDomainEvents.TransactionHasBeenCompletedEvent) => TestData.DomainEvents.TransactionHasBeenCompletedEvent, nameof(TransactionDomainEvents.MerchantFeePendingSettlementAddedToTransactionEvent) => new TransactionDomainEvents.MerchantFeePendingSettlementAddedToTransactionEvent(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.CalculatedFeeValue, 0, TestData.TransactionFeeId, TestData.TransactionFeeValue, TestData.TransactionFeeCalculateDateTime, TestData.TransactionFeeSettlementDueDate, TestData.TransactionDateTime), diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyVoucherDomainService.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyVoucherDomainService.cs index 3b920b43..701bcd2b 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyVoucherDomainService.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyVoucherDomainService.cs @@ -17,9 +17,7 @@ public async Task> IssueVoucher(VoucherCommands.Iss return Result.Success(new IssueVoucherResponse()); } - public async Task> RedeemVoucher(Guid estateId, - String voucherCode, - DateTimeOffset redeemedDateTime, + public async Task> RedeemVoucher(VoucherCommands.RedeemVoucherCommand command, CancellationToken cancellationToken) { return Result.Success(new RedeemVoucherResponse()); } diff --git a/TransactionProcessor.BusinessLogic.Tests/RequestHandler/VoucherManagementRequestHandlerTests.cs b/TransactionProcessor.BusinessLogic.Tests/RequestHandler/VoucherManagementRequestHandlerTests.cs index b13cd588..396e9707 100644 --- a/TransactionProcessor.BusinessLogic.Tests/RequestHandler/VoucherManagementRequestHandlerTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/RequestHandler/VoucherManagementRequestHandlerTests.cs @@ -41,7 +41,7 @@ public async Task VoucherManagementRequestHandler_RedeemVoucherRequest_IsHandled { IVoucherDomainServiceImposter voucherDomainService = new(); IVoucherManagementManagerImposter voucherManagementManager = new(); - voucherDomainService.RedeemVoucher(Arg.Any(), Arg.Any(), Arg.Any(), + voucherDomainService.RedeemVoucher(Arg.Any(), Arg.Any()).ReturnsAsync(TestData.RedeemVoucherResponse); VoucherManagementRequestHandler handler = new VoucherManagementRequestHandler(voucherDomainService.Instance(), voucherManagementManager.Instance()); diff --git a/TransactionProcessor.BusinessLogic.Tests/Services/FloatDomainServiceTests.cs b/TransactionProcessor.BusinessLogic.Tests/Services/FloatDomainServiceTests.cs index 5468cdc2..e205bfdd 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Services/FloatDomainServiceTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Services/FloatDomainServiceTests.cs @@ -88,8 +88,7 @@ public async Task FloatDomainService_RecordCreditPurchase_PurchaseRecorded(){ this.AggregateService.Save(Arg.Any(), Arg.Any()).ReturnsAsync(Result.Success()); FloatCommands.RecordCreditPurchaseForFloatCommand command = new FloatCommands.RecordCreditPurchaseForFloatCommand(TestData.EstateId, - TestData.FloatAggregateId, TestData.FloatCreditAmount, TestData.FloatCreditCostPrice, - TestData.CreditPurchasedDateTime); + TestData.RecordFloatCreditPurchaseRequest); Result result = await this.FloatDomainService.RecordCreditPurchase(command, TestContext.Current.CancellationToken); result.IsSuccess.ShouldBeTrue(); } @@ -103,8 +102,7 @@ public async Task FloatDomainService_RecordCreditPurchase_SaveFailed() this.AggregateService.Save(Arg.Any(), Arg.Any()).ReturnsAsync(Result.Failure()); FloatCommands.RecordCreditPurchaseForFloatCommand command = new FloatCommands.RecordCreditPurchaseForFloatCommand(TestData.EstateId, - TestData.FloatAggregateId, TestData.FloatCreditAmount, TestData.FloatCreditCostPrice, - TestData.CreditPurchasedDateTime); + TestData.RecordFloatCreditPurchaseRequest); Result result = await this.FloatDomainService.RecordCreditPurchase(command, TestContext.Current.CancellationToken); result.IsFailed.ShouldBeTrue(); } @@ -118,8 +116,7 @@ public async Task FloatDomainService_RecordCreditPurchase_ExceptionThrown() this.AggregateService.Save(Arg.Any(), Arg.Any()).ThrowsAsync(new Exception()); FloatCommands.RecordCreditPurchaseForFloatCommand command = new FloatCommands.RecordCreditPurchaseForFloatCommand(TestData.EstateId, - TestData.FloatAggregateId, TestData.FloatCreditAmount, TestData.FloatCreditCostPrice, - TestData.CreditPurchasedDateTime); + TestData.RecordFloatCreditPurchaseRequest); Result result = await this.FloatDomainService.RecordCreditPurchase(command, TestContext.Current.CancellationToken); result.IsFailed.ShouldBeTrue(); } @@ -204,8 +201,7 @@ public async Task FloatDomainService_RecordCreditPurchase_GetFloatFailed() this.AggregateService.GetLatest(Arg.Any(), Arg.Any()).ReturnsAsync(Result.Failure()); FloatCommands.RecordCreditPurchaseForFloatCommand command = new FloatCommands.RecordCreditPurchaseForFloatCommand(TestData.EstateId, - TestData.FloatAggregateId, TestData.FloatCreditAmount, TestData.FloatCreditCostPrice, - TestData.CreditPurchasedDateTime); + TestData.RecordFloatCreditPurchaseRequest); Result result = await this.FloatDomainService.RecordCreditPurchase(command, TestContext.Current.CancellationToken); result.IsFailed.ShouldBeTrue(); } diff --git a/TransactionProcessor.BusinessLogic.Tests/Services/TransactionDomainServiceTests.cs b/TransactionProcessor.BusinessLogic.Tests/Services/TransactionDomainServiceTests.cs index d8301512..a7446cd5 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Services/TransactionDomainServiceTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Services/TransactionDomainServiceTests.cs @@ -176,7 +176,8 @@ public async Task TransactionDomainService_ProcessReconciliationTransaction_Reco TransactionCommands.ProcessReconciliationCommand command = new(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.DeviceIdentifier, TestData.TransactionDateTime, - TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); + TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue, + TestData.HostDateTime); var result = await this.TransactionDomainService.ProcessReconciliationTransaction(command, TestContext.Current.CancellationToken); result.IsSuccess.ShouldBeTrue(); @@ -204,7 +205,8 @@ public async Task TransactionDomainService_ProcessReconciliationTransaction_Vali TransactionCommands.ProcessReconciliationCommand command = new(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.DeviceIdentifier, TestData.TransactionDateTime, - TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); + TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue, + TestData.HostDateTime); var result = await this.TransactionDomainService.ProcessReconciliationTransaction(command, TestContext.Current.CancellationToken); result.IsSuccess.ShouldBeTrue(); @@ -491,7 +493,7 @@ public async Task TransactionDomainService_ResendTransactionReceipt_TransactionR public async Task TransactionDomainService_RequireFeeCalculation_IsNotAuthorised_ReturnsFalse(){ TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.DeclineTransaction(TestData.OperatorId, "111", "SUCCESS", TransactionResponseCode.Success, "SUCCESS"); var result = TransactionHelpers.RequireFeeCalculation(transactionAggregate); @@ -502,7 +504,7 @@ public async Task TransactionDomainService_RequireFeeCalculation_IsNotAuthorised public async Task TransactionDomainService_RequireFeeCalculation_IsNotCompelted_ReturnsFalse() { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, "111", "111", "SUCCESS", "1234", TransactionResponseCode.Success, "SUCCESS"); var result = TransactionHelpers.RequireFeeCalculation(transactionAggregate); @@ -513,7 +515,7 @@ public async Task TransactionDomainService_RequireFeeCalculation_IsNotCompelted_ public async Task TransactionDomainService_RequireFeeCalculation_IsALogon_ReturnsFalse() { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Logon, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AuthoriseTransactionLocally("111", TransactionResponseCode.InvalidDeviceIdentifier, "SUCCESS"); transactionAggregate.CompleteTransaction(); @@ -526,7 +528,7 @@ public async Task TransactionDomainService_RequireFeeCalculation_IsALogon_Return public async Task TransactionDomainService_RequireFeeCalculation_NoContractId_ReturnsFalse() { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, "111", "111", "SUCCESS", "1234", TransactionResponseCode.Success, "SUCCESS"); transactionAggregate.CompleteTransaction(); @@ -539,7 +541,7 @@ public async Task TransactionDomainService_RequireFeeCalculation_NoContractId_Re public async Task TransactionDomainService_RequireFeeCalculation_NullAmount_ReturnsFalse() { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, null); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, null); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, "111", "111", "SUCCESS", "1234", TransactionResponseCode.Success, "SUCCESS"); transactionAggregate.CompleteTransaction(); @@ -553,7 +555,7 @@ public async Task TransactionDomainService_RequireFeeCalculation_NullAmount_Retu public async Task TransactionDomainService_RequireFeeCalculation_ReturnsTrue() { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TransactionType.Sale, TestData.TransactionReference, new TransactionStartContext { EstateId = TestData.EstateId, MerchantId = TestData.MerchantId, DeviceIdentifier = TestData.DeviceIdentifier }, TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, "111", "111", "SUCCESS", "1234", TransactionResponseCode.Success, "SUCCESS"); transactionAggregate.CompleteTransaction(); @@ -780,7 +782,8 @@ public async Task TransactionDomainService_ProcessReconciliationTransaction_GetA TransactionCommands.ProcessReconciliationCommand command = new(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.DeviceIdentifier, TestData.TransactionDateTime, - TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); + TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue, + TestData.HostDateTime); var result = await this.TransactionDomainService.ProcessReconciliationTransaction(command, TestContext.Current.CancellationToken); result.IsFailed.ShouldBeTrue(); @@ -799,7 +802,8 @@ public async Task TransactionDomainService_ProcessReconciliationTransaction_Save TransactionCommands.ProcessReconciliationCommand command = new(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.DeviceIdentifier, TestData.TransactionDateTime, - TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); + TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue, + TestData.HostDateTime); var result = await this.TransactionDomainService.ProcessReconciliationTransaction(command, TestContext.Current.CancellationToken); result.IsFailed.ShouldBeTrue(); diff --git a/TransactionProcessor.BusinessLogic.Tests/Services/VoucherDomainServiceTests.cs b/TransactionProcessor.BusinessLogic.Tests/Services/VoucherDomainServiceTests.cs index e7e5c66e..7590cb99 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Services/VoucherDomainServiceTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Services/VoucherDomainServiceTests.cs @@ -114,9 +114,7 @@ public async Task VoucherDomainService_RedeemVoucher_InvalidEstate_ErrorThrown() }); await this.Context.SaveChangesAsync(TestContext.Current.CancellationToken); - Result result = await this.VoucherDomainService.RedeemVoucher(TestData.EstateId, - TestData.VoucherCode, - TestData.RedeemedDateTime, + Result result = await this.VoucherDomainService.RedeemVoucher(TestData.Commands.RedeemVoucherCommand, TestContext.Current.CancellationToken); result.IsFailed.ShouldBeTrue(); } @@ -138,9 +136,7 @@ public async Task VoucherDomainService_RedeemVoucher_VoucherRedeemed() { }); await this.Context.SaveChangesAsync(TestContext.Current.CancellationToken); - Result result = await this.VoucherDomainService.RedeemVoucher(TestData.EstateId, - TestData.VoucherCode, - TestData.RedeemedDateTime, + Result result = await this.VoucherDomainService.RedeemVoucher(TestData.Commands.RedeemVoucherCommand, TestContext.Current.CancellationToken); result.IsSuccess.ShouldBeTrue(); @@ -153,9 +149,7 @@ public async Task VoucherDomainService_RedeemVoucher_VoucherNotFound_ErrorThrown .ReturnsAsync(Result.Success(TestData.GetVoucherAggregateWithRecipientMobile())); this.AggregateService.Get(Arg.Any(), Arg.Any()).ReturnsAsync(Result.Success(TestData.Aggregates.CreatedEstateAggregate())); - Result result = await this.VoucherDomainService.RedeemVoucher(TestData.EstateId, - TestData.VoucherCode, - TestData.RedeemedDateTime, + Result result = await this.VoucherDomainService.RedeemVoucher(TestData.Commands.RedeemVoucherCommand, TestContext.Current.CancellationToken); result.IsFailed.ShouldBeTrue(); } @@ -194,9 +188,7 @@ public async Task VoucherDomainService_RedeemVoucher_GetVoucherAggregateFailed_E }); await this.Context.SaveChangesAsync(TestContext.Current.CancellationToken); - Result result = await this.VoucherDomainService.RedeemVoucher(TestData.EstateId, - TestData.VoucherCode, - TestData.RedeemedDateTime, + Result result = await this.VoucherDomainService.RedeemVoucher(TestData.Commands.RedeemVoucherCommand, TestContext.Current.CancellationToken); result.IsFailed.ShouldBeTrue(); } @@ -216,9 +208,7 @@ public async Task VoucherDomainService_RedeemVoucher_SaveFailed_ErrorThrown() { }); await this.Context.SaveChangesAsync(TestContext.Current.CancellationToken); - Result result = await this.VoucherDomainService.RedeemVoucher(TestData.EstateId, - TestData.VoucherCode, - TestData.RedeemedDateTime, + Result result = await this.VoucherDomainService.RedeemVoucher(TestData.Commands.RedeemVoucherCommand, TestContext.Current.CancellationToken); result.IsFailed.ShouldBeTrue(); } diff --git a/TransactionProcessor.BusinessLogic/Common/TransactionHelpers.cs b/TransactionProcessor.BusinessLogic/Common/TransactionHelpers.cs index 8a5c72c3..2b970155 100644 --- a/TransactionProcessor.BusinessLogic/Common/TransactionHelpers.cs +++ b/TransactionProcessor.BusinessLogic/Common/TransactionHelpers.cs @@ -16,7 +16,7 @@ public static String GenerateTransactionReference() i *= (b + 1); } - return $"{i - DateTime.Now.Ticks:x}"; + return $"{i - DateTimeOffset.UtcNow.Ticks:x}"; } [ExcludeFromCodeCoverage] diff --git a/TransactionProcessor.BusinessLogic/EventHandling/MerchantDomainEventHandler.cs b/TransactionProcessor.BusinessLogic/EventHandling/MerchantDomainEventHandler.cs index fc37fa98..0a2dd2ff 100644 --- a/TransactionProcessor.BusinessLogic/EventHandling/MerchantDomainEventHandler.cs +++ b/TransactionProcessor.BusinessLogic/EventHandling/MerchantDomainEventHandler.cs @@ -67,7 +67,7 @@ private async Task HandleSpecificDomainEvent(CallbackReceivedEnrichedEve // We now need to deserialise the message from the callback CallbackHandler.DataTransferObjects.Deposit callbackMessage = StringSerialiser.Deserialise(domainEvent.CallbackMessage); - MerchantCommands.MakeMerchantDepositCommand command = new(domainEvent.EstateId, result.Data.MerchantId, DataTransferObjects.Requests.Merchant.MerchantDepositSource.Automatic, new MakeMerchantDepositRequest { DepositDateTime = callbackMessage.DateTime, Reference = callbackMessage.Reference, Amount = callbackMessage.Amount, }); + MerchantCommands.MakeMerchantDepositCommand command = new(domainEvent.EstateId, result.Data.MerchantId, DataTransferObjects.Requests.Merchant.MerchantDepositSource.Automatic, new MakeMerchantDepositRequest { DepositDateTime = callbackMessage.DateTime, Reference = callbackMessage.Reference, Amount = callbackMessage.Amount,HostDateTime = DateTimeOffset.UtcNow }); return await this.Mediator.Send(command, cancellationToken); } diff --git a/TransactionProcessor.BusinessLogic/Manager/FeeCalculationManager.cs b/TransactionProcessor.BusinessLogic/Manager/FeeCalculationManager.cs index 690286c7..a46a36b1 100644 --- a/TransactionProcessor.BusinessLogic/Manager/FeeCalculationManager.cs +++ b/TransactionProcessor.BusinessLogic/Manager/FeeCalculationManager.cs @@ -39,7 +39,7 @@ public List CalculateFees(List feeList FeeCalculationType = transactionFeeToCalculate.CalculationType, FeeId = transactionFeeToCalculate.FeeId, FeeValue = transactionFeeToCalculate.Value, - FeeCalculatedDateTime = calculationDateTime == DateTime.MinValue ? DateTime.Now : calculationDateTime + FeeCalculatedDateTime = calculationDateTime == DateTimeOffset.MinValue ? DateTimeOffset.UtcNow : calculationDateTime }); } else if (transactionFeeToCalculate.CalculationType == CalculationType.Fixed) @@ -52,7 +52,7 @@ public List CalculateFees(List feeList FeeCalculationType = transactionFeeToCalculate.CalculationType, FeeId = transactionFeeToCalculate.FeeId, FeeValue = transactionFeeToCalculate.Value, - FeeCalculatedDateTime = calculationDateTime == DateTime.MinValue ? DateTime.Now : calculationDateTime + FeeCalculatedDateTime = calculationDateTime == DateTimeOffset.MinValue ? DateTimeOffset.UtcNow : calculationDateTime }); } } diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/VoucherManagement/VoucherManagementProxy.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/VoucherManagement/VoucherManagementProxy.cs index 21f93306..0487be7f 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/VoucherManagement/VoucherManagementProxy.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/VoucherManagement/VoucherManagementProxy.cs @@ -61,7 +61,7 @@ public async Task> ProcessSaleMessage(Guid transactionI operatorId, merchant.EstateId, transactionId, - DateTime.Now, + DateTimeOffset.UtcNow, amountAsDecimal, recipientEmail, recipientMobile); diff --git a/TransactionProcessor.BusinessLogic/RequestHandlers/VoucherManagementRequestHandler.cs b/TransactionProcessor.BusinessLogic/RequestHandlers/VoucherManagementRequestHandler.cs index 47b4f263..70cf7703 100644 --- a/TransactionProcessor.BusinessLogic/RequestHandlers/VoucherManagementRequestHandler.cs +++ b/TransactionProcessor.BusinessLogic/RequestHandlers/VoucherManagementRequestHandler.cs @@ -68,7 +68,7 @@ public async Task> Handle(VoucherCommands.IssueVouc public async Task> Handle(VoucherCommands.RedeemVoucherCommand command, CancellationToken cancellationToken) { - return await this.VoucherDomainService.RedeemVoucher(command.EstateId, command.VoucherCode, command.RedeemedDateTime, cancellationToken); + return await this.VoucherDomainService.RedeemVoucher(command, cancellationToken); } #endregion diff --git a/TransactionProcessor.BusinessLogic/Requests/FloatCommands.cs b/TransactionProcessor.BusinessLogic/Requests/FloatCommands.cs index d8cc7022..ee691a91 100644 --- a/TransactionProcessor.BusinessLogic/Requests/FloatCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/FloatCommands.cs @@ -1,7 +1,8 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using MediatR; +using MediatR; using SimpleResults; +using System; +using System.Diagnostics.CodeAnalysis; +using TransactionProcessor.DataTransferObjects.Requests.Float; namespace TransactionProcessor.BusinessLogic.Requests; @@ -12,8 +13,5 @@ public record CreateFloatCommand(Guid EstateId, DateTimeOffset CreateDateTime) : IRequest; public record RecordCreditPurchaseForFloatCommand(Guid EstateId, - Guid FloatId, - Decimal CreditAmount, - Decimal CostPrice, - DateTimeOffset PurchaseDateTime) : IRequest; + RecordFloatCreditPurchaseRequest RecordFloatCreditPurchaseRequest) : IRequest; } \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic/Requests/TransactionCommands.cs b/TransactionProcessor.BusinessLogic/Requests/TransactionCommands.cs index 190bfbd8..b8e201f3 100644 --- a/TransactionProcessor.BusinessLogic/Requests/TransactionCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/TransactionCommands.cs @@ -17,7 +17,7 @@ public record ProcessLogonTransactionCommand(Guid TransactionId, String TransactionType, DateTimeOffset TransactionDateTime, String TransactionNumber, - DateTimeOffset TransactionReceivedDateTime) + DateTimeOffset HostDateTime) : IRequest>; public record ProcessReconciliationCommand(Guid TransactionId, @@ -26,7 +26,8 @@ public record ProcessReconciliationCommand(Guid TransactionId, String DeviceIdentifier, DateTimeOffset TransactionDateTime, Int32 TransactionCount, - Decimal TransactionValue) + Decimal TransactionValue, + DateTimeOffset HostDateTime) : IRequest>; public record ProcessSaleTransactionCommand(Guid TransactionId, @@ -42,7 +43,7 @@ public record ProcessSaleTransactionCommand(Guid TransactionId, Guid ContractId, Guid ProductId, Int32 TransactionSource, - DateTimeOffset TransactionReceivedDateTime) + DateTimeOffset HostDateTime) : IRequest>; public record ResendTransactionReceiptCommand(Guid TransactionId, Guid EstateId) : IRequest; diff --git a/TransactionProcessor.BusinessLogic/Requests/VoucherCommands.cs b/TransactionProcessor.BusinessLogic/Requests/VoucherCommands.cs index f3dcb7a1..536c2e10 100644 --- a/TransactionProcessor.BusinessLogic/Requests/VoucherCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/VoucherCommands.cs @@ -1,7 +1,8 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using MediatR; +using MediatR; using SimpleResults; +using System; +using System.Diagnostics.CodeAnalysis; +using TransactionProcessor.DataTransferObjects.Requests.Voucher; using TransactionProcessor.Models; namespace TransactionProcessor.BusinessLogic.Requests; @@ -17,6 +18,6 @@ public record IssueVoucherCommand(Guid VoucherId, String RecipientEmail, String RecipientMobile) : IRequest>; - public record RedeemVoucherCommand(Guid EstateId, String VoucherCode, DateTimeOffset RedeemedDateTime) + public record RedeemVoucherCommand(Guid EstateId, String VoucherCode, RedeemVoucherRequest RedeemVoucherRequest) : IRequest>; } \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic/Services/FloatDomainService.cs b/TransactionProcessor.BusinessLogic/Services/FloatDomainService.cs index be1b50aa..f4c39de7 100644 --- a/TransactionProcessor.BusinessLogic/Services/FloatDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/FloatDomainService.cs @@ -107,13 +107,14 @@ public async Task RecordCreditPurchase(FloatCommands.RecordCreditPurchas try { - Result getFloatResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.GetLatest(command.FloatId, ct), command.FloatId, cancellationToken); + Result getFloatResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.GetLatest(command.RecordFloatCreditPurchaseRequest.FloatId, ct), command.RecordFloatCreditPurchaseRequest.FloatId, cancellationToken); if (getFloatResult.IsFailed) return ResultHelpers.CreateFailure(getFloatResult); FloatAggregate floatAggregate = getFloatResult.Data; - Result stateResult = floatAggregate.RecordCreditPurchase(command.PurchaseDateTime, command.CreditAmount, command.CostPrice); + Result stateResult = floatAggregate.RecordCreditPurchase(command.RecordFloatCreditPurchaseRequest.PurchaseDateTime, command.RecordFloatCreditPurchaseRequest.CreditAmount, command.RecordFloatCreditPurchaseRequest.CostPrice, + command.RecordFloatCreditPurchaseRequest.HostDateTime); if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); diff --git a/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs b/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs index 3ab325fc..f992efaa 100644 --- a/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs @@ -227,7 +227,7 @@ public async Task CreateMerchant(MerchantCommands.CreateMerchantCommand // Set the settlement schedule SettlementSchedule settlementSchedule = ConvertSettlementSchedule(command.RequestDto.SettlementSchedule); - var stateResult = merchantAggregate.Create(command.EstateId, command.RequestDto.Name, command.RequestDto.CreatedDateTime.GetValueOrDefault(DateTime.Now), + var stateResult = merchantAggregate.Create(command.EstateId, command.RequestDto.Name, command.RequestDto.CreatedDateTime.GetValueOrDefault(DateTimeOffset.UtcNow), address, contact, settlementSchedule); if (stateResult.IsFailed) return stateResult; @@ -333,7 +333,7 @@ public async Task MakeMerchantDeposit(MerchantCommands.MakeMerchantDepos PositiveMoney amount = PositiveMoney.Create(Money.Create(command.RequestDto.Amount)); MerchantDepositSource depositSource = this.ConvertDepositSource(command.DepositSource); - Result stateResult = depositListResult.Data.MakeDeposit(depositSource, command.RequestDto.Reference, command.RequestDto.DepositDateTime, amount); + Result stateResult = depositListResult.Data.MakeDeposit(depositSource, command.RequestDto.Reference, command.RequestDto.DepositDateTime, amount, command.RequestDto.HostDateTime); if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); @@ -367,7 +367,7 @@ public async Task MakeMerchantWithdrawal(MerchantCommands.MakeMerchantWi PositiveMoney amount = PositiveMoney.Create(Money.Create(command.RequestDto.Amount)); MerchantDepositListAggregate merchantDepositListAggregate = getDepositListResult.Data; - Result stateResult = merchantDepositListAggregate.MakeWithdrawal(command.RequestDto.WithdrawalDateTime, amount); + Result stateResult = merchantDepositListAggregate.MakeWithdrawal(command.RequestDto.WithdrawalDateTime, amount, command.RequestDto.HostDateTime); if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); diff --git a/TransactionProcessor.BusinessLogic/Services/MerchantStatementDomainService.cs b/TransactionProcessor.BusinessLogic/Services/MerchantStatementDomainService.cs index 03a2222e..d25b45df 100644 --- a/TransactionProcessor.BusinessLogic/Services/MerchantStatementDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/MerchantStatementDomainService.cs @@ -152,7 +152,7 @@ public async Task GenerateStatement(MerchantCommands.GenerateMerchantSta return ResultHelpers.CreateFailure(result); } - Result stateResult = merchantStatementAggregate.GenerateStatement(DateTime.Now); + Result stateResult = merchantStatementAggregate.GenerateStatement(DateTimeOffset.UtcNow); if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); @@ -192,7 +192,7 @@ public async Task EmailStatement(MerchantStatementCommands.EmailMerchant await this.MessagingServiceClient.SendEmail(this.TokenResponse.AccessToken, sendEmailRequest, cancellationToken); - Result stateResult = merchantStatementAggregate.EmailStatement(DateTime.Now, messageId); + Result stateResult = merchantStatementAggregate.EmailStatement(DateTimeOffset.UtcNow, messageId); if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); @@ -216,7 +216,7 @@ public async Task EmailStatement(MerchantStatementCommands.EmailMerchant Guid messageId = IdGenerationService.GenerateEventId(new { command.MerchantStatementId, - DateTime.Now + DateTimeOffset.UtcNow }); SendEmailRequest sendEmailRequest = new SendEmailRequest diff --git a/TransactionProcessor.BusinessLogic/Services/SettlementDomainService.cs b/TransactionProcessor.BusinessLogic/Services/SettlementDomainService.cs index 9a4371ef..b5fa0c38 100644 --- a/TransactionProcessor.BusinessLogic/Services/SettlementDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/SettlementDomainService.cs @@ -79,7 +79,7 @@ private async Task> ProcessSettlementInternal(SettlementCommands.Pr CancellationToken cancellationToken) { Result settlementSaveResult = Result.Success(); if (merchantAggregate.SettlementSchedule == SettlementSchedule.Immediate) { - settlementAggregate.StartProcessing(DateTime.Now); + settlementAggregate.StartProcessing(DateTimeOffset.UtcNow); settlementAggregate.ManuallyComplete(); settlementSaveResult = await this.AggregateService.Save(settlementAggregate, cancellationToken); } @@ -87,7 +87,7 @@ private async Task> ProcessSettlementInternal(SettlementCommands.Pr List<(Guid transactionId, Guid merchantId, CalculatedFee calculatedFee)> feesToBeSettled = settlementAggregate.GetFeesToBeSettled(); if (feesToBeSettled.Any()) { - Result stateResult = settlementAggregate.StartProcessing(DateTime.Now); + Result stateResult = settlementAggregate.StartProcessing(DateTimeOffset.UtcNow); if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); diff --git a/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs b/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs index f95bc871..dee4c1e0 100644 --- a/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/TransactionDomainService.cs @@ -101,7 +101,7 @@ public async Task> ProcessLogonTransacti // Generate a transaction reference String transactionReference = TransactionHelpers.GenerateTransactionReference(); - Result stateResult = transactionAggregate.StartTransaction(command.TransactionDateTime, command.TransactionNumber, transactionType, transactionReference, new TransactionStartContext { EstateId = command.EstateId, MerchantId = command.MerchantId, DeviceIdentifier = command.DeviceIdentifier, TransactionSource = TransactionSource.NotSet }, null); // Logon transaction has no amount + Result stateResult = transactionAggregate.StartTransaction(command.TransactionDateTime, command.HostDateTime, command.TransactionNumber, transactionType, transactionReference, new TransactionStartContext { EstateId = command.EstateId, MerchantId = command.MerchantId, DeviceIdentifier = command.DeviceIdentifier, TransactionSource = TransactionSource.NotSet }, null); // Logon transaction has no amount if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); @@ -115,7 +115,7 @@ public async Task> ProcessLogonTransacti if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); - stateResult = transactionAggregate.RecordTransactionTimings(command.TransactionReceivedDateTime, null, null, DateTime.Now); + stateResult = transactionAggregate.RecordTransactionTimings(command.HostDateTime, null, null, DateTimeOffset.UtcNow); if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); @@ -567,9 +567,9 @@ public async Task> ProcessSaleTransaction if (startResult.IsFailed) return ResultHelpers.CreateFailure(startResult); - (DateTime? Start, DateTime? End) operatorTiming = await HandleOperatorProcessing(transactionAggregate, command, validationResult, cancellationToken); + (DateTimeOffset? Start, DateTimeOffset? End) operatorTiming = await HandleOperatorProcessing(transactionAggregate, command, validationResult, cancellationToken); - transactionAggregate.RecordTransactionTimings(command.TransactionReceivedDateTime, operatorTiming.Start, operatorTiming.End, DateTime.Now); + transactionAggregate.RecordTransactionTimings(command.HostDateTime, operatorTiming.Start, operatorTiming.End, DateTimeOffset.UtcNow); transactionAggregate.CompleteTransaction(); @@ -657,7 +657,7 @@ private Result StartTransaction(TransactionAggregate transactionAggregate, String transactionReference = TransactionHelpers.GenerateTransactionReference(); Decimal? amount = command.AdditionalTransactionMetadata.ExtractFieldFromMetadata("Amount"); - Result result = transactionAggregate.StartTransaction(command.TransactionDateTime, command.TransactionNumber, transactionType, transactionReference, new TransactionStartContext { EstateId = command.EstateId, MerchantId = command.MerchantId, DeviceIdentifier = command.DeviceIdentifier, + Result result = transactionAggregate.StartTransaction(command.TransactionDateTime, command.HostDateTime, command.TransactionNumber, transactionType, transactionReference, new TransactionStartContext { EstateId = command.EstateId, MerchantId = command.MerchantId, DeviceIdentifier = command.DeviceIdentifier, TransactionSource = transactionSourceValue}, amount); if (result.IsFailed) @@ -675,7 +675,7 @@ private Result StartTransaction(TransactionAggregate transactionAggregate, private Result ProcessReconciliation(ReconciliationAggregate reconciliationAggregate, TransactionCommands.ProcessReconciliationCommand command, Result validationResult) { - Result result = reconciliationAggregate.StartReconciliation(command.TransactionDateTime, command.EstateId, command.MerchantId); + Result result = reconciliationAggregate.StartReconciliation(command.TransactionDateTime, command.EstateId, command.MerchantId, command.HostDateTime); if (result.IsFailed) return result; @@ -699,11 +699,11 @@ private static Result ApplyReconciliationValidationResult(ReconciliationAggregat return reconciliationAggregate.Decline(validationResult.Data.ResponseCode, validationResult.Data.ResponseMessage); } - private async Task<(DateTime? Start, DateTime? End)> HandleOperatorProcessing(TransactionAggregate transactionAggregate, + private async Task<(DateTimeOffset? Start, DateTimeOffset? End)> HandleOperatorProcessing(TransactionAggregate transactionAggregate, TransactionCommands.ProcessSaleTransactionCommand command, Result validationResult, CancellationToken cancellationToken) { - DateTime? start = null, end = null; + DateTimeOffset? start = null, end = null; if (validationResult.Data.ResponseCode != TransactionResponseCode.Success) { Logger.LogInformation("Validation failed for TransactionId {TransactionId} with ResponseCode {ResponseCode}: {ResponseMessage}", @@ -720,9 +720,9 @@ private static Result ApplyReconciliationValidationResult(ReconciliationAggregat if (merchantResult.IsFailed) return (start, end); - start = DateTime.Now; + start = DateTimeOffset.UtcNow; Result operatorResult = await ProcessMessageWithOperator(merchantResult.Data, command.TransactionId, command.TransactionDateTime, command.OperatorId, command.AdditionalTransactionMetadata, TransactionHelpers.GenerateTransactionReference(), cancellationToken); - end = DateTime.Now; + end = DateTimeOffset.UtcNow; if (operatorResult.IsSuccess) { Logger.LogInformation("Operator {OperatorId} authorised transaction {TransactionId} successfully", command.OperatorId, command.TransactionId); diff --git a/TransactionProcessor.BusinessLogic/Services/VoucherDomainService.cs b/TransactionProcessor.BusinessLogic/Services/VoucherDomainService.cs index 440b829a..d2f04a5b 100644 --- a/TransactionProcessor.BusinessLogic/Services/VoucherDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/VoucherDomainService.cs @@ -27,9 +27,7 @@ public interface IVoucherDomainService Task> IssueVoucher(VoucherCommands.IssueVoucherCommand command, CancellationToken cancellationToken); - Task> RedeemVoucher(Guid estateId, - String voucherCode, - DateTimeOffset redeemedDateTime, + Task> RedeemVoucher(VoucherCommands.RedeemVoucherCommand command, CancellationToken cancellationToken); #endregion @@ -100,25 +98,25 @@ public async Task> IssueVoucher(VoucherCommands.Iss } } - public async Task> RedeemVoucher(Guid estateId, - String voucherCode, - DateTimeOffset redeemedDateTime, + public async Task> RedeemVoucher(VoucherCommands.RedeemVoucherCommand command, CancellationToken cancellationToken) { try { + DateTimeOffset redeemedDateTime = command.RedeemVoucherRequest.RedeemedDateTime.HasValue ? command.RedeemVoucherRequest.RedeemedDateTime.Value : DateTimeOffset.UtcNow; + // Find the voucher based on the voucher code - using ResolvedDbContext? resolvedContext = this.Resolver.Resolve(EstateManagementDatabaseName, estateId.ToString()); + using ResolvedDbContext? resolvedContext = this.Resolver.Resolve(EstateManagementDatabaseName, command.EstateId.ToString()); await using EstateManagementContext context = resolvedContext.Context; - TransactionProcessor.Database.Entities.VoucherProjectionState voucher = await context.VoucherProjectionStates.SingleOrDefaultAsync(v => v.VoucherCode == voucherCode, cancellationToken); + TransactionProcessor.Database.Entities.VoucherProjectionState voucher = await context.VoucherProjectionStates.SingleOrDefaultAsync(v => v.VoucherCode == command.VoucherCode, cancellationToken); if (voucher == null) { - return Result.NotFound($"No voucher found with voucher code [{voucherCode}]"); + return Result.NotFound($"No voucher found with voucher code [{command.VoucherCode}]"); } - Result validateResult = await this.ValidateVoucherRedemption(estateId, cancellationToken); + Result validateResult = await this.ValidateVoucherRedemption(command.EstateId, cancellationToken); if (validateResult.IsFailed) return ResultHelpers.CreateFailure(validateResult); @@ -129,7 +127,7 @@ public async Task> RedeemVoucher(Guid estateId, VoucherAggregate voucherAggregate = voucherResult.Data; // Redeem the voucher - Result stateResult = voucherAggregate.Redeem(redeemedDateTime); + Result stateResult = voucherAggregate.Redeem(redeemedDateTime, command.RedeemVoucherRequest.HostDateTime); if (stateResult.IsFailed) return ResultHelpers.CreateFailure(stateResult); diff --git a/TransactionProcessor.DataTransferObjects/Requests/Float/RecordFloatCreditPurchaseRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Float/RecordFloatCreditPurchaseRequest.cs index a64d5fd4..5e4b1e95 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Float/RecordFloatCreditPurchaseRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Float/RecordFloatCreditPurchaseRequest.cs @@ -3,10 +3,10 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Float; /// -/// Float credit amount, cost price, and purchase timestamp. +/// Host timestamp, float credit amount, cost price, and purchase timestamp. /// -/// {"floatId":"00000000-0000-0000-0000-000000000166","purchaseDateTime":"2026-01-15T10:30:00Z","creditAmount":42.5,"costPrice":42.5} -public class RecordFloatCreditPurchaseRequest { +/// {"hostDateTime":"2026-01-15T10:30:00Z","floatId":"00000000-0000-0000-0000-000000000166","purchaseDateTime":"2026-01-15T10:30:00Z","creditAmount":42.5,"costPrice":42.5} +public class RecordFloatCreditPurchaseRequest : RequestWithHostDateTime { /// /// Identifier of the float. /// diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/CreateMerchantRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/CreateMerchantRequest.cs index 53a3eeff..54fa0c76 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/CreateMerchantRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/CreateMerchantRequest.cs @@ -38,6 +38,6 @@ public class CreateMerchantRequest /// /// Optional merchant creation timestamp. /// - public DateTime? CreatedDateTime { get; set; } + public DateTimeOffset? CreatedDateTime { get; set; } } } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantDepositRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantDepositRequest.cs index bd2e6200..ed85aaec 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantDepositRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantDepositRequest.cs @@ -4,11 +4,11 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant { /// - /// Deposit amount, effective date and time, and reference. + /// Host timestamp, deposit amount, effective date and time, and reference. /// - /// {"amount":42.5,"depositDateTime":"2026-01-15T10:30:00Z","reference":"REF-2026-001"} + /// {"hostDateTime":"2026-01-15T10:30:00Z","amount":42.5,"depositDateTime":"2026-01-15T10:30:00Z","reference":"REF-2026-001"} [ExcludeFromCodeCoverage] - public class MakeMerchantDepositRequest { + public class MakeMerchantDepositRequest : RequestWithHostDateTime { /// /// Monetary amount of the deposit or withdrawal. diff --git a/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantWithdrawalRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantWithdrawalRequest.cs index c0d4d24a..14ec1027 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantWithdrawalRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Merchant/MakeMerchantWithdrawalRequest.cs @@ -4,11 +4,11 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Merchant { /// - /// Withdrawal amount, effective date and time, and reference. + /// Host timestamp, withdrawal amount, effective date and time, and reference. /// - /// {"amount":42.5,"withdrawalDateTime":"2026-01-15T10:30:00Z","reference":"REF-2026-001"} + /// {"hostDateTime":"2026-01-15T10:30:00Z","amount":42.5,"withdrawalDateTime":"2026-01-15T10:30:00Z","reference":"REF-2026-001"} [ExcludeFromCodeCoverage] - public class MakeMerchantWithdrawalRequest { + public class MakeMerchantWithdrawalRequest : RequestWithHostDateTime { /// /// Monetary amount of the deposit or withdrawal. /// diff --git a/TransactionProcessor.DataTransferObjects/Requests/RequestWithHostDateTime.cs b/TransactionProcessor.DataTransferObjects/Requests/RequestWithHostDateTime.cs index 591eeeb7..5cf5857b 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/RequestWithHostDateTime.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/RequestWithHostDateTime.cs @@ -1,9 +1,13 @@ using System; -using System.Collections.Generic; -using System.Text; namespace TransactionProcessor.DataTransferObjects.Requests; +/// +/// Base request fields shared by requests that include the host timestamp. +/// public class RequestWithHostDateTime { - public DateTimeOffset HostDateTime { get; set; } + /// + /// Date and time on the host when the request was created or sent. + /// + public DateTimeOffset HostDateTime { get; set; } = DateTimeOffset.UtcNow; } diff --git a/TransactionProcessor.DataTransferObjects/Requests/Transaction/LogonTransactionRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Transaction/LogonTransactionRequest.cs index d2de249c..87ac7c11 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Transaction/LogonTransactionRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Transaction/LogonTransactionRequest.cs @@ -4,9 +4,9 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Transaction using System.Diagnostics.CodeAnalysis; /// - /// Terminal logon message fields, including the shared transaction identity and timestamp. + /// Terminal logon message fields, including the host timestamp and shared transaction identity and timestamp. /// - /// {"estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example","deviceIdentifier":"EXAMPLE-001","transactionNumber":"EXAMPLE-001"} + /// {"hostDateTime":"2026-01-15T10:30:00Z","estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example","deviceIdentifier":"EXAMPLE-001","transactionNumber":"EXAMPLE-001"} [ExcludeFromCodeCoverage] public class LogonTransactionRequest : TransactionRequest { diff --git a/TransactionProcessor.DataTransferObjects/Requests/Transaction/ReconciliationRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Transaction/ReconciliationRequest.cs index 80e5503d..99831e64 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Transaction/ReconciliationRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Transaction/ReconciliationRequest.cs @@ -4,9 +4,9 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Transaction { using System.Diagnostics.CodeAnalysis; /// - /// Terminal transaction totals and optional per-operator/per-contract breakdown. + /// Terminal transaction totals, host timestamp, and optional per-operator/per-contract breakdown. /// - /// {"estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example","deviceIdentifier":"EXAMPLE-001","operatorTotals":[{"contractId":"00000000-0000-0000-0000-000000000239","operatorId":"00000000-0000-0000-0000-000000000253","transactionCount":1,"transactionValue":42.5}],"transactionCount":1,"transactionValue":42.5} + /// {"hostDateTime":"2026-01-15T10:30:00Z","estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example","deviceIdentifier":"EXAMPLE-001","operatorTotals":[{"contractId":"00000000-0000-0000-0000-000000000239","operatorId":"00000000-0000-0000-0000-000000000253","transactionCount":1,"transactionValue":42.5}],"transactionCount":1,"transactionValue":42.5} [ExcludeFromCodeCoverage] public class ReconciliationRequest : TransactionRequest { diff --git a/TransactionProcessor.DataTransferObjects/Requests/Transaction/SaleTransactionRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Transaction/SaleTransactionRequest.cs index cc1f5d0a..b8cd1dd9 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Transaction/SaleTransactionRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Transaction/SaleTransactionRequest.cs @@ -5,9 +5,9 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Transaction using System.Diagnostics.CodeAnalysis; /// - /// Sale details including merchant, device, operator, contract, product, and optional metadata. + /// Sale details including host timestamp, merchant, device, operator, contract, product, and optional metadata. /// - /// {"estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example","contractId":"00000000-0000-0000-0000-000000000239","customerEmailAddress":"customer@example.com","deviceIdentifier":"EXAMPLE-001","operatorId":"00000000-0000-0000-0000-000000000253","productId":"00000000-0000-0000-0000-000000000146","transactionNumber":"EXAMPLE-001","transactionSource":1,"additionalTransactionMetadata":{"channel":"terminal"}} + /// {"hostDateTime":"2026-01-15T10:30:00Z","estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example","contractId":"00000000-0000-0000-0000-000000000239","customerEmailAddress":"customer@example.com","deviceIdentifier":"EXAMPLE-001","operatorId":"00000000-0000-0000-0000-000000000253","productId":"00000000-0000-0000-0000-000000000146","transactionNumber":"EXAMPLE-001","transactionSource":1,"additionalTransactionMetadata":{"channel":"terminal"}} [ExcludeFromCodeCoverage] public class SaleTransactionRequest : TransactionRequest { diff --git a/TransactionProcessor.DataTransferObjects/Requests/Transaction/TransactionRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Transaction/TransactionRequest.cs index 9c2f1a5d..3db9fc53 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Transaction/TransactionRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Transaction/TransactionRequest.cs @@ -4,13 +4,11 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Transaction; /// -/// Shared estate, merchant, transaction timestamp, and transaction type fields. +/// Shared host, estate, merchant, transaction timestamp, and transaction type fields. /// -/// {"estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example"} +/// {"hostDateTime":"2026-01-15T10:30:00Z","estateId":"00000000-0000-0000-0000-000000000023","merchantId":"00000000-0000-0000-0000-000000000227","transactionDateTime":"2026-01-15T10:30:00Z","transactionType":"example"} [ExcludeFromCodeCoverage] -public class TransactionRequest - -{ +public class TransactionRequest : RequestWithHostDateTime { /// /// Estate that owns or scopes this operation. /// diff --git a/TransactionProcessor.DataTransferObjects/Requests/Voucher/IssueVoucherRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Voucher/IssueVoucherRequest.cs deleted file mode 100644 index 35a10165..00000000 --- a/TransactionProcessor.DataTransferObjects/Requests/Voucher/IssueVoucherRequest.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace TransactionProcessor.DataTransferObjects.Requests.Voucher -{ - using System; - /// Data transfer object for IssueVoucherRequest. - /// {"operatorIdentifier":"EXAMPLE-001","estateId":"00000000-0000-0000-0000-000000000023","transactionId":"00000000-0000-0000-0000-000000000057","value":42.5,"recipientEmail":"customer@example.com","recipientMobile":"+15550100","issuedDateTime":"2026-01-15T10:30:00Z"} - - public class IssueVoucherRequest - { - /// The operator identifier. - public String OperatorIdentifier { get; set; } - - /// The estate id. - public Guid EstateId { get; set; } - - /// The transaction id. - public Guid TransactionId { get; set; } - - /// The value. - public Decimal Value { get; set; } - - /// The recipient email. - public String RecipientEmail { get; set; } - - /// The recipient mobile. - public String RecipientMobile { get; set; } - - /// The issued date time. - public DateTime? IssuedDateTime { get; set; } - } -} diff --git a/TransactionProcessor.DataTransferObjects/Requests/Voucher/RedeemVoucherRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/Voucher/RedeemVoucherRequest.cs index cafc737c..5e99f9c8 100644 --- a/TransactionProcessor.DataTransferObjects/Requests/Voucher/RedeemVoucherRequest.cs +++ b/TransactionProcessor.DataTransferObjects/Requests/Voucher/RedeemVoucherRequest.cs @@ -3,10 +3,10 @@ namespace TransactionProcessor.DataTransferObjects.Requests.Voucher using System; /// - /// Voucher code and estate to redeem, with an optional redemption timestamp. + /// Host timestamp, voucher code, and estate to redeem, with an optional redemption timestamp. /// - /// {"voucherCode":"VOUCHER-2026-001","estateId":"00000000-0000-0000-0000-000000000023","redeemedDateTime":"2026-01-15T10:30:00Z"} - public class RedeemVoucherRequest { + /// {"hostDateTime":"2026-01-15T10:30:00Z","voucherCode":"VOUCHER-2026-001","estateId":"00000000-0000-0000-0000-000000000023","redeemedDateTime":"2026-01-15T10:30:00Z"} + public class RedeemVoucherRequest : RequestWithHostDateTime { /// /// Code printed on or assigned to the voucher. /// diff --git a/TransactionProcessor.DatabaseTests/FloatEventTests.cs b/TransactionProcessor.DatabaseTests/FloatEventTests.cs index 1c578fc7..7350d8cd 100644 --- a/TransactionProcessor.DatabaseTests/FloatEventTests.cs +++ b/TransactionProcessor.DatabaseTests/FloatEventTests.cs @@ -50,7 +50,8 @@ public async Task CreateFloatActivity_CreditPurchaseIsAdded() TestData.EstateId, TestData.CreditPurchasedDateTime, TestData.FloatCreditAmount, - TestData.FloatCreditCostPrice); + TestData.FloatCreditCostPrice, + TestData.HostDateTime); Result result = await this.Repository.CreateFloatActivity(@event, TestContext.Current.CancellationToken); result.IsSuccess.ShouldBeTrue(); @@ -74,7 +75,8 @@ public async Task CreateFloatActivity_CreditPurchaseReplayHandled() TestData.EstateId, TestData.CreditPurchasedDateTime, TestData.FloatCreditAmount, - TestData.FloatCreditCostPrice); + TestData.FloatCreditCostPrice, + TestData.HostDateTime); Result result = await this.Repository.CreateFloatActivity(@event, TestContext.Current.CancellationToken); result.IsSuccess.ShouldBeTrue(); diff --git a/TransactionProcessor.DomainEvents/DateTimeOffsetSecondsConverter.cs b/TransactionProcessor.DomainEvents/DateTimeOffsetSecondsConverter.cs new file mode 100644 index 00000000..75e8f9d7 --- /dev/null +++ b/TransactionProcessor.DomainEvents/DateTimeOffsetSecondsConverter.cs @@ -0,0 +1,25 @@ +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace TransactionProcessor.DomainEvents; + +/// +/// Writes event timestamps with second precision while accepting standard ISO 8601 input. +/// +public sealed class DateTimeOffsetSecondsConverter : JsonConverter +{ + private const string Format = "yyyy-MM-dd'T'HH:mm:sszzz"; + + public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string value = reader.GetString() ?? throw new JsonException("Expected a date/time string."); + return DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind); + } + + public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) + { + string timestamp = value.ToString(Format, CultureInfo.InvariantCulture); + writer.WriteRawValue($"\"{timestamp}\""); + } +} diff --git a/TransactionProcessor.DomainEvents/FloatDomainEvents.cs b/TransactionProcessor.DomainEvents/FloatDomainEvents.cs index 3d75620e..333bc220 100644 --- a/TransactionProcessor.DomainEvents/FloatDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/FloatDomainEvents.cs @@ -7,6 +7,6 @@ namespace TransactionProcessor.DomainEvents; public class FloatDomainEvents { public record FloatCreatedEvent(Guid FloatId, Guid EstateId, DateTimeOffset CreatedDateTime) : DomainEvent(FloatId, Guid.NewGuid()); public record FloatCreatedForContractProductEvent(Guid FloatId, Guid EstateId, Guid ContractId, Guid ProductId, DateTimeOffset CreatedDateTime) : DomainEvent(FloatId, Guid.NewGuid()); - public record FloatCreditPurchasedEvent(Guid FloatId, Guid EstateId, DateTimeOffset CreditPurchasedDateTime, Decimal Amount, Decimal CostPrice) : DomainEvent(FloatId, Guid.NewGuid()); + public record FloatCreditPurchasedEvent(Guid FloatId, Guid EstateId, DateTimeOffset CreditPurchasedDateTime, Decimal Amount, Decimal CostPrice, [property: System.Text.Json.Serialization.JsonConverter(typeof(DateTimeOffsetSecondsConverter))] DateTimeOffset HostDateTime) : DomainEvent(FloatId, Guid.NewGuid()); public record FloatDecreasedByTransactionEvent(Guid FloatId, Guid EstateId, Guid TransactionId, Decimal Amount) : DomainEvent(FloatId, Guid.NewGuid()); } diff --git a/TransactionProcessor.DomainEvents/MerchantDomainEvents.cs b/TransactionProcessor.DomainEvents/MerchantDomainEvents.cs index 6dfbe690..9143dd1e 100644 --- a/TransactionProcessor.DomainEvents/MerchantDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/MerchantDomainEvents.cs @@ -6,11 +6,11 @@ namespace TransactionProcessor.DomainEvents { [ExcludeFromCodeCoverage] public class MerchantDomainEvents { public record AddressAddedEvent(Guid MerchantId, Guid EstateId, Guid AddressId, String AddressLine1, String AddressLine2, String AddressLine3, String AddressLine4, String Town, String Region, String PostalCode, String Country) : DomainEvent(MerchantId, Guid.NewGuid()); - public record AutomaticDepositMadeEvent(Guid MerchantId, Guid EstateId, Guid DepositId, String Reference, DateTimeOffset DepositDateTime, Decimal Amount) : DomainEvent(MerchantId, Guid.NewGuid()); + public record AutomaticDepositMadeEvent(Guid MerchantId, Guid EstateId, Guid DepositId, String Reference, DateTimeOffset DepositDateTime, Decimal Amount, [property: System.Text.Json.Serialization.JsonConverter(typeof(DateTimeOffsetSecondsConverter))] DateTimeOffset HostDateTime) : DomainEvent(MerchantId, Guid.NewGuid()); public record ContactAddedEvent(Guid MerchantId, Guid EstateId, Guid ContactId, String ContactName, String ContactPhoneNumber, String ContactEmailAddress) : DomainEvent(MerchantId, Guid.NewGuid()); public record DeviceAddedToMerchantEvent(Guid MerchantId, Guid EstateId, Guid DeviceId, String DeviceIdentifier) : DomainEvent(MerchantId, Guid.NewGuid()); public record DeviceSwappedForMerchantEvent(Guid MerchantId, Guid EstateId, Guid DeviceId, Guid OriginalDeviceId, String NewDeviceIdentifier) : DomainEvent(MerchantId, Guid.NewGuid()); - public record ManualDepositMadeEvent(Guid MerchantId, Guid EstateId, Guid DepositId, String Reference, DateTimeOffset DepositDateTime, Decimal Amount) : DomainEvent(MerchantId, Guid.NewGuid()); + public record ManualDepositMadeEvent(Guid MerchantId, Guid EstateId, Guid DepositId, String Reference, DateTimeOffset DepositDateTime, Decimal Amount, [property: System.Text.Json.Serialization.JsonConverter(typeof(DateTimeOffsetSecondsConverter))] DateTimeOffset HostDateTime) : DomainEvent(MerchantId, Guid.NewGuid()); public record MerchantCreatedEvent(Guid MerchantId, Guid EstateId, String MerchantName, DateTimeOffset DateCreated) : DomainEvent(MerchantId, Guid.NewGuid()); public record MerchantDepositListCreatedEvent(Guid MerchantId, Guid EstateId, DateTimeOffset DateCreated) : DomainEvent(MerchantId, Guid.NewGuid()); public record MerchantReferenceAllocatedEvent(Guid MerchantId, Guid EstateId, String MerchantReference) : DomainEvent(MerchantId, Guid.NewGuid()); @@ -18,7 +18,7 @@ public record OperatorAssignedToMerchantEvent(Guid MerchantId, Guid EstateId, Gu public record OperatorRemovedFromMerchantEvent(Guid MerchantId, Guid EstateId, Guid OperatorId) : DomainEvent(MerchantId, Guid.NewGuid()); public record SecurityUserAddedToMerchantEvent(Guid MerchantId, Guid EstateId, Guid SecurityUserId, String EmailAddress) : DomainEvent(MerchantId, Guid.NewGuid()); public record SettlementScheduleChangedEvent(Guid MerchantId, Guid EstateId, Int32 SettlementSchedule, DateTimeOffset NextSettlementDate) : DomainEvent(MerchantId, Guid.NewGuid()); - public record WithdrawalMadeEvent(Guid MerchantId, Guid EstateId, Guid WithdrawalId, DateTimeOffset WithdrawalDateTime, Decimal Amount) : DomainEvent(MerchantId, Guid.NewGuid()); + public record WithdrawalMadeEvent(Guid MerchantId, Guid EstateId, Guid WithdrawalId, DateTimeOffset WithdrawalDateTime, Decimal Amount, [property: System.Text.Json.Serialization.JsonConverter(typeof(DateTimeOffsetSecondsConverter))] DateTimeOffset HostDateTime) : DomainEvent(MerchantId, Guid.NewGuid()); public record ContractAddedToMerchantEvent(Guid MerchantId, Guid EstateId, Guid ContractId) : DomainEvent(MerchantId, Guid.NewGuid()); public record ContractRemovedFromMerchantEvent(Guid MerchantId, Guid EstateId, Guid ContractId) : DomainEvent(MerchantId, Guid.NewGuid()); public record ContractProductAddedToMerchantEvent(Guid MerchantId, Guid EstateId, Guid ContractId, Guid ContractProductId) : DomainEvent(MerchantId, Guid.NewGuid()); diff --git a/TransactionProcessor.DomainEvents/ReconciliationDomainEvents.cs b/TransactionProcessor.DomainEvents/ReconciliationDomainEvents.cs index 00f80fbf..327fc4a5 100644 --- a/TransactionProcessor.DomainEvents/ReconciliationDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/ReconciliationDomainEvents.cs @@ -9,5 +9,5 @@ public record OverallTotalsRecordedEvent(Guid TransactionId, Guid EstateId, Guid public record ReconciliationHasBeenLocallyAuthorisedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); public record ReconciliationHasBeenLocallyDeclinedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); public record ReconciliationHasCompletedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record ReconciliationHasStartedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); -} \ No newline at end of file + public record ReconciliationHasStartedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionDateTime, [property: System.Text.Json.Serialization.JsonConverter(typeof(DateTimeOffsetSecondsConverter))] DateTimeOffset HostDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); +} diff --git a/TransactionProcessor.DomainEvents/TransactionDomainEvents.cs b/TransactionProcessor.DomainEvents/TransactionDomainEvents.cs index 69e28706..1ec43603 100644 --- a/TransactionProcessor.DomainEvents/TransactionDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/TransactionDomainEvents.cs @@ -19,8 +19,8 @@ public record TransactionDeclinedByOperatorEvent(Guid TransactionId, Guid Estate public record TransactionHasBeenCompletedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, Boolean IsAuthorised, DateTimeOffset CompletedDateTime, Decimal? TransactionAmount, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); public record TransactionHasBeenLocallyAuthorisedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String AuthorisationCode, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); public record TransactionHasBeenLocallyDeclinedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, String ResponseCode, String ResponseMessage, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); - public record TransactionHasStartedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionDateTime, String TransactionNumber, String TransactionType, String TransactionReference, String DeviceIdentifier, Decimal? TransactionAmount) : DomainEvent(TransactionId, Guid.NewGuid()); + public record TransactionHasStartedEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionDateTime, String TransactionNumber, String TransactionType, String TransactionReference, String DeviceIdentifier, Decimal? TransactionAmount, [property: System.Text.Json.Serialization.JsonConverter(typeof(DateTimeOffsetSecondsConverter))] DateTimeOffset HostDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); public record TransactionSourceAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, Int32 TransactionSource, DateTimeOffset TransactionDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); public record TransactionTimingsAddedToTransactionEvent(Guid TransactionId, Guid EstateId, Guid MerchantId, DateTimeOffset TransactionStartedDateTime, DateTimeOffset? OperatorCommunicationsStartedEvent, DateTimeOffset? OperatorCommunicationsCompletedEvent, DateTimeOffset TransactionCompletedDateTime) : DomainEvent(TransactionId, Guid.NewGuid()); -} \ No newline at end of file +} diff --git a/TransactionProcessor.DomainEvents/VoucherDomainEvents.cs b/TransactionProcessor.DomainEvents/VoucherDomainEvents.cs index 72f39d8b..9e9149e6 100644 --- a/TransactionProcessor.DomainEvents/VoucherDomainEvents.cs +++ b/TransactionProcessor.DomainEvents/VoucherDomainEvents.cs @@ -6,7 +6,7 @@ namespace TransactionProcessor.DomainEvents; [ExcludeFromCodeCoverage] public class VoucherDomainEvents { public record BarcodeAddedEvent(Guid VoucherId, Guid EstateId, String Barcode) : DomainEvent(VoucherId, Guid.NewGuid()); - public record VoucherFullyRedeemedEvent(Guid VoucherId, Guid EstateId, DateTimeOffset RedeemedDateTime) : DomainEvent(VoucherId, Guid.NewGuid()); + public record VoucherFullyRedeemedEvent(Guid VoucherId, Guid EstateId, DateTimeOffset RedeemedDateTime, [property: System.Text.Json.Serialization.JsonConverter(typeof(DateTimeOffsetSecondsConverter))] DateTimeOffset HostDateTime) : DomainEvent(VoucherId, Guid.NewGuid()); public record VoucherGeneratedEvent(Guid VoucherId, Guid EstateId, Guid TransactionId, DateTimeOffset GeneratedDateTime, Guid OperatorId, Decimal Value, String VoucherCode, DateTimeOffset ExpiryDateTime, String Message) : DomainEvent(VoucherId, Guid.NewGuid()); public record VoucherIssuedEvent(Guid VoucherId, Guid EstateId, DateTimeOffset IssuedDateTime, String RecipientEmail, String RecipientMobile) : DomainEvent(VoucherId, Guid.NewGuid()); -} \ No newline at end of file +} diff --git a/TransactionProcessor.IntegrationTests/Common/TestingContext.cs b/TransactionProcessor.IntegrationTests/Common/TestingContext.cs index 8c85aed1..1147d4ad 100644 --- a/TransactionProcessor.IntegrationTests/Common/TestingContext.cs +++ b/TransactionProcessor.IntegrationTests/Common/TestingContext.cs @@ -12,7 +12,6 @@ namespace TransactionProcessor.IntegrationTests.Common { using global::Shared.Logger; using Reqnroll; using Shouldly; - using TransactionProcessor.DataTransferObjects.Requests.Voucher; using TransactionProcessor.DataTransferObjects.Responses.Transaction; using TransactionProcessor.DataTransferObjects.Responses.Voucher; using Retry = IntegrationTests.Retry; @@ -45,7 +44,6 @@ public TestingContext() { this.Estates = new List(); this.Clients = new List(); - this.Vouchers = new List<(IssueVoucherRequest request, IssueVoucherResponse response)>(); } #endregion @@ -186,13 +184,6 @@ public EstateDetails GetEstateDetails(Guid estateId) #endregion - private readonly List<(IssueVoucherRequest request, IssueVoucherResponse response)> Vouchers; - - public void AddVoucher((IssueVoucherRequest request, IssueVoucherResponse response) voucher) - { - this.Vouchers.Add(voucher); - } - public async Task GetVoucherByTransactionNumber(String estateName, String merchantName, Int32 transactionNumber) { EstateDetails estate = this.GetEstateDetails(estateName); Guid merchantId = estate.GetMerchantId(merchantName); diff --git a/TransactionProcessor.ProjectionEngine.Tests/MerchantBalanceProjectionTests.cs b/TransactionProcessor.ProjectionEngine.Tests/MerchantBalanceProjectionTests.cs index edc4e9c2..5e082831 100644 --- a/TransactionProcessor.ProjectionEngine.Tests/MerchantBalanceProjectionTests.cs +++ b/TransactionProcessor.ProjectionEngine.Tests/MerchantBalanceProjectionTests.cs @@ -256,7 +256,8 @@ public async Task MerchantBalanceProjection_Handle_AutomaticDepositMadeEvent_Sec TestData.AutomaticDepositMadeEvent.DepositId, TestData.AutomaticDepositMadeEvent.Reference, TestData.AutomaticDepositMadeEvent.DepositDateTime.AddDays(-1), - TestData.AutomaticDepositMadeEvent.Amount); + TestData.AutomaticDepositMadeEvent.Amount, + TestData.AutomaticDepositMadeEvent.HostDateTime); MerchantBalanceState newState = await projection.Handle(state, @event, CancellationToken.None); diff --git a/TransactionProcessor.ProjectionEngine.Tests/TestData.cs b/TransactionProcessor.ProjectionEngine.Tests/TestData.cs index 2dc772ee..6e58b7b8 100644 --- a/TransactionProcessor.ProjectionEngine.Tests/TestData.cs +++ b/TransactionProcessor.ProjectionEngine.Tests/TestData.cs @@ -13,6 +13,7 @@ public class TestData{ public static DateTime CreatedDateTime = new DateTime(2022, 10, 13, 1, 2, 3); public static DateTime ManualDepositDateTime = new DateTime(2022, 10, 13, 2, 2, 3); + public static DateTime HostDateTime = new DateTime(2022, 10, 13, 2, 2, 3); public static Guid ManualDepositId = Guid.Parse("7BDB5FD8-F944-4864-844E-EF12F7B16A4F"); @@ -139,7 +140,8 @@ public static TransactionDomainEvents.TransactionHasStartedEvent GetTransactionH type, TestData.TransactionReference, TestData.DeviceIdentifier, - amount); + amount, + TestData.HostDateTime); } public static MerchantDomainEvents.MerchantCreatedEvent MerchantCreatedEvent => @@ -148,22 +150,26 @@ public static TransactionDomainEvents.TransactionHasStartedEvent GetTransactionH public static MerchantDomainEvents.ManualDepositMadeEvent ManualDepositMadeEvent => new MerchantDomainEvents.ManualDepositMadeEvent(TestData.MerchantId, TestData.EstateId, TestData.ManualDepositId, TestData.ManualDepositReference, TestData.ManualDepositDateTime, - TestData.ManualDepositAmount); + TestData.ManualDepositAmount, + TestData.HostDateTime); public static MerchantDomainEvents.AutomaticDepositMadeEvent AutomaticDepositMadeEvent => new MerchantDomainEvents.AutomaticDepositMadeEvent(TestData.MerchantId, TestData.EstateId, TestData.AutomaticDepositId, TestData.AutomaticDepositReference, TestData.AutomaticDepositDateTime, - TestData.AutomaticDepositAmount); + TestData.AutomaticDepositAmount, + TestData.HostDateTime); public static MerchantDomainEvents.WithdrawalMadeEvent WithdrawalMadeEvent => new MerchantDomainEvents.WithdrawalMadeEvent(TestData.MerchantId, TestData.EstateId, TestData.ManualWithdrawalId, TestData.WithdrawalDateTime, - TestData.WithdrawalAmount); + TestData.WithdrawalAmount, + TestData.HostDateTime); public static MerchantDomainEvents.WithdrawalMadeEvent WithdrawalMadeEvent1 => new MerchantDomainEvents.WithdrawalMadeEvent(TestData.MerchantId, TestData.EstateId, TestData.ManualWithdrawalId, TestData.WithdrawalDateTime.AddDays(1), - TestData.WithdrawalAmount); + TestData.WithdrawalAmount, + TestData.HostDateTime); public static Dictionary DefaultAppSettings => new Dictionary @@ -211,7 +217,7 @@ public static TransactionDomainEvents.TransactionHasStartedEvent GetTransactionH public static VoucherDomainEvents.VoucherIssuedEvent VoucherIssuedEvent => new VoucherDomainEvents.VoucherIssuedEvent(TestData.VoucherId,TestData.EstateId, TestData.IssuedDateTime, TestData.RecipientEmail, TestData.RecipientMobile); - public static VoucherDomainEvents.VoucherFullyRedeemedEvent VoucherFullyRedeemedEvent => new VoucherDomainEvents.VoucherFullyRedeemedEvent(TestData.VoucherId, TestData.EstateId, TestData.RedeemedDateTime); + public static VoucherDomainEvents.VoucherFullyRedeemedEvent VoucherFullyRedeemedEvent => new VoucherDomainEvents.VoucherFullyRedeemedEvent(TestData.VoucherId, TestData.EstateId, TestData.RedeemedDateTime, TestData.HostDateTime); public static TransactionDomainEvents.TransactionHasBeenCompletedEvent TransactionHasBeenCompletedEvent => new TransactionDomainEvents.TransactionHasBeenCompletedEvent(TestData.TransactionId, TestData.EstateId, diff --git a/TransactionProcessor.Testing/TestData.cs b/TransactionProcessor.Testing/TestData.cs index 933a1f6a..8b940867 100644 --- a/TransactionProcessor.Testing/TestData.cs +++ b/TransactionProcessor.Testing/TestData.cs @@ -9,9 +9,11 @@ using TransactionProcessor.BusinessLogic.Services; using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects.Requests.Estate; +using TransactionProcessor.DataTransferObjects.Requests.Float; using TransactionProcessor.DataTransferObjects.Requests.Merchant; using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Requests.Operator; +using TransactionProcessor.DataTransferObjects.Requests.Voucher; using TransactionProcessor.DataTransferObjects.Responses.Estate; using TransactionProcessor.DataTransferObjects.Responses.Merchant; using TransactionProcessor.DomainEvents; @@ -1118,7 +1120,7 @@ public static TransactionAggregate GetCompletedLogonTransactionAggregate() { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); @@ -1131,7 +1133,7 @@ public static TransactionAggregate GetCompletedAuthorisedSaleTransactionAggregat { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); @@ -1152,7 +1154,7 @@ public static TransactionAggregate GetCompletedAuthorisedSaleTransactionAggregat { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); @@ -1174,7 +1176,7 @@ public static TransactionAggregate GetCompletedAuthorisedSaleTransactionWithRece { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); @@ -1197,7 +1199,7 @@ public static TransactionAggregate GetCompletedDeclinedSaleTransactionAggregate( { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); @@ -1216,7 +1218,7 @@ public static TransactionAggregate GetIncompleteAuthorisedSaleTransactionAggrega { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.AddProductDetails(TestData.ContractId, TestData.ProductId); @@ -1233,7 +1235,7 @@ public static TransactionAggregate GetCompletedAuthorisedLogonTransactionAggrega { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, @@ -1248,7 +1250,7 @@ public static TransactionAggregate GetCompletedAuthorisedSaleWithNoProductDetail { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeSale, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.AuthoriseTransaction(TestData.OperatorId, TestData.AuthorisationCode, @@ -1277,7 +1279,7 @@ public static FloatAggregate GetFloatAggregateWithCostValues(){ FloatAggregate floatAggregate = FloatAggregate.Create(TestData.FloatAggregateId); floatAggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime); - floatAggregate.RecordCreditPurchase(DateTime.Now, TestData.FloatCreditAmount, TestData.FloatCreditCostPrice); + floatAggregate.RecordCreditPurchase(DateTime.Now, TestData.FloatCreditAmount, TestData.FloatCreditCostPrice, DateTime.Now); return floatAggregate; } @@ -1290,7 +1292,7 @@ public static TransactionAggregate GetLocallyAuthorisedTransactionAggregate() { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.AuthoriseTransactionLocally(TestData.AuthorisationCode, TestData.ResponseCode, TestData.ResponseMessage); @@ -1301,7 +1303,7 @@ public static TransactionAggregate GetLocallyDeclinedTransactionAggregate(Transa { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.DeclineTransactionLocally(transactionResponseCode, TestData.GetResponseCodeMessage(transactionResponseCode)); @@ -1313,7 +1315,7 @@ public static TransactionAggregate GetDeclinedTransactionAggregate(TransactionRe { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); transactionAggregate.DeclineTransaction(TestData.OperatorId, TestData.DeclinedOperatorResponseCode, @@ -1338,7 +1340,7 @@ public static TransactionAggregate GetStartedTransactionAggregate() { TransactionAggregate transactionAggregate = TransactionAggregate.Create(TestData.TransactionId); - transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); + transactionAggregate.StartTransaction(TestData.TransactionDateTime, TestData.HostDateTime, TestData.TransactionNumber, TestData.TransactionTypeLogon, TestData.TransactionReference, CreateTransactionStartContext(), TestData.TransactionAmount); return transactionAggregate; } @@ -1706,7 +1708,10 @@ public static SettlementAggregate GetSettlementAggregateWithNotAllFeesSettled(In public static DateTime RedeemedDateTime = new DateTime(2020, 11, 5); - public static VoucherCommands.RedeemVoucherCommand RedeemVoucherCommand => new(TestData.EstateId, TestData.VoucherCode, TestData.RedeemedDateTime); + public static VoucherCommands.RedeemVoucherCommand RedeemVoucherCommand => new( TestData.EstateId, TestData.VoucherCode, new RedeemVoucherRequest { + RedeemedDateTime = RedeemedDateTime, + HostDateTime = HostDateTime + }); private static Decimal RemainingBalance = 1.00m; @@ -1737,7 +1742,17 @@ public static SettlementAggregate GetSettlementAggregateWithNotAllFeesSettled(In TestData.TotalCostPrice, TestData.TransactionDateTime); - public static FloatCommands.RecordCreditPurchaseForFloatCommand RecordCreditPurchaseForFloatCommand => new(TestData.EstateId, TestData.FloatAggregateId, TestData.FloatCreditAmount, TestData.FloatCreditCostPrice, TestData.CreditPurchasedDateTime); + public static DateTime HostDateTime = DateTime.Now; + + public static RecordFloatCreditPurchaseRequest RecordFloatCreditPurchaseRequest = new() { + CostPrice = FloatCreditCostPrice, + CreditAmount = FloatCreditAmount, + FloatId = FloatAggregateId, + PurchaseDateTime = CreditPurchasedDateTime, + HostDateTime = HostDateTime + }; + + public static FloatCommands.RecordCreditPurchaseForFloatCommand RecordCreditPurchaseForFloatCommand => new(TestData.EstateId, TestData.RecordFloatCreditPurchaseRequest); public static FloatCommands.CreateFloatCommand CreateFloatCommand => new(TestData.EstateId, TestData.FloatAggregateId, TestData.FloatCreatedDateTime); @@ -2104,7 +2119,8 @@ public static class Commands { TestData.TransactionSource, TestData.TransactionReceivedDateTime); public static TransactionCommands.ProcessReconciliationCommand ProcessReconciliationCommand => - new(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.DeviceIdentifier, TestData.TransactionDateTime, TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue); + new(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.DeviceIdentifier, TestData.TransactionDateTime, TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue, + TestData.HostDateTime); public static TransactionCommands.ProcessLogonTransactionCommand ProcessLogonTransactionCommand => new(TestData.TransactionId, TestData.EstateId, @@ -2212,6 +2228,8 @@ public static ContractCommands.AddTransactionFeeForProductToContractCommand TestData.MerchantId, MerchantDepositSourceManualDTO, TestData.MakeMerchantDepositRequest); + + public static VoucherCommands.RedeemVoucherCommand RedeemVoucherCommand => new(TestData.EstateId, TestData.VoucherCode, new RedeemVoucherRequest { RedeemedDateTime = RedeemedDateTime, HostDateTime = HostDateTime }); } public static Guid SettlementId = Guid.Parse("7CF02BE4-4BF0-4BB2-93C1-D6E5EC769E56"); public static String StartDate = "20210104"; @@ -2297,7 +2315,8 @@ public static MerchantDepositListAggregate MerchantDepositListAggregateWithDepos MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - merchantDepositListAggregate.MakeDeposit(Models.Merchant.MerchantDepositSource.Manual, TestData.Commands.MakeMerchantDepositCommand.RequestDto.Reference, TestData.Commands.MakeMerchantDepositCommand.RequestDto.DepositDateTime, PositiveMoney.Create(Money.Create(TestData.Commands.MakeMerchantDepositCommand.RequestDto.Amount))); + merchantDepositListAggregate.MakeDeposit(Models.Merchant.MerchantDepositSource.Manual, TestData.Commands.MakeMerchantDepositCommand.RequestDto.Reference, TestData.Commands.MakeMerchantDepositCommand.RequestDto.DepositDateTime, PositiveMoney.Create(Money.Create(TestData.Commands.MakeMerchantDepositCommand.RequestDto.Amount)), + TestData.Commands.MakeMerchantDepositCommand.RequestDto.HostDateTime); return merchantDepositListAggregate; } @@ -2310,7 +2329,8 @@ public static MerchantDepositListAggregate MerchantDepositListAggregateWithWithd MerchantDepositListAggregate merchantDepositListAggregate = MerchantDepositListAggregate.Create(TestData.MerchantId); merchantDepositListAggregate.Create(merchantAggregate, TestData.DateMerchantCreated); - merchantDepositListAggregate.MakeWithdrawal(TestData.Commands.MakeMerchantWithdrawalCommand.RequestDto.WithdrawalDateTime, PositiveMoney.Create(Money.Create(TestData.Commands.MakeMerchantWithdrawalCommand.RequestDto.Amount))); + merchantDepositListAggregate.MakeWithdrawal(TestData.Commands.MakeMerchantWithdrawalCommand.RequestDto.WithdrawalDateTime, PositiveMoney.Create(Money.Create(TestData.Commands.MakeMerchantWithdrawalCommand.RequestDto.Amount)), + TestData.HostDateTime); return merchantDepositListAggregate; } @@ -2620,11 +2640,11 @@ public static Models.Merchant.Merchant MerchantModelWithAddressesContactsDevices public static class DomainEvents { - public static ReconciliationDomainEvents.ReconciliationHasStartedEvent ReconciliationHasStartedEvent => new ReconciliationDomainEvents.ReconciliationHasStartedEvent(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.TransactionDateTime); + public static ReconciliationDomainEvents.ReconciliationHasStartedEvent ReconciliationHasStartedEvent => new ReconciliationDomainEvents.ReconciliationHasStartedEvent(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.TransactionDateTime, TestData.HostDateTime); public static FloatDomainEvents.FloatCreatedForContractProductEvent FloatCreatedForContractProductEvent => new FloatDomainEvents.FloatCreatedForContractProductEvent(FloatAggregateId, EstateId, ContractId, ProductId, FloatCreatedDateTime); public static FloatDomainEvents.FloatCreatedEvent FloatCreatedEvent => new FloatDomainEvents.FloatCreatedEvent(FloatAggregateId, EstateId, FloatCreatedDateTime); - public static TransactionDomainEvents.TransactionHasStartedEvent TransactionHasStartedEvent => new TransactionDomainEvents.TransactionHasStartedEvent(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.TransactionDateTime1, TestData.TransactionNumber, TestData.TransactionTypeSale.ToString(), TestData.TransactionReference, TestData.DeviceIdentifier, TestData.TransactionAmount); + public static TransactionDomainEvents.TransactionHasStartedEvent TransactionHasStartedEvent => new TransactionDomainEvents.TransactionHasStartedEvent(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.TransactionDateTime1, TestData.TransactionNumber, TestData.TransactionTypeSale.ToString(), TestData.TransactionReference, TestData.DeviceIdentifier, TestData.TransactionAmount, TestData.HostDateTime); public static TransactionDomainEvents.AdditionalRequestDataRecordedEvent AdditionalRequestDataRecordedEvent => new TransactionDomainEvents.AdditionalRequestDataRecordedEvent(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.OperatorId, new Dictionary { { "Amount", "123.45" }, @@ -2653,10 +2673,10 @@ public static class DomainEvents { TestData.TransactionAmount, TestData.TransactionDateTime); - public static MerchantDomainEvents.AutomaticDepositMadeEvent AutomaticDepositMadeEvent => new(MerchantId, EstateId, DepositId, DepositReference, DepositDateTime, DepositAmount.Value); - public static MerchantDomainEvents.ManualDepositMadeEvent ManualDepositMadeEvent => new(MerchantId, EstateId, DepositId, DepositReference, DepositDateTime, DepositAmount.Value); + public static MerchantDomainEvents.AutomaticDepositMadeEvent AutomaticDepositMadeEvent => new(MerchantId, EstateId, DepositId, DepositReference, DepositDateTime, DepositAmount.Value, HostDateTime); + public static MerchantDomainEvents.ManualDepositMadeEvent ManualDepositMadeEvent => new(MerchantId, EstateId, DepositId, DepositReference, DepositDateTime, DepositAmount.Value, HostDateTime); - public static MerchantDomainEvents.WithdrawalMadeEvent WithdrawalMadeEvent => new(MerchantId, EstateId, WithdrawalId, WithdrawalDateTime, WithdrawalAmount.Value); + public static MerchantDomainEvents.WithdrawalMadeEvent WithdrawalMadeEvent => new(MerchantId, EstateId, WithdrawalId, WithdrawalDateTime, WithdrawalAmount.Value,HostDateTime); public static MerchantStatementForDateDomainEvents.StatementCreatedForDateEvent StatementCreatedForDateEvent => new(MerchantStatementForDateId1, ActivityDate1, StatementDate, MerchantStatementId, EstateId, MerchantId); public static SettlementDomainEvents.SettlementCreatedForDateEvent SettlementCreatedForDateEvent => new(SettlementId, EstateId, MerchantId, SettlementDate); diff --git a/TransactionProcessor.Tests/HandlerTests/WebHandlersTests.cs b/TransactionProcessor.Tests/HandlerTests/WebHandlersTests.cs index 7893b1d6..da0ea661 100644 --- a/TransactionProcessor.Tests/HandlerTests/WebHandlersTests.cs +++ b/TransactionProcessor.Tests/HandlerTests/WebHandlersTests.cs @@ -355,9 +355,9 @@ public static IEnumerable FloatCases() SetupSuccess(command => { command.EstateId.ShouldBe(EstateId); - command.FloatId.ShouldBe(FloatId); - command.CreditAmount.ShouldBe(10m); - command.CostPrice.ShouldBe(8m); + command.RecordFloatCreditPurchaseRequest.FloatId.ShouldBe(FloatId); + command.RecordFloatCreditPurchaseRequest.CreditAmount.ShouldBe(10m); + command.RecordFloatCreditPurchaseRequest.CostPrice.ShouldBe(8m); }), mediator => FloatHandlers.RecordFloatCreditPurchase(mediator, new DefaultHttpContext(), @@ -1067,15 +1067,17 @@ public static IEnumerable VoucherCases() { command.EstateId.ShouldBe(EstateId); command.VoucherCode.ShouldBe(VoucherCode); - command.RedeemedDateTime.ShouldBeGreaterThan(DateTime.Now.AddSeconds(-5)); - command.RedeemedDateTime.ShouldBeLessThan(DateTime.Now.AddSeconds(5)); + command.RedeemVoucherRequest.RedeemedDateTime.GetValueOrDefault().ShouldBeGreaterThan(DateTime.Now.AddSeconds(-5)); + command.RedeemVoucherRequest.RedeemedDateTime.GetValueOrDefault().ShouldBeLessThan(DateTime.Now.AddSeconds(5)); }), mediator => VoucherHandlers.RedeemVoucher(mediator, new DefaultHttpContext(), new RedeemVoucherRequest { EstateId = EstateId, - VoucherCode = VoucherCode + VoucherCode = VoucherCode, + RedeemedDateTime = DateTime.Now, + HostDateTime = DateTime.Now }, CancellationToken.None)); diff --git a/TransactionProcessor/Bootstrapper/ClientRegistry.cs b/TransactionProcessor/Bootstrapper/ClientRegistry.cs index 0dd26dd2..efc761c5 100644 --- a/TransactionProcessor/Bootstrapper/ClientRegistry.cs +++ b/TransactionProcessor/Bootstrapper/ClientRegistry.cs @@ -45,7 +45,7 @@ public SerialiserRegistry() this.AddSingleton(); this.AddSingleton>(_ => obj => StringSerialiser.Serialise(obj)); this.AddSingleton>(_ => (str, type) => StringSerialiser.DeserializeObject(str, type)); - + var serialiserSettings = SystemTextJsonSerializer.GetDefaultJsonSerializerOptions().AddModifier(JsonTypeInfoModifierExtensions.ForType(typeInfo => { typeInfo.RenameProperty(x => x.StreamName, "eventStreamId"); diff --git a/TransactionProcessor/Handlers/FloatHandlers.cs b/TransactionProcessor/Handlers/FloatHandlers.cs index d2de2847..ae5db0f5 100644 --- a/TransactionProcessor/Handlers/FloatHandlers.cs +++ b/TransactionProcessor/Handlers/FloatHandlers.cs @@ -6,7 +6,6 @@ using SimpleResults; using Shared.Results.Web; using TransactionProcessor.BusinessLogic.Requests; -using TransactionProcessor.Factories; using TransactionProcessor.DataTransferObjects.Requests.Float; namespace TransactionProcessor.Handlers @@ -21,9 +20,9 @@ public static async Task CreateFloat(IMediator mediator, HttpContext ct return ResponseFactory.FromResult(result); } - public static async Task RecordFloatCreditPurchase(IMediator mediator, HttpContext ctx, Guid estateId, RecordFloatCreditPurchaseRequest recordFloatCreditPurchaseRequest, CancellationToken cancellationToken) - { - FloatCommands.RecordCreditPurchaseForFloatCommand command = new(estateId, recordFloatCreditPurchaseRequest.FloatId, recordFloatCreditPurchaseRequest.CreditAmount, recordFloatCreditPurchaseRequest.CostPrice, recordFloatCreditPurchaseRequest.PurchaseDateTime); + public static async Task RecordFloatCreditPurchase(IMediator mediator, HttpContext ctx, Guid estateId, RecordFloatCreditPurchaseRequest recordFloatCreditPurchaseRequest, CancellationToken cancellationToken) { + + FloatCommands.RecordCreditPurchaseForFloatCommand command = new(estateId, recordFloatCreditPurchaseRequest); Result result = await mediator.Send(command, cancellationToken); return ResponseFactory.FromResult(result); diff --git a/TransactionProcessor/Handlers/MerchantHandlers.cs b/TransactionProcessor/Handlers/MerchantHandlers.cs index 4be56a00..ce099545 100644 --- a/TransactionProcessor/Handlers/MerchantHandlers.cs +++ b/TransactionProcessor/Handlers/MerchantHandlers.cs @@ -1,13 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using MediatR; using Microsoft.AspNetCore.Http; using Shared.Results.Web; using SimpleResults; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; using TransactionProcessor.BusinessLogic.Requests; using TransactionProcessor.DataTransferObjects; +using TransactionProcessor.DataTransferObjects.Requests.Float; using TransactionProcessor.DataTransferObjects.Requests.Merchant; using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Responses; diff --git a/TransactionProcessor/Handlers/TransactionHandlers.cs b/TransactionProcessor/Handlers/TransactionHandlers.cs index 8c9f8ac1..64b34b90 100644 --- a/TransactionProcessor/Handlers/TransactionHandlers.cs +++ b/TransactionProcessor/Handlers/TransactionHandlers.cs @@ -1,16 +1,17 @@ -using System; -using System.Threading; -using System.Threading.Tasks; using MediatR; using Microsoft.AspNetCore.Http; -using SimpleResults; -using Shared.Results.Web; using Shared.Results; -using TransactionProcessor.Factories; +using Shared.Results.Web; +using SimpleResults; +using System; +using System.Threading; +using System.Threading.Tasks; using TransactionProcessor.BusinessLogic.Requests; -using TransactionProcessor.Models; +using TransactionProcessor.DataTransferObjects.Requests.Float; using TransactionProcessor.DataTransferObjects.Requests.Transaction; using TransactionProcessor.DataTransferObjects.Responses.Transaction; +using TransactionProcessor.Factories; +using TransactionProcessor.Models; namespace TransactionProcessor.Handlers { @@ -18,18 +19,14 @@ public static class TransactionHandlers { public static async Task PerformSaleTransaction(IMediator mediator, HttpContext ctx, SaleTransactionRequest transactionRequest, CancellationToken cancellationToken) { - DateTimeOffset transactionReceivedDateTime = DateTime.Now; - - Result transactionResult = await ProcessSpecificMessage(mediator, transactionRequest, transactionReceivedDateTime, cancellationToken); + Result transactionResult = await ProcessSpecificMessage(mediator, transactionRequest, cancellationToken); return ResponseFactory.FromResult(transactionResult, message => message); } public static async Task PerformLogonTransaction(IMediator mediator, HttpContext ctx, LogonTransactionRequest transactionRequest, CancellationToken cancellationToken) { - DateTimeOffset transactionReceivedDateTime = DateTime.Now; - - Result transactionResult = await ProcessSpecificMessage(mediator, transactionRequest, transactionReceivedDateTime, cancellationToken); + Result transactionResult = await ProcessSpecificMessage(mediator, transactionRequest, cancellationToken); return ResponseFactory.FromResult(transactionResult, message => message); } @@ -53,7 +50,7 @@ public static async Task ResendTransactionReceipt(IMediator mediator, H } // Helpers copied from controller logic - private static async Task> ProcessSpecificMessage(IMediator mediator, LogonTransactionRequest logon, DateTimeOffset transactionReceivedDateTime, CancellationToken cancellationToken) + private static async Task> ProcessSpecificMessage(IMediator mediator, LogonTransactionRequest logon, CancellationToken cancellationToken) { Guid transactionId = Guid.NewGuid(); @@ -65,7 +62,7 @@ private static async Task> ProcessSpecificMessa logon.TransactionType, logon.TransactionDateTime, logon.TransactionNumber, - transactionReceivedDateTime); + logon.HostDateTime); Result result = await mediator.Send(command, cancellationToken); if (result.IsFailed) @@ -74,7 +71,7 @@ private static async Task> ProcessSpecificMessa return ModelFactory.ConvertFrom(result.Data); } - private static async Task> ProcessSpecificMessage(IMediator mediator, SaleTransactionRequest sale, DateTimeOffset transactionReceivedDateTime, CancellationToken cancellationToken) + private static async Task> ProcessSpecificMessage(IMediator mediator, SaleTransactionRequest sale, CancellationToken cancellationToken) { Guid transactionId = Guid.NewGuid(); @@ -93,7 +90,7 @@ private static async Task> ProcessSpecificMessag sale.ProductId, // Default to an online sale sale.TransactionSource.GetValueOrDefault(1), - transactionReceivedDateTime); + sale.HostDateTime); var result = await mediator.Send(command, cancellationToken); if (result.IsFailed) @@ -113,7 +110,8 @@ private static async Task> ProcessSpecificMessage reconciliation.DeviceIdentifier, reconciliation.TransactionDateTime, reconciliation.TransactionCount, - reconciliation.TransactionValue); + reconciliation.TransactionValue, + reconciliation.HostDateTime); Result result = await mediator.Send(command, cancellationToken); diff --git a/TransactionProcessor/Handlers/VoucherHandlers.cs b/TransactionProcessor/Handlers/VoucherHandlers.cs index b49a536c..fcba6917 100644 --- a/TransactionProcessor/Handlers/VoucherHandlers.cs +++ b/TransactionProcessor/Handlers/VoucherHandlers.cs @@ -15,8 +15,7 @@ public static class VoucherHandlers { public static async Task RedeemVoucher(IMediator mediator, HttpContext ctx, RedeemVoucherRequest redeemVoucherRequest, CancellationToken cancellationToken) { - DateTimeOffset redeemedDateTime = redeemVoucherRequest.RedeemedDateTime.HasValue ? redeemVoucherRequest.RedeemedDateTime.Value : DateTime.Now; - VoucherCommands.RedeemVoucherCommand command = new(redeemVoucherRequest.EstateId, redeemVoucherRequest.VoucherCode, redeemedDateTime); + VoucherCommands.RedeemVoucherCommand command = new(redeemVoucherRequest.EstateId, redeemVoucherRequest.VoucherCode, redeemVoucherRequest); Result result = await mediator.Send(command, cancellationToken); From 44b2afe8bf9a8104b743bb5d22e9c5e333c31ecf Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Tue, 3 Nov 2026 07:53:02 +0000 Subject: [PATCH 3/3] Fix offset serialization and settlement date mapping --- .../PataPawaPrePay/PataPawaPrePayProxy.cs | 6 +++--- ...102135338_DateTime_to_DateTimeOffset.Designer.cs | 4 ++-- ...EstateManagementSqlServerContextModelSnapshot.cs | 4 ++-- .../ViewEntities/SettlementView.cs | 4 ++-- .../ITransactionProcessorReadModelRepository.cs | 13 +++++++++++-- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPrePay/PataPawaPrePayProxy.cs b/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPrePay/PataPawaPrePayProxy.cs index 086b5e7e..f71156e5 100644 --- a/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPrePay/PataPawaPrePayProxy.cs +++ b/TransactionProcessor.BusinessLogic/OperatorInterfaces/PataPawaPrePay/PataPawaPrePayProxy.cs @@ -310,7 +310,7 @@ public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConver return default; // Try exact known formats first (handles "2026-05-07 06:03:18") - if (DateTime.TryParseExact(s, AcceptedFormats, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal | DateTimeStyles.AllowWhiteSpaces, out var dtExact)) + if (DateTimeOffset.TryParseExact(s, AcceptedFormats, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal | DateTimeStyles.AllowWhiteSpaces, out var dtExact)) return dtExact; // Fall back to general parse @@ -331,8 +331,8 @@ public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConver public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) { - // Write in the same "space" format so round-trip matches your input - writer.WriteStringValue(value.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture)); + // Preserve both the instant and the original offset in API responses. + writer.WriteStringValue(value.ToString("o", CultureInfo.InvariantCulture)); } } } diff --git a/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.Designer.cs b/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.Designer.cs index c9240b42..7fa0d4c3 100644 --- a/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.Designer.cs +++ b/TransactionProcessor.Database/Migrations/SqlServer/20261102135338_DateTime_to_DateTimeOffset.Designer.cs @@ -1527,8 +1527,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("SettlementDate") - .HasColumnType("datetimeoffset"); + b.Property("SettlementDate") + .HasColumnType("datetime2"); b.Property("SettlementId") .HasColumnType("uniqueidentifier"); diff --git a/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs b/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs index aa81679d..3c8ccfe2 100644 --- a/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs +++ b/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs @@ -1524,8 +1524,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("SettlementDate") - .HasColumnType("datetimeoffset"); + b.Property("SettlementDate") + .HasColumnType("datetime2"); b.Property("SettlementId") .HasColumnType("uniqueidentifier"); diff --git a/TransactionProcessor.Database/ViewEntities/SettlementView.cs b/TransactionProcessor.Database/ViewEntities/SettlementView.cs index bf0ae608..80d300b0 100644 --- a/TransactionProcessor.Database/ViewEntities/SettlementView.cs +++ b/TransactionProcessor.Database/ViewEntities/SettlementView.cs @@ -70,7 +70,7 @@ public class SettlementView /// public String OperatorIdentifier { get; set; } - public DateTimeOffset SettlementDate { get; set; } + public DateTime SettlementDate { get; set; } public Guid SettlementId { get; set; } @@ -94,4 +94,4 @@ public class SettlementView #endregion } -} \ No newline at end of file +} diff --git a/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs b/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs index e1768f40..7185d555 100644 --- a/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs +++ b/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs @@ -2205,12 +2205,12 @@ public async Task>> GetSettlements(Guid estateId, query = query.Where(t => t.MerchantId == merchantId); } - List result = await query.GroupBy(t => new + var settlementRows = await query.GroupBy(t => new { t.SettlementId, t.SettlementDate, t.IsCompleted - }).Select(t => new SettlementModel + }).Select(t => new { SettlementId = t.Key.SettlementId, SettlementDate = t.Key.SettlementDate, @@ -2220,6 +2220,15 @@ public async Task>> GetSettlements(Guid estateId, }).OrderByDescending(t => t.SettlementDate) .ToListAsync(cancellationToken); + List result = settlementRows.Select(t => new SettlementModel + { + SettlementId = t.SettlementId, + SettlementDate = new DateTimeOffset(DateTime.SpecifyKind(t.SettlementDate, DateTimeKind.Unspecified), TimeSpan.Zero), + NumberOfFeesSettled = t.NumberOfFeesSettled, + ValueOfFeesSettled = t.ValueOfFeesSettled, + IsCompleted = t.IsCompleted + }).ToList(); + return Result.Success(result); }