components.payment_gateway.public.rules ¶
This module defines the public API for the rules subcomponent.
Only business logic is exposed here. Basic entities and enums are exposed in separate modules to avoid loading the entire subcomponent with its models and dependencies when they are not needed.
Classes¶
ExpenseLimitRuleNotFoundException ¶
Bases: PaymentRulesException
Exception raised when trying to use a non-existing Expense Limit Rule.
ExpenseLimitRuleTerminatedException ¶
Bases: PaymentRulesException
Exception raised when trying to use a terminated Expense Limit Rule.
ExpenseLimitsLogic ¶
This class is the public interface to the expense limit logic.
Implements the following Nullable patterns: - Nullables: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#nullables ⧉ - Parameterless instantiation: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#instantiation ⧉
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
Attributes¶
expense_limit_rule_actions
instance-attribute
¶
expense_limit_rule_queries
instance-attribute
¶
Functions¶
activate_expense_limit_rule ¶
Activate an expense limit rule.
Activating a rule will also set the start date to the current date.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
create
classmethod
¶
create_expense_limit_rule ¶
create_expense_limit_rule(
session,
/,
description,
reference,
card_id,
amount,
currency,
period,
criteria,
first_day=None,
is_active=False,
start=None,
end=None,
)
Create an expense limit rule for a card.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
create_null
classmethod
¶
Null factory
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
deactivate_expense_limit_rule ¶
Deactivate an expense limit rule.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
get_expense_limit_rule ¶
Get an expense limit from its ID.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
get_expense_limit_rule_ids_for_card ¶
Get all the expense limit rule IDs for a card.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
get_expense_limit_rules_for_card ¶
Get all the expense limit rules for a card.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
set_expense_limit_rule_validity_period ¶
Define the period when an expense limit rule is valid.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
terminate_expense_limit_rule ¶
Terminate an expense limit rule.
Usage restrictions in terminal state cannot be modified or used anymore.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
update_expense_limit_rule_amount ¶
Update the amount of an expense limit rule.
This operation can be safely performed in the middle of a validity period. The new limit will be applied to all future transactions.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
update_expense_limit_rule_criteria ¶
Update the criteria of an expense limit rule.
Warning: we don't know yet how this will behave when performed in the middle of a validity period with respect to the cumulated amount so far. Use with caution.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/expense_limits.py
InvalidValidityPeriodException ¶
Bases: PaymentRulesException, ValueError
Exception raised when creating or updating a Rule with invalid start/end dates.
PaymentRulesException ¶
Bases: PaymentGatewayException
Base class for all Rules exceptions.
UsageRestrictionRuleNotFoundException ¶
Bases: PaymentRulesException
Exception raised when trying to use a non-existing Usage Restriction Rule.
UsageRestrictionRuleTerminatedException ¶
Bases: PaymentRulesException
Exception raised when trying to use a terminated Usage Restriction Rule.
UsageRestrictionsLogic ¶
This class is the public interface to the usage restriction logic.
Implements the following Nullable patterns: - Nullables: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#nullables ⧉ - Parameterless instantiation: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#instantiation ⧉
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
Attributes¶
usage_restriction_rule_actions
instance-attribute
¶
usage_restriction_rule_queries
instance-attribute
¶
Functions¶
activate_usage_restriction_rule ¶
Activate a usage restriction rule.
Activating a rule will also set the start date to the current date.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
create
classmethod
¶
Normal factory
create_null
classmethod
¶
Null factory
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
create_usage_restriction_rule ¶
create_usage_restriction_rule(
session,
/,
description,
reference,
account_id,
criteria,
is_active=False,
start=None,
end=None,
)
Create a usage restriction rule for an account.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
deactivate_usage_restriction_rule ¶
Deactivate a usage restriction rule.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
get_usage_restriction_rule ¶
Get a usage restriction rule from its ID.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
get_usage_restriction_rule_ids_for_account ¶
Get all the usage restriction rule IDs for an account.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
get_usage_restriction_rules_for_account ¶
Get all the usage restriction rules for an account.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
set_usage_restriction_rule_validity_period ¶
Define the period when a usage restriction rule is valid.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
terminate_usage_restriction_rule ¶
Terminate a usage restriction rule.
Usage restrictions in terminal state cannot be modified or used anymore.
Source code in components/payment_gateway/subcomponents/rules/protected/business_logic/usage_restrictions.py
update_usage_restriction_rule_criteria ¶
Update the criteria of a usage restriction rule.