mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Add whether Reference Transactions are enabled to status report
This commit is contained in:
parent
602e1e59c7
commit
5322f101b4
3 changed files with 171 additions and 0 deletions
|
@ -15,6 +15,7 @@ use Interop\Container\ServiceProviderInterface;
|
|||
use Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\PayPalBearer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingAgreementsEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\CurrencySupport;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
|
||||
|
@ -68,6 +69,9 @@ class StatusReportModule implements ModuleInterface {
|
|||
$last_webhook_storage = $c->get( 'webhook.last-webhook-storage' );
|
||||
assert( $last_webhook_storage instanceof WebhookInfoStorage );
|
||||
|
||||
$billing_agreements_endpoint = $c->get( 'api.endpoint.billing-agreements' );
|
||||
assert( $billing_agreements_endpoint instanceof BillingAgreementsEndpoint );
|
||||
|
||||
/* @var Renderer $renderer The renderer. */
|
||||
$renderer = $c->get( 'status-report.renderer' );
|
||||
|
||||
|
@ -134,6 +138,14 @@ class StatusReportModule implements ModuleInterface {
|
|||
$settings->has( 'logging_enabled' ) && $settings->get( 'logging_enabled' )
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Reference Transactions', 'woocommerce-paypal-payments' ),
|
||||
'exported_label' => 'Reference Transactions',
|
||||
'description' => esc_html__( 'Whether Reference Transactions are enabled for the connected account', 'woocommerce-paypal-payments' ),
|
||||
'value' => $this->bool_to_text(
|
||||
$this->reference_transaction_enabled( $billing_agreements_endpoint )
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Used PayPal Checkout plugin', 'woocommerce-paypal-payments' ),
|
||||
'exported_label' => 'Used PayPal Checkout plugin',
|
||||
|
@ -192,6 +204,19 @@ class StatusReportModule implements ModuleInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if reference transactions are enabled in account.
|
||||
*
|
||||
* @param BillingAgreementsEndpoint $billing_agreements_endpoint The endpoint.
|
||||
*/
|
||||
private function reference_transaction_enabled( BillingAgreementsEndpoint $billing_agreements_endpoint ): bool {
|
||||
try {
|
||||
return $billing_agreements_endpoint->reference_transaction_enabled();
|
||||
} catch ( RuntimeException $exception ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the bool value to "Yes" or "No".
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue