Payment plan calculation rule: fees

version = 1
status = active
UUID = 1a69f129-afa3-4919-a53d-e111f5fb2b2b
calculation_rule_name = “payment: fees “

type = account_payable

sub_type = fees

dateValidTo = None

dateValidFrom = 2000-01-01

from_to: [{“from”:”BatchRun”,”to”:”Bill”}, {“from”:”InvoicePayment”,”to”:”BillItem”}]

list of impacted parameters:

{class:"PaymentPlan", ‘parameters':[

{'type':"number",'name':"fee_rate",'label':{'en':'fee rate(%)',’fr':'Taux de frais(%)'},'rights':{'read':"157101", “write':'157102', 'update’:'157103','replace’:'157206'}, relevance:"True",condition:".$_<100",'default':'1.5'},

{'type':"string",'name':"paimentOrigin",'label':{'en':'Paiement origin',’fr':'Origine de paiement)'},'rights':{'read':"157101", “write':'157102', 'update’:'157103','replace’:'157206'}, relevance:"True",condition:"True",'default':''},
]}

description = “ This calculation will, for the selected level and product, calculate how much the insurance need to pay the payment platform for the fee for payment service “

Service

activeForObject(self, instance, context, type, sub_type)
instance.__class__ == PaymentPan and context IN (batchPayement) and self.checkCalculation(instance)

 

check_calculation(cls, instance)

if instance = BatchRun

check_calculation(cls, location)

else if instance == Location

for each Product where Product.locaiton = Location:

check_calculation(cls, Product )

else if Product

if there active payment plan for Product and self.UUID return true

calculate(cls, instance, *args[date_from, date_to, productid, location])
instance.__class__ == contribution

return fee_rate / 100 * contribution value

 

 convert(from, to, context,**agrs)

if context == BatchPayment

argv:

  • batch_id

  • sub_type,

  • product_id,

Batchrun will trigger convert_batch for all the product part of it.

if active_for_object(<paymentplan>, 'submit', type, sub_type):

paymentplan>, *args[date_from, date_to, productid, location])

then convert IF payment

  1. one accountPayable per type of payment (TBC)

    1. one asset (line) per product/commission, sum of policy value as quantity, Payment fees as unit price, product account code as ledger account

    2. one asset (line) per policy : policy value as quantity, Payment fees as unit price, product account code as ledger account (dependent detail as asset description)

bill:

field

type

comment

subject_type

json

batch_run

subject_id

json

run_id

 thirdparty_type

str

Payer

 thirdparty_id

id/uuid

PayerID (don’t know what else)

 code

 str 

Paymentplan_code-PayerID-YYYYMM

 date_due

 date 

batch run date +30 days

 date_invoice

 date 

batch run date

 *dateValidFrom

 date 

validFrom: first day of batch run

 *dateValidTo

 date 

validTo: last first day of batch run

 amount_discount

 float 

N/A

 amount_net

 float 

Total without tax

 tax_analysis

 json 

N/A

 amount_total

 float 

total net

 status

 int 

validated

 currency_rcp_code

 str 

default-curency

 currency_code

 str 

default-curency-code

 note

 bigttext 

 

 terms

 bigttext 

  Product: Product Name, fee_rate

billItem

field

type

comment

line_id

 

Premium_id

line_type

 

Premium

code

 str 

Paymentplan_code

description

 str 

 

details

 json 

Head of family CHFID

ledger_account

 int 

N/A

quantity

 float 

1

unit_price

 type 

fee value

deduction

float

n/a

discount

float

1-(rate of fee/100)

 tax_rate

 Calculation uuid 

N/A

tax_analysis

json

1

amount_total

float

net

amount_net

 float

total