public async Task ProcessPayment(ProviderPaymentEventModel payment, CancellationToken cancellationToken) { var stopwatch = new Stopwatch(); stopwatch.Start(); var isCurrentProviderIlr = await IsCurrentProviderIlr(payment.JobId, payment.Ukprn, payment.IlrSubmissionDateTime, cancellationToken).ConfigureAwait(false); if (!isCurrentProviderIlr) { paymentLogger.LogWarning($"Received out of sequence payment with Job Id {payment.JobId} for Ukprn {payment.Ukprn} "); telemetry.TrackEvent("Provider payments service received out of sequence payment"); return; } paymentLogger.LogVerbose($"Received valid payment with Job Id {payment.JobId} for Ukprn {payment.Ukprn} "); await paymentCache.AddPayment(payment, cancellationToken); stopwatch.Stop(); telemetry.TrackDuration(GetType().FullName + ".ProcessPayment", stopwatch.Elapsed); paymentLogger.LogInfo($"Finished adding the payment to the cache. EventId: {payment.EventId}, FundingSourceId: {payment.FundingSourceId}, UKPRN: {payment.Ukprn}"); }
public async Task ProcessPaymentsEvent(TPaymentsEvent message, CancellationToken cancellationToken) { var model = mapper.Map <TPaymentsEventModel>(message); await cache.AddPayment(model, cancellationToken); }