diff --git a/ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs b/ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs index 2492418d3..4571ea355 100644 --- a/ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs +++ b/ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs @@ -1075,7 +1075,17 @@ await Parallel.ForEachAsync(payments, ct, async (payment, ct) => logger.LogInformation("Attempting to Reconcile Invoice Info for etransfer {0} ", payment.Id); var result = await paymentRepository.Manage(new ReconcileEtransferRequest { InvoiceId = payment.Id }); var outResult = (ReconcileEtransferResponse)result; - logger.LogInformation("Invoice {0} has been reconciled", payment.Id); + if (outResult != null) + { + if (outResult.reconciled == true) + { + logger.LogInformation("Invoice {0} has been reconciled", payment.Id); + } + else + { + logger.LogInformation("Unable to reconile Invoice {0}", payment.Id); + } + } } catch (CasException e) { diff --git a/ess/src/API/EMBC.ESS/Resources/Payments/Contract.cs b/ess/src/API/EMBC.ESS/Resources/Payments/Contract.cs index cf842d1a6..e3661cea4 100644 --- a/ess/src/API/EMBC.ESS/Resources/Payments/Contract.cs +++ b/ess/src/API/EMBC.ESS/Resources/Payments/Contract.cs @@ -130,6 +130,8 @@ public class ReconcileEtransferRequest : ManagePaymentRequest public class ReconcileEtransferResponse : ManagePaymentResponse { public string EtrasnferIdReconciled { get; set; } + + public bool reconciled { get; set; } } public class ReconcileSupplierIdResponse : ManagePaymentResponse diff --git a/ess/src/API/EMBC.ESS/Resources/Payments/PaymentRepository.cs b/ess/src/API/EMBC.ESS/Resources/Payments/PaymentRepository.cs index ab957755a..24bb5c518 100644 --- a/ess/src/API/EMBC.ESS/Resources/Payments/PaymentRepository.cs +++ b/ess/src/API/EMBC.ESS/Resources/Payments/PaymentRepository.cs @@ -101,6 +101,7 @@ private async Task Handle(CreatePaymentRequest request, C private async Task Handle(ReconcileEtransferRequest request, CancellationToken ct) { if (request.InvoiceId == null) throw new ArgumentNullException(nameof(request.InvoiceId)); + bool success = false; var ctx = essContextFactory.Create(); IQueryable query = ctx.era_etransfertransactions; if (!string.IsNullOrEmpty(request.InvoiceId)) query = query.Where(tx => tx.era_name == request.InvoiceId); @@ -134,12 +135,13 @@ private async Task Handle(ReconcileEtransferRequest //Save the data ctx.UpdateObject(payment); await ctx.SaveChangesAsync(ct); + success = true; } } } } ctx.DetachAll(); - return new ReconcileEtransferResponse { EtrasnferIdReconciled = request.InvoiceId }; + return new ReconcileEtransferResponse { EtrasnferIdReconciled = request.InvoiceId, reconciled = success }; } private async Task Handle(SearchPaymentRequest request, CancellationToken ct)