From 9b88d1a4aee006eb67b504073288455bf48d747d Mon Sep 17 00:00:00 2001 From: dinamiko Date: Thu, 26 May 2022 11:29:09 +0200 Subject: [PATCH] Move signup link cache into a service --- modules/ppcp-onboarding/services.php | 7 +++++-- modules/ppcp-wc-gateway/services.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/ppcp-onboarding/services.php b/modules/ppcp-onboarding/services.php index bb57eb27d..f200d97d1 100644 --- a/modules/ppcp-onboarding/services.php +++ b/modules/ppcp-onboarding/services.php @@ -210,18 +210,21 @@ return array( $container->get( 'woocommerce.logger.woocommerce' ) ); }, + 'onboarding.signup-link-cache' => static function( ContainerInterface $container ): Cache { + return new Cache( 'ppcp-paypal-signup-link' ); + }, 'onboarding.render' => static function ( ContainerInterface $container ) : OnboardingRenderer { $partner_referrals = $container->get( 'api.endpoint.partner-referrals-production' ); $partner_referrals_sandbox = $container->get( 'api.endpoint.partner-referrals-sandbox' ); $partner_referrals_data = $container->get( 'api.repository.partner-referrals-data' ); $settings = $container->get( 'wcgateway.settings' ); - $cache = new Cache( 'ppcp-paypal-signup-link' ); + $signup_link_cache = $container->get( 'onboarding.signup-link-cache' ); return new OnboardingRenderer( $settings, $partner_referrals, $partner_referrals_sandbox, $partner_referrals_data, - $cache + $signup_link_cache ); }, 'onboarding.render-options' => static function ( ContainerInterface $container ) : OnboardingOptionsRenderer { diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index 7d5361e7f..f0f890cbb 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -219,7 +219,7 @@ return array( $cache = new Cache( 'ppcp-paypal-bearer' ); $bearer = $container->get( 'api.bearer' ); $page_id = $container->get( 'wcgateway.current-ppcp-settings-page-id' ); - $signup_link_cache = new Cache( 'ppcp-paypal-signup-link' ); + $signup_link_cache = $container->get( 'onboarding.signup-link-cache' ); return new SettingsListener( $settings, $fields, $webhook_registrar, $cache, $state, $bearer, $page_id, $signup_link_cache ); }, 'wcgateway.order-processor' => static function ( ContainerInterface $container ): OrderProcessor {