Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit fdd50e6

Browse files
author
Barbara Palumbo
committed
2 parents 83a1005 + 8c05407 commit fdd50e6

File tree

5 files changed

+63
-3
lines changed

5 files changed

+63
-3
lines changed

src/Core/Builder/Update/CustomersActionBuilder.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Commercetools\Core\Request\Customers\Command\CustomerRemoveStoreAction;
1717
use Commercetools\Core\Request\Customers\Command\CustomerSetAddressCustomFieldAction;
1818
use Commercetools\Core\Request\Customers\Command\CustomerSetAddressCustomTypeAction;
19+
use Commercetools\Core\Request\Customers\Command\CustomerSetAuthenticationModeAction;
1920
use Commercetools\Core\Request\Customers\Command\CustomerSetCompanyNameAction;
2021
use Commercetools\Core\Request\Customers\Command\CustomerSetCustomFieldAction;
2122
use Commercetools\Core\Request\Customers\Command\CustomerSetCustomTypeAction;
@@ -171,6 +172,17 @@ public function setAddressCustomType($action = null)
171172
return $this;
172173
}
173174

175+
/**
176+
* @link https://docs.commercetools.com/api/projects/customers#set-authenticationmode
177+
* @param CustomerSetAuthenticationModeAction|callable $action
178+
* @return $this
179+
*/
180+
public function setAuthenticationMode($action = null)
181+
{
182+
$this->addAction($this->resolveAction(CustomerSetAuthenticationModeAction::class, $action));
183+
return $this;
184+
}
185+
174186
/**
175187
* @link https://docs.commercetools.com/http-api-projects-customers.html#set-company-name
176188
* @param CustomerSetCompanyNameAction|callable $action

src/Core/Model/Customer/Customer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
* @method Customer setLastModifiedBy(LastModifiedBy $lastModifiedBy = null)
8080
* @method StoreReferenceCollection getStores()
8181
* @method Customer setStores(StoreReferenceCollection $stores = null)
82+
* @method string getAuthenticationMode()
83+
* @method Customer setAuthenticationMode(string $authenticationMode = null)
8284
* @method CustomerReference getReference()
8385
*/
8486
class Customer extends Resource
@@ -127,6 +129,7 @@ public function fieldDefinitions()
127129
'createdBy' => [static::TYPE => CreatedBy::class, static::OPTIONAL => true],
128130
'lastModifiedBy' => [static::TYPE => LastModifiedBy::class, static::OPTIONAL => true],
129131
'stores' => [static::TYPE => StoreReferenceCollection::class, static::OPTIONAL => true],
132+
'authenticationMode' => [static::TYPE => 'string', static::OPTIONAL => true],
130133
];
131134
}
132135

src/Core/Model/Customer/CustomerDraft.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
* @method CustomerDraft setStores(StoreReferenceCollection $stores = null)
7474
* @method CartReference getAnonymousCart()
7575
* @method CustomerDraft setAnonymousCart(CartReference $anonymousCart = null)
76+
* @method string getAuthenticationMode()
77+
* @method CustomerDraft setAuthenticationMode(string $authenticationMode = null)
7678
*/
7779
class CustomerDraft extends JsonObject
7880
{
@@ -111,6 +113,7 @@ public function fieldDefinitions()
111113
'anonymousId' => [static::TYPE => 'string', static::OPTIONAL => true],
112114
'stores' => [static::TYPE => StoreReferenceCollection::class, static::OPTIONAL => true],
113115
'anonymousCart' => [static::TYPE => CartReference::class, static::OPTIONAL => true],
116+
'authenticationMode' => [static::TYPE => 'string', static::OPTIONAL => true],
114117
];
115118
}
116119

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Commercetools\Core\Request\Customers\Command;
4+
5+
use Commercetools\Core\Model\Common\Context;
6+
use Commercetools\Core\Request\AbstractAction;
7+
8+
/**
9+
* @package Commercetools\Core\Request\Customers\Command
10+
* @link https://docs.commercetools.com/api/projects/customers#set-authenticationmode
11+
* @method string getAction()
12+
* @method CustomerSetAuthenticationModeAction setAction(string $action = null)
13+
* @method string getAuthenticationMode()
14+
* @method CustomerSetAuthenticationModeAction setAuthenticationMode(string $key = null)
15+
* @method string getAuthMode()
16+
* @method CustomerSetAuthenticationModeAction setAuthMode(string $authMode = null)
17+
* @method string getPassword()
18+
* @method CustomerSetAuthenticationModeAction setPassword(string $password = null)
19+
*/
20+
class CustomerSetAuthenticationModeAction extends AbstractAction
21+
{
22+
public function fieldDefinitions()
23+
{
24+
return [
25+
'action' => [static::TYPE => 'string'],
26+
'authMode' => [static::TYPE => 'string'],
27+
'password' => [static::TYPE => 'string', static::OPTIONAL => true],
28+
];
29+
}
30+
31+
/**
32+
* @param array $data
33+
* @param Context|callable $context
34+
*/
35+
public function __construct(array $data = [], $context = null)
36+
{
37+
parent::__construct($data, $context);
38+
$this->setAction('setAuthenticationMode');
39+
}
40+
}

