Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 3:57 pm
Predictive Dialer


All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: sepa / direct debit
PostPosted: Wed Nov 05, 2014 9:12 pm 
Offline

Joined: Tue Mar 17, 2009 4:00 pm
Posts: 153
Location: Where the sun shines
Hello

I am an old user, running on a2b 1.4... I wanted to get the direct debit in place, european style sepa, and did some work on it that I am ready to share. you'll still have to do some work though if you're interested.

I have written a quick & dirty batch (real dirty...) that works for any payment after the first (they are a bit different, and I do them through the web). it fetches from a custom table the accounts details (iban, bic, rum, signature date, etc...), and then looks for any invoice still due (issued after the dd mandate date), and generates the XML file, then post the entries into the cc_logpayment and cc_invoice_payment tables.


as of this minute, the code is not really ready to be shared, but if there is some interest, I can add a bit of work to share it.

Let me know !

J.


Top
 Profile  
 
 Post subject: Re: sepa / direct debit
PostPosted: Mon Nov 17, 2014 12:13 am 
Offline

Joined: Thu Sep 13, 2007 12:46 pm
Posts: 254
Location: Naples, Fl ( USA )
cerien wrote:
Hello

I am an old user, running on a2b 1.4... I wanted to get the direct debit in place, european style sepa, and did some work on it that I am ready to share. you'll still have to do some work though if you're interested.

I have written a quick & dirty batch (real dirty...) that works for any payment after the first (they are a bit different, and I do them through the web). it fetches from a custom table the accounts details (iban, bic, rum, signature date, etc...), and then looks for any invoice still due (issued after the dd mandate date), and generates the XML file, then post the entries into the cc_logpayment and cc_invoice_payment tables.


as of this minute, the code is not really ready to be shared, but if there is some interest, I can add a bit of work to share it.

Let me know !

J.


I am interested send me the code if you will and will work on it too.


Top
 Profile  
 
 Post subject: Re: sepa / direct debit
PostPosted: Mon Nov 17, 2014 6:32 pm 
Offline

Joined: Tue Mar 17, 2009 4:00 pm
Posts: 153
Location: Where the sun shines
I am just finishing up the processing of the first payments, so only one file gets sent per month (which reduces the costs). that should be done by the end of the week, I'll post everything then

J.


Top
 Profile  
 
 Post subject: Re: sepa / direct debit
PostPosted: Thu Nov 20, 2014 8:33 pm 
Offline

Joined: Tue Mar 17, 2009 4:00 pm
Posts: 153
Location: Where the sun shines
ok, here we go....

first, after I wrote this process, I found a public php class for dd, which would have been helpful: https://github.com/digitick/php-sepa-xml

second... code is provided as is, no guarantee expressed or implied, yada yada yada... no specific licence, just use it

third.... it is based on a2billing 1.4, with one change; I've added two columns on the table cc_invoice, total_amount and open_amount, which make life easier for reporting. they are updated with triggers. no perf issues as the base tables are not updated that often.

alter `cc_invoice` add (
`total_amount` decimal(15,5) DEFAULT '0.00000',
`open_amount` decimal(15,5) DEFAULT '0.00000',
) ;

the triggers are in the attached file http://pastebin.com/17xZTwSg

then I've created two tables that hold the customer's bank detail
http://pastebin.com/hdujZvKD
No gui is provided, just insert the data in direct_debit - it is only needed once - in addition to the obvious fields, rum is the Unique Mandate Reference, isactive is just a switch that says if dd is activated (you may want to suspend/disable), and isfirst should be set to 1 for the first direct debit. My undestanding of SEPA is that the very first debit for a customer should be in a separate payment info block, so that's what it's used for.

the script consists of two files:
- holidays.php : http://pastebin.com/GijvX0nJ
- sepa.php : http://pastebin.com/bK3Dfi6w

obviously, the meat is in the sepa.php - you'll need to customize the first variables, and probably the $detailqry & $postqry so they select only the invoices you require.

the script first generates the file, then updates the database. error processing is minimal....
note that before doing any db updates, you are prompted, so you can review the file before screwing your db !


So far, I've successfully issued 2 files to my french bank, the sepa file also passes various sepa validators online.

Feedback is appreciated !

Enjoy !!!

J.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 
Hosted Voice Broadcast


All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group