This commit is contained in:
Thomas Peterson 2024-06-13 21:17:15 +00:00
parent a45e3ab0d3
commit 1eb90b5751
113 changed files with 894 additions and 342 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"9cf7f18ab0554c25acf26994eed62e83","collectionName":"README","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"cabfb9c4a99141a4896aaa069b16ec24","collectionName":"system.version","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"96c128ea94fd405fbfb2b2085798b0af","collectionName":"Account","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"f1346444a1484e549759c26138d9f87e","collectionName":"Contact","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"e65bd27d71484a4298d7d8e08af74de9","collectionName":"Contact","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"62a354bbd1464068b85e25293188a77d","collectionName":"ContactAddress","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"1a6bc71d62204993a30ea3cbc483ac49","collectionName":"ContactAddress","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"169571b84c0243a4b11e5e439aff4d15","collectionName":"Country","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"59837fffaaee40e78c4f17675a7192ff","collectionName":"Country","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"57d377abaa7044c19b65c3821392c38a","collectionName":"Gatewaysettings","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"1881a39e24f94ae387f9a9c3219cc978","collectionName":"Instance","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"9ee3da2c8ca84eb89765af8213dc3317","collectionName":"Instance","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"8e93a4d7154b4b85a836aad2577d8f27","collectionName":"Job","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"33af3d9422b545e1aafa5fe326e5115a","collectionName":"Job","type":"collection"}

View File

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"bc2166345a5744afbefea355652905bd","collectionName":"JobLog","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"199ca7f10d0f43beb73d7ead3bd481ad","collectionName":"LayouterSession","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"72bedb18918c433297916d5dc042cefa","collectionName":"LogEntry","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"f290794af1b0450491498bc5aba08407","collectionName":"LogEntry","type":"collection"}

BIN
dev_db/dump/psc/Media.bson Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"c6e5ee0333504de98bed8406b165aa3d","collectionName":"Media","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"d8dc8eb6b6dc461f8277c994224dee91","collectionName":"Media_Folder","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"49ecb6cbbbca4ec3b044f0a747de2562","collectionName":"Media_Folder","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"e300ea694a354d369dd12bd271dc08c4","collectionName":"Migration","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"e5598ab5df1a41b49b64f494c8c6518c","collectionName":"Migration","type":"collection"}

BIN
dev_db/dump/psc/Motiv.bson Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"76fd879bd0294206a54ec086f3ecdd02","collectionName":"Motiv","type":"collection"}

BIN
dev_db/dump/psc/Order.bson Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"d81d2fa19d9b4f58ac7d9aa63d083f63","collectionName":"Order","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"a3d6610a675b4e3eb2756d41921d7192","collectionName":"Paper","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"a8d94a25837b45aabd4e35332f6a5fd2","collectionName":"Paper","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"7ce30c5d2a89476095657c09e1d68600","collectionName":"Payment","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"05aed50a1d2647da9dd165c76dcdb964","collectionName":"Payment","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"c2e5bfb9ea6642e39825d89e4613151d","collectionName":"Plugin","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"bba4c875d7a14359a7d05bc1d6f26c55","collectionName":"Plugin","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"fa91ca9880b54f62849628311c4556c9","collectionName":"Position","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"74b3092017164bf4a803b8c96695410b","collectionName":"Product","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"fc9a818c396041c89e6c8b30fea0d9ce","collectionName":"Product","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"8087c9592a164c2f963c1b179696f506","collectionName":"Productgroup","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"404294a8c2844344bbe4046da91d4e3d","collectionName":"Productgroup","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"c92053c6ced24d758145a558dd2e9860","collectionName":"Queue","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"6173337471a7434e837c2976609d6ba8","collectionName":"Queue","type":"collection"}

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"734514bc3bb34e90b4361c9a4f8173e5","collectionName":"Route","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"57897370d13a4822a4c7c75bf7ec24a7","collectionName":"Route","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"630efa1cd2a641da9243f2f94dde939c","collectionName":"Shipping","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"d9d6aa3c816c4923b5becec6c7871365","collectionName":"Shop","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"1aeca7b3886f4ed8a6f7bc093d123e06","collectionName":"Shop","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"b42f3a7e24184815ae7d8c0070b904ac","collectionName":"ShopFormular","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"b30fa9be7c1146edb26d5493f48a4562","collectionName":"ShopFormular","type":"collection"}

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"f0b2232622354b6cad5fb62317e5b7ca","collectionName":"Status","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"0344b531680845bba6e65de7478af37b","collectionName":"Status","type":"collection"}

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"174a8f8aa338436bb72aed095f070b46","collectionName":"Tax","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"ee8261af745c41f3a210406ff8cbbfc1","collectionName":"Tax","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"d5e80f2e8a4b444d95250de37e582d50","collectionName":"accountObj_history","type":"collection"}

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"4d7d0b1a64e34f21ba51386575a5cf93","collectionName":"contactObj_history","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"098a461995214847bcfc7cffbff3209a","collectionName":"contactObj_history","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"4f475b12266c4f939a9949f107fa8aa3","collectionName":"payment_history","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"e421db95dc1c4ee4b442f210c645f609","collectionName":"payment_history","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"076f826f8ae040f28ddb3ee8df17acec","collectionName":"producktgroupObj_history","type":"collection"}

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"958170fc5354431f9e1ee15c598fd00b","collectionName":"productObj_history","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"54ed92e16668459a9f6ee1a781309450","collectionName":"productObj_history","type":"collection"}

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"c6a2e2cd6a9a4922a7f423ee8f581c4a","collectionName":"shipping_history","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"36872d347afd453db3cb84acd79eca04","collectionName":"shipping_history","type":"collection"}

