Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions
DefaultPaymentGateways::get_rules_for_wcpay_connected
Get default rules for WooPayments being connected or not.
This does not include the check for the WooPayments plugin to be active.
Метод класса: DefaultPaymentGateways{}
Хуков нет.
Возвращает
Объект. Rules to match.
Использование
$result = DefaultPaymentGateways::get_rules_for_wcpay_connected( $should_be );
- $should_be(true|false) (обязательный)
- Whether WooPayments should be connected.
Код DefaultPaymentGateways::get_rules_for_wcpay_connected() DefaultPaymentGateways::get rules for wcpay connected WC 10.5.0
public static function get_rules_for_wcpay_connected( $should_be ) {
return (object) array(
'type' => 'option',
'transformers' => array(
// Extract only the 'data' key from the option.
(object) array(
'use' => 'dot_notation',
'arguments' => (object) array(
'path' => 'data',
),
),
// Extract the keys from the data array.
(object) array(
'use' => 'array_keys',
),
),
'option_name' => 'wcpay_account_data',
// The rule will be look for the 'account_id' key in the account data array.
'operation' => $should_be ? 'contains' : '!contains',
'value' => 'account_id',
'default' => array(),
);
}