Hi Amit,
I believe this piece of code should answer your questions:
https://github.com/2600hz/kazoo/blob/master/core/kazoo_services/src/kz_services.erl#L588-L597
Here you can see that non-direct master account's children, i.e.
sub-reseller's ones, assigned to local bookkeeper only.
Besides that, I can't resist to remind about recent Darren's comment
about Braintree:
https://groups.google.com/forum/#!topic/2600hz-dev/qXUWQup6TDc
I use Braintree for accounts topup only, but manage subscriptions
logic at Kazoo locally, therefore don't feel described by Darren
inconvenience with Braintree personally.
I didn't touched subresellers logic yet (coming soon), but to
achieve needs you described, I believe first of all you need to:
- patch bookkeeper selection logic;
- (maybe you'll want to) patch braintree module in order to make
resellers able to use their own braintree merchant accounts to bill
its children, I doubt such PR will be accepted.
This way you probably will still be able to use Braintree
subscriptions management feature (who knows).
(IMHO!!!) Using Braintree subscriptions management feature was
implemented in Kazoo as an easy way just for fast start.
In my opinion it is better to implement your very own bookeeper and
kazoo_app to manage subscriptions.
Implementing of your own bookkeeper could start from making changes
to kz_bookkeeper_braintree.erl
Here is an example of mine:
https://github.com/onnet/onbill/blob/master/src/misc/kz_bookkeeper_onbill.erl
Some differencies from out of the box billing implementation:
- all MRC and ProratedMRC withdrawls are made from local account
balance (not from credit card);
- withdrawls are made immediately after purchase to get a bit closer
to realtime balance (still account could go negative a bit);
- you can select to charge MRC on monthly or on daily basis;
- etc
Hope some ideas will be usefull for you.
Regards,
Kirill