public ResponseEntity distribute()

in service/src/main/java/org/apache/fineract/cn/payroll/service/rest/PayrollDistributionRestController.java [90:107]


  public ResponseEntity<Void> distribute(@RequestBody @Valid final PayrollCollectionSheet payrollCollectionSheet) {

    this.verifyAccount(payrollCollectionSheet.getSourceAccountNumber());
    payrollCollectionSheet.getPayrollPayments()
        .forEach(payrollPayment -> {
          final PayrollConfiguration payrollConfiguration =
              this.payrollConfigurationService.findPayrollConfiguration(payrollPayment.getCustomerIdentifier())
                  .orElseThrow(() -> ServiceException.conflict("Payroll configuration for certain customers not available."));

          this.verifyAccount(payrollConfiguration.getMainAccountNumber());
          payrollConfiguration.getPayrollAllocations()
              .forEach(payrollAllocation -> this.verifyAccount(payrollAllocation.getAccountNumber()));
        });

    this.commandGateway.process(new DistributePayrollCommand(payrollCollectionSheet));

    return ResponseEntity.accepted().build();
  }