That's not what "long tail" means in insurance. It does not mean unlikely, it means the claim might need to be paid out years after the period coverage was paid for. (Think current lawsuits about asbestos exposure from the 1970s).
I would have also done a separate article separating paying premiums to the carrier from the carrier paying out claims. Those are basically two totally different parts of the insurance company, with different systems (usually) and definitely from different bank accounts.
Source: built a fairly large insurance company with zero client money accounts by using Stripe Connect
Disclosure - we are locked into processing card payments with Stripe only, but have no incentive to say nice things about them
with this you mean you don't get money from them to promote them. Please correct me if I'm wrong.
or some such. In addition to being ready for foreign currencies, you can build in type safety to ensure that nobody does something meaningless like "60 dollars times 90 dollars", and prevents you from accidentally asking for $6,000 when you meant $60. It's less efficient, to be sure, and you have to implement all of those operations like "addition", but it's a case where being excruciatingly, provably correct seems more important than a few extra bucks on servers.
With that said, it's better not to reinvent the wheel here and follow the flow, and it's also the safer option— it's better to charge a customer $10 when you meant to charge them $1000, than it is to charge them $1000 when you meant to charge them $10.
[1] https://stripe.com/docs/api/charges/object#charge_object-amo...
In financial transactions on the other hand, we always need only 2 decimal places. So there is no benefit in using floating point.
For example, interest accrued daily, but only ‘compounded’ monthly. In those cases, it is necessary to maintain far more than the 2 decimal places for the daily accruals.
The best type to use here would be BigDecimal or equivalent. These ultimately serialise to infinite length strings.
https://developers.google.com/standard-payments/reference/gl...
Really, it’s about rounding and floating point math.