Skip to content

Commit

Permalink
Release 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
edgaraswallee committed Apr 3, 2024
1 parent 7388276 commit 3720baf
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 64 deletions.
7 changes: 0 additions & 7 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,3 @@ Tested against:
- [Tested Against] Woocommerce 8.5.2
- [Tested Against] PHP SDK 4.0.2

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

51 changes: 33 additions & 18 deletions includes/admin/class-wc-postfinancecheckout-admin-document.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,35 +113,50 @@ public static function add_buttons_to_overview( WC_Order $order ) {

/**
* Add WC Meta boxes.
* @see: https://woo.com/document/high-performance-order-storage/#section-8
*/
public static function add_meta_box() {
$screen = class_exists( '\Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' )
&& wc_get_container()->get( \Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled()
? wc_get_page_screen_id( 'shop-order' )
: 'shop_order';
add_meta_box(
'woocommerce-order-postfinancecheckout-documents',
__( 'PostFinance Checkout Documents', 'woo-postfinancecheckout' ),
global $post;
if ( 'shop_order' !== $post->post_type ) {
return;
}
$order = WC_Order_Factory::get_order( $post->ID );
$method = wc_get_payment_gateway_by_order( $order );
if ( ! ( $method instanceof WC_PostFinanceCheckout_Gateway ) ) {
return;
}
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_order_id( $order->get_id() );
if ( $transaction_info->get_id() !== null && in_array(
$transaction_info->get_state(),
array(
__CLASS__,
'output',
\PostFinanceCheckout\Sdk\Model\TransactionState::COMPLETED,
\PostFinanceCheckout\Sdk\Model\TransactionState::FULFILL,
\PostFinanceCheckout\Sdk\Model\TransactionState::DECLINE,
),
$screen,
'side',
'default'
);
true
) ) {
add_meta_box(
'woocommerce-order-postfinancecheckout-documents',
__( 'PostFinance Checkout Documents', 'woo-postfinancecheckout' ),
array(
__CLASS__,
'output',
),
'shop_order',
'side',
'default'
);
}
}

/**
* Output the metabox.
*
* @param WP_Post|WP_Order $post_or_order_object
* This object is provided by woocommerce when using its screen.
* @param WP_Post $post Post.
*/
public static function output( $post_or_order_object ) {
$order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
public static function output( $post ) {
global $post;

$order = WC_Order_Factory::get_order( $post->ID );
$method = wc_get_payment_gateway_by_order( $order );
if ( ! ( $method instanceof WC_PostFinanceCheckout_Gateway ) ) {
return;
Expand Down
56 changes: 33 additions & 23 deletions includes/admin/class-wc-postfinancecheckout-admin-transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,45 @@ public static function init() {

/**
* Add WC Meta boxes.
* @see: https://woo.com/document/high-performance-order-storage/#section-8
*/
public static function add_meta_box() {
$screen = class_exists( '\Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' )
&& wc_get_container()->get( \Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled()
? wc_get_page_screen_id( 'shop-order' )
: 'shop_order';
add_meta_box(
'woocommerce-order-postfinancecheckout-transaction',
__( 'PostFinance Checkout Transaction', 'woocommerce-postfinancecheckout' ),
array(
__CLASS__,
'output',
),
$screen,
'normal',
'default'
);
global $post;
if ( 'shop_order' != $post->post_type ) {
return;
}
$order = WC_Order_Factory::get_order( $post->ID );
$method = wc_get_payment_gateway_by_order( $order );
if ( ! ( $method instanceof WC_PostFinanceCheckout_Gateway ) ) {
return;
}
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_order_id( $order->get_id() );
if ( $transaction_info->get_id() == null ) {
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_newest_by_mapped_order_id( $order->get_id() );
}
if ( $transaction_info->get_id() != null ) {
add_meta_box(
'woocommerce-order-postfinancecheckout-transaction',
__( 'PostFinance Checkout Transaction', 'woocommerc-postfinancecheckout' ),
array(
__CLASS__,
'output',
),
'shop_order',
'normal',
'default'
);
}
}

/**
* Output the metabox.
*
* @param WP_Post|WP_Order $post_or_order_object
* This object is provided by woocommerce when using its screen.
* @param WP_Post $post post data.
*/
public static function output( $post_or_order_object ) {
$order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;
public static function output( $post ) {
global $post;

$order = WC_Order_Factory::get_order( $post->ID );
$method = wc_get_payment_gateway_by_order( $order );
if ( ! ( $method instanceof WC_PostFinanceCheckout_Gateway ) ) {
return;
Expand Down Expand Up @@ -119,7 +129,7 @@ public static function output( $post_or_order_object ) {
<td class="value"><strong><?php esc_html_e( $transaction_info->get_order_id() ); ?></strong></td>
</tr>
<?php endif; ?>

<?php if ( $transaction_info->get_failure_reason() != null ) : ?>
<tr>
<td class="label"><label><?php esc_html_e( 'Failure Reason', 'woo-postfinancecheckout' ); ?></label></td>
Expand All @@ -145,7 +155,7 @@ public static function output( $post_or_order_object ) {
</tbody>
</table>
</div>


<?php if ( ! empty( $labels_by_group ) ) : ?>
<?php foreach ( $labels_by_group as $group ) : ?>
Expand All @@ -167,7 +177,7 @@ public static function output( $post_or_order_object ) {
</table>
</div>
</div>

<?php endforeach; ?>
<?php endif; ?>
</div>
Expand Down
12 changes: 6 additions & 6 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: postfinancecheckout AG
Tags: woocommerce PostFinance Checkout, woocommerce, PostFinance Checkout, payment, e-commerce, webshop, psp, invoice, packing slips, pdf, customer invoice, processing
Requires at least: 4.7
Tested up to: 6.2
Stable tag: 3.0.1
Stable tag: 3.0.0
License: Apache 2
License URI: http://www.apache.org/licenses/LICENSE-2.0

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


= 3.0.1 - April 3 2024 =
- [Feature] Added support to High Performance Order Storage (HPOS).
- [Tested Against] PHP 8.2
- [Tested Against] Wordpress 6.5
- [Tested Against] Woocommerce 8.7.0
= 3.0.0 - February 20 2024 =
- [Feature] Full version release
- [Tested Against] PHP 8.0
- [Tested Against] Wordpress 6.4.3
- [Tested Against] Woocommerce 8.5.2
- [Tested Against] PHP SDK 4.0.2
17 changes: 7 additions & 10 deletions woocommerce-postfinancecheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
* Plugin Name: PostFinance Checkout
* Plugin URI: https://wordpress.org/plugins/woo-postfinancecheckout
* Description: Process WooCommerce payments with PostFinance Checkout.
* Version: 3.0.0
* License: Apache2
* License URI: http://www.apache.org/licenses/LICENSE-2.0
* Author: postfinancecheckout AG
* Author URI: https://postfinance.ch/en/business/products/e-commerce/postfinance-checkout-all-in-one.html
* Requires at least: 4.7
* Tested up to: 6.3
* WC requires at least: 3.0.0
* WC tested up to: 7.8.2
*
* Text Domain: postfinancecheckout
* Domain Path: /languages/
Expand Down Expand Up @@ -34,14 +39,14 @@ final class WooCommerce_PostFinanceCheckout {
const CK_INTEGRATION = 'wc_postfinancecheckout_integration';
const CK_ORDER_REFERENCE = 'wc_postfinancecheckout_order_reference';
const CK_ENFORCE_CONSISTENCY = 'wc_postfinancecheckout_enforce_consistency';
const WC_MAXIMUM_VERSION = '8.7.0';
const WC_MAXIMUM_VERSION = '8.5.2';

/**
* WooCommerce PostFinanceCheckout version.
*
* @var string
*/
private $version = '3.0.1';
private $version = '3.0.0';

/**
* The single instance of the class.
Expand Down Expand Up @@ -442,14 +447,6 @@ public function loaded() {
10,
2
);


add_action( 'before_woocommerce_init', function() {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
} );

}

/**
Expand Down

0 comments on commit 3720baf

Please sign in to comment.