Merge pull request #1471 from woocommerce/PCP-1827-update-system-report-plugin-status-for-vaulting

Update system report plugin status for Vaulting (1827)
This commit is contained in:
Emili Castells 2023-06-28 11:22:09 +02:00 committed by GitHub
commit 315ef2c2cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -120,11 +120,19 @@ class StatusReportModule implements ModuleInterface {
'value' => $this->bool_to_html( ! $last_webhook_storage->is_empty() ),
),
array(
'label' => esc_html__( 'Vault enabled', 'woocommerce-paypal-payments' ),
'exported_label' => 'Vault enabled',
'description' => esc_html__( 'Whether vaulting is enabled on PayPal account or not.', 'woocommerce-paypal-payments' ),
'label' => esc_html__( 'PayPal Vault enabled', 'woocommerce-paypal-payments' ),
'exported_label' => 'PayPal Vault enabled',
'description' => esc_html__( 'Whether vaulting option is enabled on Standard Payments settings or not.', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_html(
$this->vault_enabled( $bearer )
$settings->has( 'vault_enabled' ) && $settings->get( 'vault_enabled' )
),
),
array(
'label' => esc_html__( 'ACDC Vault enabled', 'woocommerce-paypal-payments' ),
'exported_label' => 'ACDC Vault enabled',
'description' => esc_html__( 'Whether vaulting option is enabled on Advanced Card Processing settings or not.', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_html(
$settings->has( 'vault_enabled_dcc' ) && $settings->get( 'vault_enabled_dcc' )
),
),
array(
@ -192,21 +200,6 @@ class StatusReportModule implements ModuleInterface {
return $token->is_valid() && $current_state === $state::STATE_ONBOARDED;
}
/**
* It returns whether vaulting is enabled or not.
*
* @param Bearer $bearer The bearer.
* @return bool
*/
private function vault_enabled( Bearer $bearer ): bool {
try {
$token = $bearer->bearer();
return $token->vaulting_available();
} catch ( RuntimeException $exception ) {
return false;
}
}
/**
* Checks if reference transactions are enabled in account.
*