Skip to content

Commit feac8c6

Browse files
Release 3.3.10
1 parent 82175ce commit feac8c6

26 files changed

+415
-49
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This repository contains the PostFinance Checkout plugin that enables WooCommerc
1414

1515
## Documentation
1616

17-
* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.9/docs/en/documentation.html)
17+
* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.10/docs/en/documentation.html)
1818

1919
## Support
2020

@@ -31,7 +31,7 @@ ____________________________________________________________________________
3131

3232
## License
3333

34-
Please see the [license file](https://github.com/pfpayments/woocommerce/blob/3.3.9/LICENSE) for more information.
34+
Please see the [license file](https://github.com/pfpayments/woocommerce/blob/3.3.10/LICENSE) for more information.
3535

3636
## Privacy Policy
3737

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('@woocommerce/blocks-registry', 'react', 'wp-polyfill'), 'version' => '462b4016eb3699d922cf');
1+
<?php return array('dependencies' => array('@woocommerce/blocks-registry', 'react', 'wp-polyfill'), 'version' => '2c623899a9a4f847ea27');

assets/js/frontend/blocks/build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/frontend/checkout.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ jQuery(
4747
},
4848

4949
init : function () {
50+
const selected = this.get_selected_payment_method();
51+
52+
if (selected === 'postfinancecheckout_zero') {
53+
return;
54+
}
55+
5056
// Payment methods.
5157
this.$checkout_form.off( 'click.woo-postfinancecheckout' ).on(
5258
'click.woo-postfinancecheckout',

changelog.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,3 +928,12 @@ Please ensure that in woocommerce->settings->tax, the "Round tax at subtotal lev
928928
- [Tested Against] Woocommerce 9.8.2
929929
- [Tested Against] PHP SDK 4.8.0
930930

931+
= 3.3.10 - May 13th 2025 =
932+
- [Bugfix] Fix to allow bulk order updates
933+
- [Bugfix] Process 0 amount transactions correctly
934+
- [Bugfix] Fix email sending at the correct time (when payment authorized and paid)
935+
- [Tested Against] PHP 8.2
936+
- [Tested Against] Wordpress 6.7
937+
- [Tested Against] Woocommerce 9.8.5
938+
- [Tested Against] PHP SDK 4.8.0
939+

docs/en/documentation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h2>Documentation</h2> </div>
2323
</a>
2424
</li>
2525
<li>
26-
<a href="https://github.com/pfpayments/woocommerce/releases/tag/3.3.9/">
26+
<a href="https://github.com/pfpayments/woocommerce/releases/tag/3.3.10/">
2727
Source
2828
</a>
2929
</li>

includes/admin/class-wc-postfinancecheckout-admin-settings-page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function get_default_settings() {
205205
$settings = array(
206206
array(
207207
'links' => array(
208-
'https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.9/docs/en/documentation.html' => esc_html__( 'Documentation', 'woo-postfinancecheckout' ),
208+
'https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.10/docs/en/documentation.html' => esc_html__( 'Documentation', 'woo-postfinancecheckout' ),
209209
'https://checkout.postfinance.ch/en-ch/user/signup' => esc_html__( 'Sign Up', 'woo-postfinancecheckout' ),
210210
),
211211
'type' => 'postfinancecheckout_links',

includes/class-wc-postfinancecheckout-blocks-support.php

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function is_active() {
5757
*/
5858
public function get_payment_method_script_handles() {
5959
$dependencies = array();
60-
$version = '1';
60+
$version = '3.3.10';
6161

6262
wp_register_script(
6363
'WooCommerce_PostFinanceCheckout_blocks_support',
@@ -108,6 +108,7 @@ public static function get_payment_methods(): array {
108108
}
109109

110110
$payment_gateways = WC()->payment_gateways()->payment_gateways();
111+
111112
$available_payment_methods = WC_PostFinanceCheckout_Service_Transaction::instance()->get_possible_payment_methods_for_cart();
112113

113114
$payment_plugin = array_filter(
@@ -118,7 +119,15 @@ public static function get_payment_methods(): array {
118119

119120
$payments_list =
120121
array_map(
121-
function ( WC_PostFinanceCheckout_Gateway $payment_gateway ) use ( $available_payment_methods ) {
122+
function ( $payment_gateway ) use ( $available_payment_methods ) {
123+
$has_subscription = WC_PostFinanceCheckout_Zero_Gateway::cart_has_subscription();
124+
$cartTotal = (WC()->cart && WC()->cart->total) ?? 0;
125+
$isPaymentMethodVisibleOnCheckout = $payment_gateway->get_payment_configuration_id() === WC_PostFinanceCheckout_Zero_Gateway::ZERO_PAYMENT_CONF_ID && $cartTotal == 0;
126+
127+
if ( !$isPaymentMethodVisibleOnCheckout ) {
128+
$isPaymentMethodVisibleOnCheckout = in_array( $payment_gateway->get_payment_configuration_id(), $available_payment_methods, true ) && ( $cartTotal > 0 || $has_subscription );
129+
}
130+
122131
return array(
123132
'name' => $payment_gateway->id,
124133
'label' => $payment_gateway->get_title(),
@@ -128,7 +137,7 @@ function ( WC_PostFinanceCheckout_Gateway $payment_gateway ) use ( $available_pa
128137
'integration_mode' => get_option( WooCommerce_PostFinanceCheckout::POSTFINANCECHECKOUT_CK_INTEGRATION ),
129138
'supports' => $payment_gateway->supports,
130139
'icon' => $payment_gateway->get_icon(),
131-
'isActive' => in_array( $payment_gateway->get_payment_configuration_id(), $available_payment_methods, true )
140+
'isActive' => $isPaymentMethodVisibleOnCheckout
132141
);
133142
},
134143
$payment_plugin
@@ -195,18 +204,17 @@ public static function enqueue_portal_scripts() {
195204
$transaction_service = WC_PostFinanceCheckout_Service_Transaction::instance();
196205
$transaction = $transaction_service->get_transaction_from_session();
197206

198-
switch( get_option( WooCommerce_PostFinanceCheckout::POSTFINANCECHECKOUT_CK_INTEGRATION ) ) {
199-
case WC_PostFinanceCheckout_Integration::POSTFINANCECHECKOUT_IFRAME:
200-
// Ask the portal for the iframe's javascript file.
201-
$js_url = $transaction_service->get_javascript_url_for_transaction( $transaction );
202-
break;
203-
case WC_PostFinanceCheckout_Integration::POSTFINANCECHECKOUT_LIGHTBOX:
204-
$js_url = $transaction_service->get_lightbox_url_for_transaction( $transaction );
205-
// Ask the portal for the lighbox's javascript file.
206-
break;
207-
default:
208-
$js_url = '';
209-
break;
207+
$js_url = '';
208+
$zeroPaymentMethod = new WC_PostFinanceCheckout_Zero_Gateway();
209+
if ( !$zeroPaymentMethod->is_available() || $zeroPaymentMethod->cart_has_subscription() ) {
210+
switch( get_option( WooCommerce_PostFinanceCheckout::POSTFINANCECHECKOUT_CK_INTEGRATION ) ) {
211+
case WC_PostFinanceCheckout_Integration::POSTFINANCECHECKOUT_IFRAME:
212+
$js_url = $transaction_service->get_javascript_url_for_transaction( $transaction );
213+
break;
214+
case WC_PostFinanceCheckout_Integration::POSTFINANCECHECKOUT_LIGHTBOX:
215+
$js_url = $transaction_service->get_lightbox_url_for_transaction( $transaction );
216+
break;
217+
}
210218
}
211219

212220
if ( $js_url ) {
@@ -250,6 +258,7 @@ public static function process_payment( PaymentContext $context, PaymentResult &
250258
if ( ! $payment_method_object instanceof \WC_PostFinanceCheckout_Gateway ) {
251259
return;
252260
}
261+
253262
$payment_method_object->validate_fields();
254263

255264
// We call here the payment processor from our gateway.

includes/class-wc-postfinancecheckout-email.php

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Software License (ASL 2.0)
1515
*/
1616

17+
use PostFinanceCheckout\Sdk\Model\TransactionState;
18+
1719
defined( 'ABSPATH' ) || exit;
1820

1921
/**
@@ -27,6 +29,15 @@ class WC_PostFinanceCheckout_Email {
2729
* Register email hooks.
2830
*/
2931
public static function init() {
32+
add_action(
33+
'postfinancecheckout_transaction_authorized_send_email',
34+
array(
35+
__CLASS__,
36+
'send_on_hold_email_when_authorized'
37+
),
38+
10,
39+
1
40+
);
3041
add_filter(
3142
'woocommerce_email_enabled_new_order',
3243
array(
@@ -143,6 +154,27 @@ public static function init() {
143154
add_filter( 'woocommerce_email_classes', array( __CLASS__, 'add_email_classes' ), 100, 1 );
144155
}
145156

157+
/**
158+
* @param $order_id
159+
* @return void
160+
*/
161+
public static function send_on_hold_email_when_authorized( $order_id ) {
162+
$order = wc_get_order( $order_id );
163+
if ( ! $order instanceof WC_Order ) {
164+
return;
165+
}
166+
167+
$emails = WC()->mailer()->get_emails();
168+
if ( isset( $emails['WC_Email_Customer_On_Hold_Order'] ) ) {
169+
$emails['WC_Email_Customer_On_Hold_Order']->trigger( $order_id );
170+
update_post_meta( $order_id, '_postfinancecheckout_on_hold_email_sent', true );
171+
}
172+
173+
if ( isset( $emails['WC_Email_New_Order'] ) ) {
174+
$emails['WC_Email_New_Order']->trigger( $order_id );
175+
}
176+
}
177+
146178
/**
147179
* Sends emails.
148180
*
@@ -161,7 +193,11 @@ public static function send_email_for_order( $enabled, $order ) {
161193
if ( $gateway instanceof WC_PostFinanceCheckout_Gateway ) {
162194
$send = get_option( WooCommerce_PostFinanceCheckout::POSTFINANCECHECKOUT_CK_SHOP_EMAIL, 'yes' );
163195
if ( 'yes' !== $send ) {
164-
return false;
196+
return;
197+
}
198+
199+
if ( ! self::is_authorized_on_hold_order( $order ) ) {
200+
return;
165201
}
166202
}
167203
return $enabled;
@@ -317,6 +353,11 @@ public static function check_germanized_pay_email_trigger( $order_id, $order = f
317353
if ( 'yes' !== $send ) {
318354
return;
319355
}
356+
357+
if ( ! self::is_authorized_on_hold_order( $order ) ) {
358+
return;
359+
}
360+
320361
$mails = WC()->mailer()->get_emails();
321362
if ( isset( $mails['WC_GZD_Email_Customer_Paid_For_Order'] ) ) {
322363
$mails['WC_GZD_Email_Customer_Paid_For_Order']->trigger( $order_id );
@@ -404,8 +445,29 @@ public static function germanized_send_order_confirmation( $email_sent, $order_i
404445
return true;
405446
}
406447
}
448+
449+
if ( ! self::is_authorized_on_hold_order( $order ) ) {
450+
return;
451+
}
407452
return $email_sent;
408453
}
454+
455+
/**
456+
* @param WC_Order $order
457+
* @return bool
458+
*/
459+
private static function is_authorized_on_hold_order( WC_Order $order ) {
460+
if ( $order->get_status() !== 'on-hold' ) {
461+
return true;
462+
}
463+
464+
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_order_id( $order->get_id() );
465+
if ( ! $transaction_info || ( $transaction_info->get_state() !== TransactionState::AUTHORIZED ) ) {
466+
return false;
467+
}
468+
469+
return true;
470+
}
409471
}
410472

411473
WC_PostFinanceCheckout_Email::init();

includes/class-wc-postfinancecheckout-migration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public static function check_version() {
268268
public static function plugin_row_meta( $links, $file ) {
269269
if ( WC_POSTFINANCECHECKOUT_PLUGIN_BASENAME === $file ) {
270270
$row_meta = array(
271-
'docs' => '<a href="https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.9/docs/en/documentation.html" aria-label="' . esc_html__( 'View Documentation', 'woo-postfinancecheckout' ) . '">' . esc_html__( 'Documentation', 'woo-postfinancecheckout' ) . '</a>',
271+
'docs' => '<a href="https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.10/docs/en/documentation.html" aria-label="' . esc_html__( 'View Documentation', 'woo-postfinancecheckout' ) . '">' . esc_html__( 'Documentation', 'woo-postfinancecheckout' ) . '</a>',
272272
);
273273

274274
return array_merge( $links, $row_meta );

includes/class-wc-postfinancecheckout-order-status-adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private function initialize_filters(): void
9696
//tests.
9797
// CPT-based orders.
9898
add_filter( 'bulk_actions-edit-shop_order', array($this, 'bulk_actions_shop_order'), 20, 1 );
99-
add_action( 'handle_bulk_actions-edit-shop_order', 'rudr_bulk_process_custom_status', 20, 3 );
99+
add_action( 'handle_bulk_actions-edit-shop_order', array($this, 'bulk_process_custom_status'), 20, 3 );
100100
// HPOS orders.
101101
add_filter( 'bulk_actions-woocommerce_page_wc-orders', array($this, 'bulk_actions_shop_order'), 20, 1 );
102102
add_filter( 'handle_bulk_actions-woocommerce_page_wc-orders', array($this, 'bulk_process_custom_status'), 20, 3 );

0 commit comments

Comments
 (0)