BNPL| Rule Based Convenience Fee Calculation

 


  1. m_charge changes
    a. charge_identifier:- “CVF”
    b. charge_event_type:- 3 (BILL_GENERATION)
    c. charge_category_enum:- 4 (CONVENIENCE_FEES)
    d. charge_calculation_enum:- 2 (PERCENT_OF_AMOUNT)
    e. charge_time_enum:- 51 (EVENT_BASED_FEE)
    f. charge_applies_to_enum:- 5 (CREDIT)

  2. INSERT INTO `f_credit_line_transaction_config` (`id`, `applicable_charge_config`, `version`) VALUES (1, '{\"ruleName\": \"creditAccountTransactionApplicableCharges\"} ', 0);
  1. Insert into f_system_sql

    INSERT INTO `f_system_sql` ( `uname`, `description`, `sql`) VALUES ( 'creditlineTransactionBillStatus', 'creditlineTransactionBillStatus', 'SELECT IF(fcatad.is_billed=0 || COUNT(fcatad.is_billed)=0 , \"UNBILLED\", \"BILLED\") AS billingStatus FROM f_credit_account_transaction_additional_detail fcatad WHERE fcatad.transaction_identifier=?;');
  2. Insert into f_risk_rule

    INSERT INTO `f_risk_rule` ( `entity_type`, `name`, `uname`, `description`, `default_value`, `value_type`, `possible_outputs`, `expression`, `is_active`, `version`, `definition_type`, `created_on`, `status`) VALUES ( 4, 'creditAccountTransactionBillStaus', 'creditAccountTransactionBillStaus', 'creditAccountTransactionBillStaus', '1', 0, '[]', '{\n \"inputs\": [\n \"transactionIdentifier\" \n ],\n \"outputs\": {\n \"billingStatus\": \"String\"\n },\n \"outputProvider\":\"BUCKETEXPRESSION\",\n \"outputBuckets\": [{\n \"label\": \"Credit Line Transaction Bill Status\",\n \"expressions\": [\n \"true\"\n ],\n \"output\": {\n \"billingStatus\":\"#sqlUtil.fetch(\'creditlineTransactionBillStatus\',0,#transactionIdentifier)\"\n }\n }]\n}', 1, 1, 2, NULL, NULL), ( 4, 'creditAccountTransactionApplicableCharges', 'creditAccountTransactionApplicableCharges', 'creditAccountTransactionApplicableCharges', '1', 0, '[]', '{\n\"dependsOn\": [{\n \"rule\": \"creditAccountTransactionBillStaus\",\n \"version\": 1\n }],\n \"inputs\": [\n \"transactionIdentifier\",\n \"transactionType\",\n \"billingStatus\"\n \n ],\n \"outputs\": {\n \"chargeApplicable\": \"String\",\n \"chargeType\":\"String\"\n },\n \"outputProvider\": \"BUCKET\",\n \"outputBuckets\": [\n {\n \"label\": \"PAYOUT_TRANSACTION\",\n \"expressions\": [\n \"#billingStatus ==\'UNBILLED\' && #transactionType==\'PAYOUT\'\"\n ],\n \"output\": {\n \"chargeApplicable\": \"CVF\",\n \"chargeCategory\":\"CREDIT\"\n }\n },\n {\n \"label\": \"UNDO_PAYOUT_TRANSACTION\",\n \"expressions\": [\n \"#billingStatus ==\'UNBILLED\' && #transactionType==\'UNDO_PAYOUT\'\"\n ],\n \"output\": {\n \"chargeApplicable\": \"CVF\",\n \"chargeCategory\":\"DEBIT\"\n }\n },\n {\n \"label\": \"RETURN_TRANSACTION\",\n \"expressions\": [\n \"#billingStatus ==\'UNBILLED\' && #transactionType==\'RETURN\'\"\n ],\n \"output\": {\n \"chargeApplicable\": \"CVF\",\n \"chargeCategory\":\"DEBIT\"\n }\n },\n {\n \"label\": \"DEFAULT\",\n \"expressions\": [\n \"true\"\n ],\n \"output\": {\n \"chargeApplicable\": \"\",\n \"chargeCategory\":\"\"\n }\n }\n ]\n}', 1, 1, 2, NULL, NULL);