Refactor onboarding link update endpoint refactor.

This commit is contained in:
Pedro Silva 2023-09-26 13:58:33 +01:00
parent 26a2b80b1b
commit 43136ecf3c
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
10 changed files with 168 additions and 85 deletions

View file

@ -200,10 +200,12 @@ return array(
return $ppcp_tab ? $ppcp_tab : $section;
},
'wcgateway.settings' => static function ( ContainerInterface $container ): Settings {
$default_button_locations = $container->get( 'wcgateway.button.default-locations' );
return new Settings( $default_button_locations );
},
'wcgateway.settings' => SingletonDecorator::make(
static function ( ContainerInterface $container ): Settings {
$default_button_locations = $container->get( 'wcgateway.button.default-locations' );
return new Settings( $default_button_locations );
}
),
'wcgateway.notice.connect' => static function ( ContainerInterface $container ): ConnectAdminNotice {
$state = $container->get( 'onboarding.state' );
$settings = $container->get( 'wcgateway.settings' );

View file

@ -142,6 +142,20 @@ class PayUponInvoice {
$this->settings->persist();
}
add_filter(
'ppcp_partner_referrals_option',
function ( array $option ): array {
if ( $option['valid'] ) {
return $option;
}
if ( $option['field'] === 'ppcp-onboarding-pui' ) {
$option['valid'] = true;
$option['value'] = ( $option['value'] ? '1' : '' );
}
return $option;
}
);
add_filter(
'ppcp_partner_referrals_data',
function ( array $data ): array {