Binary file not shown.

View File

@ -1 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"b9cb1fe5c5b842c586e150219cc1f4b4","collectionName":"shopObj_history","type":"collection"} {"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"2db60c6a38004ec9945b4b51938ca2f2","collectionName":"shopObj_history","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"7a3447a96b5b4b11823bffcf2b78fc09","collectionName":"Contact","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"2591730e9c154b359d7d2d1392be1a06","collectionName":"Country","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"2b1015e06ac74b549591317437133ea0","collectionName":"Instance","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"d7eddee478d249be8f3d63751e45b002","collectionName":"Job","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"1ecbf49744844b889bcfefd7aaf6daff","collectionName":"Order","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"f7a9ced8466848be9a1a81a1571e5032","collectionName":"Plugin","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"c9bde0617e94483498787a88591890ec","collectionName":"Position","type":"collection"}

Binary file not shown.

View File

@ -0,0 +1 @@
{"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_"}],"uuid":"0c9ba46db1f049b4bc389e7c9cff455a","collectionName":"Shop","type":"collection"}

View File

@ -13,7 +13,7 @@ PSC\Shop\EntityBundle\Entity\Voucher:
value: 5 value: 5
shop: '@shop_1' shop: '@shop_1'
voucher_2: voucher_2:
title: 5 prozent title: 5% prozent
enable: true enable: true
payment: true payment: true
shipping: true shipping: true
@ -25,4 +25,34 @@ PSC\Shop\EntityBundle\Entity\Voucher:
toDate: <(new DateTime("2025-12-12"))> toDate: <(new DateTime("2025-12-12"))>
value: 5 value: 5
shop: '@shop_1' shop: '@shop_1'
voucher_3:
title: 50 fest
enable: true
payment: true
shipping: true
more: true
percent: false
code: 50f
zeroPayment: true
zeroShipping: true
mode: 1
fromDate: <(new DateTime("2023-12-12"))>
toDate: <(new DateTime("2025-12-12"))>
value: 5
shop: '@shop_1'
voucher_4:
title: 50%
enable: true
payment: true
shipping: true
more: true
percent: false
code: 50%
zeroPayment: true
zeroShipping: true
mode: 1
fromDate: <(new DateTime("2023-12-12"))>
toDate: <(new DateTime("2025-12-12"))>
value: 5
shop: '@shop_1'

View File

@ -2,6 +2,10 @@
namespace PSC\Component\ApiBundle\Transformer; namespace PSC\Component\ApiBundle\Transformer;
use PSC\Component\ApiBundle\Model\Shop as PSCShop;
use PSC\System\SettingsBundle\Service\Shop as AliasedShop;
/** /**
* Order * Order
@ -10,6 +14,8 @@ namespace PSC\Component\ApiBundle\Transformer;
*/ */
class Shop class Shop
{ {
public function __construct(private readonly AliasedShop $shopService)
{}
public function fromEntity(\PSC\Component\ApiBundle\Model\Shop $shop, \PSC\Shop\EntityBundle\Entity\Shop $shopEntity): void public function fromEntity(\PSC\Component\ApiBundle\Model\Shop $shop, \PSC\Shop\EntityBundle\Entity\Shop $shopEntity): void
{ {
@ -24,4 +30,16 @@ class Shop
$shop->basketPosField2 = (string)$shopEntity->getBasketposfield2(); $shop->basketPosField2 = (string)$shopEntity->getBasketposfield2();
} }
public function parseModel(PSCShop $shop): void
{
$shopEntity = $this->shopService->getShopByUid($shop->getUuid());
if(!$shopEntity) {
$shopEntity = $this->shopService->getShopByUid($shop->getId());
}
if($shopEntity) {
$shop->setId($shopEntity->getId());
$shop->setName($shop->getName());
}
}
} }

View File

@ -16,7 +16,6 @@ namespace PSC\Shop\EntityBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field; use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id; use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document; use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbeddedDocument;
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbedOne; use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbedOne;
#[Document] #[Document]
@ -40,6 +39,12 @@ class Order
#[Field(type: 'bool')] #[Field(type: 'bool')]
protected $draft = false; protected $draft = false;
#[Field(type: 'raw')]
protected string $vouchers = "";
#[Field(type: 'raw')]
protected string $discounts = "";
/** /**
* @return bool * @return bool
*/ */
@ -55,12 +60,12 @@ class Order
{ {
$this->sendDataToShipping = $sendDataToShipping; $this->sendDataToShipping = $sendDataToShipping;
} }
/** /**
* @var string $externalOrderNumber; * @var string $externalOrderNumber;
*/ */
#[Field(type: 'string')] #[Field(type: 'string')]
protected $externalOrderNumber; protected $externalOrderNumber;
/** /**
* @var string $paymentRef; * @var string $paymentRef;
*/ */
#[Field(type: 'string')] #[Field(type: 'string')]
@ -68,7 +73,7 @@ class Order
#[Field(type: 'string')] #[Field(type: 'string')]
protected $paymentGateway; protected $paymentGateway;
/** /**
* @var string $paymentToken; * @var string $paymentToken;
*/ */
#[Field(type: 'string')] #[Field(type: 'string')]
@ -83,12 +88,12 @@ class Order
protected $deliveryAddressSaved; protected $deliveryAddressSaved;
#[EmbedOne] #[EmbedOne]
protected $senderAddressSaved; protected $senderAddressSaved;
/** /**
* @var boolean $withTax * @var boolean $withTax
*/ */
#[Field(type: 'bool')] #[Field(type: 'bool')]
protected $withTax; protected $withTax;
/** /**
* @return string * @return string
*/ */
public function getId() public function getId()
@ -340,4 +345,20 @@ class Order
{ {
$this->paymentGateway = $paymentGateway; $this->paymentGateway = $paymentGateway;
} }
public function setDiscounts(string $discounts): void
{
$this->discounts = $discounts;
}
public function getDiscounts(): string
{
return $this->discounts;
}
public function setVouchers(string $vouchers): void
{
$this->vouchers = $vouchers;
}
public function getVouchers(): string
{
return $this->vouchers;
}
} }

