Skip to content

Instantly share code, notes, and snippets.

@torunar
Created December 11, 2015 13:32
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 torunar/16c39e31efada457272e to your computer and use it in GitHub Desktop.
Save torunar/16c39e31efada457272e to your computer and use it in GitHub Desktop.
diff --git a/app/addons/paypal/func.php b/app/addons/paypal/func.php
index 9eb8cff..fad5933 100644
--- a/app/addons/paypal/func.php
+++ b/app/addons/paypal/func.php
@@ -784,3 +784,21 @@ function fn_paypal_get_valid_currency($id)
return $currency;
}
+
+/**
+ * Overrides user existence check results for guest customers who returned from Express Checkout
+ *
+ * @param int $user_id User ID
+ * @param array $user_data User authentication data
+ * @param boolean $is_exist True if user with specified email already exists
+ */
+function fn_paypal_is_user_exists_post($user_id, $user_data, &$is_exist)
+{
+ if (!$user_id && $is_exist) {
+ if (isset($_SESSION['pp_express_details']['token']) &&
+ (empty($user_data['register_at_checkout']) || $user_data['register_at_checkout'] != 'Y') &&
+ empty($user_data['password1']) && empty($user_data['password2'])) {
+ $is_exist = false;
+ }
+ }
+}
diff --git a/app/addons/paypal/init.php b/app/addons/paypal/init.php
index 7a1b5fd..b917a02 100644
--- a/app/addons/paypal/init.php
+++ b/app/addons/paypal/init.php
@@ -19,5 +19,6 @@ fn_register_hooks(
'payment_url',
'update_payment_pre',
'rma_update_details_post',
- 'prepare_checkout_payment_methods'
+ 'prepare_checkout_payment_methods',
+ 'is_user_exists_post'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment