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

Commit

Permalink
feat(Order): add actions to update customer email, shipping and billi…
Browse files Browse the repository at this point in the history
…ng address for orders

Closes #238
  • Loading branch information
Jens Schulze committed Aug 8, 2016
1 parent 4deb11f commit 23e0193
Show file tree
Hide file tree
Showing 28 changed files with 330 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/Model/Cart/MyCartDraft.php
Expand Up @@ -14,7 +14,7 @@

/**
* @package Commercetools\Core\Model\Cart
* @link http://dev.commercetools.com/http-api-projects-me-carts.html#mycartdraft
* @link https://dev.commercetools.com/http-api-projects-me-carts.html#mycartdraft
* @method string getCurrency()
* @method MyCartDraft setCurrency(string $currency = null)
* @method string getCustomerEmail()
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Cart/MyLineItemDraft.php
Expand Up @@ -19,7 +19,7 @@

/**
* @package Commercetools\Core\Model\Cart
* @link http://dev.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
* @link https://dev.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
* @method string getProductId()
* @method MyLineItemDraft setProductId(string $productId = null)
* @method int getVariantId()
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Cart/MyLineItemDraftCollection.php
Expand Up @@ -9,7 +9,7 @@

/**
* @package Commercetools\Core\Model\Cart
* @link http://dev.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
* @link https://dev.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
* @method MyLineItemDraft current()
* @method MyLineItemDraftCollection add(MyLineItemDraft $element)
* @method MyLineItemDraft getAt($offset)
Expand Down
46 changes: 46 additions & 0 deletions src/Model/Message/OrderBillingAddressSetMessage.php
@@ -0,0 +1,46 @@
<?php
/**
* @author @jayS-de <jens.schulze@commercetools.de>
*/

namespace Commercetools\Core\Model\Message;

use Commercetools\Core\Model\Common\DateTimeDecorator;
use Commercetools\Core\Model\Common\Reference;
use Commercetools\Core\Model\Common\Address;

/**
* @package Commercetools\Core\Model\Message
* @link https://dev.commercetools.com/http-api-projects-messages.html#orderbillingaddressset-message
*
* @method string getId()
* @method OrderBillingAddressSetMessage setId(string $id = null)
* @method int getVersion()
* @method OrderBillingAddressSetMessage setVersion(int $version = null)
* @method DateTimeDecorator getCreatedAt()
* @method OrderBillingAddressSetMessage setCreatedAt(\DateTime $createdAt = null)
* @method DateTimeDecorator getLastModifiedAt()
* @method OrderBillingAddressSetMessage setLastModifiedAt(\DateTime $lastModifiedAt = null)
* @method int getSequenceNumber()
* @method OrderBillingAddressSetMessage setSequenceNumber(int $sequenceNumber = null)
* @method Reference getResource()
* @method OrderBillingAddressSetMessage setResource(Reference $resource = null)
* @method int getResourceVersion()
* @method OrderBillingAddressSetMessage setResourceVersion(int $resourceVersion = null)
* @method string getType()
* @method OrderBillingAddressSetMessage setType(string $type = null)
* @method Address getAddress()
* @method OrderBillingAddressSetMessage setAddress(Address $address = null)
*/
class OrderBillingAddressSetMessage extends Message
{
const MESSAGE_TYPE = 'OrderBillingAddressSet';

public function fieldDefinitions()
{
$definitions = parent::fieldDefinitions();
$definitions['address'] = [static::TYPE => '\Commercetools\Core\Model\Common\Address'];

return $definitions;
}
}
45 changes: 45 additions & 0 deletions src/Model/Message/OrderCustomerEmailSetMessage.php
@@ -0,0 +1,45 @@
<?php
/**
* @author @jayS-de <jens.schulze@commercetools.de>
*/

namespace Commercetools\Core\Model\Message;

use Commercetools\Core\Model\Common\DateTimeDecorator;
use Commercetools\Core\Model\Common\Reference;