View File

@ -19,7 +19,6 @@ use Ramsey\Uuid\Uuid;
/** /**
* Cms * Cms
* *
*
* @package PSC\Shop\Entity * @package PSC\Shop\Entity
* @subpackage Entitys * @subpackage Entitys
*/ */
@ -34,28 +33,28 @@ class Voucher
*/ */
#[ORM\Column(name: 'created', type: 'datetime')] #[ORM\Column(name: 'created', type: 'datetime')]
protected $createdAt; protected $createdAt;
/** /**
* Updated * Updated
* *
* @var Datetime * @var Datetime
*/ */
#[ORM\Column(name: 'updated', type: 'datetime')] #[ORM\Column(name: 'updated', type: 'datetime')]
protected $updatedAt; protected $updatedAt;
/** /**
* @var integer * @var integer
*/ */
#[ORM\Column(name: 'id', type: 'integer')] #[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $uid; private $uid;
/** /**
* Titel * Titel
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'title', type: 'string', length: 255)] #[ORM\Column(name: 'title', type: 'string', length: 255)]
protected $title; protected $title;
/** /**
* Shop zu welcher die News gehört * Shop zu welcher die News gehört
* *
* @var int * @var int
@ -63,7 +62,7 @@ class Voucher
#[ORM\ManyToOne(targetEntity: 'PSC\Shop\EntityBundle\Entity\Shop')] #[ORM\ManyToOne(targetEntity: 'PSC\Shop\EntityBundle\Entity\Shop')]
#[ORM\JoinColumn(name: 'shop_id', referencedColumnName: 'id')] #[ORM\JoinColumn(name: 'shop_id', referencedColumnName: 'id')]
protected $shop; protected $shop;
/** /**
* enable * enable
* *
* @var boolean * @var boolean
@ -105,84 +104,84 @@ class Voucher
/** /**
* percent * percent
* *
* @var boolean * @var boolean
*/ */
#[ORM\Column(name: 'percent', type: 'boolean')] #[ORM\Column(name: 'percent', type: 'boolean')]
protected $percent; protected $percent;
/** /**
* more * more
* *
* @var boolean * @var boolean
*/ */
#[ORM\Column(name: 'more', type: 'boolean')] #[ORM\Column(name: 'more', type: 'boolean')]
protected $more; protected $more;
/** /**
* from * from
* *
* @var date * @var date
*/ */
#[ORM\Column(name: 'f', type: 'date')] #[ORM\Column(name: 'f', type: 'date')]
protected $fromDate; protected $fromDate;
/** /**
* from * from
* *
* @var date * @var date
*/ */
#[ORM\Column(name: 't', type: 'date')] #[ORM\Column(name: 't', type: 'date')]
protected $toDate; protected $toDate;
/** /**
* count * count
* *
* @var int * @var int
*/ */
#[ORM\Column(name: 'count', type: 'integer')] #[ORM\Column(name: 'count', type: 'integer')]
protected $count; protected $count;
/** /**
* mode * mode
* *
* @var int * @var int
*/ */
#[ORM\Column(name: 'mode', type: 'integer')] #[ORM\Column(name: 'mode', type: 'integer')]
protected $mode; protected $mode;
/** /**
* value * value
* *
* @var float * @var float
*/ */
#[ORM\Column(name: 'wert', type: 'float')] #[ORM\Column(name: 'wert', type: 'float')]
protected $value; protected $value;
/** /**
* Code * Code
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'pre_code', type: 'string', length: 255, nullable: true)] #[ORM\Column(name: 'pre_code', type: 'string', length: 255, nullable: true)]
protected $code; protected $code;
/** /**
* Articlegroup * Articlegroup
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'articlegroup_id', type: 'string', length: 255, nullable: true)] #[ORM\Column(name: 'articlegroup_id', type: 'string', length: 255, nullable: true)]
protected $productGroupIds; protected $productGroupIds;
/** /**
* ProductIds * ProductIds
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'product_id', type: 'string', length: 255, nullable: true)] #[ORM\Column(name: 'product_id', type: 'string', length: 255, nullable: true)]
protected $productIds; protected $productIds;
/** /**
* VoucherItems * VoucherItems
* *
* @var int * @var int
*/ */
#[ORM\OneToMany(targetEntity: 'VoucherItem', mappedBy: 'voucher')] #[ORM\OneToMany(targetEntity: 'VoucherItem', mappedBy: 'voucher')]
protected $voucherItems; protected $voucherItems;
/** /**
* Voucher constructor. * Voucher constructor.
*/ */
public function __construct() public function __construct()
@ -489,7 +488,7 @@ class Voucher
public function isZeroShipping(): bool public function isZeroShipping(): bool
{ {
return $this->zeroShipping; return (bool)$this->zeroShipping;
} }
public function setZeroShipping(bool $zeroShipping): void public function setZeroShipping(bool $zeroShipping): void
@ -499,7 +498,7 @@ class Voucher
public function isZeroPayment(): bool public function isZeroPayment(): bool
{ {
return $this->zeroPayment; return (bool)$this->zeroPayment;
} }
public function setZeroPayment(bool $zeroPayment): void public function setZeroPayment(bool $zeroPayment): void

