Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMBCESSMOD-4692 - Updated to return true false if reconciled ok #1829

Merged
merged 1 commit into from
Oct 18, 2023
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
12 changes: 11 additions & 1 deletion ess/src/API/EMBC.ESS/Managers/Events/EventsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions ess/src/API/EMBC.ESS/Resources/Payments/Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion ess/src/API/EMBC.ESS/Resources/Payments/PaymentRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ private async Task<CreatePaymentResponse> Handle(CreatePaymentRequest request, C
private async Task<ReconcileEtransferResponse> Handle(ReconcileEtransferRequest request, CancellationToken ct)
{
if (request.InvoiceId == null) throw new ArgumentNullException(nameof(request.InvoiceId));
bool success = false;
var ctx = essContextFactory.Create();
IQueryable<era_etransfertransaction> query = ctx.era_etransfertransactions;
if (!string.IsNullOrEmpty(request.InvoiceId)) query = query.Where(tx => tx.era_name == request.InvoiceId);
Expand Down Expand Up @@ -134,12 +135,13 @@ private async Task<ReconcileEtransferResponse> 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<SearchPaymentResponse> Handle(SearchPaymentRequest request, CancellationToken ct)
Expand Down