From 8f7bc61cbaffc508e00b4c953f6daf5587521b39 Mon Sep 17 00:00:00 2001 From: Nico Mollet Date: Tue, 3 Jul 2018 10:29:07 +0200 Subject: [PATCH] Fix format error when customer email > 50 chars `customerId` is 50 chars max in Payline Web Service. This fix limits the customerId to 50 chars. --- class-wc-gateway-payline.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/class-wc-gateway-payline.php b/class-wc-gateway-payline.php index f5e4659..3828ea3 100644 --- a/class-wc-gateway-payline.php +++ b/class-wc-gateway-payline.php @@ -592,8 +592,8 @@ function generate_payline_form($order_id) { $doWebPaymentRequest['buyer']['title'] = 'M'; $doWebPaymentRequest['buyer']['lastName'] = substr($order->get_billing_last_name(), 0, 100); $doWebPaymentRequest['buyer']['firstName'] = substr($order->get_billing_first_name(), 0, 100); - $doWebPaymentRequest['buyer']['customerId'] = $order->get_billing_email(); - $doWebPaymentRequest['buyer']['email'] = $doWebPaymentRequest['buyer']['customerId']; + $doWebPaymentRequest['buyer']['customerId'] = substr($order->get_billing_email(), 0, 50); + $doWebPaymentRequest['buyer']['email'] = substr($order->get_billing_email(), 0, 150); $doWebPaymentRequest['buyer']['ip'] = $_SERVER['REMOTE_ADDR']; $doWebPaymentRequest['buyer']['mobilePhone'] = substr(preg_replace("/[^0-9.]/", '', $order->get_billing_phone()), 0, 15);