View File

@ -14,7 +14,10 @@
namespace PSC\Shop\EntityBundle\Repository; namespace PSC\Shop\EntityBundle\Repository;
use DateTime; use DateTime;
use Doctrine\ORM\EntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use PSC\Component\ApiBundle\Model\Shop;
use PSC\Shop\EntityBundle\Entity\Voucher;
/** /**
* VoucherRepository * VoucherRepository
@ -23,6 +26,25 @@ use Doctrine\ORM\EntityRepository;
* @package PSC\Shop\Entity * @package PSC\Shop\Entity
* @subpackage Repositorys * @subpackage Repositorys
*/ */
class VoucherRepository extends EntityRepository class VoucherRepository extends ServiceEntityRepository
{ {
} public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Voucher::class);
}
public function findByCodeForActDate(string $code, Shop $shop)
{
$result = $this->getEntityManager()
->createQuery('
SELECT v FROM '.Voucher::class.' v
WHERE v.code = :code AND v.shop = :shop_id AND v.fromDate <= :from AND v.toDate >= :to')
->setParameter('shop_id', $shop->getId())
->setParameter('from', date('Y-m-d'))
->setParameter('to', date('Y-m-d'))
->setParameter('code', $code)
->setMaxResults(1)
->getOneOrNullResult();
return $result;
}
}

View File

