mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Fix merge conflict
This commit is contained in:
commit
e4e968a823
57 changed files with 6080 additions and 1624 deletions
|
@ -17,6 +17,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\Capture;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Repository\PayPalRequestIdRepository;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\FeesRenderer;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\OrderTablePaymentStatusColumn;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\PaymentStatusOrderDetail;
|
||||
|
@ -28,9 +29,12 @@ use WooCommerce\PayPalCommerce\WcGateway\Endpoint\ReturnUrlEndpoint;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCProductStatus;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\PayUponInvoiceProductStatus;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Notice\ConnectAdminNotice;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Notice\GatewayWithoutPayPalAdminNotice;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\HeaderRenderer;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SectionsRenderer;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsListener;
|
||||
|
@ -65,11 +69,14 @@ class WCGatewayModule implements ModuleInterface {
|
|||
add_action(
|
||||
'woocommerce_sections_checkout',
|
||||
function() use ( $c ) {
|
||||
$header_renderer = $c->get( 'wcgateway.settings.header-renderer' );
|
||||
assert( $header_renderer instanceof HeaderRenderer );
|
||||
|
||||
$section_renderer = $c->get( 'wcgateway.settings.sections-renderer' );
|
||||
assert( $section_renderer instanceof SectionsRenderer );
|
||||
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput
|
||||
echo $section_renderer->render();
|
||||
echo $header_renderer->render() . $section_renderer->render();
|
||||
},
|
||||
20
|
||||
);
|
||||
|
@ -297,15 +304,36 @@ class WCGatewayModule implements ModuleInterface {
|
|||
|
||||
$paypal_gateway_enabled = wc_string_to_bool( $paypal_gateway->get_option( 'enabled' ) );
|
||||
|
||||
$methods[] = $paypal_gateway;
|
||||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||
$methods[] = $paypal_gateway;
|
||||
|
||||
/**
|
||||
* The DCC Applies object.
|
||||
*
|
||||
* @var DccApplies $dcc_applies
|
||||
*/
|
||||
if ( $dcc_applies->for_country_currency() ) {
|
||||
$onboarding_state = $container->get( 'onboarding.state' );
|
||||
assert( $onboarding_state instanceof State );
|
||||
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof ContainerInterface );
|
||||
|
||||
$is_our_page = $container->get( 'wcgateway.is-ppcp-settings-page' );
|
||||
$is_gateways_list_page = $container->get( 'wcgateway.is-wc-gateways-list-page' );
|
||||
|
||||
if ( $onboarding_state->current_state() !== State::STATE_ONBOARDED ) {
|
||||
return $methods;
|
||||
}
|
||||
|
||||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||
assert( $dcc_applies instanceof DccApplies );
|
||||
|
||||
$dcc_product_status = $container->get( 'wcgateway.helper.dcc-product-status' );
|
||||
assert( $dcc_product_status instanceof DCCProductStatus );
|
||||
|
||||
if ( $dcc_applies->for_country_currency() &&
|
||||
// Show only if allowed in PayPal account, except when on our settings pages.
|
||||
// Performing the full DCCProductStatus check only when on the gateway list page
|
||||
// to avoid sending the API requests all the time.
|
||||
( $is_our_page ||
|
||||
( $is_gateways_list_page && $dcc_product_status->dcc_is_active() ) ||
|
||||
( $settings->has( 'products_dcc_enabled' ) && $settings->get( 'products_dcc_enabled' ) )
|
||||
)
|
||||
) {
|
||||
$methods[] = $container->get( 'wcgateway.credit-card-gateway' );
|
||||
}
|
||||
|
||||
|
@ -313,11 +341,21 @@ class WCGatewayModule implements ModuleInterface {
|
|||
$methods[] = $container->get( 'wcgateway.card-button-gateway' );
|
||||
}
|
||||
|
||||
if ( 'DE' === $container->get( 'api.shop.country' ) ) {
|
||||
$pui_product_status = $container->get( 'wcgateway.pay-upon-invoice-product-status' );
|
||||
assert( $pui_product_status instanceof PayUponInvoiceProductStatus );
|
||||
|
||||
$shop_country = $container->get( 'api.shop.country' );
|
||||
|
||||
if ( 'DE' === $shop_country &&
|
||||
( $is_our_page ||
|
||||
( $is_gateways_list_page && $pui_product_status->pui_is_active() ) ||
|
||||
( $settings->has( 'products_pui_enabled' ) && $settings->get( 'products_pui_enabled' ) )
|
||||
)
|
||||
) {
|
||||
$methods[] = $container->get( 'wcgateway.pay-upon-invoice-gateway' );
|
||||
}
|
||||
|
||||
if ( defined( 'PPCP_FLAG_OXXO' ) && PPCP_FLAG_OXXO === true ) {
|
||||
if ( defined( 'PPCP_FLAG_OXXO' ) && PPCP_FLAG_OXXO === true && 'MX' === $shop_country ) {
|
||||
$methods[] = $container->get( 'wcgateway.oxxo-gateway' );
|
||||
}
|
||||
|
||||
|
@ -349,6 +387,7 @@ class WCGatewayModule implements ModuleInterface {
|
|||
*/
|
||||
$listener->listen_for_merchant_id();
|
||||
$listener->listen_for_vaulting_enabled();
|
||||
$listener->listen_for_tracking_enabled();
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue