Merge branch 'trunk' into PCP-991-detach-vaulting-from-wc-subscriptions-support

This commit is contained in:
Emili Castells Guasch 2023-05-15 12:16:20 +02:00
commit b126d77dfb
3 changed files with 20 additions and 3 deletions

View file

@ -1274,6 +1274,11 @@ return array(
return 'https://www.paypal.com/bizsignup/entry?country.x=DE&product=payment_methods&capabilities=PAY_UPON_INVOICE';
},
'wcgateway.settings.connection.dcc-status-text' => static function ( ContainerInterface $container ): string {
$state = $container->get( 'onboarding.state' );
if ( $state->current_state() < State::STATE_ONBOARDED ) {
return '';
}
$dcc_product_status = $container->get( 'wcgateway.helper.dcc-product-status' );
assert( $dcc_product_status instanceof DCCProductStatus );
@ -1307,6 +1312,11 @@ return array(
);
},
'wcgateway.settings.connection.pui-status-text' => static function ( ContainerInterface $container ): string {
$state = $container->get( 'onboarding.state' );
if ( $state->current_state() < State::STATE_ONBOARDED ) {
return '';
}
$pui_product_status = $container->get( 'wcgateway.pay-upon-invoice-product-status' );
assert( $pui_product_status instanceof PayUponInvoiceProductStatus );

View file

@ -14,6 +14,7 @@ use Psr\Log\LoggerInterface;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\WebhookEndpoint;
use WooCommerce\PayPalCommerce\ApiClient\Entity\Webhook;
use WooCommerce\PayPalCommerce\ApiClient\Factory\WebhookFactory;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\Webhooks\Endpoint\ResubscribeEndpoint;
use WooCommerce\PayPalCommerce\Webhooks\Endpoint\SimulateEndpoint;
use WooCommerce\PayPalCommerce\Webhooks\Endpoint\SimulationStateEndpoint;
@ -126,7 +127,12 @@ return array(
$endpoint = $container->get( 'api.endpoint.webhook' );
assert( $endpoint instanceof WebhookEndpoint );
return $endpoint->list();
$state = $container->get( 'onboarding.state' );
if ( $state->current_state() >= State::STATE_ONBOARDED ) {
return $endpoint->list();
}
return array();
},
'webhook.status.registered-webhooks-data' => function( ContainerInterface $container ) : array {

View file

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Webhooks;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
use Exception;
@ -126,8 +127,8 @@ class WebhookModule implements ModuleInterface {
try {
$webhooks = $container->get( 'webhook.status.registered-webhooks' );
if ( empty( $webhooks ) ) {
$state = $container->get( 'onboarding.state' );
if ( empty( $webhooks ) && $state->current_state() >= State::STATE_ONBOARDED ) {
$registrar = $container->get( 'webhook.registrar' );
assert( $registrar instanceof WebhookRegistrar );