Skip to content

Commit

Permalink
Merge pull request #20 from krokedil/main
Browse files Browse the repository at this point in the history
Version 1.3.0
  • Loading branch information
lighe authored Oct 5, 2023
2 parents 6aad718 + a0ed324 commit f8eab52
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 17 deletions.
2 changes: 1 addition & 1 deletion classes/class-truelayer-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function enqueue_scripts() {
* @return bool
*/
protected function check_for_load_assets() {
$section = filter_input( INPUT_GET, 'section', FILTER_SANITIZE_STRING );
$section = filter_input( INPUT_GET, 'section', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
if ( empty( $section ) || 'truelayer' !== $section ) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions classes/class-truelayer-confirmation.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function __construct() {
*/
public function maybe_redirect() {

$transaction_id = filter_input( INPUT_GET, 'payment_id', FILTER_SANITIZE_STRING );
$error = filter_input( INPUT_GET, 'error', FILTER_SANITIZE_STRING );
$transaction_id = filter_input( INPUT_GET, 'payment_id', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
$error = filter_input( INPUT_GET, 'error', FILTER_SANITIZE_FULL_SPECIAL_CHARS );

$query_args = array(
'fields' => 'ids',
Expand Down
8 changes: 8 additions & 0 deletions classes/class-truelayer-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ public static function fields() {
'desc_tip' => true,
),

'truelayer_release_channel' => array(
'title' => __( 'Release channel', 'truelayer-for-woocommerce' ),
'type' => 'text',
'description' => __( 'Enter the release channel that you wish to use for TrueLayer', 'truelayer-for-woocommerce' ),
'default' => '',
'desc_tip' => true,
),

'truelayer_payment_page_type' => array(
'title' => __( 'Payments Page Types', 'truelayer-for-woocommerce' ),
'type' => 'select',
Expand Down
8 changes: 2 additions & 6 deletions classes/class-truelayer-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
* Class TrueLayer_Payment_Gateway.
*/
class TrueLayer_Payment_Gateway extends WC_Payment_Gateway {


/**
* Allowed currencies.
*
Expand Down Expand Up @@ -51,7 +49,6 @@ public function __construct() {
$this->description = $this->get_option( 'description' );

$this->testmode = $this->get_option( 'testmode' );
$this->logging = $this->get_option( 'logging' );

add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( &$this, 'process_admin_options' ) );
add_action(
Expand Down Expand Up @@ -85,7 +82,6 @@ public function get_option( $key, $empty_value = null ) {
$client_secret = 'truelayer_client_secret';
$client_certificate = 'truelayer_client_certificate';
}
$settings = get_option( 'woocommerce_truelayer_settings', array() );
$truelayer_options = array( $private_key, $client_secret, $client_certificate );
$truelayer_encryption = Truelayer_Encryption::get_instance();
if ( ! empty( $settings[ $key ] ) ) {
Expand Down Expand Up @@ -160,8 +156,8 @@ public function country_currency_check( $order = false ) {
* @return array
*/
public function process_payment( $order_id ) {
$settings = get_option( 'woocommerce_truelayer_settings', array() );
$epp_enabled = $settings['truelayer_payment_page_type'] ?? 'HPP';
$settings = get_option( 'woocommerce_truelayer_settings', array() );
$epp_enabled = $settings['truelayer_payment_page_type'] ?? 'HPP';

$response = TrueLayer()->api->create_payment( $order_id );

Expand Down
15 changes: 15 additions & 0 deletions classes/requests/post/class-truelayer-request-create-payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ protected function get_body() {
$body['payment_method']['provider_selection']['filter']['customer_segments'] = $customer_segment;
}

$release_channel = $this->get_release_channel();
if ( ! empty( $release_channel ) ) {
$body['payment_method']['provider_selection']['filter']['release_channel'] = $release_channel;
}

return $body;
}

Expand Down Expand Up @@ -144,4 +149,14 @@ private function get_banking_providers() {
$banking_providers = empty( $this->settings['truelayer_banking_providers'] ) ? array() : $this->settings['truelayer_banking_providers'];
return array_map( 'strtolower', $banking_providers );
}

/**
* Returns the release channel
*
* @return array
*/
private function get_release_channel() {
$release_channel = empty( $this->settings['truelayer_release_channel'] ) ? array() : $this->settings['truelayer_release_channel'];
return $release_channel;
}
}
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
"platform": {
"php": "7.4"
}
},
"require-dev": {
"php-stubs/woocommerce-stubs": "^8.1"
}
}
93 changes: 91 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Contributors: krokedil, danilokrlovic
Tags: ecommerce, e-commerce, woocommerce, truelayer, payments, instant payments, refunds, open banking
Requires at least: 5.0
Tested up to: 6.2.0
Tested up to: 6.3.1
Requires PHP: 7.4
WC requires at least: 6.0.0
WC tested up to: 7.6.1
WC tested up to: 8.1.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Stable tag: 1.2.1
Stable tag: 1.3.0

TrueLayer for WooCommerce is a plugin that extends WooCommerce, allowing you to take payments via TrueLayer.

Expand Down Expand Up @@ -54,6 +54,10 @@ More information on how to get started can be found in the [plugin documentation
6. Read more about the configuration process in the [plugin documentation](https://docs.krokedil.com/truelayer-for-woocommerce/).

== CHANGELOG ==
= 2023.09.19 - version 1.3.0 =
* Feature - Add feature to set a custom release channel for the payment in TrueLayer. This can be set on the settings page for the plugin in the setting "Release channel". If left empty no release channel will be sent to TrueLayer.
* Fix - Fixed some deprecation warnings for PHP version 8.2+.

= 2023.09.15 - version 1.2.1 =
* Fix - Remove sensitive data from logs

Expand Down
6 changes: 3 additions & 3 deletions truelayer-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* Description: TrueLayer for WooCommerce.
* Author: Krokedil
* Author URI: https://krokedil.com/
* Version: 1.2.1
* Version: 1.3.0
* Text Domain: truelayer-for-woocommerce
* Domain Path: /languages
*
* WC requires at least: 6.0.0
* WC tested up to: 7.6.1
* WC tested up to: 8.0.2
*
* Copyright (c) 2022-2023 Krokedil
*
Expand All @@ -29,7 +29,7 @@
define( 'TRUELAYER_WC_MAIN_FILE', __FILE__ );
define( 'TRUELAYER_WC_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'TRUELAYER_WC_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
define( 'TRUELAYER_WC_PLUGIN_VERSION', '1.2.1' );
define( 'TRUELAYER_WC_PLUGIN_VERSION', '1.3.0' );

if ( ! class_exists( 'TrueLayer_For_WooCommerce' ) ) {
/**
Expand Down

0 comments on commit f8eab52

Please sign in to comment.