commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Cart
CartSetShippingMethodActionModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\ShippingMethod\ShippingMethodResourceIdentifier
;
12
use
Commercetools\Api\Models\ShippingMethod\ShippingMethodResourceIdentifierModel
;
13
use
Commercetools\Base\DateTimeImmutableCollection
;
14
use
Commercetools\Base\JsonObject
;
15
use
Commercetools\Base\JsonObjectModel
;
16
use
Commercetools\Base\MapperFactory
;
17
use stdClass;
18
22
final
class
CartSetShippingMethodActionModel
extends
JsonObjectModel
implements
CartSetShippingMethodAction
23
{
24
public
const
DISCRIMINATOR_VALUE
=
'setShippingMethod'
;
29
protected
$action
;
30
35
protected
$shippingMethod
;
36
41
protected
$externalTaxRate
;
42
43
47
public
function
__construct
(
48
?
ShippingMethodResourceIdentifier
$shippingMethod
=
null
,
49
?
ExternalTaxRateDraft
$externalTaxRate
=
null
,
50
?
string
$action
=
null
51
) {
52
$this->shippingMethod =
$shippingMethod
;
53
$this->externalTaxRate =
$externalTaxRate
;
54
$this->action =
$action
??
self::DISCRIMINATOR_VALUE
;
55
}
56
61
public
function
getAction
()
62
{
63
if
(is_null($this->action)) {
65
$data = $this->
raw
(self::FIELD_ACTION);
66
if
(is_null($data)) {
67
return
null
;
68
}
69
$this->action = (string) $data;
70
}
71
72
return
$this->action
;
73
}
74
83
public
function
getShippingMethod
()
84
{
85
if
(is_null($this->shippingMethod)) {
87
$data = $this->
raw
(self::FIELD_SHIPPING_METHOD);
88
if
(is_null($data)) {
89
return
null
;
90
}
91
92
$this->shippingMethod =
ShippingMethodResourceIdentifierModel::of
($data);
93
}
94
95
return
$this->shippingMethod
;
96
}
97
104
public
function
getExternalTaxRate
()
105
{
106
if
(is_null($this->externalTaxRate)) {
108
$data = $this->
raw
(self::FIELD_EXTERNAL_TAX_RATE);
109
if
(is_null($data)) {
110
return
null
;
111
}
112
113
$this->externalTaxRate =
ExternalTaxRateDraftModel::of
($data);
114
}
115
116
return
$this->externalTaxRate
;
117
}
118
119
123
public
function
setShippingMethod
(?
ShippingMethodResourceIdentifier
$shippingMethod
): void
124
{
125
$this->shippingMethod =
$shippingMethod
;
126
}
127
131
public
function
setExternalTaxRate
(?
ExternalTaxRateDraft
$externalTaxRate
): void
132
{
133
$this->externalTaxRate =
$externalTaxRate
;
134
}
135
}
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel
Definition:
CartSetShippingMethodActionModel.php:23
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\getShippingMethod
getShippingMethod()
Definition:
CartSetShippingMethodActionModel.php:83
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\getAction
getAction()
Definition:
CartSetShippingMethodActionModel.php:61
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\getExternalTaxRate
getExternalTaxRate()
Definition:
CartSetShippingMethodActionModel.php:104
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\setExternalTaxRate
setExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
Definition:
CartSetShippingMethodActionModel.php:131
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\__construct
__construct(?ShippingMethodResourceIdentifier $shippingMethod=null, ?ExternalTaxRateDraft $externalTaxRate=null, ?string $action=null)
Definition:
CartSetShippingMethodActionModel.php:47
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\DISCRIMINATOR_VALUE
const DISCRIMINATOR_VALUE
Definition:
CartSetShippingMethodActionModel.php:24
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\$shippingMethod
$shippingMethod
Definition:
CartSetShippingMethodActionModel.php:35
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\$externalTaxRate
$externalTaxRate
Definition:
CartSetShippingMethodActionModel.php:41
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\setShippingMethod
setShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
Definition:
CartSetShippingMethodActionModel.php:123
Commercetools\Api\Models\Cart\CartSetShippingMethodActionModel\$action
$action
Definition:
CartSetShippingMethodActionModel.php:29
Commercetools\Api\Models\ShippingMethod\ShippingMethodResourceIdentifierModel
Definition:
ShippingMethodResourceIdentifierModel.php:23
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition:
BaseJsonObject.php:57
Commercetools\Base\BaseJsonObject\of
static of($data=null)
Definition:
BaseJsonObject.php:26
Commercetools\Base\DateTimeImmutableCollection
Definition:
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition:
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition:
MapperFactory.php:16
Commercetools\Api\Models\Cart\CartSetShippingMethodAction
Definition:
CartSetShippingMethodAction.php:16
Commercetools\Api\Models\Cart\ExternalTaxRateDraft
Definition:
ExternalTaxRateDraft.php:16
Commercetools\Api\Models\ShippingMethod\ShippingMethodResourceIdentifier
Definition:
ShippingMethodResourceIdentifier.php:16
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition:
Cart.php:9
Generated by
1.9.1