1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
<?php
/**
* @author @jenschude <jens.schulze@commercetools.de>
*/
namespace Commercetools\Core\Model\Cart;
use Commercetools\Core\Model\Common\AddressCollection;
use Commercetools\Core\Model\Common\Context;
use Commercetools\Core\Model\Common\HighPrecisionMoney;
use Commercetools\Core\Model\Common\JsonObject;
use Commercetools\Core\Model\Common\LocalizedString;
use Commercetools\Core\Model\Common\Money;
use Commercetools\Core\Model\Common\ResourceIdentifier;
use Commercetools\Core\Model\TaxCategory\TaxCategory;
use Commercetools\Core\Model\TaxCategory\TaxCategoryReference;
use Commercetools\Core\Model\CustomField\CustomFieldObject;
use Commercetools\Core\Model\TaxCategory\ExternalTaxRateDraft;
/**
* @package Commercetools\Core\Model\Cart
* @link https://docs.commercetools.com/http-api-projects-carts.html#customlineitemdraft
* @method LocalizedString getName()
* @method CustomLineItemDraft setName(LocalizedString $name = null)
* @method Money getMoney()
* @method CustomLineItemDraft setMoney(Money $money = null)
* @method string getSlug()
* @method CustomLineItemDraft setSlug(string $slug = null)
* @method int getQuantity()
* @method CustomLineItemDraft setQuantity(int $quantity = null)
* @method TaxCategoryReference getTaxCategory()
* @method CustomLineItemDraft setTaxCategory(TaxCategoryReference $taxCategory = null)
* @method CustomFieldObject getCustom()
* @method CustomLineItemDraft setCustom(CustomFieldObject $custom = null)
* @method ExternalTaxRateDraft getExternalTaxRate()
* @method CustomLineItemDraft setExternalTaxRate(ExternalTaxRateDraft $externalTaxRate = null)
* @method AddressCollection getItemShippingAddresses()
* @method CustomLineItemDraft setItemShippingAddresses(AddressCollection $itemShippingAddresses = null)
* @method ItemShippingDetailsDraft getShippingDetails()
* @method CustomLineItemDraft setShippingDetails(ItemShippingDetailsDraft $shippingDetails = null)
*/
class CustomLineItemDraft extends JsonObject
{
public function fieldDefinitions()
{
return [
'name' => [static::TYPE => LocalizedString::class],
'money' => [static::TYPE => Money::class],
'slug' => [static::TYPE => 'string'],
'quantity' => [static::TYPE => 'int'],
'taxCategory' => [static::TYPE => TaxCategoryReference::class, static::OPTIONAL => true],
'externalTaxRate' => [static::TYPE => ExternalTaxRateDraft::class, static::OPTIONAL => true],
'custom' => [static::TYPE => CustomFieldObject::class, static::OPTIONAL => true],
'shippingDetails' => [static::TYPE => ItemShippingDetailsDraft::class, static::OPTIONAL => true],
];
}
/**
* @param LocalizedString $name
* @param Money|HighPrecisionMoney $money
* @param string $slug
* @param Context|callable $context
* @return CustomLineItemDraft
*/
public static function ofNameMoneyAndSlug(LocalizedString $name, Money $money, $slug, $context = null)
{
return static::of($context)->setName($name)
->setMoney($money)
->setSlug($slug);
}
/**
* @param LocalizedString $name
* @param Money|HighPrecisionMoney $money
* @param string $slug
* @param int $quantity
* @param Context|callable $context
* @return CustomLineItemDraft
*/
public static function ofNameMoneySlugAndQuantity(
LocalizedString $name,
Money $money,
$slug,
$quantity,
$context = null
) {
return static::of($context)->setName($name)
->setMoney($money)
->setSlug($slug)
->setQuantity($quantity);
}
/**
* @param LocalizedString $name
* @param Money|HighPrecisionMoney $money
* @param string $slug
* @param ResourceIdentifier|TaxCategoryReference $taxCategory
* @param Context|callable $context
* @return CustomLineItemDraft
*/
public static function ofNameMoneySlugAndTaxCategory(
LocalizedString $name,
Money $money,
$slug,
ResourceIdentifier $taxCategory,
$context = null
) {
return static::of($context)
->setName($name)
->setMoney($money)
->setSlug($slug)
->setTaxCategory($taxCategory);
}
/**
* @param LocalizedString $name
* @param Money|HighPrecisionMoney $money
* @param string $slug
* @param ResourceIdentifier|TaxCategoryReference $taxCategory
* @param int $quantity
* @param Context|callable $context
* @return CustomLineItemDraft
*/
public static function ofNameMoneySlugTaxCategoryAndQuantity(
LocalizedString $name,
Money $money,
$slug,
ResourceIdentifier $taxCategory,
$quantity,
$context = null
) {
return static::of($context)
->setName($name)
->setMoney($money)
->setSlug($slug)
->setTaxCategory($taxCategory)
->setQuantity($quantity);
}
}