Merge branch 'pcp-50-settings-in-one-gateway'

This commit is contained in:
David Remer 2020-09-03 12:10:52 +03:00
commit 840b9cd9f0
15 changed files with 442 additions and 139 deletions

View file

@ -23,6 +23,7 @@ use Inpsyde\PayPalCommerce\WcGateway\Notice\AuthorizeOrderActionNotice;
use Inpsyde\PayPalCommerce\WcGateway\Notice\ConnectAdminNotice;
use Inpsyde\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
use Inpsyde\PayPalCommerce\WcGateway\Processor\OrderProcessor;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SectionsRenderer;
use Inpsyde\PayPalCommerce\WcGateway\Settings\Settings;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsListener;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
@ -81,6 +82,9 @@ return array(
static function ( ContainerInterface $container ): AuthorizeOrderActionNotice {
return new AuthorizeOrderActionNotice();
},
'wcgateway.settings.sections-renderer' => static function ( ContainerInterface $container ): SectionsRenderer {
return new SectionsRenderer();
},
'wcgateway.settings.render' => static function ( ContainerInterface $container ): SettingsRenderer {
$settings = $container->get( 'wcgateway.settings' );
$state = $container->get( 'onboarding.state' );
@ -178,7 +182,7 @@ return array(
State::STATE_PROGRESSIVE,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'sandbox_on' => array(
'title' => __( 'Sandbox', 'paypal-for-woocommerce' ),
@ -189,7 +193,7 @@ return array(
State::STATE_START,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'sandbox_on_info' => array(
'title' => __( 'Sandbox', 'paypal-for-woocommerce' ),
@ -201,7 +205,7 @@ return array(
),
'hidden' => 'sandbox_on',
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'merchant_email' => array(
'title' => __( 'Email address', 'paypal-for-woocommerce' ),
@ -214,7 +218,7 @@ return array(
State::STATE_START,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'merchant_email_info' => array(
'title' => __( 'Email address', 'paypal-for-woocommerce' ),
@ -226,7 +230,7 @@ return array(
),
'hidden' => 'merchant_email',
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'toggle_manual_input' => array(
'type' => 'ppcp-text',
@ -238,7 +242,7 @@ return array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'client_id' => array(
'title' => __( 'Client Id', 'paypal-for-woocommerce' ),
@ -252,7 +256,7 @@ return array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'client_secret' => array(
'title' => __( 'Secret Key', 'paypal-for-woocommerce' ),
@ -266,7 +270,7 @@ return array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'title' => array(
'title' => __( 'Title', 'paypal-for-woocommerce' ),
@ -284,6 +288,21 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'dcc_enabled' => array(
'title' => __( 'Enable/Disable', 'paypal-for-woocommerce' ),
'desc_tip' => true,
'description' => __( 'Once enabled, the Credit Card option will show up in the checkout.', 'paypal-for-woocommerce' ),
'label' => __( 'Enable PayPal Card Processing', 'paypal-for-woocommerce' ),
'type' => 'checkbox',
'default' => false,
'gateway' => 'dcc',
'requirements' => array(
'dcc',
),
'screens' => array(
State::STATE_ONBOARDED,
),
),
'dcc_gateway_title' => array(
'title' => __( 'Title', 'paypal-for-woocommerce' ),
'type' => 'text',
@ -294,10 +313,11 @@ return array(
'default' => __( 'Credit Cards', 'paypal-for-woocommerce' ),
'desc_tip' => true,
'screens' => array(
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'requirements' => array(
'dcc',
),
'gateway' => 'dcc',
),
'description' => array(
@ -332,10 +352,11 @@ return array(
'paypal-for-woocommerce'
),
'screens' => array(
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'requirements' => array(
'dcc',
),
'gateway' => 'dcc',
),
'intent' => array(
@ -356,7 +377,7 @@ return array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'capture_for_virtual_only' => array(
'title' => __( 'Capture Virtual-Only Orders ', 'paypal-for-woocommerce' ),
@ -372,7 +393,7 @@ return array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'payee_preferred' => array(
'title' => __( 'Instant Payments ', 'paypal-for-woocommerce' ),
@ -484,7 +505,7 @@ return array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
'prefix' => array(
'title' => __( 'Installation prefix', 'paypal-for-woocommerce' ),
@ -498,7 +519,7 @@ return array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'all',
'gateway' => 'paypal',
),
// General button styles.
@ -512,6 +533,18 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'button_enabled' => array(
'title' => __( 'Enable buttons on Checkout', 'paypal-for-woocommerce' ),
'type' => 'checkbox',
'label' => __( 'Enable on Checkout', 'paypal-for-woocommerce' ),
'default' => true,
'screens' => array(
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
'button_layout' => array(
'title' => __( 'Button Layout', 'paypal-for-woocommerce' ),
'type' => 'select',
@ -1337,9 +1370,9 @@ return array(
'gateway' => 'paypal',
),
'message_cart_enabled' => array(
'title' => __( 'Enable message on Single Product', 'paypal-for-woocommerce' ),
'title' => __( 'Enable message on Cart', 'paypal-for-woocommerce' ),
'type' => 'checkbox',
'label' => __( 'Enable on Single Product', 'paypal-for-woocommerce' ),
'label' => __( 'Enable on Cart', 'paypal-for-woocommerce' ),
'default' => true,
'screens' => array(
State::STATE_PROGRESSIVE,

View file

@ -73,6 +73,10 @@ class DisableGateways {
unset( $methods[ CreditCardGateway::ID ] );
}
if ( $this->settings->has('button_enabled') && ! $this->settings->get('button_enabled') && ! $this->session_handler->order()) {
unset( $methods[ PayPalGateway::ID] );
}
if ( ! $this->needs_to_disable_gateways() ) {
return $methods;
}

View file

@ -80,11 +80,11 @@ class CreditCardGateway extends PayPalGateway {
}
$this->method_title = __(
'PayPal Credit Card Processing',
'PayPal Card Processing',
'paypal-for-woocommerce'
);
$this->method_description = __(
'Provide your customers with the option to pay with credit card.',
'Accept debit and credit cards, and local payment methods with PayPals latest solution.',
'paypal-for-woocommerce'
);
$this->title = $this->config->has( 'dcc_gateway_title' ) ?
@ -123,20 +123,6 @@ class CreditCardGateway extends PayPalGateway {
);
}
/**
* Renders the settings.
*
* @return string
*/
public function generate_ppcp_html(): string {
ob_start();
$this->settings_renderer->render( true );
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/**
* Returns the title of the gateway.
*
@ -211,4 +197,13 @@ class CreditCardGateway extends PayPalGateway {
),
);
}
/**
* Whether the gateway is available or not.
*
* @return bool
*/
public function is_available() : bool {
return $this->config->has( 'dcc_enabled' ) && $this->config->get( 'dcc_enabled' );
}
}

View file

@ -14,6 +14,7 @@ use Inpsyde\PayPalCommerce\Session\SessionHandler;
use Inpsyde\PayPalCommerce\WcGateway\Notice\AuthorizeOrderActionNotice;
use Inpsyde\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
use Inpsyde\PayPalCommerce\WcGateway\Processor\OrderProcessor;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SectionsRenderer;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
use Psr\Container\ContainerInterface;
@ -116,11 +117,8 @@ class PayPalGateway extends \WC_Payment_Gateway {
);
}
$this->method_title = __( 'PayPal Checkout', 'paypal-for-woocommerce' );
$this->method_description = __(
'Accept PayPal, PayPal Credit and alternative payment types with PayPals latest solution.',
'paypal-for-woocommerce'
);
$this->method_title = $this->define_method_title();
$this->method_description = $this->define_method_description();
$this->title = $this->config->has( 'title' ) ?
$this->config->get( 'title' ) : $this->method_title;
$this->description = $this->config->has( 'description' ) ?
@ -154,15 +152,20 @@ class PayPalGateway extends \WC_Payment_Gateway {
public function init_form_fields() {
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Enable/Disable', 'paypal-for-woocommerce' ),
'type' => 'checkbox',
'label' => __( 'Enable PayPal Payments', 'paypal-for-woocommerce' ),
'default' => 'no',
'title' => __( 'Enable/Disable', 'paypal-for-woocommerce' ),
'type' => 'checkbox',
'desc_tip' => true,
'description' => __( 'In order to use PayPal or PayPal Card Processing, you need to enable the Gateway.', 'paypal-for-woocommerce' ),
'label' => __( 'Enable the PayPal Gateway', 'paypal-for-woocommerce' ),
'default' => 'no',
),
'ppcp' => array(
'type' => 'ppcp',
),
);
if ( $this->is_credit_card_tab() ) {
unset( $this->form_fields['enabled'] );
}
}
/**
@ -299,4 +302,65 @@ class PayPalGateway extends \WC_Payment_Gateway {
ob_end_clean();
return $content;
}
/**
* Defines the method title. If we are on the credit card tab in the settings, we want to change this.
*
* @return string
*/
private function define_method_title(): string {
if ( $this->is_credit_card_tab() ) {
return __( 'PayPal Card Processing', 'paypal-for-woocommerce' );
}
if ( $this->is_paypal_tab() ) {
return __( 'PayPal Checkout', 'paypal-for-woocommerce' );
}
return __( 'PayPal', 'paypal-for-woocommerce' );
}
/**
* Defines the method description. If we are on the credit card tab in the settings, we want to change this.
*
* @return string
*/
private function define_method_description(): string {
if ( $this->is_credit_card_tab() ) {
return __(
'Accept debit and credit cards, and local payment methods with PayPals latest solution.',
'paypal-for-woocommerce'
);
}
return __(
'Accept PayPal, PayPal Credit and alternative payment types with PayPals latest solution.',
'paypal-for-woocommerce'
);
}
// phpcs:disable WordPress.Security.NonceVerification.Recommended
/**
* Determines, whether the current session is on the credit card tab in the admin settings.
*
* @return bool
*/
private function is_credit_card_tab() : bool {
return is_admin()
&& isset( $_GET[ SectionsRenderer::KEY ] )
&& CreditCardGateway::ID === sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) );
}
/**
* Whether we are on the PayPal settings tab.
*
* @return bool
*/
private function is_paypal_tab() : bool {
return ! $this->is_credit_card_tab()
&& is_admin()
&& isset( $_GET['section'] )
&& self::ID === sanitize_text_field( wp_unslash( $_GET['section'] ) );
}
// phpcs:enable WordPress.Security.NonceVerification.Recommended
}

View file

@ -57,7 +57,7 @@ class ConnectAdminNotice {
$message = sprintf(
/* translators: %1$s the gateway name. */
__(
'PayPal Payments is almost ready. To get started, <a href="%1$s">connect your account</a>.',
'PayPal Checkout is almost ready. To get started, <a href="%1$s">connect your account</a>.',
'paypal-for-woocommerce'
),
admin_url( 'admin.php?page=wc-settings&tab=checkout&section=ppcp-gateway' )

View file

@ -0,0 +1,59 @@
<?php
/**
* Renders the Sections Tab.
*
* @package Inpsyde\PayPalCommerce\WcGateway\Settings
*/
declare( strict_types=1 );
namespace Inpsyde\PayPalCommerce\WcGateway\Settings;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
/**
* Class SectionsRenderer
*/
class SectionsRenderer {
public const KEY = 'ppcp-tab';
/**
* Whether the sections tab should be rendered.
*
* @return bool
*/
public function should_render() : bool {
global $current_section;
return PayPalGateway::ID === $current_section;
}
/**
* Renders the Sections tab.
*/
public function render() {
if ( ! $this->should_render() ) {
return;
}
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
$current = ! isset( $_GET[ self::KEY ] ) ? PayPalGateway::ID : sanitize_text_field( wp_unslash( $_GET[ self::KEY ] ) );
$sections = array(
PayPalGateway::ID => __( 'PayPal Checkout', 'paypal-for-woocommerce' ),
CreditCardGateway::ID => __( 'PayPal Card Processing', 'paypal-for-woocommerce' ),
);
echo '<ul class="subsubsub">';
$array_keys = array_keys( $sections );
foreach ( $sections as $id => $label ) {
$url = admin_url( 'admin.php?page=wc-settings&tab=checkout&section=ppcp-gateway&' . self::KEY . '=' . $id );
echo '<li><a href="' . esc_url( $url ) . '" class="' . ( $current === $id ? 'current' : '' ) . '">' . esc_html( $label ) . '</a> ' . ( end( $array_keys ) === $id ? '' : '|' ) . ' </li>';
}
echo '</ul><br class="clear" />';
}
}

View file

@ -79,17 +79,7 @@ class Settings implements ContainerInterface {
*/
public function reset(): bool {
$this->load();
$fields_to_reset = array(
'enabled',
'dcc_gateway_enabled',
'intent',
'client_id',
'client_secret',
'merchant_email',
);
foreach ( $fields_to_reset as $id ) {
$this->settings[ $id ] = null;
}
$this->settings = array();
return true;
}

View file

@ -119,16 +119,11 @@ class SettingsListener {
$raw_data = ( isset( $_POST['ppcp'] ) ) ? (array) wp_unslash( $_POST['ppcp'] ) : array();
// phpcs:enable phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$settings = $this->retrieve_settings_from_raw_data( $raw_data );
if ( isset( $_GET['section'] ) && PayPalGateway::ID === $_GET['section'] ) {
if ( ! isset( $_GET[ SectionsRenderer::KEY ] ) || PayPalGateway::ID === $_GET[ SectionsRenderer::KEY ] ) {
$settings['enabled'] = isset( $_POST['woocommerce_ppcp-gateway_enabled'] )
&& 1 === absint( $_POST['woocommerce_ppcp-gateway_enabled'] );
$this->maybe_register_webhooks( $settings );
}
if ( isset( $_GET['section'] ) && CreditCardGateway::ID === $_GET['section'] ) {
$dcc_enabled_post_key = 'woocommerce_ppcp-credit-card-gateway_enabled';
$settings['dcc_gateway_enabled'] = isset( $_POST[ $dcc_enabled_post_key ] )
&& 1 === absint( $_POST[ $dcc_enabled_post_key ] );
}
$this->maybe_register_webhooks( $settings );
foreach ( $settings as $id => $value ) {
$this->settings->set( $id, $value );
@ -189,13 +184,17 @@ class SettingsListener {
}
if (
'dcc' === $config['gateway']
&& sanitize_text_field( wp_unslash( $_GET['section'] ) ) !== 'ppcp-credit-card-gateway'
&& (
! isset( $_GET[ SectionsRenderer::KEY ] )
|| sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) ) !== CreditCardGateway::ID
)
) {
continue;
}
if (
'paypal' === $config['gateway']
&& sanitize_text_field( wp_unslash( $_GET['section'] ) ) !== 'ppcp-gateway'
&& isset( $_GET[ SectionsRenderer::KEY ] )
&& sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) ) !== PayPalGateway::ID
) {
continue;
}

View file

@ -12,6 +12,7 @@ namespace Inpsyde\PayPalCommerce\WcGateway\Settings;
use Inpsyde\PayPalCommerce\ApiClient\Helper\DccApplies;
use Inpsyde\PayPalCommerce\Button\Helper\MessagesApply;
use Inpsyde\PayPalCommerce\Onboarding\State;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
use Psr\Container\ContainerInterface;
/**
@ -209,12 +210,12 @@ class SettingsRenderer {
/**
* Renders the settings.
*
* @param bool $is_dcc Whether it is the DCC gateway or not.
*/
public function render( bool $is_dcc ) {
public function render() {
$nonce = wp_create_nonce( SettingsListener::NONCE );
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
$is_dcc = isset( $_GET[ SectionsRenderer::KEY ] ) && CreditCardGateway::ID === sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) );
$nonce = wp_create_nonce( SettingsListener::NONCE );
?>
<input type="hidden" name="ppcp-nonce" value="<?php echo esc_attr( $nonce ); ?>">
<?php
@ -276,38 +277,18 @@ class SettingsRenderer {
<?php
endforeach;
if ( $is_dcc ) :
?>
<tr>
<th><?php esc_html_e( '3D Secure', 'paypal-for-woocommerce' ); ?></th>
<td>
<p>
<?php
/**
* We still need to provide a docs link.
*
* @todo: Provide link to documentation.
*/
echo wp_kses_post(
sprintf(
// translators: %1$s and %2$s is a link tag.
__(
'3D Secure benefits cardholders and merchants by providing
an additional layer of verification using Verified by Visa,
MasterCard SecureCode and American Express SafeKey.
%1$sLearn more about 3D Secure.%2$s',
'paypal-for-woocommerce'
),
'<a href = "#">',
'</a>'
)
);
?>
</p>
</td>
</tr>
<?php
endif;
if ( $is_dcc ) {
if ( $this->dcc_applies->for_country_currency() ) {
if ( State::STATE_ONBOARDED > $this->state->current_state() ) {
$this->render_dcc_onboarding_info();
}
if ( State::STATE_ONBOARDED === $this->state->current_state() ) {
$this->render_3d_secure_info();
}
} else {
$this->render_dcc_does_not_apply_info();
}
}
}
/**
@ -328,4 +309,101 @@ class SettingsRenderer {
> ';
}
}
/**
* Renders the 3d secure info text.
*/
private function render_3d_secure_info() {
?>
<tr>
<th><?php esc_html_e( '3D Secure', 'paypal-for-woocommerce' ); ?></th>
<td>
<p>
<?php
/**
* We still need to provide a docs link.
*
* @todo: Provide link to documentation.
*/
echo wp_kses_post(
sprintf(
// translators: %1$s and %2$s is a link tag.
__(
'3D Secure benefits cardholders and merchants by providing
an additional layer of verification using Verified by Visa,
MasterCard SecureCode and American Express SafeKey.
%1$sLearn more about 3D Secure.%2$s',
'paypal-for-woocommerce'
),
'<a href = "#">',
'</a>'
)
);
?>
</p>
</td>
</tr>
<?php
}
/**
* Renders the DCC onboarding info.
*/
private function render_dcc_onboarding_info() {
?>
<tr>
<th><?php esc_html_e( 'Onboarding', 'paypal-for-woocommerce' ); ?></th>
<td class="notice notice-error">
<p>
<?php
esc_html_e(
'You need to complete your onboarding, before you can use the PayPal Card Processing option.',
'paypal-for-woocommerce'
);
?>
<a
href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout&section=ppcp-gateway' ) ); ?>"
>
<?php esc_html_e( 'Click here to complete your onboarding.', 'paypal-for-woocommerce' ); ?>
</a>
</p>
</td>
</tr>
<?php
}
/**
* Renders the info, that DCC is not available in the merchant's country.
*/
private function render_dcc_does_not_apply_info() {
?>
<tr>
<th><?php esc_html_e( 'Card Processing not available', 'paypal-for-woocommerce' ); ?></th>
<td class="notice notice-error">
<p>
<?php
esc_html_e(
'Unfortunatly, the card processing option is not yet available in your country.',
'paypal-for-woocommerce'
);
?>
<a
href="https://developer.paypal.com/docs/platforms/checkout/reference/country-availability-advanced-cards/"
target="_blank"
rel="noreferrer noopener"
>
<?php
esc_html_e(
'Click here to see, in which countries this option is currently available.',
'paypal-for-woocommerce'
);
?>
</a>
</p>
</td>
</tr>
<?php
}
}

View file

@ -22,6 +22,7 @@ use Inpsyde\PayPalCommerce\WcGateway\Endpoint\ReturnUrlEndpoint;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use Inpsyde\PayPalCommerce\WcGateway\Notice\ConnectAdminNotice;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SectionsRenderer;
use Inpsyde\PayPalCommerce\WcGateway\Settings\Settings;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
use Interop\Container\ServiceProviderInterface;
@ -56,6 +57,19 @@ class WcGatewayModule implements ModuleInterface {
$this->register_checkout_paypal_address_preset( $container );
$this->ajax_gateway_enabler( $container );
add_action(
'woocommerce_sections_checkout',
function() use ( $container ) {
$section_renderer = $container->get( 'wcgateway.settings.sections-renderer' );
/**
* The Section Renderer.
*
* @var SectionsRenderer $section_renderer
*/
$section_renderer->render();
}
);
add_filter(
Repository::NOTICES_FILTER,
static function ( $notices ) use ( $container ): array {
@ -130,7 +144,7 @@ class WcGatewayModule implements ModuleInterface {
$settings = $container->get( 'wcgateway.settings' );
$key = PayPalGateway::ID === $_POST['gateway_id'] ? 'enabled' : '';
if ( CreditCardGateway::ID === $_POST['gateway_id'] ) {
$key = 'dcc_gateway_enabled';
$key = 'dcc_enabled';
}
if ( ! $key ) {
return;
@ -158,12 +172,14 @@ class WcGatewayModule implements ModuleInterface {
static function ( $methods ) use ( $container ): array {
$methods[] = $container->get( 'wcgateway.paypal-gateway' );
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
$screen = ! function_exists( 'get_current_screen' ) ? (object) array( 'id' => 'front' ) : get_current_screen();
/**
* The DCC Applies object.
*
* @var DccApplies $dcc_applies
*/
if ( $dcc_applies->for_country_currency() ) {
if ( 'woocommerce_page_wc-settings' !== $screen->id && $dcc_applies->for_country_currency() ) {
$methods[] = $container->get( 'wcgateway.credit-card-gateway' );
}
return (array) $methods;