– id: banking_spend_transaction_threshold
description: Post Qualification rule for Banking Spend Transaction Threshold feature
defaults:
or:
short_circuit: true
rule:
when:
pattern: &banking-spend-when-pattern
type: r42.v2.spend.banking-transaction
data:
posted_timestamp: ?effective_timestamp
eligibility_enrichment:
– benefit_type: WELCOME_BONUS
feature_id: ?feature_id
product_id: ?product_id
qualified_transaction_bucket_id: ?bucket_id
profile_id: ?profile_id
ledger_request:
– outcome: ?lr_outcome
request:
feature_id: ?feature_id
product_id: ?product_id
book_type: accrual
product_details: ?product_details
condition:
and:
– description: Finding out the type of the feature
match: ?product_details
pattern:
– id: ?product_id
features:
– type: transaction_threshold
id: ?feature_id
data:
threshold: ?threshold
threshold_currency: ?currency
– &accrual_book_lookup
description: Looking up the accrual book value in keeper
location: ledger_book
pattern:
book_type: accrual
product_id: ?product_id
feature_id: ?feature_id
profile_id: ?profile_id
bucket_id: ?bucket_id
unit_of_value: ?currency
state:
status: ?book_status
balance: ?current_balance
– &empty_book_status_check
code: return (book_status == “”) || (book_status == null)
– &check_if_current_balance_reached_threshold
description: Checking if the current_balance is greater than or equal to the threshold
code: Nums.eval(current_balance, “>=”, threshold)
– &qualified_entry_id_binding
description: Binding the qualified entry id
match: ?lr_outcome
pattern:
entry_id: ?qualified_entry_id
action: &banking-spend-post-qual-action
ledger_request:
legacy_owner_keys: true #TODO: Remove this once downstreams support v2 ledger request schema
book_type: accrual
product_id: ?product_id
feature_id: ?feature_id
bucket_id: ?bucket_id
unit_of_value: ?currency
set_status: “QUALIFIED”
add_entry:
amount: 0
metadata:
effective_timestamp: ?effective_timestamp
goal_met: true
qualified_entry_id: ?qualified_entry_id
– id: banking_spend_deposit_threshold
description: Post Qualification rule for Banking Spend Deposit Threshold feature
rule:
when:
pattern:
<<: *banking-spend-when-pattern
condition:
and:
- description: Finding out the type of the feature
match: ?product_details
pattern:
- id: ?product_id
features:
- type: deposit_threshold
id: ?feature_id
data:
threshold: ?threshold
threshold_currency: ?currency
- <<: *accrual_book_lookup
- <<: *empty_book_status_check
- <<: *check_if_current_balance_reached_threshold
- <<: *qualified_entry_id_binding
action:
<<: *banking-spend-post-qual-action