/**
* @package Commercetools\Core\Model\Message
* @link https://dev.commercetools.com/http-api-projects-messages.html#ordercustomeremailset-message
*
* @method string getId()
* @method OrderCustomerEmailSetMessage setId(string $id = null)
* @method int getVersion()
* @method OrderCustomerEmailSetMessage setVersion(int $version = null)
* @method DateTimeDecorator getCreatedAt()
* @method OrderCustomerEmailSetMessage setCreatedAt(\DateTime $createdAt = null)
* @method DateTimeDecorator getLastModifiedAt()
* @method OrderCustomerEmailSetMessage setLastModifiedAt(\DateTime $lastModifiedAt = null)
* @method int getSequenceNumber()
* @method OrderCustomerEmailSetMessage setSequenceNumber(int $sequenceNumber = null)
* @method Reference getResource()
* @method OrderCustomerEmailSetMessage setResource(Reference $resource = null)
* @method int getResourceVersion()
* @method OrderCustomerEmailSetMessage setResourceVersion(int $resourceVersion = null)
* @method string getType()
* @method OrderCustomerEmailSetMessage setType(string $type = null)
* @method string getEmail()
* @method OrderCustomerEmailSetMessage setEmail(string $email = null)
*/
class OrderCustomerEmailSetMessage extends Message
{
const MESSAGE_TYPE = 'OrderCustomerEmailSet';

public function fieldDefinitions()
{
$definitions = parent::fieldDefinitions();
$definitions['email'] = [static::TYPE => 'string'];

return $definitions;
}
}
46 changes: 46 additions & 0 deletions src/Model/Message/OrderShippingAddressSetMessage.php
@@ -0,0 +1,46 @@
<?php
/**
* @author @jayS-de <jens.schulze@commercetools.de>
*/

namespace Commercetools\Core\Model\Message;

use Commercetools\Core\Model\Common\DateTimeDecorator;
use Commercetools\Core\Model\Common\Reference;
use Commercetools\Core\Model\Common\Address;

/**
* @package Commercetools\Core\Model\Message
* @link https://dev.commercetools.com/http-api-projects-messages.html#ordershippingaddressset-message
*
* @method string getId()
* @method OrderShippingAddressSetMessage setId(string $id = null)
* @method int getVersion()
* @method OrderShippingAddressSetMessage setVersion(int $version = null)
* @method DateTimeDecorator getCreatedAt()
* @method OrderShippingAddressSetMessage setCreatedAt(\DateTime $createdAt = null)
* @method DateTimeDecorator getLastModifiedAt()
* @method OrderShippingAddressSetMessage setLastModifiedAt(\DateTime $lastModifiedAt = null)
* @method int getSequenceNumber()
* @method OrderShippingAddressSetMessage setSequenceNumber(int $sequenceNumber = null)
* @method Reference getResource()
* @method OrderShippingAddressSetMessage setResource(Reference $resource = null)
* @method int getResourceVersion()
* @method OrderShippingAddressSetMessage setResourceVersion(int $resourceVersion = null)
* @method string getType()
* @method OrderShippingAddressSetMessage setType(string $type = null)
* @method Address getAddress()
* @method OrderShippingAddressSetMessage setAddress(Address $address = null)
*/
class OrderShippingAddressSetMessage extends Message
{
const MESSAGE_TYPE = 'OrderShippingAddressSet';

public function fieldDefinitions()
{
$definitions = parent::fieldDefinitions();
$definitions['address'] = [static::TYPE => '\Commercetools\Core\Model\Common\Address'];

return $definitions;
}
}
2 changes: 1 addition & 1 deletion src/Model/TaxCategory/ExternalTaxRateDraft.php
Expand Up @@ -9,7 +9,7 @@

