From c8e1b3cd7f548e49fbf1e95f08bcd11e06c25315 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Wed, 30 Aug 2023 16:58:30 +0200 Subject: [PATCH 1/4] Check for string instead of boolean --- .../ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php b/modules/ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php index 233c41fe2..fb6827e6e 100644 --- a/modules/ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php +++ b/modules/ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php @@ -121,7 +121,7 @@ class BillingAgreementsEndpoint { */ public function reference_transaction_enabled(): bool { try { - if ( get_transient( 'ppcp_reference_transaction_enabled' ) === true ) { + if ( get_transient( 'ppcp_reference_transaction_enabled' ) === '1' ) { return true; } From c38906da9b544eaa8795b3703964c8d853173004 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Fri, 1 Sep 2023 09:48:11 +0200 Subject: [PATCH 2/4] Convert transient vaule to boolean --- .../ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php b/modules/ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php index fb6827e6e..271efc28a 100644 --- a/modules/ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php +++ b/modules/ppcp-api-client/src/Endpoint/BillingAgreementsEndpoint.php @@ -121,7 +121,7 @@ class BillingAgreementsEndpoint { */ public function reference_transaction_enabled(): bool { try { - if ( get_transient( 'ppcp_reference_transaction_enabled' ) === '1' ) { + if ( wc_string_to_bool( get_transient( 'ppcp_reference_transaction_enabled' ) ) === true ) { return true; } From 7415fdb32d427d6b60271a81271573f8094364f1 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Wed, 5 Jul 2023 10:48:29 +0100 Subject: [PATCH 3/4] Do not declare subscription support for PayPal when only ACDC vaulting This reverts commit 01717e740a31b74e1128c1b6356efa002ca10496. --- modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php index c703de904..933e6ce51 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php @@ -227,7 +227,6 @@ class PayPalGateway extends \WC_Payment_Gateway { if ( ( $this->config->has( 'vault_enabled' ) && $this->config->get( 'vault_enabled' ) ) - || ( $this->config->has( 'vault_enabled_dcc' ) && $this->config->get( 'vault_enabled_dcc' ) ) || ( $this->config->has( 'subscriptions_mode' ) && $this->config->get( 'subscriptions_mode' ) === 'subscriptions_api' ) ) { array_push( @@ -244,6 +243,8 @@ class PayPalGateway extends \WC_Payment_Gateway { 'subscription_payment_method_change_admin', 'multiple_subscriptions' ); + } elseif ( $this->config->has( 'vault_enabled_dcc' ) && $this->config->get( 'vault_enabled_dcc' ) ) { + $this->supports[] = 'tokenization'; } } From fa45071a5f7ae0c138a26ef18b57cca7e83a2340 Mon Sep 17 00:00:00 2001 From: Narek Zakarian Date: Fri, 8 Sep 2023 14:41:21 +0400 Subject: [PATCH 4/4] Don't send `image_url` when it is empty --- modules/ppcp-api-client/src/Entity/Item.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-api-client/src/Entity/Item.php b/modules/ppcp-api-client/src/Entity/Item.php index 7d38e5f78..cc739635f 100644 --- a/modules/ppcp-api-client/src/Entity/Item.php +++ b/modules/ppcp-api-client/src/Entity/Item.php @@ -249,9 +249,12 @@ class Item { 'sku' => $this->sku(), 'category' => $this->category(), 'url' => $this->url(), - 'image_url' => $this->image_url(), ); + if ( $this->image_url() ) { + $item['image_url'] = $this->image_url(); + } + if ( $this->tax() ) { $item['tax'] = $this->tax()->to_array(); }