Skip to content

Commit 3720baf

Browse files
committed
Release 3.0.1
1 parent 7388276 commit 3720baf

File tree

5 files changed

+79
-64
lines changed

5 files changed

+79
-64
lines changed

changelog.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,3 @@ Tested against:
727727
- [Tested Against] Woocommerce 8.5.2
728728
- [Tested Against] PHP SDK 4.0.2
729729

730-
= 3.0.1 - April 3 2024 =
731-
- [Feature] Added support to High Performance Order Storage (HPOS).
732-
- [Tested Against] PHP 8.2
733-
- [Tested Against] Wordpress 6.5
734-
- [Tested Against] Woocommerce 8.7.0
735-
- [Tested Against] PHP SDK 4.0.2
736-

includes/admin/class-wc-postfinancecheckout-admin-document.php

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,35 +113,50 @@ public static function add_buttons_to_overview( WC_Order $order ) {
113113

114114
/**
115115
* Add WC Meta boxes.
116-
* @see: https://woo.com/document/high-performance-order-storage/#section-8
117116
*/
118117
public static function add_meta_box() {
119-
$screen = class_exists( '\Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' )
120-
&& wc_get_container()->get( \Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled()
121-
? wc_get_page_screen_id( 'shop-order' )
122-
: 'shop_order';
123-
add_meta_box(
124-
'woocommerce-order-postfinancecheckout-documents',
125-
__( 'PostFinance Checkout Documents', 'woo-postfinancecheckout' ),
118+
global $post;
119+
if ( 'shop_order' !== $post->post_type ) {
120+
return;
121+
}
122+
$order = WC_Order_Factory::get_order( $post->ID );
123+
$method = wc_get_payment_gateway_by_order( $order );
124+
if ( ! ( $method instanceof WC_PostFinanceCheckout_Gateway ) ) {
125+
return;
126+
}
127+
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_order_id( $order->get_id() );
128+
if ( $transaction_info->get_id() !== null && in_array(
129+
$transaction_info->get_state(),
126130
array(
127-
__CLASS__,
128-
'output',
131+
\PostFinanceCheckout\Sdk\Model\TransactionState::COMPLETED,
132+
\PostFinanceCheckout\Sdk\Model\TransactionState::FULFILL,
133+
\PostFinanceCheckout\Sdk\Model\TransactionState::DECLINE,
129134
),
130-
$screen,
131-
'side',
132-
'default'
133-
);
135+
true
136+
) ) {
137+
add_meta_box(
138+
'woocommerce-order-postfinancecheckout-documents',
139+
__( 'PostFinance Checkout Documents', 'woo-postfinancecheckout' ),
140+
array(
141+
__CLASS__,
142+
'output',
143+
),
144+
'shop_order',
145+
'side',
146+
'default'
147+
);
148+
}
134149
}
135150

136151
/**
137152
* Output the metabox.
138153
*
139-
* @param WP_Post|WP_Order $post_or_order_object
140-
* This object is provided by woocommerce when using its screen.
154+
* @param WP_Post $post Post.
141155
*/
142-
public static function output( $post_or_order_object ) {
143-
$order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
156+
public static function output( $post ) {
157+
global $post;
144158

159+
$order = WC_Order_Factory::get_order( $post->ID );
145160
$method = wc_get_payment_gateway_by_order( $order );
146161
if ( ! ( $method instanceof WC_PostFinanceCheckout_Gateway ) ) {
147162
return;

includes/admin/class-wc-postfinancecheckout-admin-transaction.php

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,45 @@ public static function init() {
4141

4242
/**
4343
* Add WC Meta boxes.
44-
* @see: https://woo.com/document/high-performance-order-storage/#section-8
4544
*/
4645
public static function add_meta_box() {
47-
$screen = class_exists( '\Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' )
48-
&& wc_get_container()->get( \Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled()
49-
? wc_get_page_screen_id( 'shop-order' )
50-
: 'shop_order';
51-
add_meta_box(
52-
'woocommerce-order-postfinancecheckout-transaction',
53-
__( 'PostFinance Checkout Transaction', 'woocommerce-postfinancecheckout' ),
54-
array(
55-
__CLASS__,
56-
'output',
57-
),
58-
$screen,
59-
'normal',
60-
'default'
61-
);
46+
global $post;
47+
if ( 'shop_order' != $post->post_type ) {
48+
return;
49+
}
50+
$order = WC_Order_Factory::get_order( $post->ID );
51+
$method = wc_get_payment_gateway_by_order( $order );
52+
if ( ! ( $method instanceof WC_PostFinanceCheckout_Gateway ) ) {
53+
return;
54+
}
55+
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_order_id( $order->get_id() );
56+
if ( $transaction_info->get_id() == null ) {
57+
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_newest_by_mapped_order_id( $order->get_id() );
58+
}
59+
if ( $transaction_info->get_id() != null ) {
60+
add_meta_box(
61+
'woocommerce-order-postfinancecheckout-transaction',
62+
__( 'PostFinance Checkout Transaction', 'woocommerc-postfinancecheckout' ),
63+
array(
64+
__CLASS__,
65+
'output',
66+
),
67+
'shop_order',
68+
'normal',
69+
'default'
70+
);
71+
}
6272
}
6373

6474
/**
6575
* Output the metabox.
6676
*
67-
* @param WP_Post|WP_Order $post_or_order_object
68-
* This object is provided by woocommerce when using its screen.
77+
* @param WP_Post $post post data.
6978
*/
70-
public static function output( $post_or_order_object ) {
71-
$order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
79+
public static function output( $post ) {
80+
global $post;
7281

82+
$order = WC_Order_Factory::get_order( $post->ID );
7383
$method = wc_get_payment_gateway_by_order( $order );
7484
if ( ! ( $method instanceof WC_PostFinanceCheckout_Gateway ) ) {
7585
return;
@@ -119,7 +129,7 @@ public static function output( $post_or_order_object ) {
119129
<td class="value"><strong><?php esc_html_e( $transaction_info->get_order_id() ); ?></strong></td>
120130
</tr>
121131
<?php endif; ?>
122-
132+
123133
<?php if ( $transaction_info->get_failure_reason() != null ) : ?>
124134
<tr>
125135
<td class="label"><label><?php esc_html_e( 'Failure Reason', 'woo-postfinancecheckout' ); ?></label></td>
@@ -145,7 +155,7 @@ public static function output( $post_or_order_object ) {
145155
</tbody>
146156
</table>
147157
</div>
148-
158+
149159

150160
<?php if ( ! empty( $labels_by_group ) ) : ?>
151161
<?php foreach ( $labels_by_group as $group ) : ?>
@@ -167,7 +177,7 @@ public static function output( $post_or_order_object ) {
167177
</table>
168178
</div>
169179
</div>
170-
180+
171181
<?php endforeach; ?>
172182
<?php endif; ?>
173183
</div>

readme.txt

Lines changed: 6 additions & 6 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.2
6-
Stable tag: 3.0.1
6+
Stable tag: 3.0.0
77
License: Apache 2
88
License URI: http://www.apache.org/licenses/LICENSE-2.0
99

@@ -56,9 +56,9 @@ Support queries can be issued on the [PostFinance Checkout support site](https:/
5656
== Changelog ==
5757

5858

59-
= 3.0.1 - April 3 2024 =
60-
- [Feature] Added support to High Performance Order Storage (HPOS).
61-
- [Tested Against] PHP 8.2
62-
- [Tested Against] Wordpress 6.5
63-
- [Tested Against] Woocommerce 8.7.0
59+
= 3.0.0 - February 20 2024 =
60+
- [Feature] Full version release
61+
- [Tested Against] PHP 8.0
62+
- [Tested Against] Wordpress 6.4.3
63+
- [Tested Against] Woocommerce 8.5.2
6464
- [Tested Against] PHP SDK 4.0.2

woocommerce-postfinancecheckout.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
* Plugin Name: PostFinance Checkout
44
* Plugin URI: https://wordpress.org/plugins/woo-postfinancecheckout
55
* Description: Process WooCommerce payments with PostFinance Checkout.
6+
* Version: 3.0.0
67
* License: Apache2
78
* License URI: http://www.apache.org/licenses/LICENSE-2.0
89
* Author: postfinancecheckout AG
910
* Author URI: https://postfinance.ch/en/business/products/e-commerce/postfinance-checkout-all-in-one.html
11+
* Requires at least: 4.7
12+
* Tested up to: 6.3
13+
* WC requires at least: 3.0.0
14+
* WC tested up to: 7.8.2
1015
*
1116
* Text Domain: postfinancecheckout
1217
* Domain Path: /languages/
@@ -34,14 +39,14 @@ final class WooCommerce_PostFinanceCheckout {
3439
const CK_INTEGRATION = 'wc_postfinancecheckout_integration';
3540
const CK_ORDER_REFERENCE = 'wc_postfinancecheckout_order_reference';
3641
const CK_ENFORCE_CONSISTENCY = 'wc_postfinancecheckout_enforce_consistency';
37-
const WC_MAXIMUM_VERSION = '8.7.0';
42+
const WC_MAXIMUM_VERSION = '8.5.2';
3843

3944
/**
4045
* WooCommerce PostFinanceCheckout version.
4146
*
4247
* @var string
4348
*/
44-
private $version = '3.0.1';
49+
private $version = '3.0.0';
4550

4651
/**
4752
* The single instance of the class.
@@ -442,14 +447,6 @@ public function loaded() {
442447
10,
443448
2
444449
);
445-
446-
447-
add_action( 'before_woocommerce_init', function() {
448-
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
449-
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
450-
}
451-
} );
452-
453450
}
454451

455452
/**

0 commit comments

Comments
 (0)