/**
* @package Commercetools\Core\Model\TaxCategory
* @link http://dev.commercetools.com/http-api-projects-carts.html#externaltaxratedraft
* @link https://dev.commercetools.com/http-api-projects-carts.html#externaltaxratedraft
* @method string getName()
* @method ExternalTaxRateDraft setName(string $name = null)
* @method float getAmount()
Expand Down
2 changes: 1 addition & 1 deletion src/Model/TaxCategory/SubRate.php
Expand Up @@ -9,7 +9,7 @@

/**
* @package Commercetools\Core\Model\TaxCategory
* @link http://dev.commercetools.com/http-api-projects-taxCategories.html#subrate
* @link https://dev.commercetools.com/http-api-projects-taxCategories.html#subrate
* @method string getName()
* @method SubRate setName(string $name = null)
* @method float getAmount()
Expand Down
2 changes: 1 addition & 1 deletion src/Model/TaxCategory/SubRateCollection.php
Expand Up @@ -9,7 +9,7 @@

/**
* @package Commercetools\Core\Model\TaxCategory
* @link http://dev.commercetools.com/http-api-projects-taxCategories.html#subrate
* @link https://dev.commercetools.com/http-api-projects-taxCategories.html#subrate
* @method SubRateCollection add(SubRate $element)
* @method SubRate current()
* @method SubRate getAt($offset)
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Carts/Command/CartChangeTaxModeAction.php
Expand Up @@ -10,7 +10,7 @@

/**
* @package Commercetools\Core\Request\Carts\Command
* @link http://dev.commercetools.com/http-api-projects-carts.html#change-taxmode
* @link https://dev.commercetools.com/http-api-projects-carts.html#change-taxmode
* @method string getAction()
* @method CartChangeTaxModeAction setAction(string $action = null)
* @method string getTaxMode()
Expand Down
Expand Up @@ -11,7 +11,7 @@

/**
* @package Commercetools\Core\Request\Carts\Command
* @link http://dev.commercetools.com/http-api-projects-carts.html#set-customlineitem-taxrate
* @link https://dev.commercetools.com/http-api-projects-carts.html#set-customlineitem-taxrate
* @method string getAction()
* @method CartSetCustomLineItemTaxRateAction setAction(string $action = null)
* @method string getCustomLineItemId()
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Carts/Command/CartSetLineItemTaxRateAction.php
Expand Up @@ -11,7 +11,7 @@

/**
* @package Commercetools\Core\Request\Carts\Command
* @link http://dev.commercetools.com/http-api-projects-carts.html#set-lineitem-taxrate
* @link https://dev.commercetools.com/http-api-projects-carts.html#set-lineitem-taxrate
* @method string getAction()
* @method CartSetLineItemTaxRateAction setAction(string $action = null)
* @method string getLineItemId()
Expand Down
Expand Up @@ -11,7 +11,7 @@

/**
* @package Commercetools\Core\Request\Carts\Command
* @link http://dev.commercetools.com/http-api-projects-carts.html#set-shippingmethod-taxrate
* @link https://dev.commercetools.com/http-api-projects-carts.html#set-shippingmethod-taxrate
* @method string getAction()
* @method CartSetShippingMethodTaxRateAction setAction(string $action = null)
* @method ExternalTaxRateDraft getExternalTaxRate()
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Channels/Command/ChannelSetAddressAction.php
Expand Up @@ -11,7 +11,7 @@

/**
* @package Commercetools\Core\Request\Channels\Command
* @link http://dev.commercetools.com/http-api-projects-channels.html#set-address
* @link https://dev.commercetools.com/http-api-projects-channels.html#set-address
* @method string getAction()
* @method ChannelSetAddressAction setAction(string $action = null)
* @method Address getAddress()
Expand Down
Expand Up @@ -10,7 +10,7 @@

/**
* @package Commercetools\Core\Request\Customers\Command
* @link http://dev.commercetools.com/http-api-projects-customers.html#set-first-name
* @link https://dev.commercetools.com/http-api-projects-customers.html#set-first-name
* @method string getAction()
* @method CustomerSetFirstNameAction setAction(string $action = null)
* @method string getFirstName()
Expand Down
Expand Up @@ -10,7 +10,7 @@

/**
* @package Commercetools\Core\Request\Customers\Command
* @link http://dev.commercetools.com/http-api-projects-customers.html#set-last-name
* @link https://dev.commercetools.com/http-api-projects-customers.html#set-last-name
* @method string getAction()
* @method CustomerSetLastNameAction setAction(string $action = null)
* @method string getLastName()
Expand Down
Expand Up @@ -10,7 +10,7 @@

/**
* @package Commercetools\Core\Request\Customers\Command
* @link http://dev.commercetools.com/http-api-projects-customers.html#set-middle-name
* @link https://dev.commercetools.com/http-api-projects-customers.html#set-middle-name
* @method string getAction()
* @method CustomerSetMiddleNameAction setAction(string $action = null)
* @method string getMiddleName()
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Customers/Command/CustomerSetTitleAction.php
Expand Up @@ -10,7 +10,7 @@

/**
* @package Commercetools\Core\Request\Customers\Command
* @link http://dev.commercetools.com/http-api-projects-customers.html#set-title
* @link https://dev.commercetools.com/http-api-projects-customers.html#set-title
* @method string getAction()
* @method CustomerSetTitleAction setAction(string $action = null)
* @method string getTitle()
Expand Down
39 changes: 39 additions & 0 deletions src/Request/Orders/Command/OrderSetBillingAddress.php
@@ -0,0 +1,39 @@
<?php
/**
* @author @jayS-de <jens.schulze@commercetools.de>
*/