@ -48,7 +48,7 @@ class Create extends AbstractController
* @Security(name="Bearer") * @Security(name="Bearer")
*/ */
#[Route(path: '/order/create', methods: ['POST'])] #[Route(path: '/order/create', methods: ['POST'])]
#[ParamConverter('order', class: '\PSC\Shop\OrderBundle\Model\Order', converter: 'psc_rest.request_body')] #[ParamConverter('order', class: ModelOrder::class, converter: 'psc_rest.request_body')]
public function create(ModelOrder $order): JsonResponse public function create(ModelOrder $order): JsonResponse
{ {
$this->orderService->storeOrder($order); $this->orderService->storeOrder($order);

View File

@ -7,91 +7,106 @@ use PSC\Component\ApiBundle\Model\Shop;
use PSC\Shop\AccountBundle\Model\Account; use PSC\Shop\AccountBundle\Model\Account;
use PSC\Shop\ContactBundle\Model\Address; use PSC\Shop\ContactBundle\Model\Address;
use PSC\Shop\ContactBundle\Model\Contact; use PSC\Shop\ContactBundle\Model\Contact;
use PSC\Shop\OrderBundle\Model\Order\Discount;
use PSC\Shop\PaymentBundle\Model\Payment; use PSC\Shop\PaymentBundle\Model\Payment;
use PSC\Shop\OrderBundle\Model\Order\Position; use PSC\Shop\OrderBundle\Model\Order\Position;
use PSC\Shop\ShippingBundle\Model\Shipping; use PSC\Shop\ShippingBundle\Model\Shipping;
use PSC\Shop\OrderBundle\Model\Order\Tax; use PSC\Shop\OrderBundle\Model\Order\Tax;
use PSC\Shop\VoucherBundle\Model\Voucher;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
abstract class Base abstract class Base
{ {
/** @var \Ramsey\Uuid\UuidInterface /**
* @var \Ramsey\Uuid\UuidInterface
*/ */
#[\OpenApi\Attributes\Property(type: 'string')] #[\OpenApi\Attributes\Property(type: 'string')]
private string $uuid; private string $uuid;
/** @var \DateTime /**
* @var \DateTime
*/ */
#[\OpenApi\Attributes\Property(type: 'string', format: 'date-time')] #[\OpenApi\Attributes\Property(type: 'string', format: 'date-time')]
private \DateTime $created; private \DateTime $created;
/** @var \DateTime /**
* @var \DateTime
*/ */
#[\OpenApi\Attributes\Property(type: 'string', format: 'date-time')] #[\OpenApi\Attributes\Property(type: 'string', format: 'date-time')]
private \DateTime $updated; private \DateTime $updated;
/** @var string /**
* @var string
*/ */
#[\OpenApi\Attributes\Property(type: 'string')] #[\OpenApi\Attributes\Property(type: 'string')]
private $alias; private $alias;
/** @var Address /**
* @var Address
*/ */
#[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\ContactBundle\Model\Address::class))] #[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\ContactBundle\Model\Address::class))]
private $deliveryAddress; private $deliveryAddress;
/** @var Address /**
* @var Address
*/ */
#[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\ContactBundle\Model\Address::class))] #[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\ContactBundle\Model\Address::class))]
private $senderAddress; private $senderAddress;
/** @var Address /**
* @var Address
*/ */
#[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\ContactBundle\Model\Address::class))] #[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\ContactBundle\Model\Address::class))]
private $invoiceAddress; private $invoiceAddress;
/** /**
* @var Shipping * @var Shipping
*/ */
#[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\ShippingBundle\Model\Shipping::class))] #[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\ShippingBundle\Model\Shipping::class))]
private Shipping $shipping; private Shipping $shipping;
/** @var Payment /**
* @var Payment
*/ */
#[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\PaymentBundle\Model\Payment::class))] #[\OpenApi\Attributes\Property(ref: new Model(type: \PSC\Shop\PaymentBundle\Model\Payment::class))]
private $payment; private $payment;
/** @var double
*/ #[\OpenApi\Attributes\Property(type: 'number', format: 'integer')]
#[\OpenApi\Attributes\Property(type: 'number', format: 'double')] private int $net = 0;
private $net; #[\OpenApi\Attributes\Property(type: 'number', format: 'integer')]
/** @var double private int $vat = 0;
*/ #[\OpenApi\Attributes\Property(type: 'number', format: 'integer')]
#[\OpenApi\Attributes\Property(type: 'number', format: 'double')] private int $gross = 0;
private $vat;
/** @var double #[\OpenApi\Attributes\Property(type: 'number', format: 'integer')]
*/ private int $grossWithDiscount = 0;
#[\OpenApi\Attributes\Property(type: 'number', format: 'double')]
private $gross; #[\OpenApi\Attributes\Property(type: 'number', format: 'integer')]
/** @var double private int $netWithDiscount = 0;
*/
#[\OpenApi\Attributes\Property(type: 'number', format: 'double')] #[\OpenApi\Attributes\Property(type: 'number', format: 'integer')]
private $paymentCosts; private int $vatWithDiscount = 0;
/** @var double #[\OpenApi\Attributes\Property(type: 'number', format: 'integer')]
*/ private int $paymentCosts = 0;
#[\OpenApi\Attributes\Property(type: 'number', format: 'double')] #[\OpenApi\Attributes\Property(type: 'number', format: 'integer')]
private $shippingCosts; private int $shippingCosts = 0;
/** @var bool /**
* @var bool
*/ */
#[\OpenApi\Attributes\Property(type: 'boolean')] #[\OpenApi\Attributes\Property(type: 'boolean')]
private $enable; private $enable;
/** @var bool /**
* @var bool
*/ */
#[\OpenApi\Attributes\Property(type: 'boolean')] #[\OpenApi\Attributes\Property(type: 'boolean')]
private $draft = false; private $draft = false;
/** @var bool /**
* @var bool
*/ */
#[\OpenApi\Attributes\Property(type: 'boolean')] #[\OpenApi\Attributes\Property(type: 'boolean')]
private $sendDataToShipping = false; private $sendDataToShipping = false;
/** @var string /**
* @var string
*/ */
#[\OpenApi\Attributes\Property(type: 'string')] #[\OpenApi\Attributes\Property(type: 'string')]
private $info; private $info;
/** @var string /**
* @var string
*/ */
#[\OpenApi\Attributes\Property(type: 'string')] #[\OpenApi\Attributes\Property(type: 'string')]
private $basketField1; private $basketField1;
@ -102,42 +117,54 @@ abstract class Base
#[\OpenApi\Attributes\Property(type: 'string')] #[\OpenApi\Attributes\Property(type: 'string')]
private string $paymentGateway = ""; private string $paymentGateway = "";
/** @var string /**
* @var string
*/ */
#[\OpenApi\Attributes\Property(type: 'string')] #[\OpenApi\Attributes\Property(type: 'string')]
private $basketField2; private $basketField2;
/** @var int /**
* @var int
*/ */
#[\OpenApi\Attributes\Property(type: 'integer')] #[\OpenApi\Attributes\Property(type: 'integer')]
private $couponType; private $couponType;
/** @var Tax[] /**
* @var Tax[]
*/ */
#[\OpenApi\Attributes\Property(type: 'array', items: new \OpenApi\Attributes\Items(ref: new Model(type: \PSC\Shop\OrderBundle\Model\Order\Tax::class)))] #[\OpenApi\Attributes\Property(type: 'array', items: new \OpenApi\Attributes\Items(ref: new Model(type: \PSC\Shop\OrderBundle\Model\Order\Tax::class)))]
private $taxes = []; private $taxes = [];
#[\OpenApi\Attributes\Property(type: 'array', items: new \OpenApi\Attributes\Items(ref: new Model(type: \PSC\Shop\VoucherBundle\Model\Voucher::class)))]
private $vouchers = [];
#[\OpenApi\Attributes\Property(type: 'array', items: new \OpenApi\Attributes\Items(ref: new Model(type: \PSC\Shop\OrderBundle\Model\Order\Tax::class)))] #[\OpenApi\Attributes\Property(type: 'array', items: new \OpenApi\Attributes\Items(ref: new Model(type: \PSC\Shop\OrderBundle\Model\Order\Tax::class)))]
private $allTaxes = []; private $allTaxes = [];
#[\OpenApi\Attributes\Property(type: 'array', items: new \OpenApi\Attributes\Items(ref: new Model(type: \PSC\Shop\OrderBundle\Model\Order\Discount::class)))]
private $discounts = [];
private Shop $shop; private Shop $shop;
/** @var int /**
* @var int
*/ */
#[\OpenApi\Attributes\Property(type: 'integer')] #[\OpenApi\Attributes\Property(type: 'integer')]
private $status = 10; private $status = 10;
/** @var Position[] /**
* @var Position[]
*/ */
#[\OpenApi\Attributes\Property(type: 'array', items: new \OpenApi\Attributes\Items(ref: new Model(type: \PSC\Shop\OrderBundle\Model\Order\Position::class)))] #[\OpenApi\Attributes\Property(type: 'array', items: new \OpenApi\Attributes\Items(ref: new Model(type: \PSC\Shop\OrderBundle\Model\Order\Position::class)))]
private $positions = []; private $positions = [];
/** @var string /**
* @var string
*/ */
#[\OpenApi\Attributes\Property(type: 'string')] #[\OpenApi\Attributes\Property(type: 'string')]
private $externalOrderNumber; private $externalOrderNumber;
/** /**
* @var int * @var int
*/ */
#[\OpenApi\Attributes\Property(type: 'integer')] #[\OpenApi\Attributes\Property(type: 'integer')]
private $uid; private $uid;
/** /**
* @var int * @var int
*/ */
#[\OpenApi\Attributes\Property(type: 'integer')] #[\OpenApi\Attributes\Property(type: 'integer')]
@ -499,6 +526,15 @@ abstract class Base
return $this->taxes; return $this->taxes;
} }
/**
* @return Voucher[]
*/
public function getVouchers()
{
return $this->vouchers;
}
public function getTaxesSum() public function getTaxesSum()
{ {
$sum = 0; $sum = 0;
@ -509,6 +545,15 @@ abstract class Base
return $sum; return $sum;
} }
/**
* @param Voucher[] $vouchers
*/
public function setVouchers($vouchers)
{
$this->vouchers = $vouchers;
}
/** /**
* @param Tax[] $taxes * @param Tax[] $taxes
*/ */
@ -525,16 +570,18 @@ abstract class Base
$this->allTaxes[] = $tax; $this->allTaxes[] = $tax;
$tmp = []; $tmp = [];
$exists = false;
foreach ($this->taxes as $taxEntry) { foreach ($this->taxes as $taxEntry) {
if ($taxEntry->getName() == $tax->getName()) { if ($taxEntry->getName() == $tax->getName()) {
$taxEntry->setValue($taxEntry->getValue() + $tax->getValue()); $taxEntry->setValue($taxEntry->getValue() + $tax->getValue());
$tmp[] = $taxEntry; $tmp[] = $taxEntry;
}else{ $exists = true;
$tmp[] = $taxEntry;
} }
} }
if(!$exists) {
$tmp[] = $tax;
}
$this->taxes = $tmp; $this->taxes = $tmp;
} }
@ -731,4 +778,45 @@ abstract class Base
{ {
$this->allTaxes = $allTaxes; $this->allTaxes = $allTaxes;
} }
public function getDiscounts(): array
{
return $this->discounts;
}
public function setDiscounts(array $discounts): void
{
$this->discounts = $discounts;
}
public function addDiscount(Discount $discount): void
{
$this->discounts[] = $discount;
}
public function setGrossWithDiscount(int $value): void
{
$this->grossWithDiscount = $value;
}
public function setNetWithDiscount(int $value): void
{
$this->netWithDiscount = $value;
}
public function setVatWithDiscount(int $value): void
{
$this->vatWithDiscount = $value;
}
public function getGrossWithDiscount(): int
{
return $this->grossWithDiscount;
}
public function getNetWithDiscount(): int
{
return $this->netWithDiscount;
}
public function getVatWithDiscount(): int
{
return $this->vatWithDiscount;
}
} }

