This repository was archived by the owner on Oct 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +64
-1
lines changed
Request/Customers/Command Expand file tree Collapse file tree 5 files changed +64
-1
lines changed Original file line number Diff line number Diff line change 6565 * @method Customer setShippingAddressIds(array $shippingAddressIds = null)
6666 * @method array getBillingAddressIds()
6767 * @method Customer setBillingAddressIds(array $billingAddressIds = null)
68+ * @method string getSalutation()
69+ * @method Customer setSalutation(string $salutation = null)
6870 * @method CustomerReference getReference()
6971 */
7072class Customer extends Resource
7173{
7274 use LocaleTrait;
73-
75+
7476 public function fieldDefinitions ()
7577 {
7678 return [
@@ -107,6 +109,7 @@ public function fieldDefinitions()
107109 'locale ' => [static ::TYPE => 'string ' ],
108110 'shippingAddressIds ' => [static ::TYPE => 'array ' ],
109111 'billingAddressIds ' => [static ::TYPE => 'array ' ],
112+ 'salutation ' => [static ::TYPE => 'string ' ],
110113 ];
111114 }
112115
Original file line number Diff line number Diff line change 6060 * @method CustomerDraft setBillingAddresses(array $billingAddresses = null)
6161 * @method array getShippingAddresses()
6262 * @method CustomerDraft setShippingAddresses(array $shippingAddresses = null)
63+ * @method string getSalutation()
64+ * @method CustomerDraft setSalutation(string $salutation = null)
6365 */
6466class CustomerDraft extends JsonObject
6567{
@@ -92,6 +94,7 @@ public function fieldDefinitions()
9294 'locale ' => [static ::TYPE => 'string ' ],
9395 'billingAddresses ' => [static ::TYPE => 'array ' ],
9496 'shippingAddresses ' => [static ::TYPE => 'array ' ],
97+ 'salutation ' => [static ::TYPE => 'string ' ],
9598 ];
9699 }
97100
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * @author @jayS-de <[email protected] > 4+ */
5+
6+ namespace Commercetools \Core \Request \Customers \Command ;
7+
8+ use Commercetools \Core \Model \Common \Context ;
9+ use Commercetools \Core \Request \AbstractAction ;
10+
11+ /**
12+ * @package Commercetools\Core\Request\Customers\Command
13+ * @link https://dev.commercetools.com/http-api-projects-customers.html#set-salutation
14+ * @method string getSalutation()
15+ * @method CustomerSetSalutationAction setSalutation(string $salutation = null)
16+ * @method string getAction()
17+ * @method CustomerSetSalutationAction setAction(string $action = null)
18+ */
19+ class CustomerSetSalutationAction extends AbstractAction
20+ {
21+ public function fieldDefinitions ()
22+ {
23+ return [
24+ 'action ' => [static ::TYPE => 'string ' ],
25+ 'salutation ' => [static ::TYPE => 'string ' ],
26+ ];
27+ }
28+
29+ /**
30+ * @param array $data
31+ * @param Context|callable $context
32+ */
33+ public function __construct (array $ data = [], $ context = null )
34+ {
35+ parent ::__construct ($ data , $ context );
36+ $ this ->setAction ('setSalutation ' );
37+ }
38+ }
Original file line number Diff line number Diff line change @@ -305,6 +305,7 @@ customer:
305305 - locale
306306 - shippingAddressIds
307307 - billingAddressIds
308+ - salutation
308309customerSigninResult :
309310 domain : customer
310311 model : CustomerSigninResult
Original file line number Diff line number Diff line change 3131use Commercetools \Core \Request \Customers \Command \CustomerSetLastNameAction ;
3232use Commercetools \Core \Request \Customers \Command \CustomerSetLocaleAction ;
3333use Commercetools \Core \Request \Customers \Command \CustomerSetMiddleNameAction ;
34+ use Commercetools \Core \Request \Customers \Command \CustomerSetSalutationAction ;
3435use Commercetools \Core \Request \Customers \Command \CustomerSetTitleAction ;
3536use Commercetools \Core \Request \Customers \Command \CustomerSetVatIdAction ;
3637use Commercetools \Core \Request \Customers \CustomerCreateRequest ;
@@ -86,6 +87,23 @@ public function testCustomerEmail()
8687 $ this ->assertSame ($ email , $ customer ->getEmail ());
8788 }
8889
90+ public function testSalutation ()
91+ {
92+ $ draft = $ this ->getDraft ('salutation ' );
93+ $ customer = $ this ->createCustomer ($ draft );
94+
95+ $ salutation = 'new-salutation ' ;
96+
97+ $ request = CustomerUpdateRequest::ofIdAndVersion ($ customer ->getId (), $ customer ->getVersion ())
98+ ->addAction (CustomerSetSalutationAction::of ()->setSalutation ($ salutation ))
99+ ;
100+ $ response = $ request ->executeWithClient ($ this ->getClient ());
101+ $ customer = $ request ->mapResponse ($ response );
102+ $ this ->deleteRequest ->setVersion ($ customer ->getVersion ());
103+
104+ $ this ->assertSame ($ salutation , $ customer ->getSalutation ());
105+ }
106+
89107 public function testNoopCustomerEmail ()
90108 {
91109 $ draft = $ this ->getDraft ('email ' );
You can’t perform that action at this time.
0 commit comments