The OpenIMIS Backend Payment Cycle Reference Module is a crucial component of the OpenIMIS system. This module is designed to handle payment cycles and facilitate periodical payments for various business objects connected to payment plans. It offers services and functionalities to perform payment cycle calculations, including a specific service customized for Benefit Plan payment cycle calculation.
ORM Mapping
The Payment Cycle Reference Module utilizes ORM mapping to interact with the underlying database. The following mappings are used:
payment_cycle_paymentcycle
,payment_cycle_historicalpaymentcycle
->Individual
: Represents the payment cycle entity.
Developers can use this mapping to access payment cycle data efficiently.
GraphQL Queries
The module provides a GraphQL query to retrieve payment cycle information:
paymentCycle
: Retrieves payment cycle data based on specified criteria.
GraphQL queries offer a flexible and efficient way to fetch relevant payment cycle information.
GraphQL Mutations
The module offers a GraphQL mutation to trigger the calculation of payment cycles:
processBenefitPlanPaymentCycle
: Initiates the calculation process for Benefit Plan payment cycles.
GraphQL mutations allow seamless execution of payment cycle calculations within the OpenIMIS system.
Services
The Payment Cycle Reference Module provides the following services:
PaymentCycleService
: A generic service containing the workflow for payment cycle calculation.BenefitPlanPaymentCycleService
: A service customized for Benefit Plan payment cycle calculation.
Developers can utilize these services to perform payment cycle calculations and retrieve the results efficiently.
Configuration Options
The behavior of the Payment Cycle Reference Module can be customized through configuration options, which can be modified via core.ModuleConfiguration
. The available configuration options are:
gql_query_payment_cycle_perms
: Specifies the required rights to query PaymentCycle. (Default:["200001"]
)gql_create_payment_cycle_perms
: Specifies the required rights to create PaymentCycle. (Default:["200002"]
)gql_update_payment_cycle_perms
: Specifies the required rights to update PaymentCycle. (Default:["200003"]
)gql_delete_payment_cycle_perms
: Specifies the required rights to delete PaymentCycle. (Default:["200004"]
)gql_mutation_process_payment_cycle_perms
: Specifies the required rights to call theprocessBenefitPlanPaymentCycle
GraphQL Mutation. (Default:["200005"]
)
These options allow administrators to control access and permissions related to payment cycle data and calculations.
Dependencies
The Payment Cycle Reference Module relies on the following modules:
core
: Provides core functionality and utilities for the OpenIMIS system.social_protection
: Manages social protection-related information within the OpenIMIS system.contribution_plan
: Handles contribution plan data.calculation
: Facilitates calculation-related functionalities within the OpenIMIS system.
Ensure that these modules are correctly installed and configured for the Payment Cycle Reference Module to function correctly.
Payment Cycle Service
The Payment Cycle Service specifies a generic workflow for performing payment cycle calculations for various business objects connected to payment plans. It includes a specialized service for Benefit Plan objects. To trigger a calculation, the service requires a user reference, year, and month. Additional keyword arguments can be passed to the process()
method to be used in calculations.
Example usage:
result = BenefitPlanPaymentCycleService(user).process(year=year, month=month)
The result is a dictionary containing the status of the operation, indicating whether it completed successfully or encountered errors. It also includes messages and details of any errors that occurred during the calculation. Additional data returned from specific implementations of services and calculation rules are grouped by the ID of the main queryset entry (BenefitPlan ID in this case).
Please note that this documentation provides an overview of the features and components of the Payment Cycle Reference Module. For detailed information on how to set up, configure, and use the module, refer to the specific documentation and guidelines provided in the codebase and related resources. Additionally, the documentation is subject to updates and improvements as the module evolves, so make sure to keep it up-to-date with any changes you make.