Sweet. Thanks Darryl As I have never started a plug in from scratch (I have always just copied an existing plug in and edited it), I don't quite know where to start. Would I just create a normal Plone Product and add these two files to it?
2009/7/22 Darryl Dixon <[email protected]> > Hi Hannes, > > This is/should be relatively straightforward. In NZ we have a flat GST > regime of 12.5% and I wrote a tax plugin to add this to all orders. It was > only very small. I don't know if my way was 'right' but It Works For Me(tm) > > > dix...@ganymede:~/src/getpaid.gst/getpaid/gst$ cat overrides.zcml > <configure xmlns="http://namespaces.zope.org/zope"> > > <!-- Taxes --> > <utility factory=".tax.TaxUtility" /> > > </configure> > > > dix...@ganymede:~/src/getpaid.gst/getpaid/gst$ cat tax.py > import decimal > from zope.interface import implements > > from getpaid.core.interfaces import ITaxUtility > > from getpaid.gst import getpaidgstMessageFactory as _ > > class TaxUtility(object): > implements(ITaxUtility) > > def getCost(self, order): > """Calculate GST at 12.5% on the subtotal and any shipping costs""" > return float(order.getSubTotalPrice() + order.getShippingCost()) * > self.tax_rate > > def getTaxes(self, order): > return [{'value' : self.getCost(order), 'name' : self.tax_name}] > > > def getTaxOnSum(self, sum): > """Return the GST value of a price, rounded to the nearest cent""" > return float('%.2f' % (sum * self.tax_rate)) > > @property > def tax_rate(self): > return 0.125 > > @property > def tax_name(self): > return _(u"GST") > > > dix...@ganymede:~/src/getpaid.gst/getpaid/gst$ cat __init__.py > > from zope.i18nmessageid import MessageFactory > > getpaidgstMessageFactory = MessageFactory('getpaid.gst') > > > > Hope this helps, > > regards, > Darryl Dixon > Winterhouse Consulting Ltd > http://www.winterhouseconsulting.com > > > > > On Wed, Jul 22, 2009 at 5:11 PM, hannesc <[email protected]> wrote: > >> >> I need to start developing some sort of Tax add-on for GetPaid, and by >> the look of things, it seems that just perhaps I will have to dive >> into the PloneGetPaid code itself. What I basically need to start >> developing is a plugin that adds 14% VAT to all orders. >> >> Before I start working on such a plugin, I wanted to know if anyone >> has already started something similar that I could perhaps look at >> before starting on a something from scratch. >> >> Thanks >> Hannes >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "getpaid-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/getpaid-dev?hl=en -~----------~----~----~----~------~----~------~--~---
