mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
introduce installation prefix
This commit is contained in:
parent
6a4b406568
commit
8f39b71e7f
9 changed files with 84 additions and 14 deletions
|
@ -35,6 +35,10 @@ return [
|
|||
$settings = $container->get('wcgateway.settings');
|
||||
return $settings->has('client_secret') ? (string) $settings->get('client_secret') : '';
|
||||
},
|
||||
'api.prefix' => static function (ContainerInterface $container): string {
|
||||
$settings = $container->get('wcgateway.settings');
|
||||
return $settings->has('prefix') ? (string) $settings->get('prefix') : 'WC-';
|
||||
},
|
||||
'api.endpoint.order' => static function (ContainerInterface $container): OrderEndpoint {
|
||||
$orderFactory = $container->get('api.factory.order');
|
||||
$patchCollectionFactory = $container->get('api.factory.patch-collection-factory');
|
||||
|
|
|
@ -529,6 +529,19 @@ return [
|
|||
],
|
||||
'requirements' => [],
|
||||
],
|
||||
'prefix' => [
|
||||
'title' => __('Installation prefix', 'woocommerce-paypal-commerce-gateway'),
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
'description' => __('If you use your PayPal account with more than one installation, please use a distinct prefix to seperate those installations. Please do not use numbers in your prefix.', 'woocommerce-paypal-commerce-gateway'),
|
||||
'default' => 'WC-',
|
||||
'screens' => [
|
||||
State::STATE_START,
|
||||
State::STATE_PROGRESSIVE,
|
||||
State::STATE_ONBOARDED,
|
||||
],
|
||||
'requirements' => [],
|
||||
],
|
||||
];
|
||||
},
|
||||
];
|
||||
|
|
|
@ -86,6 +86,12 @@ class SettingsListener
|
|||
case 'text':
|
||||
$settings[$key] = isset($rawData[$key]) ? sanitize_text_field($rawData[$key]) : '';
|
||||
break;
|
||||
case 'password':
|
||||
if (empty($rawData[$key])) {
|
||||
break;
|
||||
}
|
||||
$settings[$key] = sanitize_text_field($rawData[$key]);
|
||||
break;
|
||||
case 'ppcp-multiselect':
|
||||
$values = isset($rawData[$key]) ? (array) $rawData[$key] : [];
|
||||
$valuesToSave = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue