To make the mod working correctly with X-Payments, a slight additional modification is required.
Alter the "modules/XPayments_Connector/xpc_func.php" script and add new code:
PHP Code:
$email_matcher = "/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z](?:[a-z0-9-]*[a-z0-9])/";
if (
preg_match($email_matcher, $result['merchantEmail'], $xpc_ematches)
&& isset($xpc_ematches[0])
) {
$result['merchantEmail'] = $xpc_ematches[0];
}
at the end of the xpc_prepare_cart function as follows:
PHP Code:
function xpc_prepare_cart($cart, $refId, $force_auth)
{
.....................................................
$result['merchantEmail'] = $admin_email;
}
$email_matcher = "/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z](?:[a-z0-9-]*[a-z0-9])/";
if (
preg_match($email_matcher, $result['merchantEmail'], $xpc_ematches)
&& isset($xpc_ematches[0])
) {
$result['merchantEmail'] = $xpc_ematches[0];
}
return $result;
}