Skip to content

Instantly share code, notes, and snippets.

@martinmev
Created January 14, 2018 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinmev/cffe5bab3f39cdf67d41cfdc81a729d9 to your computer and use it in GitHub Desktop.
Save martinmev/cffe5bab3f39cdf67d41cfdc81a729d9 to your computer and use it in GitHub Desktop.
Patch for Ubercart 6 Global Payments Webpay (GP) integration (Drupal 6; logging and digest1 checking)
diff --git a/www/sites/all/modules/uc_gp/uc_gp.pages.inc b/www/sites/all/modules/uc_gp/uc_gp.pages.inc
index 62b18da..2a1137f 100644
--- a/www/sites/all/modules/uc_gp/uc_gp.pages.inc
+++ b/www/sites/all/modules/uc_gp/uc_gp.pages.inc
@@ -41,6 +41,12 @@ function uc_gp_webpay_request($order) {
// Create full URL
$url = url($action, array('query' => $values));
+ $values_s = "";
+ foreach ($values as $key => $value) {
+ $values_s .= "$key=$value|";
+ }
+ watchdog('uc_gp', 'webpay::'.$values_s);
+
// Redirect user to payment gateway
drupal_goto($url);
}
@@ -64,7 +70,23 @@ function uc_gp_webpay_response() {
}
// Check if incoming data are correct
- if (uc_gp_webpay_verify_data($data, $_GET['DIGEST'])) {
+ $digest = $_GET['DIGEST'];
+ $digest1 = $_GET['DIGEST1'];
+
+ $valid_response = uc_gp_webpay_verify_data($data, $digest);
+ $data['MERCHANTNUMBER'] = variable_get('uc_gp_merchant_number', '');
+ $valid_response1 = uc_gp_webpay_verify_data($data, $digest1);
+
+ $data_s = "";
+ foreach ($data as $key => $value) {
+ $data_s .= "$key=$value|";
+ }
+ watchdog('uc_gp', 'webpay:reply:'.
+ strval($valid_response).' '.
+ strval($valid_response1).' '.
+ $data_s.' '.$digest. ' '.$digest1);
+
+ if ($valid_response && $valid_response1) {
// Log valid response
$write = array();
foreach ($data as $key => $value) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment