Plugin/Modul trigered before invoice


https://forum.kartris.com/Topic1945.aspx
Print Topic | Close Window

By askomit - Thu 25 Apr 2013
Hi,

I found Kartris surfing Google and decided to give it a try and liked it.

So i decided to use it for all future projects and my own web site.

Situation is in Croatia that we must give out fiscal invoices, and for this before issuing invoice, i need to have/develop a module that will send basic invoice details to Croatian tax authority (invoice total + invoice taxes + invoice number + unique invoice number), and i get back unique number from them back. This two numbers must be on invoice...

Also, invoice number is regulated by law... and it looks like this

operator id / store id / invoice id

I have a dll module for contacting the tax authority.... i just need pointers where can i find in code place or how to trigger this... invoice should be issuied only after payment is cleared and this should be automatic...

Any help/pointers are welcome...

I'm in negotiations for one store now, and i'll always include in my price commercial license for Kartris to support further development....

p.s. this is for Kartris 2.
By Mart - Thu 25 Apr 2013
Assuming you are using a credit card gateway then there is a page called the "call back" which is called by the credit card gateway once a transaction has been successful.

This notifies Kartris by passing back the ID of the transaction we passed over to the gateway. Kartris can then send mail to customer and merchant, deplete the stock level of the product (if stock tracking is being used) etc.

So you'd want to add your code to this - as it will then only run when a transaction has completed.

So I guess you'd largely be working in callback.aspx and its associated vb page.
By askomit - Thu 25 Apr 2013
So there is no global trigger event that is called after we get payment successful ... I have to add that to every payment processor type...?

Or is there one file that actually creates invoice after its payed? so i can add there?

Maybe you could add that in some revision...

WHMCS has that pretty good covered... (kind of store/support/ticketing software for web hosts)

They call it action hooks...

"

What is a Hook?

Action Hooks allow you to add your own code to WHMCS that runs when specific events or actions occur inside the system."

http://docs.whmcs.com/Action_Hooks

Maybe something like this could be in one of the next versions off Kartris. I think it would help develop and maintain plugins/modules a lot...

So you don't have to worry every update to update manually code for every payment processor if needed...

There is one directory called includes and inside its directory call hooks...

so here would come one small file for every plugin/module that should be triggered on some event and in this file it would be specified on which event ... and in it calls to actual plugin that does the work

This is just a suggestion for future versions ... hope you like it ... i think WHMCS did this pretty good there... But its in PHP so i don't know how or even if its possible to implement here...

Maybe in one of next revision just add one aspx file where we can manualy add plugins/modules to be trigered on some event... add sections with events and just add your stuff under that section.. like some config file that would not get overwritten on update Smile
By askomit - Thu 25 Apr 2013
i was browsing thru code today to look for callback file and came to conclusion

i'll have to add new table in database to hold order ID, new invoice id, date of invoice, ZKI number, JIR number, payment type (cash, casg- credit card, transaction account etc) and some other fields...

One other question, if i delete order in kartris (after invoice was created) is it deleted does it really delete it from database or only marks as deleted?

In EU, well Croatia atleast, you must have invoice numbers in a row... so if i isue invoice 1 with some date, invoice number 2 must be next, and date must be same date as invoice 1 or newer... you cant skip numbers....

and if invoice is invalid, you cant just delete it but make storno of it... and actualy isue new invoice with everything in negative value, and commet that its storno of invoice number lets say 2...

i'll be writing some code for it ... but i hope you will be able to help me a little bit, cose i'll give complete code to comunity...

and one stupid thing in our law

on invoice it must be clearly stated type of payment, and they treat credit and debit cards as cash and you must write on invoice for example if its pure cash: cash bills ... if its credit card you must write: cash credit card... very stupid thing...
By Paul - Fri 26 Apr 2013
At present, the callback.aspx.vb would be the place to put this code. This same page gets called by all remote type payment systems (passing a parameter to indicate which payment system DLL to use), so the code should trigger even if you have multiple payment systems in place.

The hooks looks like an interesting idea, but I think it's probably done to provide access to various parts of the transaction process on a system where source code isn't available. With full source code you effectively have full control, you can insert code anywhere and it's really more flexible.
By askomit - Fri 26 Apr 2013
thats true ... when you have source code is more flexible, but also, you can loose customizations after update ... Smile if you are not extra careful...

i'm trying to decide what would be right direction for invoice problem to take... so i can implement...
hmmm

any suggestions?

is it possible to automatically add new menu item in backed/admin? or i have to edit and manually add it