mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🚧 Refactor the eligible-feature REST response
This commit is contained in:
parent
33bd9ecce8
commit
6591889079
8 changed files with 49 additions and 31 deletions
|
@ -550,16 +550,12 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
|||
|
||||
add_filter(
|
||||
'woocommerce_paypal_payments_rest_common_merchant_data',
|
||||
function( array $merchant_data ) use ( $c ): array {
|
||||
if ( ! isset( $merchant_data['features'] ) ) {
|
||||
$merchant_data['features'] = array();
|
||||
}
|
||||
|
||||
function( array $features ) use ( $c ): array {
|
||||
$billing_agreements_endpoint = $c->get( 'api.endpoint.billing-agreements' );
|
||||
assert( $billing_agreements_endpoint instanceof BillingAgreementsEndpoint );
|
||||
|
||||
$reference_transactions_enabled = $billing_agreements_endpoint->reference_transaction_enabled();
|
||||
$merchant_data['features']['save_paypal_and_venmo'] = array(
|
||||
$features['save_paypal_and_venmo'] = array(
|
||||
'enabled' => $reference_transactions_enabled,
|
||||
);
|
||||
|
||||
|
@ -567,11 +563,11 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
|||
assert( $dcc_product_status instanceof DCCProductStatus );
|
||||
|
||||
$dcc_enabled = $dcc_product_status->dcc_is_active();
|
||||
$merchant_data['features']['advanced_credit_and_debit_cards'] = array(
|
||||
$features['advanced_credit_and_debit_cards'] = array(
|
||||
'enabled' => $dcc_enabled,
|
||||
);
|
||||
|
||||
return $merchant_data;
|
||||
return $features;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue