• Resolved jenskirk

    (@jenskirk)


    Hi ??

    In the VirtueMart module for QuickPay there is a field where we can define a 3. party url.

    If defined the callback from QuickPay runs this 3. party call after it has ended what it needs to do (updating the webshop order and so one).

    We use this feature to call our accounting integration (E-conomic in our case) meaning that the shoppers get their order confirmation (or invoice if case of virtual products) in a few seconds after they have paid.

    In other words the last part of the callback feature ends in call an accounting integration so it can create an order or even invoice it and send it to the shopper.

    This creates a live and quick connection to the accounting system and we can send orders and invoices from E-conomic (and any other online accounting system) to the shoppers.

    It looks so much more professional – and the bookkeeper does not need to do anything.

    Can the code belov be converted into the WooCommerce module for QuickPay too?

    And where can I place it. I have tried looking in the files but have not yet found the right place.

    And can it perhaps become a feature in the official version (like is it for VirtueMart)?

    Here is the code:

    // Now notify any third party services
    if ($method->quickpay_thirdpartyapi != '' && $request->accepted && $operation->qp_status_code == "20000") {
    	$apiurl = $method->quickpay_thirdpartyapi;
    
    	$lang = JFactory::getLanguage();
    	$lang_code_explode = explode("-", $lang->getTag());
    	$lang_code = strtolower($lang_code_explode[1]);
    
    	$apiurl = str_replace('[LANGUAGE]', $lang_code, $apiurl);
    	$apiurl = str_replace('[ORDER_ID]', $virtuemart_order_id, $apiurl);
    	$apiurl = str_replace('[TRANSACTION_ID]', $request->id, $apiurl);
    	$apiurl = str_replace('[PAYMENT_METHOD_ID]', $payment->virtuemart_paymentmethod_id, $apiurl);
    
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_URL, $apiurl);
    	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Important for HTTPS
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    	$output = curl_exec($ch);
    	curl_close($ch);
    }
Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter jenskirk

    (@jenskirk)

    I improved the code in file woocommerce-quickpay.php in line 890 where I inserted this:

    //NOTE: Should read from a field value that is set via the GUI (hardcoded for now)
    $apiurl = "https://www.aClientSite1234.dk/index.php?option=com_economic&task=processor&action=payment_callback&order_id=WO-[ORDER_ID]&paymentmethod_id=[PAYMENT_METHOD_ID]&transaction_id=[TRANSACTION_ID]&format=raw";
    													
    $apiurl = str_replace('[ORDER_ID]', $json->order_id, $apiurl);
    $apiurl = str_replace('[TRANSACTION_ID]', $json->id, $apiurl);
    $apiurl = str_replace('[PAYMENT_METHOD_ID]', "", $apiurl); //Note: Not used yet
    				
    $ch = curl_init();								
    curl_setopt($ch, CURLOPT_URL, $apiurl);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //Note: Or true if correct HTTPS
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);				
    $output = curl_exec($ch);				
    curl_close($ch);

    Can this become a future part of the official version? And with a field for the URL API value that the webshop owner can set the GUI? People using E-conomic, Billy and Dinero needs this very much in order to have live integration / synchronization with their accounting system.

    • This reply was modified 8 years, 2 months ago by jenskirk.
    • This reply was modified 8 years, 2 months ago by jenskirk.
    Plugin Author PerfectSolution

    (@perfectsolution)

    Hi ??

    Making such an implementation is neither very flexible nor scalable. A possible solution could be to extend the use of hooks in the plugin which will add the possibility for developers to create their own add ons. I will look into that in a future update!

    Thread Starter jenskirk

    (@jenskirk)

    Hi ??

    So if I understand you correctly you will look into extending the use of hooks (in WooCommerce or in the QuickPay payment module)? It is not something that is there already in the way we need it?

    We are looking very much forward to a solution – and not just hacking / hardcoding the call to the accounting system integration into the quickpay file. The QuickPay module for VirtueMart (Joomla) does have a API URL field in it’s GUI where we can insert the address for the account system integration. And it works great. But we like a good solution for our WooCommerce clients too.

    It is very nice that the buyer gets the order confirmation PDF / invoice PDF sent from the accounting system integration in an e-mail just after the payment has been completed.

    More and more companies wants the account system to send the orders and invoices because they look nicer and the buyer gets the same information as the bookkeeper sees in the accounting system.

    We are mostly using E-conomic but it is very relevant for the other webbasted accounting systems also.

    Thank you for all your work ??

    Plugin Author PerfectSolution

    (@perfectsolution)

    Hi ??

    Yes, we will look into extending the QuickPay module in a way where you can make these hook integrations yourself. It is by far the best and most flexible solution to your problem. It is not possible in the current version though, but I might be able to implement it in the next version of the plugin.

    Thread Starter jenskirk

    (@jenskirk)

    Sounds soooo great ??

    Thread Starter jenskirk

    (@jenskirk)

    Perhaps it already has been solved in this ticket?
    https://stackoverflow.com/questions/33816480/woocommerce-payment-complete-hook

    Plugin Author PerfectSolution

    (@perfectsolution)

    Woocommerce indeed already has hooks that could solve your problem. Depending on requirements, some solutions might require more work and in-depth knowledge regarding the QP API.

    Plugin Author PerfectSolution

    (@perfectsolution)

    Callback action added in 4.6.0.

    See the list of available hooks here:

    https://quickpay.perfect-solution.dk/developer/actions-and-filters

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Suggestion: Notify third party service if defined’ is closed to new replies.