Refactor the service name, variable names to use the new class

This commit is contained in:
Narek Zakarian 2025-06-30 16:40:38 +04:00
parent 0a0d7e9c49
commit 96895aba51
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
8 changed files with 46 additions and 177 deletions

View file

@ -75,8 +75,8 @@ class StatusReportModule implements ServiceModule, ExtendingModule, ExecutableMo
$last_webhook_storage = $c->get( 'webhook.last-webhook-storage' );
assert( $last_webhook_storage instanceof WebhookEventStorage );
$billing_agreements_endpoint = $c->get( 'api.endpoint.billing-agreements' );
assert( $billing_agreements_endpoint instanceof ReferenceTransactionStatus );
$reference_transaction_status = $c->get( 'api.reference-transaction-status' );
assert( $reference_transaction_status instanceof ReferenceTransactionStatus );
/* @var Renderer $renderer The renderer. */
$renderer = $c->get( 'status-report.renderer' );
@ -170,7 +170,7 @@ class StatusReportModule implements ServiceModule, ExtendingModule, ExecutableMo
'exported_label' => 'Reference Transactions',
'description' => esc_html__( 'Whether Reference Transactions are enabled for the connected account', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_html(
$this->reference_transaction_enabled( $billing_agreements_endpoint )
$reference_transaction_status->reference_transaction_enabled()
),
),
array(
@ -275,19 +275,6 @@ class StatusReportModule implements ServiceModule, ExtendingModule, ExecutableMo
return $field_settings['options'][ $subscriptions_mode ] ?? $subscriptions_mode;
}
/**
* Checks if reference transactions are enabled in account.
*
* @param ReferenceTransactionStatus $billing_agreements_endpoint The endpoint.
*/
private function reference_transaction_enabled( ReferenceTransactionStatus $billing_agreements_endpoint ): bool {
try {
return $billing_agreements_endpoint->reference_transaction_enabled();
} catch ( RuntimeException $exception ) {
return false;
}
}
/**
* Converts the bool value to "yes" icon or dash.
*