Skip to content

Commit

Permalink
Merge pull request #424 from krokedil/develop
Browse files Browse the repository at this point in the history
Version 3.8.0
  • Loading branch information
MichaelBengtsson authored Oct 28, 2024
2 parents 419db1f + 9eeba79 commit d2e5c3e
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 11 deletions.
7 changes: 6 additions & 1 deletion composer-dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"krokedil/woocommerce": "^1.7.0",
"krokedil/klarna-express-checkout": "^1.4.0",
"krokedil/klarna-onsite-messaging": "^1.2.0",
"krokedil/settings-page": "^1.1.0"
"krokedil/settings-page": "^1.1.0",
"krokedil/sign-in-with-klarna": "^1.0.0"
},
"config": {
"platform": {
Expand All @@ -32,6 +33,10 @@
{
"type": "vcs",
"url": "[email protected]:krokedil/settings-page.git"
},
{
"type": "vcs",
"url": "[email protected]:krokedil/sign-in-with-klarna.git"
}
],
"minimum-stability": "dev",
Expand Down
37 changes: 36 additions & 1 deletion composer-dependencies.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bef47250909618e625a355af2afc0e22",
"content-hash": "071374db34a5e832e6d786d66760810f",
"packages": [
{
"name": "firebase/php-jwt",
Expand Down Expand Up @@ -257,6 +257,41 @@
},
"time": "2024-10-23T11:23:33+00:00"
},
{
"name": "krokedil/sign-in-with-klarna",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/krokedil/sign-in-with-klarna.git",
"reference": "dd12b73d44b6e0d14b0861ed108881cd42796e25"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/krokedil/sign-in-with-klarna/zipball/dd12b73d44b6e0d14b0861ed108881cd42796e25",
"reference": "dd12b73d44b6e0d14b0861ed108881cd42796e25",
"shasum": ""
},
"require": {
"firebase/php-jwt": "^6.0.0"
},
"require-dev": {
"php-stubs/woocommerce-stubs": "^8.3",
"php-stubs/wordpress-stubs": "^6.0",
"wp-coding-standards/wpcs": "^3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Krokedil\\SignInWithKlarna\\": "src/"
}
},
"description": "Add \"Sign in with Klarna\" compatibility with your WooCommerce plugin.",
"support": {
"source": "https://github.com/krokedil/sign-in-with-klarna/tree/1.0.2",
"issues": "https://github.com/krokedil/sign-in-with-klarna/issues"
},
"time": "2024-10-28T07:13:50+00:00"
},
{
"name": "krokedil/woocommerce",
"version": "1.7.0",
Expand Down
8 changes: 4 additions & 4 deletions composer.lock

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

11 changes: 9 additions & 2 deletions includes/kp-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ function kp_extract_error_message( $response ) {
* @return array
*/
function get_klarna_customer( $customer_type ) {
$type = ( 'b2b' === $customer_type ) ? 'organization' : 'person';
return array(
$type = ( 'b2b' === $customer_type ) ? 'organization' : 'person';
$customer = array(
'type' => $type,
);

$access_token = KP_WC()->siwk->user->get_access_token( get_current_user_id() );
if ( ! empty( $access_token ) ) {
$customer['klarna_access_token'] = $access_token;
}

return $customer;
}

/**
Expand Down
13 changes: 11 additions & 2 deletions klarna-payments-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Provides Klarna Payments as payment method to WooCommerce.
* Author: klarna
* Author URI: https://www.klarna.com/
* Version: 3.7.4
* Version: 3.8.0
* Text Domain: klarna-payments-for-woocommerce
* Domain Path: /languages
*
Expand Down Expand Up @@ -38,11 +38,12 @@
use KlarnaPayments\Blocks\Payments\KlarnaPayments;
use KrokedilKlarnaPaymentsDeps\Krokedil\KlarnaOnsiteMessaging\KlarnaOnsiteMessaging;
use KrokedilKlarnaPaymentsDeps\Krokedil\WooCommerce\KrokedilWooCommerce;
use KrokedilKlarnaPaymentsDeps\Krokedil\SignInWithKlarna\SignInWithKlarna;

/**
* Required minimums and constants
*/
define( 'WC_KLARNA_PAYMENTS_VERSION', '3.7.4' );
define( 'WC_KLARNA_PAYMENTS_VERSION', '3.8.0' );
define( 'WC_KLARNA_PAYMENTS_MIN_PHP_VER', '7.4.0' );
define( 'WC_KLARNA_PAYMENTS_MIN_WC_VER', '5.6.0' );
define( 'WC_KLARNA_PAYMENTS_MAIN_FILE', __FILE__ );
Expand Down Expand Up @@ -149,6 +150,13 @@ public function __wakeup() {
*/
public $krokedil = null;

/**
* The Sign-In With Klarna package from Krokedil.
*
* @var SignInWithKlarna
*/
public $siwk = null;

/**
* Protected constructor to prevent creating a new instance of the
* *Singleton* via the `new` operator from outside of this class.
Expand Down Expand Up @@ -202,6 +210,7 @@ public function init() {
'price_format' => 'minor',
)
);
$this->siwk = new SignInWithKlarna( $settings );

$this->register_payment_block();

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Tested up to: 6.6.2
Requires PHP: 7.4
WC requires at least: 5.6.0
WC tested up to: 9.2.3
Stable tag: 3.7.4
Stable tag: 3.8.0
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -73,6 +73,9 @@ For help setting up and configuring Klarna Payments for WooCommerce please refer
2. Express checkout

== Changelog ==
= 2024.10.25 - version 3.8.0 =
* Feature - Added support for "Sign in with Klarna" for an improved way to drive shoppers straight to the checkout, with all their preferences already set.

= 2024.10.23 - version 3.7.4 =
* Fix - Fixed an undefined index warning related to new settings.
* Fix - [KOSM] Fixed the On-site messaging preview not changing to reflect the selected theme.
Expand Down
2 changes: 2 additions & 0 deletions scoper.custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ function customize_php_scoper_config( array $config ): array {
// Ignore the abspath constant when scoping.
$config['exclude-constants'][] = 'ABSPATH';
$config['exclude-constants'][] = 'KOSM_VERSION';
$config['exclude-constants'][] = 'SIWK_VERSION';
$config['exclude-classes'][] = 'WooCommerce';
$config['exclude-classes'][] = 'Klarna_OnSite_Messaging';
$config['exclude-classes'][] = 'Klarna_OnSite_Messaging_For_WooCommerce';
$config['exclude-classes'][] = 'WC_Product';
$config['exclude-classes'][] = 'KP_Form_Fields';

$functions = array(
'KP_WC',
Expand Down

0 comments on commit d2e5c3e

Please sign in to comment.