0
Good night,
Recently I came across a situation that left me very in doubt, is a module of a system that calculates the value to be paid for a service and for this all rules are expressed in a table in the database, for examples let’s imagine the table below.
Let’s imagine that there are many rules that are registered and that these are parameters to verify if the amount to be paid for the service is entire or only half, I want the opinion on how you would implement such a case.
What’s been on my mind ?
Implement a Rewrite object calculation and in the calculation method of the Service object it would receive as parameter the Rewrite calculation, example:
$servico = new Servico(etc...);
$valorServico = $servico->calcularPagamento($regraDeCalculo);
//$regraDeCalculo consegue consultar o banco em busca da regra específica para o serviço
I’m really lost already I appreciate any help.
Thank you very much, you took away my doubt.
– Andre AL