Disable Fraudnet checkbox when PUI is enabled

This commit is contained in:
emilicastells 2023-01-20 10:58:43 +01:00
parent eb4a60e503
commit ea201a3140
No known key found for this signature in database
GPG key ID: 1520C07081754570
3 changed files with 16 additions and 0 deletions

View file

@ -1147,6 +1147,16 @@ return array(
return false;
},
'wcgateway.settings.should-disable-fraudnet-checkbox' => static function( ContainerInterface $container ): bool {
$pui_helper = $container->get( 'wcgateway.pay-upon-invoice-helper' );
assert( $pui_helper instanceof PayUponInvoiceHelper );
if ( $pui_helper->is_pui_gateway_enabled() ) {
return true;
}
return false;
},
'wcgateway.settings.tracking-label' => static function ( ContainerInterface $container ): string {
$tracking_label = sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.

View file

@ -139,6 +139,11 @@ class PayUponInvoice {
* @throws NotFoundException When setting is not found.
*/
public function init(): void {
if ( $this->pui_helper->is_pui_gateway_enabled() ) {
$this->settings->set( 'fraudnet_enabled', true );
$this->settings->persist();
}
add_filter(
'ppcp_partner_referrals_data',
function ( array $data ): array {

View file

@ -411,6 +411,7 @@ return function ( ContainerInterface $container, array $fields ): array {
),
'requirements' => array(),
'gateway' => Settings::CONNECTION_TAB_ID,
'input_class' => $container->get( 'wcgateway.settings.should-disable-fraudnet-checkbox' ) ? array( 'ppcp-disabled-checkbox' ) : array(),
),
'credentials_integration_configuration_heading' => array(