Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Guillaume

  1. Hi, Thanks for your feedback. At line 2041, I can see a check on countries to see if the gateway is available in a given country (I'm enclosing the file cubecart.class.php which I have): cubecart.class.zip Before trying to play with hooks and snippets, I tried customizing myself the function _displayGateways (starting at line 1913), which I appreciate is semi-deprecated, but I didn't see any better position to try inserting this piece of code. Attempt 1, I've added two characteristics of the module "instalments_min_amount" and "instalments_max_amount" (appreciate I could have made the naming more genric...) and added, after line 2041 the two following conditions. But it proved useless, it seems to be ignored (min amount is 100, and a basket which total value was 20 was displayed the payment method) Attempt 2 was somewhat more radical, where I inserted a false condition (see below) after line 2041. Again it didn't change anything and all gateways are displayed My takeaway from this is that, for one reason or the other, the _displayGateways function either is not called, or does not work as expected. As such I'm not sure if it's relevant to try to use the hooks which are within the function? Happy to try, but being unfamiliar with hooks and snippets, I just want to make sure first, that the function is called indeed. Again, thanks so much for your help. Best regards, Guillaume
  2. Having had a further look at this, would it make sense: either having a hook to enable each module making basket conditions, near line 2041 of cubecart.class.php (where we have other basket conditions)? or including some basic basket conditions (e.g. on amount) triggering the display/hide of the gateway? or both?
  3. Sure: A first (Beta) version of the "Pay by Instalments" version was uploaded and published to Cubecart on 3rd June 2021 - under the name Systempay - downloaded 86 times so far A second version of the above was just published yesterday. For IP reasons, I had to rename it "Paiement CB France par Améo - Paiement en plusieurs fois" A similar version for straight payment (not by instalments) was also published yesterday. It is named "Paiement CB France par Améo" In the next version I'd like to male a couple of improvements and solve a couple of bugs, included the one mentioned here. Note that I have been in touch with Lyra (which owes all the payment gateways accessible through this module) to have the module officially referenced on their website. The certification process on their side is ongoing.
  4. Hi, Would really appreciate any insight anyone may have here. Is there any way to clearly rule out, from Cubecart's perspective, whether the cookies are deleted? E.g. can I look for a cookies log in Cubecart? What I am not getting in the first response is "CubeCart does not know what the customer_id is supposed to be". I believe it does, because the customer is still logged, and his cart is still present (besides the order being recorded in his account). I am rather under the impression that when the ?_a=complete is called, for some reason the cart is not emptied, possibly because it is called incorrectly. However, I am not sure how to verify that... Any hint very appreciated. Best regards, Guillaume
  5. Hi, Thanks a lot for your feedback - really appreciate your help. I was trying so far with Firefox, and don't think I have any such add-on. I tried with Chrome (where I have no add-on for sure), same result. I am not really sure what to do next: how are IPN usually managed in the case the user closes the window? I'm afraid I can't really test to that extent on other gateways, as I would need a test key to get the payment through. What really puzzles me is that the IPN seems to be taken into consideratio, as the function call() is used indeed (I can see that as it logs the transaction). But solely when it comes to emptying the cart that fails. Could there be anything wrong with the cart emptying command we've defined? Cheers, Guillaume
  6. Hi, Thanks a lot for this detailed answer. The way I understand it is, that whenever a customer comes back to Cubecart, Cubecart will try to retrieve from the database their basket. This would explain that merely deleting the cart from the session (with the below) does not work, because Cubecart would subsequently retrieve the cart from the DB and put it back in session: $GLOBALS['session']->clear(); $GLOBALS['session']->delete('basket'); Now I've tried the below, which you suggested, but for some reason it does not work: $GLOBALS['db']->delete('CubeCart_saved_cart', array('customer_id' => $order_summary['customer_id'])); $GLOBALS['cart']->clear(); I've checked and the instruction seems corect, as in the logs the customer_id is correctly filled in, both for the cart and the order_summary. What also puzzles me is that I have the below instruction (where redirection is towards the index.php?_a=complete page) in my code: httpredir($redirection, '', true, 200, true); Where you mentioned a cart clearance is conducted. That works perfectly when I don't close the window. But for some reason it deosn't when the window is closed. I guess my next step is to read the database and make sure the instruction in database is correctly executed. Guillaume
  7. Hi, This is a continuation of this topic: So I have developped a payment module, which has a gateway.class.php file with a call() function in it. This time, my call() function is called, I know it as I log transaction notes, and they are exactly reported as instructed in such function. However, on the payment gateway: If I let the payment page go through and come back to the store URL, the order is indeed registered and the cart is emptied If I close the window after the payment is accepted, although the order is registered, the cart is not emptied What puzzles me is that the transaction logs are filled in as instructed in the call() function, and right below this instruction which I know is processed, I have put a: $GLOBALS['cart']->clear(); But in case 2, the cart is never emptied. And to be very honest, even commenting the above instruction e,ptying the cart, in case 1 the cart is emptied nevertheless. Any hint on how I could make sure the cart is emptied? Best regards, Guillaume gateway.class.php
  8. Thanks that was very helpful! The error log showed several similar notices and warning (benign, as you said) and one exception regarding a call which is made to Parcel2Go. Deactivating the Parcel2Go module, everything now works normally. I am copying the Parcel2Go error below. It might be that everything failed because we backed up recently and there were no setting filled in in that module, although it was activated. Thanks a lot again! [<strong>Exception</strong>] /home/clients/730d21bd55854ec4d0c02aa159bd4077/sites/www.temp-alerte.com/modules/shipping/Parcel2Go/shipping.class.php:25 - SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://v3.api.parcel2go.com/ParcelService.asmx?WSDL' : failed to load external entity "https://v3.api.parcel2go.com/ParcelService.asmx?WSDL" https://www.temp-alerte.com/index.php?_a=confirm
  9. Thanks for the prompt answer. Here we go: The only update I have made to the SMARTY template is in admin/index.inc.php, I have the following: $GLOBALS['smarty']->assign('STORE_URL', CC_STORE_URL); I am not sure where the System Error Log is displayed? Is that in the admin panel? I didn't find the error log you are referring to Regarding the PHP error log, I followed the procedure you mentioned on the forum linked you posted. And I got the enclosed error log. What really puzzles me is that the error seems to be referring to functions and variables which are core Cubecart and which (to my knowledge) I have not touched Any thoughts? error_log
  10. Hi, I know I should probably give more details, but I don't know exactly where to start the investigation. For a reason which I ignore, I am getting a blank page on index.php?_a=checkout (when trying to proceed with the cart recap right before payment page) and on index.php?_a=confirm (when trying to add an item to the basket). I believe it's solely a php issue (nothing coming from the back-end), as I can still proceed with payment by anually changing the URL to index.php?_a=gateway. After payment I am redirected to index.php?_a=complete and can see the order summary - no problem. I tried doing a back-up of my Cubecart folder to a date where things worked ok, but it didn't help. Maybe I did it wrong though... I usually get this blank page whenever my code has a syntax error. I'd like to be able to check the file which drives these index.php pages. The file index.php looks absolutely ok and hasn't been touched for a while. Any hint as of where I could start investigating from would be very welcome! Guillaume
  11. Sorry, I should have tried this before asking. What you describes worked perfectly indeed!
  12. Cheers, I used the following in admin/index.inc.php: $GLOBALS['smarty']->assign('STORE_URL', CC_STORE_URL); And was eventually able to re-use it in skin/admin/index.tpl. For a reason I did not understand, I was not able to assign other variables. But I didn't investigate that much, as I have enough with $STORE_URL and $VAL_SELF
  13. Hi, On the payment gateway I am developping, I am trying to define cool default values for the admin, so that they need to configurate only the very minimum. In particular, for the return URL, I'd like to set a default value equal to $GLOBALS['storeURL'] . '/modules/gateway/MyGateway/return.php' But how can I access such a global variable from index.tpl? I have seen a couple of global variables being called in index.tpl, e.g. $VAL_SELF, $SESSION_TOKEN, etc. but the naming did not seem to match what is used in php. Appreciate any help! Best regards, Guillaume
  14. Hi, In my payment gateway, for safety reasons, I would like to check the form's signature (to ensure the response is genuinely from the payment provider). For that purpose, I need to use a couple of settings which are input by the admin of the module's settings page, namely: the certificate, the mode (test or prod) and the encryption algorithm). But while a simple $mode=$this->_module['mode'] works perfectly in fixedVariables() function, it stays empty when called in call() function. I have tried the below, but with no luck: $this->_module = $GLOBALS['config']->get($module); Is there any reason why I need to specifically call the module's settings differently in that function? Best regards, Guillaume
  15. In some payment gateways, the function call() seem to be used to process the payment, while in some others it seems to be the function process(). Looking at cubecart.class.php, I found the following (rom line 278 onwards): if (file_exists($class_file)) { include $class_file; $gateway = new Gateway($GLOBALS['config']->get($module)); $command = (isset($_GET['cmd'])) ? strtolower($_GET['cmd']) : null; if (!empty($command)) { # if (method_exists($gateway, $command)) $gateway->{$command}(); switch ($_GET['cmd']) { case 'call': if (method_exists($gateway, 'call')) { $gateway->call(); } exit; break; case 'process': if (method_exists($gateway, 'process')) { $gateway->process(); } break; } } } My interpretation of this is that there is a variable $_GET['cmd'] depending on which either the function process() is used, or the function call(). However, I couldn't find much information about this variable, studying the code. I would apprecate if anyone could enlight me on what exactly it does, as this would make my understanding clearer of when exactly each of these functions are called. What I am especially after is, when exactly each of these functions are called. Is call() used when the payment providers gets back to the merchant? And process() used when the payment has been accepted (i.e. independently of the user closing the window)? What puzzles me is that this piece of code is in a function loadpage(), which implies that it is tighted to the UI experience. Best regards, Guillaume
  16. Thanks. That would make my plugin somewhat dependant on the plugin "Additional Product Fields", but this is an interesting idea, I'll give it a try!
  17. Thanks. I haven't yet come to a solution which gives me full satisfaction. Nevertheless, the below comes in handy: #URL encoding of all values except email and URL foreach ($hidden as $key => $val){ if ($key != "vads_cust_email" and substr($key, 0, 8) != "vads_url") $hidden[$key] = urlencode($val); } In other words, I encode with urlencode all the values of the form, except URLs and emails.
  18. I hqve solved this one a long time ago, so for anyone interested, here below is what I have done: #Calculation of several currency characteristics $currencyCode = $GLOBALS['tax']->_currency_vars['code']; #Numeric currency calculation $currency_records = $GLOBALS['db']->select('CubeCart_currency','iso',array('code' => $currencyCode)); if ($currency_records !== false) $numericalCurrency = $currency_records[0]['iso']; #Exchange rate calculation $currency_records = $GLOBALS['db']->select('CubeCart_currency','value',array('code' => $currencyCode)); if ($currency_records !== false) $exchange_rate = $currency_records[0]['value']; #Decimals calculation $currency_records = $GLOBALS['db']->select('CubeCart_currency','decimal_places',array('code' => $currencyCode)); if ($currency_records !== false) $decimal_places = intval($currency_records[0]['decimal_places']); Retrieving the decimal places is important as pmost payment gateways do not use the dot or comma sign and expect an amount of USD 12.45 to be sent as "1245" (hence it is important to know how many decimals the currency has).
  19. Cheers, I retrieve the config version and uid with the below code - works perfectly indeed: $configxml = simplexml_load_file(__DIR__ . "/config.xml"); $module_version = $configxml->info->version; $module_uid = $configxml->info->uid;
  20. I'd very happily do this. I could even use the selected shipping product, without the need to iterate. But would we have this "3" or "5" value in a parameter? Or are you saying that this would be a prospective development for Cubecart?
  21. I could do what you recommend for shipping_type indeed. For shipping_speed and shipping_delay, I belive I do not really want to have anything specific to a given shipping company, in the payment gateway. I believe an interesting improvement in Cubecart would be either: to allow, for a given payment gateway a setting (say: shipping_speed) which could be instantiated on each and every shipping product or to allow defining such standard settings (shipping_speed, shipping_delay, etc. but not sure everyone needs the same as I do, maybe expected_delivery_datetime would sound better) so that the shipping module could fill it in and the payment gateway module could read it
  22. I have actually just tried applying the url_encode function to the address containing the quote, and the payment provider system seems to be happy because the payment goes through. Next, I will url_encode all the variables in the array. Now one thing I am wondering is that if I send either of those, it works: $signature = hash_hmac('sha256', $concatenated_string, $certificate, true); $signature = hash_hmac('sha256', $concatenated_string, $certificate, false); $signature = base64_encode(hash_hmac('sha256', $concatenated_string, $certificate, true));
  23. Really appreciate your help. Unfortunately, I'm getting two different strings when trying what you mentioned: Expected string : [egPOUxw8gjnOnBs2weJDngpxIwVBGvTStigqFGqEknQ=] Received string : [FkGkaCo8foKTG2y/b4F/t22GrYkQjj5nmRU/a5zdWVk=] Can it be a subtlety of the hash_hmac function which we are missing?
  24. No I completely appreciate that the encoding will be totally different with or without the quote. What I am struggling to understand is that, I'm encoding a string, (say AB'CD), and the payment gateway tells me the string I shall encode is AB'CD, and: The expected encryption is: [tqMQ6eliAfYpBWPUf5E6QDTlTRxER1GQvIllzZ652xo=] While the received encryption is: [CYrNQ4ETAFfoN9xMAy+phHEopWZQbelEOJndkQJWz8k=] Where I am struggling is, that when I try (on https://www.devglan.com/online-tools/hmac-sha256-online) to encrypt AB'CD, it says that the encryption is: tqMQ6eliAfYpBWPUf5E6QDTlTRxER1GQvIllzZ652xo= (I.e. the expected encryption) And I'd like to find out what exact input string results in the following encryption (so that I can debug it), which is the one received by the gateway: CYrNQ4ETAFfoN9xMAy+phHEopWZQbelEOJndkQJWz8k= I have tried ABCD, AB\'CD, AB'\\CD, AB\\\'CD and none of them give this result. I hope it clarifies
  25. Cheers, this is really interesting. So in the file admin/index.inc.php I have added these instructions: if($_POST['module']['status'] == 1) { $code = file_get_contents(CC_ROOT_DIR.'/modules/gateway/Systempay_multi/snippet-class.display_gateways'); $GLOBALS['db']->insert('CubeCart_code_snippet', array('enabled' => 1, 'unique_id' => 'systempay-multi-gateway-display', 'description' => 'Systempay Display Multipay Option', 'hook_trigger' => 'class.cubecart.display_gateways', 'php_code' => base64_encode($code), 'version' => '1.0.0', 'author' => 'Guillaume Richard', 'priority' => 1)); } And of course, the folder of my module is called Systempay_multi and has a file called snippet-class.display_gateways in it. Because I am really unfamiliar with the concept of hooks/snippets, so far I am trying to check that my snippet is actually called, so I have only put this in it, hoping to display a php message on top of the page and change the module description: But neither action is performed. But maybe it is a wrong indicator, because when I put the same echo in _displayGateways function, it isn't called either. Another thing which puzzles me is that in the cubecart.class.php file, in the _displayGateways function, the hooks called on line 1928 seem to be only to modify the parameters of a given gateway (e.g. change its description). Indeed, afterwards (from line 1923, but especially from line 2022 onwards), we seem to loop on all the gateways and take them as granted. So I'm not sure whether this hook is a good place to display/hide a gateway dynamically. But I'm a beginner in this, so I may very well miss something obvious. Guillaume
  • Create New...