namespace Commercetools\Core\Request\Orders\Command;

use Commercetools\Core\Model\Common\Context;
use Commercetools\Core\Request\AbstractAction;
use Commercetools\Core\Model\Common\Address;

/**
* @package Commercetools\Core\Request\Orders\Command
*
* @method string getAction()
* @method OrderSetBillingAddress setAction(string $action = null)
* @method Address getAddress()
* @method OrderSetBillingAddress setAddress(Address $address = null)
*/
class OrderSetBillingAddress extends AbstractAction
{
public function fieldDefinitions()
{
return [
'action' => [static::TYPE => 'string'],
'address' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
];
}

/**
* @param array $data
* @param Context|callable $context
*/
public function __construct(array $data = [], $context = null)
{
parent::__construct($data, $context);
$this->setAction('setBillingAddress');
}
}
38 changes: 38 additions & 0 deletions src/Request/Orders/Command/OrderSetCustomerEmail.php
@@ -0,0 +1,38 @@
<?php
/**
* @author @jayS-de <jens.schulze@commercetools.de>
*/

namespace Commercetools\Core\Request\Orders\Command;

use Commercetools\Core\Model\Common\Context;
use Commercetools\Core\Request\AbstractAction;

/**
* @package Commercetools\Core\Request\Orders\Command
*
* @method string getAction()
* @method OrderSetCustomerEmail setAction(string $action = null)
* @method string getEmail()
* @method OrderSetCustomerEmail setEmail(string $email = null)
*/
class OrderSetCustomerEmail extends AbstractAction
{
public function fieldDefinitions()
{
return [
'action' => [static::TYPE => 'string'],
'email' => [static::TYPE => 'string'],
];
}

/**
* @param array $data
* @param Context|callable $context
*/
public function __construct(array $data = [], $context = null)
{
parent::__construct($data, $context);
$this->setAction('setCustomerEmail');
}
}
39 changes: 39 additions & 0 deletions src/Request/Orders/Command/OrderSetShippingAddress.php
@@ -0,0 +1,39 @@
<?php
/**
* @author @jayS-de <jens.schulze@commercetools.de>
*/

namespace Commercetools\Core\Request\Orders\Command;

use Commercetools\Core\Model\Common\Context;
use Commercetools\Core\Request\AbstractAction;
use Commercetools\Core\Model\Common\Address;

/**
* @package Commercetools\Core\Request\Orders\Command
*
* @method string getAction()
* @method OrderSetShippingAddress setAction(string $action = null)
* @method Address getAddress()
* @method OrderSetShippingAddress setAddress(Address $address = null)
*/
class OrderSetShippingAddress extends AbstractAction
{
public function fieldDefinitions()
{
return [
'action' => [static::TYPE => 'string'],
'address' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
];
}

/**
* @param array $data
* @param Context|callable $context
*/
public function __construct(array $data = [], $context = null)
{
parent::__construct($data, $context);
$this->setAction('setShippingAddress');
}
}

0 comments on commit 23e0193

Please sign in to comment.