Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
976ab69
Create onboarding flow techincal document
Dinamiko Sep 18, 2025
bda5742
Add post-onboarding document
Dinamiko Sep 18, 2025
fd1d0e3
Add post-onboarding document
Dinamiko Sep 18, 2025
ccadf52
Add post-onboarding document
Dinamiko Sep 18, 2025
4b91065
Add merchant capabilitlities service
Dinamiko Sep 18, 2025
2f5dbf6
Add merchant capabilitlities service
Dinamiko Sep 18, 2025
81750fc
Remove redundant content
Dinamiko Sep 18, 2025
cf82350
Add capabilty checks for connected merchant into service wcgateway.fe…
Dinamiko Sep 19, 2025
317400f
Remove get_shop_country from MerchantDetails
Dinamiko Sep 19, 2025
887c3ca
Merge branch 'develop' into PCP-5311-documentation-task-vaulting
Dinamiko Sep 29, 2025
60eb84b
refactor: Centralize Feature eligibility in Merchant Details
puntope Sep 30, 2025
9a53273
refactor: Simplify features logic
puntope Oct 6, 2025
b310999
Restore currency check in advanced_credit_and_debit_cards
puntope Oct 7, 2025
174506b
Remove early return
puntope Oct 7, 2025
1c7f893
Fix pay-later key
puntope Oct 7, 2025
106b6ec
Merge branch 'develop' into PCP-5311-documentation-task-vaulting
puntope Oct 7, 2025
53f9cf2
Completely Remove installments if Merchant is not MX
puntope Oct 7, 2025
e328c5f
Remove docs
puntope Oct 7, 2025
7398a32
Fix potential issue with pay_later_messaging
puntope Oct 7, 2025
1662ba2
Rename variable
puntope Oct 9, 2025
cd3d1af
Rename variable
puntope Oct 9, 2025
13a0de3
PHPCS
puntope Oct 9, 2025
13dce9c
Restore paypal venmo check
puntope Oct 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/ppcp-onboarding/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
$woo_country = $container->get( 'api.shop.country' );
$eligibility_checks = $container->get( 'wcgateway.feature-eligibility.list' );

return new MerchantDetails( $woo_country, $woo_country, $eligibility_checks );
return new MerchantDetails( $woo_country, $eligibility_checks );
},
'onboarding.assets' => function ( ContainerInterface $container ): OnboardingAssets {
$state = $container->get( 'onboarding.state' );
Expand Down
146 changes: 48 additions & 98 deletions modules/ppcp-settings/services.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
class FeaturesDefinition {


/**
* The features eligibility service.
*
* @var FeaturesEligibilityService
*/
protected FeaturesEligibilityService $eligibilities;

/**
* The general settings service.
Expand All @@ -53,18 +47,15 @@ class FeaturesDefinition {
/**
* Constructor.
*
* @param FeaturesEligibilityService $eligibilities The features eligibility service.
* @param GeneralSettings $settings The general settings service.
* @param array $merchant_capabilities The merchant capabilities.
* @param SettingsModel $plugin_settings The plugin settings.
*/
public function __construct(
FeaturesEligibilityService $eligibilities,
GeneralSettings $settings,
array $merchant_capabilities,
SettingsModel $plugin_settings
) {
$this->eligibilities = $eligibilities;
$this->settings = $settings;
$this->merchant_capabilities = $merchant_capabilities;
$this->plugin_settings = $plugin_settings;
Expand All @@ -76,15 +67,7 @@ public function __construct(
* @return array The array of feature definitions.
*/
public function get(): array {
$all_features = $this->all_available_features();
$eligible_features = array();
$eligibility_checks = $this->eligibilities->get_eligibility_checks();
foreach ( $all_features as $feature_key => $feature ) {
if ( $eligibility_checks[ $feature_key ]() ) {
$eligible_features[ $feature_key ] = $feature;
}
}
return $eligible_features;
return $this->all_available_features();
}

/**
Expand All @@ -106,7 +89,7 @@ public function all_available_features(): array {
$country_location = in_array( $store_country, $paylater_countries, true ) ? strtolower( $store_country ) : 'us';
$save_paypal_and_venmo = $this->plugin_settings->get_save_paypal_and_venmo();

return array(
$features = array(
'save_paypal_and_venmo' => array(
'title' => __( 'Save PayPal and Venmo', 'woocommerce-paypal-payments' ),
'description' => __( 'Securely save PayPal and Venmo payment methods for subscriptions or return buyers.', 'woocommerce-paypal-payments' ),
Expand Down Expand Up @@ -297,7 +280,7 @@ public function all_available_features(): array {
'Let customers know they can buy now and pay later with PayPal. Adding this messaging can boost conversion rates and increase cart sizes by 39%¹, with no extra cost to you—plus, you get paid up front.',
'woocommerce-paypal-payments'
),
'enabled' => $this->merchant_capabilities['pay_later'] && ! $save_paypal_and_venmo,
'enabled' => $this->merchant_capabilities['paylater'] && ! $save_paypal_and_venmo,
'buttons' => array(
array(
'type' => 'secondary',
Expand Down Expand Up @@ -346,5 +329,10 @@ public function all_available_features(): array {
),
),
);
if ( $this->settings->get_merchant_country() !== 'MX' ) {
unset( $features['installments'] );
}

return $features;
}
}
114 changes: 0 additions & 114 deletions modules/ppcp-settings/src/Service/FeaturesEligibilityService.php

This file was deleted.

Loading
Loading