Add improvements based on PR feedback

This commit is contained in:
Emili Castells Guasch 2023-09-21 11:24:50 +02:00
parent 1523ee4dfb
commit 09ac019bd0
5 changed files with 5 additions and 5 deletions

View file

@ -46,7 +46,7 @@ return function ( string $root_dir ): iterable {
if ( apply_filters( if ( apply_filters(
//phpcs:disable WordPress.NamingConventions.ValidHookName.UseUnderscores //phpcs:disable WordPress.NamingConventions.ValidHookName.UseUnderscores
'woocommerce.deprecated-flags.woocommerce_paypal_payments.saved_payment_checker_enabled', 'woocommerce.deprecated_flags.woocommerce_paypal_payments.saved_payment_checker_enabled',
getenv( 'PCP_SAVED_PAYMENT_CHECKER_ENABLED' ) === '1' getenv( 'PCP_SAVED_PAYMENT_CHECKER_ENABLED' ) === '1'
) ) { ) ) {
$modules[] = ( require "$modules_dir/ppcp-saved-payment-checker/module.php" )(); $modules[] = ( require "$modules_dir/ppcp-saved-payment-checker/module.php" )();

View file

@ -194,7 +194,7 @@ class OrderEndpoint {
): Order { ): Order {
$bearer = $this->bearer->bearer(); $bearer = $this->bearer->bearer();
$data = array( $data = array(
'intent' => apply_filters( 'woocommerce_paypal_payments_saved_payment_subscription_intent', $this->intent ), 'intent' => apply_filters( 'woocommerce_paypal_payments_order_intent', $this->intent ),
'purchase_units' => array_map( 'purchase_units' => array_map(
static function ( PurchaseUnit $item ) use ( $shipping_preference ): array { static function ( PurchaseUnit $item ) use ( $shipping_preference ): array {
$data = $item->to_array(); $data = $item->to_array();

View file

@ -1554,7 +1554,7 @@ class SmartButton implements SmartButtonInterface {
$intent = $this->settings->has( 'intent' ) ? $this->settings->get( 'intent' ) : 'capture'; $intent = $this->settings->has( 'intent' ) ? $this->settings->get( 'intent' ) : 'capture';
return strtolower( apply_filters( 'woocommerce_paypal_payments_saved_payment_subscription_intent', $intent ) ); return strtolower( apply_filters( 'woocommerce_paypal_payments_order_intent', $intent ) );
} }
/** /**

View file

@ -1,5 +1,5 @@
{ {
"name": "woocommerce/ppcp-saved-payment-checked", "name": "woocommerce/ppcp-saved-payment-checker",
"type": "dhii-mod", "type": "dhii-mod",
"description": "Saved payments checker module", "description": "Saved payments checker module",
"license": "GPL-2.0", "license": "GPL-2.0",

View file

@ -41,7 +41,7 @@ class SavedPaymentCheckerModule implements ModuleInterface {
* Set authorize intent for vaulted subscriptions, so we can void if payment not saved. * Set authorize intent for vaulted subscriptions, so we can void if payment not saved.
*/ */
add_filter( add_filter(
'woocommerce_paypal_payments_saved_payment_subscription_intent', 'woocommerce_paypal_payments_order_intent',
function( string $intent ) use ( $c ) { function( string $intent ) use ( $c ) {
$subscription_helper = $c->get( 'subscription.helper' ); $subscription_helper = $c->get( 'subscription.helper' );
assert( $subscription_helper instanceof SubscriptionHelper ); assert( $subscription_helper instanceof SubscriptionHelper );