public async Task <UnreconciledResult> SaveAndGetUnreconciled(ReconciliationSavePayload payload, ReconciliationGetUnreconciledArguments args) { await Initialize(); // Start transaction using var trx = TransactionFactory.ReadCommitted(); // Preprocess and Validate await PermissionsPreprocessAndValidate(args.AccountId, args.AgentId, payload); // Save UnreconciledOutput output = await _behavior.Repository.Reconciliations__SaveAndLoad_Unreconciled( accountId : args.AccountId, agentId : args.AgentId, externalEntriesForSave : payload.ExternalEntries, reconciliations : payload.Reconciliations, deletedExternalEntryIds : payload.DeletedExternalEntryIds, deletedReconciliationIds : payload.DeletedReconciliationIds, asOfDate : args.AsOfDate, top : args.EntriesTop, skip : args.EntriesSkip, topExternal : args.ExternalEntriesTop, skipExternal : args.ExternalEntriesSkip, userId : UserId); trx.Complete(); return(MapFromOutput(output)); }
private static UnreconciledResult MapFromOutput(UnreconciledOutput output) { return(new UnreconciledResult ( entriesBalance: output.EntriesBalance, unreconciledEntriesBalance: output.UnreconciledEntriesBalance, unreconciledExternalEntriesBalance: output.UnreconciledExternalEntriesBalance, unreconciledEntriesCount: output.UnreconciledEntriesCount, unreconciledExternalEntriesCount: output.UnreconciledExternalEntriesCount, entries: output.Entries, externalEntries: output.ExternalEntries )); }
public async Task <UnreconciledResult> GetUnreconciled(ReconciliationGetUnreconciledArguments args, CancellationToken cancellation) { await Initialize(cancellation); // Authorized access (Criteria are not supported here) var permissions = await UserPermissions(PermissionActions.Read, cancellation); if (!permissions.Any()) { throw new ForbiddenException(); } UnreconciledOutput output = await _behavior.Repository.Reconciliation__Load_Unreconciled( accountId : args.AccountId, agentId : args.AgentId, asOfDate : args.AsOfDate, top : args.EntriesTop, skip : args.EntriesSkip, topExternal : args.ExternalEntriesTop, skipExternal : args.ExternalEntriesSkip, cancellation); return(MapFromOutput(output)); }