Skip to content

Commit 837aba6

Browse files
Release 3.3.7
1 parent f98c263 commit 837aba6

10 files changed

+297
-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.6/docs/en/documentation.html)
17+
* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.7/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.6/LICENSE) for more information.
34+
Please see the [license file](https://github.com/pfpayments/woocommerce/blob/3.3.7/LICENSE) for more information.
3535

3636
## Privacy Policy
3737

changelog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,3 +905,10 @@ Please ensure that in woocommerce->settings->tax, the "Round tax at subtotal lev
905905
= 3.3.6 - Mar 4 2025 =
906906
- [Bugfix] Correct default status for confirmed and fulfill
907907

908+
= 3.3.7 - Mar 19 2025 =
909+
- [Bugfix] Fix for incorrect statuses being set upon completion
910+
- [Tested Against] PHP 8.2
911+
- [Tested Against] Wordpress 6.7
912+
- [Tested Against] Woocommerce 9.7.0
913+
- [Tested Against] PHP SDK 4.6.0
914+

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.6/">
26+
<a href="https://github.com/pfpayments/woocommerce/releases/tag/3.3.7/">
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.6/docs/en/documentation.html' => esc_html__( 'Documentation', 'woo-postfinancecheckout' ),
208+
'https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.7/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-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.6/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.7/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-webhook-handler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public static function process() {
7979
$webhook_service = WC_PostFinanceCheckout_Service_Webhook::instance();
8080

8181
// Handling of payloads without a signature (legacy method).
82+
// TODO add config to disable strategy/use default webhooks
8283
// Deprecated since 3.0.12.
8384
if ( empty( $signature ) ) {
8485
$webhook_model = $webhook_service->get_webhook_entity_for_id( $request->get_listener_entity_id() );

includes/webhook/strategies/class-wc-postfinancecheckout-webhook-transaction-strategy.php

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -39,71 +39,73 @@ public function match( string $webhook_entity_id ) {
3939
/**
4040
* Process the webhook request.
4141
*
42-
* @param WC_PostFinanceCheckout_Webhook_Request $request The webhook request object.
42+
* @param \PostFinanceCheckout\Sdk\Model\Transaction $transaction The webhook request object.
4343
* @return mixed The result of the processing.
4444
*/
4545
public function process( WC_PostFinanceCheckout_Webhook_Request $request ) {
4646
$order = $this->get_order( $request );
47+
$entity = $this->load_entity( $request );
4748
if ( false != $order && $order->get_id() ) {
48-
$this->process_order_related_inner( $order, $request );
49+
$this->process_order_related_inner( $order, $entity );
4950
}
5051
}
5152

5253
/**
5354
* Process order related inner.
5455
*
5556
* @param WC_Order $order order.
56-
* @param WC_PostFinanceCheckout_Webhook_Request $request request.
57+
* @param mixed $transaction transaction.
5758
* @return void
5859
* @throws Exception Exception.
5960
*/
60-
protected function process_order_related_inner( WC_Order $order, WC_PostFinanceCheckout_Webhook_Request $request ) {
61+
protected function process_order_related_inner( WC_Order $order, $transaction ) {
6162
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_order_id( $order->get_id() );
62-
if ( $request->get_state() != $transaction_info->get_state() ) {
63-
switch ( $request->get_state() ) {
63+
$transaction_state = $transaction->getState();
64+
if ( $transaction_state != $transaction_info->get_state() ) {
65+
switch ( $transaction_state ) {
6466
case \PostFinanceCheckout\Sdk\Model\TransactionState::CONFIRMED:
6567
case \PostFinanceCheckout\Sdk\Model\TransactionState::PROCESSING:
66-
$this->confirm( $request, $order );
68+
$this->confirm( $transaction, $order );
6769
break;
6870
case \PostFinanceCheckout\Sdk\Model\TransactionState::AUTHORIZED:
69-
$this->authorize( $request, $order );
71+
$this->authorize( $transaction, $order );
7072
break;
7173
case \PostFinanceCheckout\Sdk\Model\TransactionState::DECLINE:
72-
$this->decline( $request, $order );
74+
$this->decline( $transaction, $order );
7375
break;
7476
case \PostFinanceCheckout\Sdk\Model\TransactionState::FAILED:
75-
$this->failed( $request, $order );
77+
$this->failed( $transaction, $order );
7678
break;
7779
case \PostFinanceCheckout\Sdk\Model\TransactionState::FULFILL:
78-
$this->authorize( $request, $order );
79-
$this->fulfill( $request, $order );
80+
$this->authorize( $transaction, $order );
81+
$this->fulfill( $transaction, $order );
8082
break;
8183
case \PostFinanceCheckout\Sdk\Model\TransactionState::VOIDED:
82-
$this->voided( $request, $order );
84+
$this->voided( $transaction, $order );
8385
break;
8486
case \PostFinanceCheckout\Sdk\Model\TransactionState::COMPLETED:
85-
$this->authorize( $request, $order );
86-
$this->waiting( $request, $order );
87+
$this->authorize( $transaction, $order );
88+
$this->waiting( $transaction, $order );
8789
break;
8890
default:
8991
// Nothing to do.
9092
break;
9193
}
9294
}
9395

94-
WC_PostFinanceCheckout_Service_Transaction::instance()->update_transaction_info( $this->load_entity( $request ), $order );
96+
WC_PostFinanceCheckout_Service_Transaction::instance()->update_transaction_info( $transaction, $order );
9597
}
9698

9799
/**
98100
* Confirm.
99101
*
100-
* @param WC_PostFinanceCheckout_Webhook_Request $request request.
102+
* @param \PostFinanceCheckout\Sdk\Model\Transaction $transaction transaction.
101103
* @param WC_Order $order order.
102104
* @return void
103105
*/
104-
protected function confirm( WC_PostFinanceCheckout_Webhook_Request $request, WC_Order $order ) {
106+
protected function confirm( \PostFinanceCheckout\Sdk\Model\Transaction $transaction, WC_Order $order ) {
105107
if ( ! $order->get_meta( '_postfinancecheckout_confirmed', true ) && ! $order->get_meta( '_postfinancecheckout_authorized', true ) ) {
106-
do_action( 'wc_postfinancecheckout_confirmed', $this->load_entity( $request ), $order );
108+
do_action( 'wc_postfinancecheckout_confirmed', $transaction, $order );
107109
$order->add_meta_data( '_postfinancecheckout_confirmed', 'true', true );
108110
$default_status = apply_filters( 'wc_postfinancecheckout_confirmed_status', 'postfi-redirected', $order );
109111
apply_filters( 'postfinancecheckout_order_update_status', $order, \PostFinanceCheckout\Sdk\Model\TransactionState::CONFIRMED, $default_status );
@@ -114,12 +116,12 @@ protected function confirm( WC_PostFinanceCheckout_Webhook_Request $request, WC_
114116
/**
115117
* Authorize.
116118
*
117-
* @param WC_PostFinanceCheckout_Webhook_Request $request request.
119+
* @param \PostFinanceCheckout\Sdk\Model\Transaction $transaction transaction.
118120
* @param \WC_Order $order order.
119121
*/
120-
protected function authorize( WC_PostFinanceCheckout_Webhook_Request $request, WC_Order $order ) {
122+
protected function authorize( \PostFinanceCheckout\Sdk\Model\Transaction $transaction, WC_Order $order ) {
121123
if ( ! $order->get_meta( '_postfinancecheckout_authorized', true ) ) {
122-
do_action( 'wc_postfinancecheckout_authorized', $this->load_entity( $request ), $order );
124+
do_action( 'wc_postfinancecheckout_authorized', $transaction, $order );
123125
$order->add_meta_data( '_postfinancecheckout_authorized', 'true', true );
124126
$default_status = apply_filters( 'wc_postfinancecheckout_authorized_status', 'on-hold', $order );
125127
apply_filters( 'postfinancecheckout_order_update_status', $order, \PostFinanceCheckout\Sdk\Model\TransactionState::AUTHORIZED, $default_status );
@@ -133,13 +135,13 @@ protected function authorize( WC_PostFinanceCheckout_Webhook_Request $request, W
133135
/**
134136
* Waiting.
135137
*
136-
* @param WC_PostFinanceCheckout_Webhook_Request $request request.
138+
* @param \PostFinanceCheckout\Sdk\Model\Transaction $transaction transaction.
137139
* @param WC_Order $order order.
138140
* @return void
139141
*/
140-
protected function waiting( WC_PostFinanceCheckout_Webhook_Request $request, WC_Order $order ) {
142+
protected function waiting( \PostFinanceCheckout\Sdk\Model\Transaction $transaction, WC_Order $order ) {
141143
if ( ! $order->get_meta( '_postfinancecheckout_manual_check', true ) ) {
142-
do_action( 'wc_postfinancecheckout_completed', $this->load_entity( $request ), $order );
144+
do_action( 'wc_postfinancecheckout_completed', $transaction, $order );
143145
$default_status = apply_filters( 'wc_postfinancecheckout_completed_status', 'processing', $order );
144146
apply_filters( 'postfinancecheckout_order_update_status', $order, \PostFinanceCheckout\Sdk\Model\TransactionState::COMPLETED, $default_status );
145147
}
@@ -148,12 +150,12 @@ protected function waiting( WC_PostFinanceCheckout_Webhook_Request $request, WC_
148150
/**
149151
* Decline.
150152
*
151-
* @param WC_PostFinanceCheckout_Webhook_Request $request request.
153+
* @param \PostFinanceCheckout\Sdk\Model\Transaction $transaction transaction.
152154
* @param WC_Order $order order.
153155
* @return void
154156
*/
155-
protected function decline( WC_PostFinanceCheckout_Webhook_Request $request, WC_Order $order ) {
156-
do_action( 'wc_postfinancecheckout_declined', $this->load_entity( $request ), $order );
157+
protected function decline( \PostFinanceCheckout\Sdk\Model\Transaction $transaction, WC_Order $order ) {
158+
do_action( 'wc_postfinancecheckout_declined', $transaction, $order );
157159
$default_status = apply_filters( 'wc_postfinancecheckout_decline_status', 'cancelled', $order );
158160
apply_filters( 'postfinancecheckout_order_update_status', $order, \PostFinanceCheckout\Sdk\Model\TransactionState::DECLINE, $default_status );
159161
WC_PostFinanceCheckout_Helper::instance()->maybe_restock_items_for_order( $order );
@@ -162,12 +164,12 @@ protected function decline( WC_PostFinanceCheckout_Webhook_Request $request, WC_
162164
/**
163165
* Failed.
164166
*
165-
* @param WC_PostFinanceCheckout_Webhook_Request $request request.
167+
* @param \PostFinanceCheckout\Sdk\Model\Transaction $transaction transaction.
166168
* @param WC_Order $order order.
167169
* @return void
168170
*/
169-
protected function failed( WC_PostFinanceCheckout_Webhook_Request $request, WC_Order $order ) {
170-
do_action( 'wc_postfinancecheckout_failed', $this->load_entity( $request ), $order );
171+
protected function failed( \PostFinanceCheckout\Sdk\Model\Transaction $transaction, WC_Order $order ) {
172+
do_action( 'wc_postfinancecheckout_failed', $transaction, $order );
171173
$valid_order_statuses = array(
172174
// Default pending status.
173175
'pending',
@@ -185,26 +187,26 @@ protected function failed( WC_PostFinanceCheckout_Webhook_Request $request, WC_O
185187
/**
186188
* Fulfill.
187189
*
188-
* @param WC_PostFinanceCheckout_Webhook_Request $request request.
190+
* @param \PostFinanceCheckout\Sdk\Model\Transaction $transaction transaction.
189191
* @param WC_Order $order order.
190192
* @return void
191193
*/
192-
protected function fulfill( WC_PostFinanceCheckout_Webhook_Request $request, WC_Order $order ) {
193-
do_action( 'wc_postfinancecheckout_fulfill', $this->load_entity( $request ), $order );
194+
protected function fulfill( \PostFinanceCheckout\Sdk\Model\Transaction $transaction, WC_Order $order ) {
195+
do_action( 'wc_postfinancecheckout_fulfill', $transaction, $order );
194196
// Sets the status to procesing or complete depending on items.
195-
$order->payment_complete( $request->get_entity_id() );
197+
$order->payment_complete( $transaction->getId() );
196198
}
197199

198200
/**
199201
* Voided.
200202
*
201-
* @param WC_PostFinanceCheckout_Webhook_Request $request request.
203+
* @param \PostFinanceCheckout\Sdk\Model\Transaction $transaction transaction.
202204
* @param WC_Order $order order.
203205
* @return void
204206
*/
205-
protected function voided( WC_PostFinanceCheckout_Webhook_Request $request, WC_Order $order ) {
207+
protected function voided( \PostFinanceCheckout\Sdk\Model\Transaction $transaction, WC_Order $order ) {
206208
$default_status = apply_filters( 'wc_postfinancecheckout_voided_status', 'cancelled', $order );
207209
apply_filters( 'postfinancecheckout_order_update_status', $order, \PostFinanceCheckout\Sdk\Model\TransactionState::VOIDED, $default_status );
208-
do_action( 'wc_postfinancecheckout_voided', $this->load_entity( $request ), $order );
210+
do_action( 'wc_postfinancecheckout_voided', $transaction, $order );
209211
}
210212
}

readme.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: postfinancecheckout AG
33
Tags: woocommerce PostFinance Checkout, woocommerce, PostFinance Checkout, payment, e-commerce, webshop, psp, invoice, packing slips, pdf, customer invoice, processing
44
Requires at least: 4.7
55
Tested up to: 6.7
6-
Stable tag: 3.3.6
6+
Stable tag: 3.3.7
77
License: Apache-2.0
88
License URI: http://www.apache.org/licenses/LICENSE-2.0
99

@@ -23,7 +23,7 @@ To use this extension, a PostFinance Checkout account is required. Sign up on [P
2323

2424
== Documentation ==
2525

26-
Additional documentation for this plugin is available [here](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.6/docs/en/documentation.html).
26+
Additional documentation for this plugin is available [here](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/3.3.7/docs/en/documentation.html).
2727

2828
== External Services ==
2929

@@ -81,5 +81,9 @@ Enquiries about our terms of use can be made on the [PostFinance Checkout terms
8181
== Changelog ==
8282

8383

84-
= 3.3.6 - Mar 4 2025 =
85-
- [Bugfix] Correct default status for confirmed and fulfill
84+
= 3.3.7 - Mar 19 2025 =
85+
- [Bugfix] Fix for incorrect statuses being set upon completion
86+
- [Tested Against] PHP 8.2
87+
- [Tested Against] Wordpress 6.7
88+
- [Tested Against] Woocommerce 9.7.0
89+
- [Tested Against] PHP SDK 4.6.0

0 commit comments

Comments
 (0)