Skip to content

Commit

Permalink
Release 2.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Mar 2, 2023
1 parent 5f4248f commit 6250bdb
Show file tree
Hide file tree
Showing 336 changed files with 16,779 additions and 1,498 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This repository contains the PostFinance Checkout plugin that enables WooCommerc

## Documentation

* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.6/docs/en/documentation.html)
* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.7/docs/en/documentation.html)

## Support

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

## License

Please see the [license file](https://github.com/pfpayments/woocommerce/blob/2.1.6/LICENSE) for more information.
Please see the [license file](https://github.com/pfpayments/woocommerce/blob/2.1.7/LICENSE) for more information.
14 changes: 14 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -504,3 +504,17 @@ Tested against:
- Wordpress 6.1.1
- Woocommerce 7.3.0

## Feature
- Upgrade the **PHP sdk version** to 3.2.0 to add compatibility with PHP 8.1
- Support of Woocommerce 7.4.0
- Loading jQuery BlockUI only if it is available

## Bug
- Removal of *woocommerce* trademark from translations and error message

## Tested Against
- PHP 8.1
- Wordpress 6.1.1
- Woocommerce 7.4.0
- PHP sdk 3.2.0

6 changes: 3 additions & 3 deletions docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="keywords" value="PostFinance Checkout, WooCommerce, Wordpress Plugin, WooCommerce Extension, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the WooCommerce PostFinance Checkout plugin that enables processing payments with PostFinance Checkout."> <link rel="canonical" href="https://plugin-documentation.wallee.com/wallee-payment/woocommerce/master/docs/en/documentation.html" />
<meta name="keywords" value="PostFinance Checkout, WooCommerce, Wordpress Plugin, WooCommerce Extension, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the PostFinance Checkout plugin that enables processing payments with PostFinance Checkout."> <link rel="canonical" href="https://plugin-documentation.wallee.com/wallee-payment/woocommerce/master/docs/en/documentation.html" />
<title>PostFinance Checkout WooCommerce</title>
<link href="assets/monokai-sublime.css" rel="stylesheet" />
<link href="assets/base.css" rel="stylesheet" />
Expand All @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/pfpayments/woocommerce/releases/tag/2.1.6/">
<a href="https://github.com/pfpayments/woocommerce/releases/tag/2.1.7/">
Source
</a>
</li>
Expand Down Expand Up @@ -408,7 +408,7 @@ <h2>
<div class="section-body">
<div class="paragraph">
<p>Plugin updates can be done directly in your Wordpress backend under Plugins.
Search for the plugin WooCommerce PostFinance Checkout and click on <code>update now</code>. To perform the update, WordPress will need to access your web server. You will therefore have to enter your FTP credentials to proceed.</p>
Search for the plugin PostFinance Checkout and click on <code>update now</code>. To perform the update, WordPress will need to access your web server. You will therefore have to enter your FTP credentials to proceed.</p>
</div> </div>
</div> <div class="section" id="_how_can_i_translate_the_plugin">
<div class="section-title">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,20 @@ public static function execute_completion() {
wp_die( -1 );
}

$order_id = isset( $_POST['order_id'] ) ? absint( $_POST['order_id'] ) : null;
$completion_amount = isset( $_POST['completion_amount'] ) ? wc_format_decimal( sanitize_text_field( wp_unslash( $_POST['completion_amount'] ) ), wc_get_price_decimals() ) : null;
$order_id = isset( $_POST['order_id'] ) ? absint( $_POST['order_id'] ) : 0;
$completion_amount = isset( $_POST['completion_amount'] ) ? wc_format_decimal( sanitize_text_field( wp_unslash( $_POST['completion_amount'] ) ), wc_get_price_decimals() ) : 0;
// phpcs:ignore
$line_item_qtys = isset( $_POST['line_item_qtys'] ) ? array_map('sanitize_text_field', json_decode( wp_unslash( $_POST['line_item_qtys'] ), true ) ) : null;
$line_item_qtys = isset( $_POST['line_item_qtys'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['line_item_qtys'] ) ), true ) : array();
// phpcs:ignore
$line_item_totals = isset( $_POST['line_item_totals'] ) ? array_map('sanitize_text_field', json_decode( wp_unslash( $_POST['line_item_totals'] ), true ) ) : null;
// phpcs:ignore
$line_item_tax_totals = isset( $_POST['line_item_tax_totals'] ) ? array_map('sanitize_text_field', json_decode( wp_unslash( $_POST['line_item_tax_totals'] ), true ) ): null;
$line_item_totals = isset( $_POST['line_item_totals'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['line_item_totals'] ) ), true ) : array();
// phpcs:ignore
$line_item_tax_totals = isset( $_POST['line_item_tax_totals'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['line_item_tax_totals'] ) ), true ) : array();
$restock_not_completed_items = isset( $_POST['restock_not_completed_items'] ) && 'true' === sanitize_text_field( wp_unslash( $_POST['restock_not_completed_items'] ) );
$current_completion_id = null;
$transaction_info = null;
try {

// Prepare line items which we are completed.
$line_items = array();
$item_ids = array_unique( array_merge( array_keys( $line_item_qtys, $line_item_totals, true ) ) );
$item_ids = array_unique( array_merge( array_keys( $line_item_qtys ), array_keys( $line_item_totals ) ) );
foreach ( $item_ids as $item_id ) {
$line_items[ $item_id ] = array(
'qty' => 0,
Expand Down Expand Up @@ -173,8 +171,7 @@ public static function execute_completion() {
WC_PostFinanceCheckout_Helper::instance()->lock_by_transaction_id( $transaction_info->get_space_id(), $transaction_info->get_transaction_id() );
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_transaction(
$transaction_info->get_space_id(),
$transaction_info->get_transaction_id(),
$transaction_info->get_space_id()
$transaction_info->get_transaction_id()
);

if ( $transaction_info->get_state() !== TransactionState::AUTHORIZED ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function get_settings() {
$settings = array(
array(
'links' => array(
'https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.6/docs/en/documentation.html' => __( 'Documentation', 'woo-postfinancecheckout' ),
'https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.7/docs/en/documentation.html' => __( 'Documentation', 'woo-postfinancecheckout' ),
'https://checkout.postfinance.ch/en-ch/user/signup' => __( 'Sign Up', 'woo-postfinancecheckout' ),
),
'type' => 'postfinancecheckout_links',
Expand Down
1 change: 1 addition & 0 deletions includes/class-wc-postfinancecheckout-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ public function payment_fields() {
WooCommerce_PostFinanceCheckout::instance()->plugin_url() . '/assets/js/frontend/checkout.js',
array(
'jquery',
'jquery-blockui',
'postfinancecheckout-remote-checkout-js',
),
1,
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-postfinancecheckout-migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private static function check_requirements() {
}

if ( ! empty( $errors ) ) {
$title = __( 'Could not activate plugin WooCommerce PostFinance Checkout.', 'woo-postfinancecheckout' );
$title = __( 'Could not activate plugin PostFinance Checkout.', 'woo-postfinancecheckout' );
// phpcs:ignore
$message = '<h1><strong>' . esc_html_e( $title ) . '</strong></h1><br/>' .
'<h3>' . __( 'Please check the following requirements before activating:', 'woo-postfinancecheckout' ) . '</h3>' .
Expand Down Expand Up @@ -248,7 +248,7 @@ public static function check_version() {
public static function plugin_row_meta( $links, $file ) {
if ( WC_POSTFINANCECHECKOUT_PLUGIN_BASENAME === $file ) {
$row_meta = array(
'docs' => '<a href="https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.6/docs/en/documentation.html" aria-label="' . esc_attr__( 'View Documentation', 'woo-postfinancecheckout' ) . '">' . esc_html__( 'Documentation', 'woo-postfinancecheckout' ) . '</a>',
'docs' => '<a href="https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/2.1.7/docs/en/documentation.html" aria-label="' . esc_attr__( 'View Documentation', 'woo-postfinancecheckout' ) . '">' . esc_html__( 'Documentation', 'woo-postfinancecheckout' ) . '</a>',
);

return array_merge( $links, $row_meta );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ class WC_PostFinanceCheckout_Service_Transaction extends WC_PostFinanceCheckout_
*/
private $charge_attempt_service;

/**
* The charge attempt API service.
*
* @var \PostFinanceCheckout\Sdk\Service\TransactionLineItemVersionService
*/
private $transaction_line_item_version_service;

/**
* Returns the transaction API service.
*
Expand Down Expand Up @@ -134,6 +141,19 @@ protected function get_charge_attempt_service() {
return $this->charge_attempt_service;
}

/**
* Returns the transaction line item version service.
*
* @return \PostFinanceCheckout\Sdk\Service\TransactionLineItemVersionService
* @throws Exception Exception.
*/
protected function get_transaction_line_item_version_service() {
if ( is_null( $this->transaction_line_item_version_service ) ) {
$this->transaction_line_item_version_service = new \PostFinanceCheckout\Sdk\Service\TransactionLineItemVersionService( WC_PostFinanceCheckout_Helper::instance()->get_api_client() );
}
return $this->transaction_line_item_version_service;
}

/**
* Clears the transaction cache
*
Expand Down Expand Up @@ -251,19 +271,20 @@ public function get_failed_charge_attempt( $space_id, $transaction_id ) {
}

/**
* Updates the line items of the given transaction.
* Updates the line items version of the given transaction.
*
* @param int $space_id space id.
* @param int $transaction_id transaction id.
* @param \PostFinanceCheckout\Sdk\Model\LineItem[] $line_items line items.
* @param int $space_id space id.
* @param int $transaction_id transaction id.
* @param \PostFinanceCheckout\Sdk\Model\LineItemCreate[] $line_items line items.
* @return \PostFinanceCheckout\Sdk\Model\TransactionLineItemVersion
* @throws Exception Exception.
*/
public function update_line_items( $space_id, $transaction_id, $line_items ) {
$update_request = new \PostFinanceCheckout\Sdk\Model\TransactionLineItemUpdateRequest();
$update_request->setTransactionId( $transaction_id );
$update_request->setNewLineItems( $line_items );
return $this->get_transaction_service()->updateTransactionLineItems( $space_id, $update_request );
$line_item_version_create = new \PostFinanceCheckout\Sdk\Model\TransactionLineItemVersionCreate();
$line_item_version_create->setLineItems( $line_items );
$line_item_version_create->setTransaction( $transaction_id );
$line_item_version_create->setExternalId( uniqid( $transaction_id . '-' ) );
return $this->get_transaction_line_item_version_service()->create( $space_id, $line_item_version_create );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ protected function success( \PostFinanceCheckout\Sdk\Model\TransactionCompletion
$completion_job->set_state( WC_PostFinanceCheckout_Entity_Completion_Job::STATE_DONE );

if ( $completion_job->get_restock() ) {
$this->restock_non_completed_items( $completion_job->get_items(), $order );
$this->restock_non_completed_items( (array) $completion_job->get_items(), $order );
}
$this->adapt_order_items( $completion_job->get_items(), $order );
$this->adapt_order_items( (array) $completion_job->get_items(), $order );
$completion_job->save();
}

Expand Down
Binary file modified languages/woo-postfinancecheckout-de_DE.mo
Binary file not shown.
18 changes: 9 additions & 9 deletions languages/woo-postfinancecheckout-de_DE.po
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce PostFinance Checkout\n"
"Project-Id-Version: PostFinance Checkout\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-30 16:16+0100\n"
"PO-Revision-Date: 2021-11-30 16:16+0100\n"
Expand Down Expand Up @@ -45,8 +45,8 @@ msgid "Woocommerce %s+ is required. (You're running version %s)"
msgstr "Woocommerce %s+ wird benötigt. (Du verwendest Version %s)"

#: includes/class-wc-postfinancecheckout-migration.php:116
msgid "Could not activate plugin WooCommerce PostFinance Checkout."
msgstr "Das Plugin WooCommerce PostFinance Checkout konnte nicht aktiviert werden."
msgid "Could not activate plugin PostFinance Checkout."
msgstr "Das Plugin PostFinance Checkout konnte nicht aktiviert werden."

#: includes/class-wc-postfinancecheckout-migration.php:118
msgid "Please check the following requirements before activating:"
Expand Down Expand Up @@ -536,21 +536,21 @@ msgstr ""

#: views/admin-notices/migration-failed.php:15
msgid ""
"There was an issue executing the migration for WooCommerce PostFinance Checkout."
"There was an issue executing the migration for PostFinance Checkout."
msgstr ""
"Es gab ein Problem bei der Ausführung der Migration für WooCommerce "
"Es gab ein Problem bei der Ausführung der Migration für "
"PostFinance Checkout."

#: views/admin-notices/plugin-deactivated.php:14
msgid ""
"WooCommerce PostFinance Checkout deactivated because it depends on WooCommerce."
"PostFinance Checkout deactivated because it depends on WooCommerce."
msgstr ""
"WooCommerce PostFinance Checkout wurde deaktiviert, weil es von WooCommerce "
"PostFinance Checkout wurde deaktiviert, weil es von WooCommerce "
"abhängig ist."

#. Name of the plugin
msgid "WooCommerce PostFinance Checkout"
msgstr "WooCommerce PostFinance Checkout"
msgid "PostFinance Checkout"
msgstr "PostFinance Checkout"

#. Description of the plugin
msgid "Process WooCommerce payments with PostFinance Checkout."
Expand Down
18 changes: 9 additions & 9 deletions languages/woo-postfinancecheckout.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce PostFinance Checkout\n"
"Project-Id-Version: PostFinance Checkout\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date:2021-11-30 16:16+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE"
Expand Down Expand Up @@ -45,8 +45,8 @@ msgid "Woocommerce %s+ is required. (You're running version %s)"
msgstr "Woocommerce %s+ ist erforderlich. (Sie verwenden die Version %s)"

#: includes/class-wc-postfinancecheckout-migration.php:116
msgid "Could not activate plugin WooCommerce PostFinance Checkout."
msgstr "Das Plugin WooCommerce PostFinance Checkout konnte nicht aktiviert werden."
msgid "Could not activate plugin PostFinance Checkout."
msgstr "Das Plugin PostFinance Checkout konnte nicht aktiviert werden."

#: includes/class-wc-postfinancecheckout-migration.php:118
msgid "Please check the following requirements before activating:"
Expand Down Expand Up @@ -500,16 +500,16 @@ msgstr "Die PostFinance Checkout Zahlungsmethode ist nicht verfügbar, wenn die
"um die PostFinance Checkout-Zahlungsmethoden zu aktivieren."

#: views/admin-notices/migration-failed.php:15
msgid "There was an issue executing the migration for WooCommerce PostFinance Checkout."
msgstr "Es gab ein Problem bei der Ausführung der Migration für WooCommerce PostFinance Checkout."
msgid "There was an issue executing the migration for PostFinance Checkout."
msgstr "Es gab ein Problem bei der Ausführung der Migration für PostFinance Checkout."

#: views/admin-notices/plugin-deactivated.php:14
msgid "WooCommerce PostFinance Checkout deactivated because it depends on WooCommerce."
msgstr "WooCommerce PostFinance Checkout deaktiviert, weil es von WooCommerce abhängt."
msgid "PostFinance Checkout deactivated because it depends on WooCommerce."
msgstr "PostFinance Checkout deaktiviert, weil es von WooCommerce abhängt."

#. Name of the plugin
msgid "WooCommerce PostFinance Checkout"
msgstr "WooCommerce PostFinance Checkout"
msgid "PostFinance Checkout"
msgstr "PostFinance Checkout"

#. Description of the plugin
msgid "Process WooCommerce payments with PostFinance Checkout."
Expand Down
3 changes: 2 additions & 1 deletion postfinancecheckout-sdk/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: php
sudo: false
php:
- 5.6
- 8.0
- 8.1
before_install: "composer install"
script: "phpunit --bootstrap autoload.php test/"
2 changes: 1 addition & 1 deletion postfinancecheckout-sdk/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2021 wallee AG
Copyright 2023 wallee AG

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
3 changes: 3 additions & 0 deletions postfinancecheckout-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ $client = new \PostFinanceCheckout\Sdk\ApiClient($userId, $secret);
$httpClientType = \PostFinanceCheckout\Sdk\Http\HttpClientFactory::TYPE_CURL; // or \PostFinanceCheckout\Sdk\Http\HttpClientFactory::TYPE_SOCKET

$client->setHttpClientType($httpClientType);

//Setup a custom connection timeout if needed. (Default value is: 25 seconds)
$client->setConnectionTimeout(20);
```

You can also specify the HTTP client via the `PFC_HTTP_CLIENT` environment variable. The possible string values are `curl` or `socket`.
Expand Down
4 changes: 2 additions & 2 deletions postfinancecheckout-sdk/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postfinancecheckout/sdk",
"version": "3.0.1",
"version": "3.2.0",
"description": "PostFinance Checkout SDK for PHP",
"keywords": [
"postfinancecheckout",
Expand All @@ -23,7 +23,7 @@
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "~8"
},
"autoload": {
"psr-4": { "PostFinanceCheckout\\Sdk\\" : "lib/" }
Expand Down
Loading

0 comments on commit 6250bdb

Please sign in to comment.