Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Guillaume

  1. 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
  2. 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
  3. 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
  4. Sorry, I should have tried this before asking. What you describes worked perfectly indeed!
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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!
  10. 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.
  11. 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).
  12. 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;
  13. 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?
  14. 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
  15. 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));
  16. 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?
  17. 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
  18. 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
  19. Hi, That might be more of a question on a PHP developer forum, and apologise if it's irrelevant here. I am working on developping a plug-in for a payment gateway. As part the payment gateway API, I am sending several fields (e.g. amount, currency, etc. but also some plain-text fields like delivery address). I put all these in an array.The payment gateay requires to be passed a field called "signature", which is an encryption of the concatenation of all other fields. The encryption is as the PHP code below: $signature = base64_encode(hash_hmac('sha256',$concatenated_string, $certificate, true)); As long as I don't have any single quotes (') or double quotes ("), everything works fine (even with special characters, such as "é"), and the gateway recognizes that the signature is correct. Now, whenever I input single or double quotes (and single quote is a valid character in a delivery address), I am getting something completely different (which means that I am not endoding the right expected string). For example: Expected string (UTF-8) : [tqMQ6eliAfYpBWPUf5E6QDTlTRxER1GQvIllzZ652xo=] String received (UTF-8) : [CYrNQ4ETAFfoN9xMAy+phHEopWZQbelEOJndkQJWz8k=] What really puzzles me, is that when I checked online (https://www.devglan.com/online-tools/hmac-sha256-online), encoding my string with hmac sha256, with the correct certificate and output as base64, I get the correct expected string, even when quotes are present. So I believe it's my PHP code shown above with does something wrong and wrongly interprets the quote. I cannot reverse the "received string" I believe. So in order to modify my code I would need to understand what exactly is wrongly interpreted in my code, and so far I haven't found it. I have tried adding a backslash before the quote ('), two or three backslashes before the quote (\', \'), I have tried stripping the string right before the quote, or right after the quote. But none of these gave me the same result as the "received string" above, so I'm still in the dark about what is wrong there. All the plain-text fields come from a user form. I could forbid quotes in there (or remove them when contacting the gateway), but I think that wouldn't be exactly the expected behaviour. Any hint would be highly appreciated! Cheers, Guillaume
  20. Hi, I just had a look at what is done in goShippo shipping module and indeed the snippet option looks promising. I understand that I shall call it from index.inc.php, but I am really in the blind on how to adapt the below (taken from goShippo): if($_POST['module']['status'] == 1) { $code = file_get_contents(CC_ROOT_DIR.'/modules/shipping/goShippo/snippet-class.order_status.php'); $GLOBALS['db']->insert('CubeCart_code_snippet', array('enabled' => 1, 'unique_id' => 'shippo-transaction-create', 'description' => 'Shippo Create Rate Transaction', 'hook_trigger' => 'class.order.order_status', 'php_code' => base64_encode($code), 'version' => '1.0.0', 'author' => 'CubeCart Limited', 'priority' => 1)); To my payment gateway. In particular I have the following questions: I am assuming that 'hook_trigger' => 'class.order.order_status' calls code in classes/order.class. While this snippet simply changes the status of an order, which class would therefore be relevant to display/hide a payment gateway? I am not sure of what 'priority' => 1 means, but I am guessing it ensures the snippet is called indeed? I believe there is no requirement on the value of 'unique_id' except that it shall be unique? As you suggest a snippet to dynamically hide or display the payment gateway, I am coming back to my original point where I wanted to avoid having two different modules (one for pay-at-once, another for pay-by-instalments). Can I use a snippet to display a module twice (but with different settings)? In particular, I might need to have several instances of pay-by-instalments (e.g. if a merchant wants to offer both pay-in-3-times and pay-in-10-times) Thanks a lot in advance for your help. Best regards, Guillaume
  21. Hi, I believe there is no solution for this problem, but I am still raising it, just in case there is actually one, or in case Cubecart is interested in developping it. After discussing with the payment provider of the gateways I developped (Systempay), for their fraud assessment policy, they asked me to input: The shipping provider (that's easy, I get it from basket['shipping']['product'] But they also want a couple of structured data, and I wonder whether Cubecart offers a standard for that: Shipping type (which can be "delivery at address", "delivery at pick-up point", "claim in store", etc.) Shipping speed (which is PRIORITY, EXPRESS or STANDARD, depending on whether the delivery is the same day, within 2 working days, or longer) Shipping delay (which in the case the shipping speed is PRIORITY) defines how fast the delivery is (immediate, less than one hour, more than one hour) I absolutely understand that, to enable such a mapping, I would need the shipping modules to fill in that information (if it exists). But my immediate question is rather whether Cubecart has any solution, should the shipping modules wish to support the above? Cheers, Guillaume
  22. Cheers, I guess I am struggling from the very beginning, which is, getting to the config.xml file (which is in the very same folder as the gateway.class.php I am calling it from...) The glob function wouldn't really work for me as I have only one file. So I have tried getcwd() but it returns this: /home/clients/730d21bd55854ec4d0c02aa159bd4077/sites/www.temp-alerte.com, not exactly what I was after... Of course I have tried simplexml_load_file("config.xml") and simplexml_load_file("/config.xml") but none worked. I'm certainly missing something very basic here.
  23. Thanks, I've used something very similar in my code. Posting it below if anyone is interested: if ($GLOBALS['user']->getId()){ $hidden['vads_cust_id'] = $GLOBALS['user']->getId(); $hidden['vads_ext_info_guest'] = "NO"; } else { $hidden['vads_cust_id'] = $GLOBALS['user']->getGhostId(); $hidden['vads_ext_info_guest'] = "YES"; }
  24. Thanks! I got really confused that I was doing all my tests with the same user, user whom had changed the currency at some point, and hence I got always see the currency in the session parameters. But as soon as I got someone else to test my module everything failed. Sorted now, thanks!
  25. Hi, I developped two twin payment gateways which differ only by an if loop (I would have liked to avoid it, but was advised to do this way, see below link). To better manage my if loop where the modules differ, I would like, in gateway.class.php, to retrieve the module name (as defined in config.xml) and make a condition on it. In index.tpl, I use $VAL_SELF (which isn't exactly the module name, but good enough to make a condition), but I don't see how to get such data in gateway.class.php. Similarly, the payment provider would like me to send them the version of my module (as defined in config.xml). I would like to find a way to make that soft and not have to change it each time I publish. I tried CC_VERSION but that's the Cube Cart version, I couldn't see where to get the module version. Thanks for any help you may bring. Cheers, Guillaume )
  • Create New...