tests/unit/Request/GenericActionTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@
8989
use Commercetools\Core\Request\Customers\Command\CustomerAddAddressAction;
9090
use Commercetools\Core\Request\Customers\Command\CustomerChangeAddressAction;
9191
use Commercetools\Core\Request\Customers\Command\CustomerChangeEmailAction;
92-
use Commercetools\Core\Request\Customers\Command\CustomerChangeNameAction;
9392
use Commercetools\Core\Request\Customers\Command\CustomerRemoveAddressAction;
93+
use Commercetools\Core\Request\Customers\Command\CustomerSetAuthenticationModeAction;
9494
use Commercetools\Core\Request\Customers\Command\CustomerSetCompanyNameAction;
9595
use Commercetools\Core\Request\Customers\Command\CustomerSetCustomerGroupAction;
9696
use Commercetools\Core\Request\Customers\Command\CustomerSetCustomerNumberAction;
@@ -178,15 +178,13 @@
178178
use Commercetools\Core\Request\Products\Command\ProductSetAttributeInAllVariantsAction;
179179
use Commercetools\Core\Request\Products\Command\ProductSetCategoryOrderHintAction;
180180
use Commercetools\Core\Request\Products\Command\ProductSetDescriptionAction;
181-
use Commercetools\Core\Request\Products\Command\ProductSetMetaAttributesAction;
182181
use Commercetools\Core\Request\Products\Command\ProductSetMetaDescriptionAction;
183182
use Commercetools\Core\Request\Products\Command\ProductSetMetaKeywordsAction;
184183
use Commercetools\Core\Request\Products\Command\ProductSetMetaTitleAction;
185184
use Commercetools\Core\Request\Products\Command\ProductSetPriceCustomFieldAction;
186185
use Commercetools\Core\Request\Products\Command\ProductSetPriceCustomTypeAction;
187186
use Commercetools\Core\Request\Products\Command\ProductSetPricesAction;
188187
use Commercetools\Core\Request\Products\Command\ProductSetSearchKeywordsAction;
189-
use Commercetools\Core\Request\Products\Command\ProductSetSkuNotStageableAction;
190188
use Commercetools\Core\Request\Products\Command\ProductSetTaxCategoryAction;
191189
use Commercetools\Core\Request\Products\Command\ProductTransitionStateAction;
192190
use Commercetools\Core\Request\Products\Command\ProductUnpublishAction;
@@ -670,6 +668,10 @@ public function actionArgumentProvider()
670668
CustomerSetVatIdAction::class,
671669
'of',
672670
],
671+
[
672+
CustomerSetAuthenticationModeAction::class,
673+
'of',
674+
],
673675
[
674676
CategoryChangeNameAction::class,
675677
'ofName',

0 commit comments

Comments
 (0)