Skip to content

Commit c7d6ab3

Browse files
committed
Allow B2B customers
1 parent e8cd685 commit c7d6ab3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Module/KlarnaCheckout.php

+5
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ private function klarnaOrderData()
233233
/** @var RouterInterface $router */
234234
$router = System::getContainer()->get('router');
235235

236+
$billingFieldsConfig = $this->config->getBillingFieldsConfig();
237+
$companyConfig = array_filter($billingFieldsConfig, static function (array $c) {return 'company' === $c['value']; })[0] ?? [];
238+
236239
return [
237240
'purchase_country' => $this->config->country,
238241
'purchase_currency' => $this->config->currency,
@@ -312,6 +315,8 @@ private function klarnaOrderData()
312315
'color_link' => $this->klarna_color_link
313316
? '#'.$this->klarna_color_link
314317
: null,
318+
'allowed_customer_types' => $companyConfig && $companyConfig['mandatory'] ? ['organization'] :
319+
($companyConfig && $companyConfig['enabled'] ? ['organization', 'person'] : ['person']),
315320
'require_validate_callback_success' => true,
316321
'show_subtotal_detail' => (bool) $this->klarna_show_subtotal_detail,
317322
],

0 commit comments

Comments
 (0)