version = 1
status = active
UUID = 0a1b6d5671a69f129-5cc1afa3-4fc64919-ac47a53d-2a99c235eaa8e111f5fb2b2b
calculation_rule_name = “payment: fees “
...
dateValidFrom = 2000-01-01
from_to: [{“from”:”BatchRun”,”to”:”Bill”}, {“from”:”InvoicePayment”,”to”:”BillItem”}]
list of impacted parameters: NULL (will take data from product, claims … )
{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 “
...
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__ ==
...
get all paid contribution that matches args
create a bill through the converters
...
contribution
return fee_rate / 100 * contribution value
convert(from, to, context,**agrs)
if context == BatchPayment
argv:
batch_id
sub_type,
product_id,
...
Registration on signals from other module(existing or not):
billCreationFromCalculation
Batchrun will trigger billCreationFromCalculation and will send: when the payment plan would be deliver the batch run page could be replaced by payment plan (this page could call billCreationFromCalculation service on selected payment plans) page and bill pageconvert_batch for all the product part of it.
if active_for_object(<fakepaymentplan><paymentplan>, 'submit', type, sub_type):
...
paymentplan>, *args[date_from, date_to, productid, location])
...
then convert IF payment
one accountPayable per type of payment (TBC)
one asset (line) per product/commission, sum of policy value as quantity, Payment fees as unit price, product account code as ledger account
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 |
| ||
amount_total | float | net | ||
amount_net | float | total |