Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions TransactionProcessor.BusinessLogic/Common/PolicyFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ private static void LogResult(string policyTag, ResultBase result, int retryCoun
string retryMessage = retryCount > 0 ? $" after {retryCount} retries." : "";
Logger.LogWarning($"{policyTag} - {message}{retryMessage}");
break;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
break;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Shared.Results;
using Shared.Exceptions;
using Shared.Results;
using SimpleResults;
using TransactionProcessor.Aggregates;
using TransactionProcessor.BusinessLogic.Services;
Expand Down Expand Up @@ -127,7 +128,7 @@ private async Task<String> GetVoucherOperator(Models.Voucher voucherModel,
Database.Entities.Transaction transaction = await context.Transactions.SingleOrDefaultAsync(t => t.TransactionId == voucherModel.TransactionId, cancellationToken);
if (transaction == null)
{
throw new Exception($"Transaction not found Transaction Id {voucherModel.TransactionId}");
throw new NotFoundException($"Transaction not found Transaction Id {voucherModel.TransactionId}");
}

Contract contract = await context.Contracts.SingleOrDefaultAsync(c => c.ContractId == transaction.ContractId, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ Task<Result<List<ContractProductTransactionFee>>> GetTransactionFeesForProduct(G
Guid contractId,
Guid productId,
CancellationToken cancellationToken);

//Task<Result<File>> GetFileDetails(Guid estateId, Guid fileId, CancellationToken cancellationToken);

Task<Result<Models.Operator.Operator>> GetOperator(Guid estateId, Guid operatorId,
CancellationToken cancellationToken);
CancellationToken cancellationToken);

Task<Result<List<Models.Operator.Operator>>> GetOperators(Guid estateId, CancellationToken cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ public async Task<Result> EmailStatement(MerchantStatementCommands.EmailMerchant
this.TokenResponse = getTokenResult.Data;

Result sendEmailResponseResult = await this.MessagingServiceClient.SendEmail(this.TokenResponse.AccessToken, sendEmailRequest, cancellationToken);
//if (sendEmailResponseResult.IsFailed) {
// // TODO: record a failed event??
//}

Result stateResult = merchantStatementAggregate.EmailStatement(DateTime.Now, messageId);
if (stateResult.IsFailed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,6 @@ private async Task<Result> ResendEmailMessage(String accessToken,
private async Task<Result<List<Models.Contract.ContractProductTransactionFee>>> GetTransactionFeesForProduct(Guid contractId,
Guid productId,
CancellationToken cancellationToken) {
//Result<ContractAggregate> contractAggregateResult = await this.AggregateService.Get<ContractAggregate>(contractId, CancellationToken.None);
//if (contractAggregateResult.IsFailed)
// return ResultHelpers.CreateFailure(contractAggregateResult);
Result<ContractAggregate> contractAggregateResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.Get<ContractAggregate>(contractId, ct), contractId, cancellationToken, false);
if (contractAggregateResult.IsFailed)
return ResultHelpers.CreateFailure(contractAggregateResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ public async Task<Result> Handle(IDomainEvent @event, CancellationToken cancella

builder.Insert(0, $"Total time: {stopwatch.ElapsedMilliseconds}ms|");

//Int32 projectionTraceThresholdInSeconds = Int32.Parse(ConfigurationReader.GetValue("AppSettings", "ProjectionTraceThresholdInSeconds"));
//if (stopwatch.Elapsed.Seconds > projectionTraceThresholdInSeconds){
Logger.LogWarning(builder.ToString());
Logger.LogInformation($"{@event.EventId}|Event Type {@event.EventType} Id [{@event.EventId}] for state {state.GetType().Name} took {stopwatch.ElapsedMilliseconds}ms to process");
//}
Logger.LogWarning(builder.ToString());
Logger.LogInformation($"{@event.EventId}|Event Type {@event.EventType} Id [{@event.EventId}] for state {state.GetType().Name} took {stopwatch.ElapsedMilliseconds}ms to process");

return Result.Success();
}
}
11 changes: 0 additions & 11 deletions TransactionProcessor.ProjectionEngine/State/State.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ Task<Result> AddFileLineToFile(FileLineAddedEvent domainEvent,
Task<Result> AddFileToImportLog(FileAddedToImportLogEvent domainEvent,
CancellationToken cancellationToken);

//Task<Result> AddGeneratedVoucher(VoucherDomainEvents.VoucherGeneratedEvent domainEvent,
// CancellationToken cancellationToken);

Task<Result> AddMerchant(MerchantDomainEvents.MerchantCreatedEvent domainEvent,
CancellationToken cancellationToken);

Expand Down Expand Up @@ -109,20 +106,12 @@ Task<Result> AddPendingMerchantFeeToSettlement(SettlementDomainEvents.MerchantFe
Task<Result> AddProductDetailsToTransaction(TransactionDomainEvents.ProductDetailsAddedToTransactionEvent domainEvent,
CancellationToken cancellationToken);

// TODO@ Add this back in
//Task<Result> AddSettledFeeToStatement(SettledFeeAddedToStatementEvent domainEvent,
// CancellationToken cancellationToken);

Task<Result> AddSettledMerchantFeeToSettlement(TransactionDomainEvents.SettledMerchantFeeAddedToTransactionEvent domainEvent,
CancellationToken cancellationToken);

Task<Result> AddSourceDetailsToTransaction(TransactionDomainEvents.TransactionSourceAddedToTransactionEvent domainEvent,
CancellationToken cancellationToken);

// TODO@ Add this back in
//Task<Result> AddTransactionToStatement(TransactionAddedToStatementEvent domainEvent,
// CancellationToken cancellationToken);

Task<Result> CompleteReconciliation(ReconciliationDomainEvents.ReconciliationHasCompletedEvent domainEvent,
CancellationToken cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public DomainEventHandlerRegistry()
Startup.Configuration.GetSection("AppSettings:EventHandlerConfiguration").Bind(eventHandlersConfiguration);
}

//this.AddSingleton(eventHandlersConfiguration);
this.Use(eventHandlersConfiguration).Named("EventHandlerConfiguration");

section = Startup.Configuration.GetSection("AppSettings:EventHandlerConfigurationDomain");
Expand Down
1 change: 0 additions & 1 deletion TransactionProcessor/Bootstrapper/OperatorRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace TransactionProcessor.Bootstrapper
using Lamar;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
//using Org.BouncyCastle.Security;
using PataPawaPostPay;

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion TransactionProcessor/Controllers/DomainEventController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Shared.Exceptions;

namespace TransactionProcessor.Controllers
{
Expand Down Expand Up @@ -135,7 +136,7 @@ private async Task<IDomainEvent> GetDomainEvent(Object domainEvent)
Type type = TypeMap.GetType(eventType);

if (type == null)
throw new Exception($"Failed to find a domain event with type {eventType}");
throw new NotFoundException($"Failed to find a domain event with type {eventType}");

JsonIgnoreAttributeIgnorerContractResolver jsonIgnoreAttributeIgnorerContractResolver = new JsonIgnoreAttributeIgnorerContractResolver();
JsonSerializerSettings jsonSerialiserSettings = new JsonSerializerSettings
Expand Down
2 changes: 1 addition & 1 deletion TransactionProcessor/Controllers/MerchantController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private bool PerformStandardChecks(Guid estateId)

return true;
}
//private TokenResponse TokenResponse;

[HttpPost]
[Route("")]
public async Task<IActionResult> CreateMerchant([FromRoute] Guid estateId,
Expand Down
3 changes: 3 additions & 0 deletions TransactionProcessor/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public static class Extensions {
case TraceEventType.Verbose:
Logger.LogDebug(logMessage);
break;
default:
Logger.LogDebug(logMessage);
break;
}
};

Expand Down
Loading