mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Show billing data mode in card button gateway settings
This commit is contained in:
parent
73dc768955
commit
55b2adf2aa
3 changed files with 28 additions and 2 deletions
|
@ -129,6 +129,7 @@ return array(
|
|||
},
|
||||
'wcgateway.card-button-gateway' => static function ( ContainerInterface $container ): CardButtonGateway {
|
||||
return new CardButtonGateway(
|
||||
$container->get( 'wcgateway.settings.render' ),
|
||||
$container->get( 'wcgateway.order-processor' ),
|
||||
$container->get( 'wcgateway.settings' ),
|
||||
$container->get( 'session.handler' ),
|
||||
|
@ -887,7 +888,7 @@ return array(
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'paypal',
|
||||
'gateway' => array( 'paypal', CardButtonGateway::ID ),
|
||||
),
|
||||
|
||||
// General button styles.
|
||||
|
|
|
@ -24,16 +24,24 @@ use WooCommerce\PayPalCommerce\WcGateway\Exception\GatewayGenericException;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Processor\OrderProcessor;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
|
||||
|
||||
/**
|
||||
* Class CardButtonGateway
|
||||
*/
|
||||
class CardButtonGateway extends \WC_Payment_Gateway {
|
||||
|
||||
use ProcessPaymentTrait, FreeTrialHandlerTrait;
|
||||
use ProcessPaymentTrait, FreeTrialHandlerTrait, GatewaySettingsRendererTrait;
|
||||
|
||||
const ID = 'ppcp-card-button-gateway';
|
||||
|
||||
/**
|
||||
* The Settings Renderer.
|
||||
*
|
||||
* @var SettingsRenderer
|
||||
*/
|
||||
protected $settings_renderer;
|
||||
|
||||
/**
|
||||
* The processor for orders.
|
||||
*
|
||||
|
@ -114,6 +122,7 @@ class CardButtonGateway extends \WC_Payment_Gateway {
|
|||
/**
|
||||
* CardButtonGateway constructor.
|
||||
*
|
||||
* @param SettingsRenderer $settings_renderer The Settings Renderer.
|
||||
* @param OrderProcessor $order_processor The Order Processor.
|
||||
* @param ContainerInterface $config The settings.
|
||||
* @param SessionHandler $session_handler The Session Handler.
|
||||
|
@ -126,6 +135,7 @@ class CardButtonGateway extends \WC_Payment_Gateway {
|
|||
* @param LoggerInterface $logger The logger.
|
||||
*/
|
||||
public function __construct(
|
||||
SettingsRenderer $settings_renderer,
|
||||
OrderProcessor $order_processor,
|
||||
ContainerInterface $config,
|
||||
SessionHandler $session_handler,
|
||||
|
@ -138,6 +148,7 @@ class CardButtonGateway extends \WC_Payment_Gateway {
|
|||
LoggerInterface $logger
|
||||
) {
|
||||
$this->id = self::ID;
|
||||
$this->settings_renderer = $settings_renderer;
|
||||
$this->order_processor = $order_processor;
|
||||
$this->config = $config;
|
||||
$this->session_handler = $session_handler;
|
||||
|
@ -228,6 +239,9 @@ class CardButtonGateway extends \WC_Payment_Gateway {
|
|||
'desc_tip' => true,
|
||||
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'ppcp' => array(
|
||||
'type' => 'ppcp',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -328,4 +342,13 @@ class CardButtonGateway extends \WC_Payment_Gateway {
|
|||
|
||||
return parent::get_transaction_url( $order );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the settings renderer.
|
||||
*
|
||||
* @return SettingsRenderer
|
||||
*/
|
||||
protected function settings_renderer(): SettingsRenderer {
|
||||
return $this->settings_renderer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Settings;
|
||||
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CardButtonGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Status\WebhooksStatusPage;
|
||||
|
@ -34,6 +35,7 @@ trait PageMatcherTrait {
|
|||
$gateway_page_id_map = array(
|
||||
PayPalGateway::ID => 'paypal',
|
||||
CreditCardGateway::ID => 'dcc', // TODO: consider using just the gateway ID for PayPal and DCC too.
|
||||
CardButtonGateway::ID => CardButtonGateway::ID,
|
||||
WebhooksStatusPage::ID => WebhooksStatusPage::ID,
|
||||
);
|
||||
return array_key_exists( $current_page_id, $gateway_page_id_map )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue