Ejemplo n.º 1
0
        public async Task <ReconciliationGetReconciledResponse> GetReconciled(ReconciliationGetReconciledArguments args, CancellationToken cancellation)
        {
            // Authorized access (Criteria are not supported here)
            var permissions = await _repo.PermissionsFromCache(VIEW, Constants.Read, cancellation);

            if (!permissions.Any())
            {
                throw new ForbiddenException();
            }

            var(
                reconciledCount,
                reconciliations
                ) = await _repo.Reconciliation__Load_Reconciled(
                accountId : args.AccountId,
                custodyId : args.CustodyId,
                fromDate : args.FromDate,
                toDate : args.ToDate,
                fromAmount : args.FromAmount,
                toAmount : args.ToAmount,
                externalReferenceContains : args.ExternalReferenceContains,
                top : args.Top,
                skip : args.Skip,
                cancellation);

            return(new ReconciliationGetReconciledResponse
            {
                ReconciledCount = reconciledCount,
                Reconciliations = reconciliations
            });
        }
Ejemplo n.º 2
0
        public async Task <ReconciledResult> GetReconciled(ReconciliationGetReconciledArguments 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();
            }

            ReconciledOutput output = await _behavior.Repository.Reconciliation__Load_Reconciled(
                accountId : args.AccountId,
                agentId : args.AgentId,
                fromDate : args.FromDate,
                toDate : args.ToDate,
                fromAmount : args.FromAmount,
                toAmount : args.ToAmount,
                externalReferenceContains : args.ExternalReferenceContains,
                top : args.Top,
                skip : args.Skip,
                cancellation);

            return(MapFromOutput(output));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <ReconciliationGetReconciledResponse> > SaveAndGetReconciled([FromBody] ReconciliationSavePayload payload, [FromQuery] ReconciliationGetReconciledArguments args)
        {
            var result = await _service.SaveAndGetReconciled(payload, args);

            return(Ok(MapFromResult(result)));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <ReconciliationGetReconciledResponse> > GetReconciled([FromQuery] ReconciliationGetReconciledArguments args, CancellationToken cancellation)
        {
            var result = await _service.GetReconciled(args, cancellation);

            return(Ok(MapFromResult(result)));
        }
Ejemplo n.º 5
0
 public async Task <ActionResult <ReconciliationGetReconciledResponse> > SaveAndGetReconciled([FromBody] ReconciliationSavePayload payload, [FromQuery] ReconciliationGetReconciledArguments args)
 {
     return(await ControllerUtilities.InvokeActionImpl(async() =>
     {
         var result = await _service.SaveAndGetReconciled(payload, args);
         return Ok(result);
     },
                                                       _logger));
 }
Ejemplo n.º 6
0
 public async Task <ActionResult <ReconciliationGetReconciledResponse> > GetReconciled([FromQuery] ReconciliationGetReconciledArguments args, CancellationToken cancellation)
 {
     return(await ControllerUtilities.InvokeActionImpl(async() =>
     {
         var result = await _service.GetReconciled(args, cancellation);
         return Ok(result);
     },
                                                       _logger));
 }
Ejemplo n.º 7
0
        public async Task <ReconciliationGetReconciledResponse> SaveAndGetReconciled(ReconciliationSavePayload payload, ReconciliationGetReconciledArguments args)
        {
            // Start transaction
            using var trx = ControllerUtilities.CreateTransaction();

            // Preprocess and Validate
            await PermissionsPreprocessAndValidate(args.AccountId, args.CustodyId, payload);

            // Save
            var(
                reconciledCount,
                reconciliations
                ) = await _repo.Reconciliations__SaveAndLoad_Reconciled(
                accountId : args.AccountId,
                custodyId : args.CustodyId,
                externalEntriesForSave : payload.ExternalEntries,
                reconciliations : payload.Reconciliations,
                deletedExternalEntryIds : payload.DeletedExternalEntryIds,
                deletedReconciliationIds : payload.DeletedReconciliationIds,
                fromDate : args.FromDate,
                toDate : args.ToDate,
                fromAmount : args.FromAmount,
                toAmount : args.ToAmount,
                externalReferenceContains : args.ExternalReferenceContains,
                top : args.Top,
                skip : args.Skip);

            trx.Complete();

            return(new ReconciliationGetReconciledResponse
            {
                ReconciledCount = reconciledCount,
                Reconciliations = reconciliations
            });
        }
Ejemplo n.º 8
0
        public async Task <ReconciledResult> SaveAndGetReconciled(ReconciliationSavePayload payload, ReconciliationGetReconciledArguments args)
        {
            await Initialize();

            // Start transaction
            using var trx = TransactionFactory.ReadCommitted();

            // Preprocess and Validate
            await PermissionsPreprocessAndValidate(args.AccountId, args.AgentId, payload);

            // Save
            ReconciledOutput output = await _behavior.Repository.Reconciliations__SaveAndLoad_Reconciled(
                accountId : args.AccountId,
                agentId : args.AgentId,
                externalEntriesForSave : payload.ExternalEntries,
                reconciliations : payload.Reconciliations,
                deletedExternalEntryIds : payload.DeletedExternalEntryIds,
                deletedReconciliationIds : payload.DeletedReconciliationIds,
                fromDate : args.FromDate,
                toDate : args.ToDate,
                fromAmount : args.FromAmount,
                toAmount : args.ToAmount,
                externalReferenceContains : args.ExternalReferenceContains,
                top : args.Top,
                skip : args.Skip,
                userId : UserId);

            trx.Complete();

            return(MapFromOutput(output));
        }