Skip to content

Commit

Permalink
Merge pull request #10 from TrueLayer/develop
Browse files Browse the repository at this point in the history
Version 1.1.0
  • Loading branch information
NiklasHogefjord authored Feb 16, 2023
2 parents 56c50d0 + b61bd72 commit 85e4bd5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
16 changes: 16 additions & 0 deletions classes/class-truelayer-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,22 @@ public static function fields() {
'default' => '',
'desc_tip' => true,
),
'truelayer_advance' => array(
'title' => __( 'TrueLayer advanced settings', 'truelayer-for-woocommerce' ),
'type' => 'title',
),

'truelayer_banking_providers' => array(
'title' => __( 'Banking Provider Types', 'truelayer-for-woocommerce' ),
'type' => 'multiselect',
'options' => array(
'Retail' => __( 'Retail', 'truelayer-for-woocommerce' ),
'Business' => __( 'Business', 'truelayer-for-woocommerce' ),
'Corporate' => __( 'Corporate', 'truelayer-for-woocommerce' ),
),
'default' => '',
'desc_tip' => true,
),
);

return apply_filters( 'truelayer_gateway_settings', $settings );
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 @@ -66,6 +66,11 @@ protected function get_body() {
),
);

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

return $body;
}

Expand Down Expand Up @@ -114,4 +119,14 @@ protected function get_request_args() {
'body' => apply_filters( 'truelayer_request_args', wp_json_encode( $body ) ),
);
}

/**
* Returns banking providers.
*
* @return array
*/
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 );
}
}
15 changes: 10 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
=== TrueLayer for WooCommerce ===
Contributors: krokedil, danilokrlovic
Tags: ecommerce, e-commerce, woocommerce, truelayer, payments, instant payments, refunds, open banking
Requires at least: 4.5
Tested up to: 6.0.2
Requires PHP: 7.0
Requires at least: 5.0
Tested up to: 6.1.1
Requires PHP: 7.4
WC requires at least: 6.0.0
WC tested up to: 6.9.4
WC tested up to: 7.3.0
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Stable tag: 1.0.4
Stable tag: 1.1.0

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

Expand Down Expand Up @@ -54,6 +54,11 @@ 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.02.14 - version 1.1.0 =
* Feature - Add support for sending different customer types in create payment request. New setting "Banking Provider Types" introduced to control this feature.
* Tweak - Bumped minimum required PHP version to 7.4.
* Fix - Fix PHP8 related error that could happen during plugin activation when TrueLayer config key was created.

= 2022.09.30 - version 1.0.4 =
* Fix - Do not try to load plugin if WooCommerce isn't activated. Could cause fatal error.
* Fix - Remove enqueuing of unused admin css file.
Expand Down
12 changes: 6 additions & 6 deletions truelayer-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* Description: TrueLayer for WooCommerce.
* Author: Krokedil
* Author URI: https://krokedil.com/
* Version: 1.0.4
* Version: 1.1.0
* Text Domain: truelayer-for-woocommerce
* Domain Path: /languages
*
* WC requires at least: 6.0.0
* WC tested up to: 6.9.4
* WC tested up to: 7.3.0
*
* Copyright (c) 2022 Krokedil
* Copyright (c) 2022-2023 Krokedil
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
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.0.4' );
define( 'TRUELAYER_WC_PLUGIN_VERSION', '1.1.0' );

if ( ! class_exists( 'TrueLayer_For_WooCommerce' ) ) {
/**
Expand Down Expand Up @@ -109,7 +109,7 @@ public function create_truelayer_key() {
return;
}
do_action( 'truelayer_plugin_activated' );
TrueLayer_Config_Keys::create_truelayer_key_and_save_to_wp_config();
TrueLayer_Config_Keys::get_instance()->create_truelayer_key_and_save_to_wp_config();
}

/**
Expand All @@ -121,7 +121,7 @@ public function delete_truelayer_key() {
if ( ! defined( 'TRUELAYER_KEY' ) ) {
return;
}
TrueLayer_Config_Keys::delete_truelayer_key_from_wp_config();
TrueLayer_Config_Keys::get_instance()->delete_truelayer_key_from_wp_config();
}

/**
Expand Down

0 comments on commit 85e4bd5

Please sign in to comment.