From fc61039537aac970f955ee824082922c03976cf2 Mon Sep 17 00:00:00 2001 From: Kirill Braslavsky Date: Tue, 6 Apr 2021 10:15:21 +0300 Subject: [PATCH] Generate random default prefix --- modules/ppcp-wc-gateway/services.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index 096ad5965..5cbe58668 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -711,7 +711,10 @@ return array( 'type' => 'text', 'desc_tip' => true, 'description' => __( 'If you use your PayPal account with more than one installation, please use a distinct prefix to separate those installations. Please do not use numbers in your prefix.', 'woocommerce-paypal-payments' ), - 'default' => 'WC-', + 'default' => (static function (array $allowedSymbols): string { //Generate random string from 4 letters and -. + $default_prefix_chars = array_rand(array_flip($allowedSymbols), 4); + return implode('', $default_prefix_chars) . '-'; + })(range('A', 'Z')), 'screens' => array( State::STATE_PROGRESSIVE, State::STATE_ONBOARDED,