From 8cb66440d318c123cf5e26257a6474d2b940ccdf Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Wed, 5 Mar 2025 15:23:25 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Reduce=20nesting-depth=20of=20co?= =?UTF-8?q?de?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Repository/PartnerReferralsData.php | 79 +++++++++---------- 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php index 9f22c548c..2bb6514a6 100644 --- a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php +++ b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php @@ -78,53 +78,48 @@ class PartnerReferralsData { __( 'Return to your shop.', 'woocommerce-paypal-payments' ) ); - /** - * Returns the partners referrals data. - */ - return apply_filters( - 'ppcp_partner_referrals_data', - array( - 'partner_config_override' => array( - /** - * Returns the URL which will be opened at the end of onboarding. - */ - 'return_url' => $return_url, - /** - * Returns the description of the URL which will be opened at the end of onboarding. - */ - 'return_url_description' => $return_url_label, - 'show_add_credit_card' => true, + $first_party_features = array( + 'PAYMENT', + 'FUTURE_PAYMENT', + 'REFUND', + 'ADVANCED_TRANSACTIONS_SEARCH', + 'VAULT', + 'TRACKING_SHIPMENT_READWRITE', + ); + + $payload = array( + 'partner_config_override' => array( + 'return_url' => $return_url, + 'return_url_description' => $return_url_label, + 'show_add_credit_card' => true, + ), + 'products' => $products, + 'legal_consents' => array( + array( + 'type' => 'SHARE_DATA_CONSENT', + 'granted' => true, ), - 'products' => $products, - 'legal_consents' => array( - array( - 'type' => 'SHARE_DATA_CONSENT', - 'granted' => true, - ), - ), - 'operations' => array( - array( - 'operation' => 'API_INTEGRATION', - 'api_integration_preference' => array( - 'rest_api_integration' => array( - 'integration_method' => 'PAYPAL', - 'integration_type' => 'FIRST_PARTY', - 'first_party_details' => array( - 'features' => array( - 'PAYMENT', - 'FUTURE_PAYMENT', - 'REFUND', - 'ADVANCED_TRANSACTIONS_SEARCH', - 'VAULT', - 'TRACKING_SHIPMENT_READWRITE', - ), - 'seller_nonce' => $this->nonce(), - ), + ), + 'operations' => array( + array( + 'operation' => 'API_INTEGRATION', + 'api_integration_preference' => array( + 'rest_api_integration' => array( + 'integration_method' => 'PAYPAL', + 'integration_type' => 'FIRST_PARTY', + 'first_party_details' => array( + 'features' => $first_party_features, + 'seller_nonce' => $this->nonce(), ), ), ), ), - ) + ), ); + + /** + * Returns the partners referrals data. + */ + return apply_filters( 'ppcp_partner_referrals_data', $payload ); } }