Automattic\WooCommerce\Internal\Admin\Settings
PaymentsProviders::maybe_add_pseudo_mollie_gateway
Add the pseudo Mollie gateway to the payment gateways list if necessary.
Method of the class: PaymentsProviders{}
No Hooks.
Returns
Array. The payment gateways list with the pseudo Mollie gateway added if necessary.
Usage
// private - for code of main (parent) class only $result = $this->maybe_add_pseudo_mollie_gateway( $payment_gateways ): array;
- $payment_gateways(array) (required)
- The payment gateways list.
PaymentsProviders::maybe_add_pseudo_mollie_gateway() PaymentsProviders::maybe add pseudo mollie gateway code WC 10.7.0
private function maybe_add_pseudo_mollie_gateway( array $payment_gateways ): array {
$mollie_provider = $this->get_payment_gateway_provider_instance( 'mollie' );
// Do nothing if there is a Mollie gateway registered.
if ( $mollie_provider->is_gateway_registered( $payment_gateways ) ) {
return $payment_gateways;
}
// Get the Mollie suggestion and determine if the plugin is active.
$mollie_suggestion = $this->get_extension_suggestion_by_id( ExtensionSuggestions::MOLLIE );
if ( empty( $mollie_suggestion ) ) {
return $payment_gateways;
}
// Do nothing if the plugin is not active.
if ( self::EXTENSION_ACTIVE !== $mollie_suggestion['plugin']['status'] ) {
return $payment_gateways;
}
// Add the pseudo Mollie gateway to the list since the plugin is active but there is no Mollie gateway registered.
$payment_gateways[] = $mollie_provider->get_pseudo_gateway( $mollie_suggestion );
return $payment_gateways;
}