Skip to content

Commit eb84600

Browse files
author
root
committed
Release 2.1.15
1 parent f9a874d commit eb84600

9 files changed

+62
-19
lines changed

README.md

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

1616
## Documentation
1717

18-
* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.14/docs/en/documentation.html)
18+
* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.15/docs/en/documentation.html)
1919

2020
## Support
2121

@@ -24,4 +24,4 @@ Support queries can be issued on the [PostFinance Checkout support site](https:/
2424

2525
## License
2626

27-
Please see the [license file](https://github.com/pfpayments/woocommerce/blob/2.1.14/LICENSE) for more information.
27+
Please see the [license file](https://github.com/pfpayments/woocommerce/blob/2.1.15/LICENSE) for more information.

changelog.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,3 +589,13 @@ Tested against:
589589
* [Tested Against] Woocommerce 7.6.1
590590
* [Tested Against] PHP SDK 3.2.0
591591

592+
* [Features] Provide a fallback to handle payment when Woocommerce latest release break the iframe / lightbox
593+
* [Features] Support of Woocommerce 7.7.0
594+
* [BugFix] Fix the line item inconsistency when using Taxes and a Coupon
595+
* [BugFix] Fix the parameter organisation name when using the payment method **Powerpay Invoice**
596+
597+
* [Tested Against] PHP 8.0.28
598+
* [Tested Against] Wordpress 6.2.0
599+
* [Tested Against] Woocommerce 7.7.0
600+
* [Tested Against] PHP SDK 3.2.0
601+

docs/en/documentation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
2222
</a>
2323
</li>
2424
<li>
25-
<a href="https://github.com/pfpayments/woocommerce/releases/tag/2.1.14/">
25+
<a href="https://github.com/pfpayments/woocommerce/releases/tag/2.1.15/">
2626
Source
2727
</a>
2828
</li>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function get_settings() {
187187
$settings = array(
188188
array(
189189
'links' => array(
190-
'https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.14/docs/en/documentation.html' => __( 'Documentation', 'woo-postfinancecheckout' ),
190+
'https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.15/docs/en/documentation.html' => __( 'Documentation', 'woo-postfinancecheckout' ),
191191
'https://checkout.postfinance.ch/en-ch/user/signup' => __( 'Sign Up', 'woo-postfinancecheckout' ),
192192
),
193193
'type' => 'postfinancecheckout_links',

includes/class-wc-postfinancecheckout-migration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public static function check_version() {
249249
public static function plugin_row_meta( $links, $file ) {
250250
if ( WC_POSTFINANCECHECKOUT_PLUGIN_BASENAME === $file ) {
251251
$row_meta = array(
252-
'docs' => '<a href="https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.14/docs/en/documentation.html" aria-label="' . esc_attr__( 'View Documentation', 'woo-postfinancecheckout' ) . '">' . esc_html__( 'Documentation', 'woo-postfinancecheckout' ) . '</a>',
252+
'docs' => '<a href="https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.15/docs/en/documentation.html" aria-label="' . esc_attr__( 'View Documentation', 'woo-postfinancecheckout' ) . '">' . esc_html__( 'Documentation', 'woo-postfinancecheckout' ) . '</a>',
253253
);
254254

255255
return array_merge( $links, $row_meta );

includes/service/class-wc-postfinancecheckout-service-line-item.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ protected function create_coupons_line_items_from_session() {
270270
}
271271
/** @var WC_Coupon $coupon_applied */
272272
$coupon_applied = $wp_coupons[ $coupon_code ];
273-
$amount = $this->round_amount( $cart->get_coupon_discount_amount( $coupon_code ), $currency );
273+
$amount = $this->round_amount( $cart->get_coupon_discount_amount( $coupon_code, false ), $currency );
274274
$line_item = $this->create_coupon_line_item( $coupon_applied, $amount );
275275
$coupons[] = $this->clean_line_item( $line_item );
276276
}
@@ -549,7 +549,7 @@ protected function create_coupons_line_items_from_order( WC_Order $order ) {
549549
//all wp coupons available
550550
foreach ( $order->get_coupons() as $coupon ) {
551551
/** @var WC_Order_Item_Coupon $coupon */
552-
$line_item = $this->create_coupon_line_item( $coupon, $coupon->get_discount() );
552+
$line_item = $this->create_coupon_line_item( $coupon, $coupon->get_discount() + $coupon->get_discount_tax() );
553553
$coupons[] = $this->clean_line_item( $line_item );
554554
}
555555
return $coupons;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,10 @@ protected function get_session_shipping_address() {
10361036
$address->setCountry( $customer->get_shipping_country() );
10371037
$address->setFamilyName( $this->fix_length( $customer->get_shipping_last_name(), 100 ) );
10381038
$address->setGivenName( $this->fix_length( $customer->get_shipping_first_name(), 100 ) );
1039-
$address->setOrganizationName( $this->fix_length( $customer->get_shipping_company(), 100 ) );
1039+
// Because of a problem with WC, we don't get the shipping_company value from the checkout.
1040+
// We use the billing_company if shipping_company is empty.
1041+
$shipping_company = !empty($customer->get_shipping_company()) ? $customer->get_shipping_company() : $customer->get_billing_company();
1042+
$address->setOrganizationName( $this->fix_length( $shipping_company, 100 ) );
10401043
if ( ! empty( $customer->get_shipping_state() ) ) {
10411044
$address->setPostalState( $customer->get_shipping_country() . '-' . $customer->get_shipping_state() );
10421045
}

readme.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: customwebgmbh
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: 2.1.14
6+
Stable tag: 2.1.15
77
License: Apache 2
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/2.1.14/docs/en/documentation.html).
26+
Additional documentation for this plugin is available [here](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.15/docs/en/documentation.html).
2727

2828
== Support ==
2929

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

5858

59-
= 2.1.14 - April 27, 2023 =
59+
* [Features] Provide a fallback to handle payment when Woocommerce latest release break the iframe / lightbox
60+
* [Features] Support of Woocommerce 7.7.0
61+
* [BugFix] Fix the line item inconsistency when using Taxes and a Coupon
62+
* [BugFix] Fix the parameter organisation name when using the payment method **Powerpay Invoice**
6063

61-
* [Features] Support of Woocommerce 7.6.1
62-
63-
* [Tested Against] PHP 8.1
64+
* [Tested Against] PHP 8.0.28
6465
* [Tested Against] Wordpress 6.2.0
65-
* [Tested Against] Woocommerce 7.6.1
66+
* [Tested Against] Woocommerce 7.7.0
6667
* [Tested Against] PHP SDK 3.2.0

woocommerce-postfinancecheckout.php

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +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: 2.1.14
6+
* Version: 2.1.15
77
* License: Apache2
88
* License URI: http://www.apache.org/licenses/LICENSE-2.0
99
* Author: wallee AG
1010
* Author URI: https://www.wallee.com
1111
* Requires at least: 4.7
1212
* Tested up to: 6.2
1313
* WC requires at least: 3.0.0
14-
* WC tested up to: 7.6.1
14+
* WC tested up to: 7.7.0
1515
*
1616
* Text Domain: postfinancecheckout
1717
* Domain Path: /languages/
@@ -39,14 +39,14 @@ final class WooCommerce_PostFinanceCheckout {
3939
const CK_INTEGRATION = 'wc_postfinancecheckout_integration';
4040
const CK_ORDER_REFERENCE = 'wc_postfinancecheckout_order_reference';
4141
const CK_ENFORCE_CONSISTENCY = 'wc_postfinancecheckout_enforce_consistency';
42-
const WC_MAXIMUM_VERSION = '7.6.1';
42+
const WC_MAXIMUM_VERSION = '7.7.0';
4343

4444
/**
4545
* WooCommerce PostFinanceCheckout version.
4646
*
4747
* @var string
4848
*/
49-
private $version = '2.1.14';
49+
private $version = '2.1.15';
5050

5151
/**
5252
* The single instance of the class.
@@ -158,6 +158,14 @@ protected function init_hooks() {
158158
)
159159
);
160160

161+
add_action(
162+
'woocommerce_thankyou',
163+
array(
164+
$this,
165+
'secure_redirect_order_confirmed',
166+
)
167+
);
168+
161169
add_action(
162170
'plugins_loaded',
163171
array(
@@ -205,6 +213,27 @@ protected function init_hooks() {
205213
);
206214
}
207215

216+
217+
/**
218+
* Secirity check in the thank you page.
219+
*
220+
* Note: If for some reason order status is still pending, it will redirect you to the payment form.
221+
*
222+
*/
223+
224+
public function secure_redirect_order_confirmed($order_id) {
225+
$order = wc_get_order( $order_id );
226+
$wc_service_transaction = WC_PostFinanceCheckout_Service_Transaction::instance();
227+
$sdk_service_transaction = new \PostFinanceCheckout\Sdk\Service\TransactionService(WC_PostFinanceCheckout_Helper::instance()->get_api_client());
228+
$wc_transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_order_id($order_id);
229+
$state = $sdk_service_transaction->read(get_option(self::CK_SPACE_ID), $wc_transaction_info->get_transaction_id())->getState();
230+
231+
if ($state == \PostFinanceCheckout\Sdk\Model\TransactionState::CONFIRMED) {
232+
wp_redirect($wc_service_transaction->get_payment_page_url(get_option(self::CK_SPACE_ID), $wc_transaction_info->get_transaction_id()));
233+
exit;
234+
}
235+
}
236+
208237
/**
209238
* Load Localization files.
210239
*

0 commit comments

Comments
 (0)