View File

@ -0,0 +1,24 @@
<?php
namespace PSC\Shop\OrderBundle\Model\Order;
use PSC\Shop\OrderBundle\Model\Order\Discount\Price;
class Discount
{
private Price $price;
public function __construct()
{
$this->price = new Price();
}
public function setPrice(Price $price): void
{
$this->price = $price;
}
public function getPrice(): Price
{
return $this->price;
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace PSC\Shop\OrderBundle\Model\Order\Discount;
use PSC\Shop\OrderBundle\Model\Order\Tax;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA;
class Price
{
#[OA\Property(type: 'integer')]
private int $net = 0;
#[OA\Property(type: 'integer')]
private int $vat = 0;
#[OA\Property(type: 'integer')]
private int $gross = 0;
#[OA\Property(ref: new Model(type: Tax::class))]
public Tax $tax;
public function getNet(): int
{
return $this->net;
}
public function setNet(int $net): void
{
$this->net = $net;
}
public function getVat(): int
{
return $this->vat;
}
public function setVat(int $vat): void
{
$this->vat = $vat;
}
public function getGross(): int
{
return $this->gross;
}
public function setGross(int $gross): void
{
$this->gross = $gross;
}
public function getTax(): Tax
{
return $this->tax;
}
public function setTax(Tax $tax): void
{
$this->tax = $tax;
}
}

View File

@ -3,21 +3,26 @@
namespace PSC\Shop\OrderBundle\Service; namespace PSC\Shop\OrderBundle\Service;
use Brick\Money\Money; use Brick\Money\Money;
use PSC\Shop\OrderBundle\Model\Order\Tax; use PSC\Component\ApiBundle\Transformer\Shop;
use PSC\Shop\PaymentBundle\Service\Price; use PSC\Shop\PaymentBundle\Service\Price;
use PSC\Shop\PaymentBundle\Transformer\Payment; use PSC\Shop\PaymentBundle\Transformer\Payment;
use PSC\Shop\ShippingBundle\Transformer\Shipping; use PSC\Shop\ShippingBundle\Transformer\Shipping;
use PSC\Shop\VoucherBundle\Service\Calc as CalcVoucher;
use PSC\Shop\VoucherBundle\Transformer\Voucher as PSCVoucher;
use PSC\System\PluginBundle\Service\ProductType; use PSC\System\PluginBundle\Service\ProductType;
class Calc class Calc
{ {
public function __construct(private readonly Price $pricePayment, public function __construct(private readonly Price $pricePayment,
private readonly Shop $shopTransformer,
private readonly \PSC\Shop\ShippingBundle\Service\Price $priceShipping, private readonly \PSC\Shop\ShippingBundle\Service\Price $priceShipping,
private readonly ProductType $productTypeRegistry, private readonly ProductType $productTypeRegistry,
private readonly Shipping $shippingTransformer, private readonly Shipping $shippingTransformer,
private readonly Payment $paymentTransformer, private readonly Payment $paymentTransformer,
private readonly VatCalc $vatCalcService private readonly VatCalc $vatCalcService,
private readonly CalcVoucher $voucherCalcService,
private readonly PSCVoucher $voucherTransformer
) { ) {
} }
@ -25,6 +30,9 @@ class Calc
public function calcOrder(\PSC\Shop\OrderBundle\Model\Base $order) public function calcOrder(\PSC\Shop\OrderBundle\Model\Base $order)
{ {
if($order->getShop()->getUuid() != "") {
$this->shopTransformer->parseModel($order->getShop());
}
$priceNet = Money::ofMinor(0, 'EUR'); $priceNet = Money::ofMinor(0, 'EUR');
$priceVat = Money::ofMinor(0, 'EUR'); $priceVat = Money::ofMinor(0, 'EUR');
$priceGross = Money::ofMinor(0, 'EUR'); $priceGross = Money::ofMinor(0, 'EUR');
@ -64,7 +72,8 @@ class Calc
$order->setNet($priceNet->getMinorAmount()->toInt()); $order->setNet($priceNet->getMinorAmount()->toInt());
$order->setVat($priceVat->getMinorAmount()->toInt()); $order->setVat($priceVat->getMinorAmount()->toInt());
$order->setGross($priceGross->getMinorAmount()->toInt()); $order->setGross($priceGross->getMinorAmount()->toInt());
$this->voucherTransformer->parseModel($order);
$this->voucherCalcService->calc($order);
$this->vatCalcService->calcVat($order); $this->vatCalcService->calcVat($order);
} }
} }

View File

@ -5,11 +5,14 @@ namespace PSC\Shop\OrderBundle\Transformer;
use PSC\Shop\ContactBundle\Transformer\Order\Address; use PSC\Shop\ContactBundle\Transformer\Order\Address;
use PSC\Shop\ContactBundle\Transformer\Order\Contact; use PSC\Shop\ContactBundle\Transformer\Order\Contact;
use PSC\Shop\EntityBundle\Document\Embed\ContactAddress; use PSC\Shop\EntityBundle\Document\Embed\ContactAddress;
use PSC\Shop\OrderBundle\Model\Order\Discount;
use PSC\Shop\OrderBundle\Model\Order\Tax; use PSC\Shop\OrderBundle\Model\Order\Tax;
use PSC\Shop\OrderBundle\Model\Order\TaxEnum; use PSC\Shop\OrderBundle\Model\Order\TaxEnum;
use PSC\Shop\OrderBundle\Transformer\Order\Account; use PSC\Shop\OrderBundle\Transformer\Order\Account;
use PSC\Shop\PaymentBundle\Transformer\Payment; use PSC\Shop\PaymentBundle\Transformer\Payment;
use PSC\Shop\ShippingBundle\Transformer\Shipping; use PSC\Shop\ShippingBundle\Transformer\Shipping;
use PSC\Shop\VoucherBundle\Model\Voucher;
use Symfony\Component\Serializer\SerializerInterface;
/** /**
* Order * Order
@ -26,11 +29,12 @@ class Order extends Base
private Payment $paymentTransformer; private Payment $paymentTransformer;
private SerializerInterface $serializer;
private Shipping $shippingTransformer; private Shipping $shippingTransformer;
private \PSC\Component\ApiBundle\Transformer\Shop $shopTransformer; private \PSC\Component\ApiBundle\Transformer\Shop $shopTransformer;
#[\Symfony\Contracts\Service\Attribute\Required] #[\Symfony\Contracts\Service\Attribute\Required]
public function setAddressTransformer(Address $addressTransformer, Contact $contactTransformer, Account $accountTransformer, Payment $paymentTransformer, Shipping $shippingTransformer, \PSC\Component\ApiBundle\Transformer\Shop $shopTransformer) public function setAddressTransformer(SerializerInterface $serializer, Address $addressTransformer, Contact $contactTransformer, Account $accountTransformer, Payment $paymentTransformer, Shipping $shippingTransformer, \PSC\Component\ApiBundle\Transformer\Shop $shopTransformer)
{ {
$this->addressTransformer = $addressTransformer; $this->addressTransformer = $addressTransformer;
$this->contactTransformer = $contactTransformer; $this->contactTransformer = $contactTransformer;
@ -38,6 +42,7 @@ class Order extends Base
$this->paymentTransformer = $paymentTransformer; $this->paymentTransformer = $paymentTransformer;
$this->shippingTransformer = $shippingTransformer; $this->shippingTransformer = $shippingTransformer;
$this->shopTransformer = $shopTransformer; $this->shopTransformer = $shopTransformer;
$this->serializer = $serializer;
} }
public function fromDb(\PSC\Shop\OrderBundle\Model\Base $order, \PSC\Shop\EntityBundle\Entity\Order $orderEntity, \PSC\Shop\EntityBundle\Document\Order $orderDoc) public function fromDb(\PSC\Shop\OrderBundle\Model\Base $order, \PSC\Shop\EntityBundle\Entity\Order $orderEntity, \PSC\Shop\EntityBundle\Document\Order $orderDoc)
@ -53,9 +58,9 @@ class Order extends Base
$order->setStatus($orderEntity->getStatus()); $order->setStatus($orderEntity->getStatus());
$order->setBasketField1((string)$orderEntity->getBasketfield1()); $order->setBasketField1((string)$orderEntity->getBasketfield1());
$order->setBasketField2((string)$orderEntity->getBasketfield2()); $order->setBasketField2((string)$orderEntity->getBasketfield2());
$order->setNet($orderEntity->getNetto()*100); $order->setNet($orderEntity->getNetto() * 100);
$order->setVat($orderEntity->getSteuer()*100); $order->setVat($orderEntity->getSteuer() * 100);
$order->setGross($orderEntity->getBrutto()*100); $order->setGross($orderEntity->getBrutto() * 100);
$order->setExternalOrderNumber((string)$orderEntity->getPackage()); $order->setExternalOrderNumber((string)$orderEntity->getPackage());
$order->setPaymentRef((string)$orderDoc->getPaymentRef()); $order->setPaymentRef((string)$orderDoc->getPaymentRef());
$order->setPaymentGateway((string)$orderDoc->getPaymentGateway()); $order->setPaymentGateway((string)$orderDoc->getPaymentGateway());
@ -105,6 +110,24 @@ class Order extends Base
} }
$order->setPluginSettings($orderDoc->getPluginSettings()); $order->setPluginSettings($orderDoc->getPluginSettings());
$order->setSendDataToShipping($orderDoc->isSendDataToShipping()); $order->setSendDataToShipping($orderDoc->isSendDataToShipping());
if($orderDoc->getVouchers() != "") {
$order->setVouchers($this->serializer->deserialize($orderDoc->getVouchers(), Voucher::class.'[]', 'json'));
}
if($orderDoc->getDiscounts() != "") {
$net = 0;
$gross = 0;
$vat = 0;
$order->setDiscounts($this->serializer->deserialize($orderDoc->getDiscounts(), Discount::class.'[]', 'json'));
foreach($order->getDiscounts() as $discounts) {
$net += $discounts->getPrice()->getNet();
$vat += $discounts->getPrice()->getVat();
$gross += $discounts->getPrice()->getGross();
}
$order->setNetWithDiscount($order->getNet() - $net);
$order->setVatWithDiscount($order->getVat() - $vat);
$order->setGrossWithDiscount($order->getGross() - $gross);
}
} }
public function toDb(\PSC\Shop\OrderBundle\Model\Base $order, \PSC\Shop\EntityBundle\Entity\Order $orderEntity, \PSC\Shop\EntityBundle\Document\Order $orderDoc) public function toDb(\PSC\Shop\OrderBundle\Model\Base $order, \PSC\Shop\EntityBundle\Entity\Order $orderEntity, \PSC\Shop\EntityBundle\Document\Order $orderDoc)
@ -113,11 +136,11 @@ class Order extends Base
$orderEntity->setCreated(new \DateTime()); $orderEntity->setCreated(new \DateTime());
$orderEntity->setUpdated(new \DateTime()); $orderEntity->setUpdated(new \DateTime());
$orderEntity->setAlias((string)$order->getAlias()); $orderEntity->setAlias((string)$order->getAlias());
$orderEntity->setNetto($order->getNet()/100); $orderEntity->setNetto($order->getNet() / 100);
$orderEntity->setSteuer($order->getVat()/100); $orderEntity->setSteuer($order->getVat() / 100);
$orderEntity->setBrutto($order->getGross()/100); $orderEntity->setBrutto($order->getGross() / 100);
$orderEntity->setVersandKosten($order->getShippingCosts()/100); $orderEntity->setVersandKosten($order->getShippingCosts() / 100);
$orderEntity->setZahlKosten($order->getPaymentCosts()/100); $orderEntity->setZahlKosten($order->getPaymentCosts() / 100);
$orderEntity->setEnable($order->isEnable()); $orderEntity->setEnable($order->isEnable());
$orderEntity->setInfo($order->getInfo()); $orderEntity->setInfo($order->getInfo());
$orderEntity->setDeliverySame(0); $orderEntity->setDeliverySame(0);
@ -164,6 +187,7 @@ class Order extends Base
$orderDoc->setDraft($order->isDraft()); $orderDoc->setDraft($order->isDraft());
$orderDoc->setPluginSettings($order->getPluginSettings()); $orderDoc->setPluginSettings($order->getPluginSettings());
$orderDoc->setDiscounts($this->serializer->serialize($order->getDiscounts(), 'json'));
$orderDoc->setVouchers($this->serializer->serialize($order->getVouchers(), 'json'));
} }
} }

Some files were not shown because too many files have changed in this diff Show More