Backup
This commit is contained in:
parent
1199cc6901
commit
9aa0056bac
@ -8,8 +8,11 @@ use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use PSC\Shop\MediaBundle\Document\Media as PSCMedia;
|
||||
use PSC\Shop\MediaBundle\Model\Media;
|
||||
use PSC\Shop\MediaBundle\Transformer\Media as AliasedMedia;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class One extends AbstractController
|
||||
@ -17,13 +20,19 @@ class One extends AbstractController
|
||||
public function __construct(
|
||||
private readonly DocumentManager $dm,
|
||||
private readonly PaginatorInterface $paginator,
|
||||
private readonly AliasedMedia $mediaTransformer,
|
||||
) {}
|
||||
|
||||
#[Response(response: 200, description: 'get media', content: new JsonContent(ref: new Model(type: Media::class)))]
|
||||
#[Route(path: '/media/{uuid}', methods: ['GET'])]
|
||||
#[Route(path: '/{uuid}', methods: ['GET'])]
|
||||
#[Tag('Media')]
|
||||
public function one(string $uuid): string
|
||||
public function one(string $uuid): SymfonyResponse
|
||||
{
|
||||
return $this->json(new Media());
|
||||
$media = $this->dm->getRepository(PSCMedia::class)->find($uuid);
|
||||
|
||||
$model = new Media();
|
||||
$this->mediaTransformer->fromDb($model, $media);
|
||||
|
||||
return $this->json($model);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,26 +12,23 @@ use PSC\Shop\VoucherBundle\Service\Calc as CalcVoucher;
|
||||
use PSC\Shop\VoucherBundle\Transformer\Voucher as PSCVoucher;
|
||||
use PSC\System\PluginBundle\Service\ProductType;
|
||||
|
||||
class Calc
|
||||
readonly class Calc
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Price $pricePayment,
|
||||
private readonly Shop $shopTransformer,
|
||||
private readonly \PSC\Shop\ShippingBundle\Service\Price $priceShipping,
|
||||
private readonly ProductType $productTypeRegistry,
|
||||
private readonly Shipping $shippingTransformer,
|
||||
private readonly Payment $paymentTransformer,
|
||||
private readonly VatCalc $vatCalcService,
|
||||
private readonly CalcVoucher $voucherCalcService,
|
||||
private readonly PSCVoucher $voucherTransformer
|
||||
) {
|
||||
|
||||
}
|
||||
private Price $pricePayment,
|
||||
private Shop $shopTransformer,
|
||||
private \PSC\Shop\ShippingBundle\Service\Price $priceShipping,
|
||||
private ProductType $productTypeRegistry,
|
||||
private Shipping $shippingTransformer,
|
||||
private Payment $paymentTransformer,
|
||||
private VatCalc $vatCalcService,
|
||||
private CalcVoucher $voucherCalcService,
|
||||
private PSCVoucher $voucherTransformer,
|
||||
) {}
|
||||
|
||||
public function calcOrder(\PSC\Shop\OrderBundle\Model\Base $order)
|
||||
{
|
||||
|
||||
if ($order->getShop()->getUuid() != "") {
|
||||
if ($order->getShop()->getUuid() != '') {
|
||||
$this->shopTransformer->parseModel($order->getShop());
|
||||
}
|
||||
$priceNet = Money::ofMinor(0, 'EUR');
|
||||
@ -45,19 +42,33 @@ class Calc
|
||||
$priceVat = $priceVat->plus(Money::ofMinor($order->getPayment()->getCalcPrice()->vat, 'EUR'));
|
||||
$priceGross = $priceGross->plus(Money::ofMinor($order->getPayment()->getCalcPrice()->gross, 'EUR'));
|
||||
|
||||
$order->setPaymentCosts(Money::ofMinor($order->getPayment()->getCalcPrice()->net, 'EUR')->getMinorAmount()->toInt());
|
||||
$order->setPaymentCosts(
|
||||
Money::ofMinor($order->getPayment()->getCalcPrice()->net, 'EUR')->getMinorAmount()->toInt(),
|
||||
);
|
||||
$order->addTax($order->getPayment()->getCalcPrice()->tax);
|
||||
$this->shippingTransformer->parseModel($order->getShipping());
|
||||
$this->priceShipping->getPrice($order->getShipping(), $order->getNet(), $order->getWeight(), (string)$order->getDeliveryAddress()->getCountry(), (int)$order->getDeliveryAddress()->getZip());
|
||||
$this->priceShipping->getPrice(
|
||||
$order->getShipping(),
|
||||
$order->getNet(),
|
||||
$order->getWeight(),
|
||||
(string) $order->getDeliveryAddress()->getCountry(),
|
||||
(int) $order->getDeliveryAddress()->getZip(),
|
||||
);
|
||||
$priceNet = $priceNet->plus(Money::ofMinor($order->getShipping()->getCalcPrice()->net, 'EUR'));
|
||||
$priceVat = $priceVat->plus(Money::ofMinor($order->getShipping()->getCalcPrice()->vat, 'EUR'));
|
||||
$priceGross = $priceGross->plus(Money::ofMinor($order->getShipping()->getCalcPrice()->gross, 'EUR'));
|
||||
$order->setShippingCosts(Money::ofMinor($order->getShipping()->getCalcPrice()->net, 'EUR')->getMinorAmount()->toInt());
|
||||
$order->setShippingCosts(
|
||||
Money::ofMinor($order->getShipping()->getCalcPrice()->net, 'EUR')->getMinorAmount()->toInt(),
|
||||
);
|
||||
$order->addTax($order->getShipping()->getCalcPrice()->tax);
|
||||
foreach ($order->getPositions() as $position) {
|
||||
$position->getProduct()->setShopUuid($order->getShop()->getUuid());
|
||||
if ($this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())) {
|
||||
$specialProductTransformer = $this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())->getProducer();
|
||||
if (
|
||||
$this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())
|
||||
) {
|
||||
$specialProductTransformer = $this->productTypeRegistry
|
||||
->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())
|
||||
->getProducer();
|
||||
if ($specialProductTransformer) {
|
||||
if ($specialProductTransformer instanceof ICalcNeedContact) {
|
||||
$specialProductTransformer->setContact($order->getContact());
|
||||
|
||||
@ -27,15 +27,21 @@ class Position extends Base
|
||||
private ProductType $productTypeRegistry;
|
||||
|
||||
#[\Symfony\Contracts\Service\Attribute\Required]
|
||||
public function setProductService(\PSC\Shop\ProductBundle\Service\Product $productService, ProductType $productTypeRegistry, \PSC\Shop\ProductBundle\Hydrate\Product $productHydrate)
|
||||
{
|
||||
public function setProductService(
|
||||
\PSC\Shop\ProductBundle\Service\Product $productService,
|
||||
ProductType $productTypeRegistry,
|
||||
\PSC\Shop\ProductBundle\Hydrate\Product $productHydrate,
|
||||
) {
|
||||
$this->productService = $productService;
|
||||
$this->productTypeRegistry = $productTypeRegistry;
|
||||
$this->productHydrate = $productHydrate;
|
||||
}
|
||||
|
||||
public function toDb(\PSC\Shop\OrderBundle\Model\Order\Position $position, Orderpos $positionEntity, \PSC\Shop\EntityBundle\Document\Position $positionDoc): void
|
||||
{
|
||||
public function toDb(
|
||||
\PSC\Shop\OrderBundle\Model\Order\Position $position,
|
||||
Orderpos $positionEntity,
|
||||
\PSC\Shop\EntityBundle\Document\Position $positionDoc,
|
||||
): void {
|
||||
$positionEntity->setPos($position->getPos());
|
||||
$positionEntity->setUuid($position->getUuid());
|
||||
$positionEntity->setTyp($position->getProduct()->getSpecialProductTypeObject()->getTyp());
|
||||
@ -58,7 +64,8 @@ class Position extends Base
|
||||
* @var Product $product
|
||||
*/
|
||||
$product = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $position->getProduct()->getUuid()));
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(['uuid' => $position->getProduct()->getUuid()]);
|
||||
|
||||
if ($position->isCopyProduct()) {
|
||||
$product = $this->productService->copy($product, false, true);
|
||||
@ -81,13 +88,19 @@ class Position extends Base
|
||||
$positionDoc->setAdditionalInfos($temp);
|
||||
$positionDoc->setCustomerInfo($position->getCustomerInfo());
|
||||
$positionDoc->setExternalOrderNumber($position->getExternalOrderNumber());
|
||||
$positionDoc->setSpecialProductTypeObject($position->getProduct()->getSpecialProductTypeObject()->getPositionData());
|
||||
$positionDoc->setSpecialProductTypeObject(
|
||||
$position->getProduct()->getSpecialProductTypeObject()->getPositionData(),
|
||||
);
|
||||
|
||||
/**
|
||||
* Plugin Special Savings
|
||||
*/
|
||||
if ($this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())) {
|
||||
$specialProductTransformer = $this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())->getPositionProductTransformer();
|
||||
if (
|
||||
$this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())
|
||||
) {
|
||||
$specialProductTransformer = $this->productTypeRegistry
|
||||
->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())
|
||||
->getPositionProductTransformer();
|
||||
$specialProductTransformer->toDb($position, $positionEntity, $positionDoc);
|
||||
} else {
|
||||
$position->getProduct()->setSpecialProductTypeObject(new DummyProductTypeObject());
|
||||
@ -95,23 +108,22 @@ class Position extends Base
|
||||
$positionEntity->setWeight($position->getWeight());
|
||||
}
|
||||
|
||||
public function fromDb(\PSC\Shop\OrderBundle\Model\Order\Position $position, Orderpos $pos, \PSC\Shop\EntityBundle\Document\Position $positionDoc): void
|
||||
{
|
||||
public function fromDb(
|
||||
\PSC\Shop\OrderBundle\Model\Order\Position $position,
|
||||
Orderpos $pos,
|
||||
\PSC\Shop\EntityBundle\Document\Position $positionDoc,
|
||||
): void {
|
||||
$position->setProduct(new \PSC\Shop\ProductBundle\Model\Product());
|
||||
|
||||
if ($pos->getProduct()) {
|
||||
|
||||
$position->setProduct($this->productHydrate->hydrateToModel($pos->getProduct()));
|
||||
$tax = new Tax();
|
||||
$tax->setName((int)$pos->getProduct()->getMwert() * 100);
|
||||
$tax->setBasisAmount((int)$pos->getPriceAllNetto() * 100);
|
||||
$tax->setCalculatedAmount((int)$pos->getPriceAllSteuer() * 100);
|
||||
$tax->setName(((int) $pos->getProduct()->getMwert()) * 100);
|
||||
$tax->setBasisAmount(((int) $pos->getPriceAllNetto()) * 100);
|
||||
$tax->setCalculatedAmount(((int) $pos->getPriceAllSteuer()) * 100);
|
||||
$position->getPrice()->setTax($tax);
|
||||
|
||||
} else {
|
||||
$tax = new Tax();
|
||||
$position->getPrice()->setTax($tax);
|
||||
|
||||
}
|
||||
|
||||
$position->setPos($pos->getPos());
|
||||
@ -174,14 +186,18 @@ class Position extends Base
|
||||
|
||||
if ($pos->getProduct()) {
|
||||
if ($this->productTypeRegistry->getProductType($pos->getProduct()->getType())) {
|
||||
$specialProductTransformer = $this->productTypeRegistry->getProductType($pos->getProduct()->getType())->getPositionProductTransformer();
|
||||
$specialProductTransformer = $this->productTypeRegistry
|
||||
->getProductType($pos->getProduct()->getType())
|
||||
->getPositionProductTransformer();
|
||||
$specialProductTransformer->fromDb($position, $pos, $positionDoc);
|
||||
} else {
|
||||
$position->getProduct()->setSpecialProductTypeObject(new DummyProductTypeObject());
|
||||
}
|
||||
} else {
|
||||
if ($this->productTypeRegistry->getProductType($pos->getTyp())) {
|
||||
$specialProductTransformer = $this->productTypeRegistry->getProductType($pos->getTyp())->getPositionProductTransformer();
|
||||
$specialProductTransformer = $this->productTypeRegistry
|
||||
->getProductType($pos->getTyp())
|
||||
->getPositionProductTransformer();
|
||||
$specialProductTransformer->fromDb($position, $pos, $positionDoc);
|
||||
} else {
|
||||
$position->getProduct()->setSpecialProductTypeObject(new DummyProductTypeObject());
|
||||
|
||||
@ -14,21 +14,30 @@ use PSC\Shop\ProductBundle\Model\OriginalProduct;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
class Product
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly DocumentManager $documentManager, private readonly \PSC\Shop\MediaBundle\Transformer\Media $mediaTransformer)
|
||||
readonly class Product
|
||||
{
|
||||
public function __construct(
|
||||
private EntityManagerInterface $entityManager,
|
||||
private DocumentManager $documentManager,
|
||||
private \PSC\Shop\MediaBundle\Transformer\Media $mediaTransformer,
|
||||
) {}
|
||||
|
||||
public function toDb(
|
||||
\PSC\Shop\ProductBundle\Model\Product $product,
|
||||
\PSC\Shop\EntityBundle\Entity\Product $productEntity,
|
||||
\PSC\Shop\EntityBundle\Document\Product $productDoc,
|
||||
): void {
|
||||
}
|
||||
|
||||
public function toDb(\PSC\Shop\ProductBundle\Model\Product $product, \PSC\Shop\EntityBundle\Entity\Product $productEntity, \PSC\Shop\EntityBundle\Document\Product $productDoc): void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function fromDb(\PSC\Shop\ProductBundle\Model\Product $product, \PSC\Shop\EntityBundle\Entity\Product $productEntity, ?\PSC\Shop\EntityBundle\Document\Product $productDoc = null): void
|
||||
{
|
||||
public function fromDb(
|
||||
\PSC\Shop\ProductBundle\Model\Product $product,
|
||||
\PSC\Shop\EntityBundle\Entity\Product $productEntity,
|
||||
null|\PSC\Shop\EntityBundle\Document\Product $productDoc = null,
|
||||
): void {
|
||||
if ($productDoc === null) {
|
||||
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $productEntity->getUid()]);
|
||||
$productDoc = $this->documentManager
|
||||
->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)
|
||||
->findOneBy(['uid' => $productEntity->getUid()]);
|
||||
}
|
||||
|
||||
$product->setUid($productEntity->getUID());
|
||||
@ -54,8 +63,10 @@ class Product
|
||||
$product->setCustom9((string) $productDoc->getCustom9());
|
||||
$product->setCustom10((string) $productDoc->getCustom10());
|
||||
|
||||
if($productDoc->getUploadProvidedFile() != "") {
|
||||
$mediaDoc = $this->documentManager->getRepository(Media::class)->find(new ObjectId($productDoc->getUploadProvidedFile()));
|
||||
if ($productDoc->getUploadProvidedFile() != '') {
|
||||
$mediaDoc = $this->documentManager
|
||||
->getRepository(Media::class)
|
||||
->find(new ObjectId($productDoc->getUploadProvidedFile()));
|
||||
if ($mediaDoc) {
|
||||
$media = new \PSC\Shop\MediaBundle\Model\Media();
|
||||
$this->mediaTransformer->fromDb($media, $mediaDoc);
|
||||
@ -63,33 +74,38 @@ class Product
|
||||
}
|
||||
}
|
||||
|
||||
if ($productEntity->getImage1() != "") {
|
||||
if ($productEntity->getImage1() != '') {
|
||||
$file1 = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Image')->findOneBy(['uid' => $productEntity->getImage1()]);
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Image')
|
||||
->findOneBy(['uid' => $productEntity->getImage1()]);
|
||||
if ($file1) {
|
||||
$media = new \PSC\Shop\MediaBundle\Model\Media();
|
||||
$media->setUrl($file1->getPath());
|
||||
$product->setImage1($media);
|
||||
} else {
|
||||
$mediaDoc = $this->documentManager->getRepository(Media::class)->find(new ObjectId($productEntity->getImage1()));
|
||||
$mediaDoc = $this->documentManager
|
||||
->getRepository(Media::class)
|
||||
->find(new ObjectId($productEntity->getImage1()));
|
||||
if ($mediaDoc) {
|
||||
$media = new \PSC\Shop\MediaBundle\Model\Media();
|
||||
$this->mediaTransformer->fromDb($media, $mediaDoc);
|
||||
$product->setImage1($media);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($productEntity->getImage2() != "") {
|
||||
if ($productEntity->getImage2() != '') {
|
||||
$file2 = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Image')->findOneBy(['uid' => $productEntity->getImage2()]);
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Image')
|
||||
->findOneBy(['uid' => $productEntity->getImage2()]);
|
||||
if ($file2) {
|
||||
$media = new \PSC\Shop\MediaBundle\Model\Media();
|
||||
$media->setUrl($file2->getPath());
|
||||
$product->setImage2($media);
|
||||
} else {
|
||||
$mediaDoc = $this->documentManager->getRepository(Media::class)->find(new ObjectId($productEntity->getImage2()));
|
||||
$mediaDoc = $this->documentManager
|
||||
->getRepository(Media::class)
|
||||
->find(new ObjectId($productEntity->getImage2()));
|
||||
if ($mediaDoc) {
|
||||
$media = new \PSC\Shop\MediaBundle\Model\Media();
|
||||
$this->mediaTransformer->fromDb($media, $mediaDoc);
|
||||
@ -100,7 +116,9 @@ class Product
|
||||
|
||||
if ($productEntity->getOriginalProduct() != 0) {
|
||||
/** @var PSCProduct $subProduct */
|
||||
$subProduct = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Product::class)->find($productEntity->getOriginalProduct());
|
||||
$subProduct = $this->entityManager
|
||||
->getRepository(\PSC\Shop\EntityBundle\Entity\Product::class)
|
||||
->find($productEntity->getOriginalProduct());
|
||||
|
||||
if ($subProduct) {
|
||||
$subProductObj = new OriginalProduct();
|
||||
@ -111,6 +129,5 @@ class Product
|
||||
$product->setOriginalProduct($subProductObj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,18 +3,20 @@
|
||||
namespace PSC\Shop\ShippingBundle\Api;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use Nelmio\ApiDocBundle\Attribute\Security;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use PSC\Shop\EntityBundle\Entity\Shipping;
|
||||
use PSC\Shop\ShippingBundle\Dto\All\Output;
|
||||
use PSC\Shop\ShippingBundle\Model\Shipping as PSCShipping;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class All extends AbstractController
|
||||
{
|
||||
@ -24,28 +26,29 @@ class All extends AbstractController
|
||||
|
||||
private TokenStorageInterface $tokenStorage;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager, Shop $shopService, TokenStorageInterface $tokenStorage)
|
||||
{
|
||||
public function __construct(
|
||||
EntityManagerInterface $entityManager,
|
||||
Shop $shopService,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->shopService = $shopService;
|
||||
$this->tokenStorage = $tokenStorage;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all shipments
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="shipments",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\ShippingBundle\Dto\All\Output::class))
|
||||
* )
|
||||
* @OA\Tag(name="Shipping")
|
||||
*/
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'get shippments',
|
||||
content: new JsonContent(ref: new Model(type: Output::class)),
|
||||
)]
|
||||
#[Tag(name: 'Shipping')]
|
||||
#[Route(path: '/', methods: ['GET'])]
|
||||
public function all(): JsonResponse
|
||||
{
|
||||
$output = [];
|
||||
$result = $this->entityManager->getRepository(Shipping::class)->findBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0]);
|
||||
$result = $this->entityManager
|
||||
->getRepository(Shipping::class)
|
||||
->findBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0]);
|
||||
foreach ($result as $shipping) {
|
||||
$shipObj = new PSCShipping();
|
||||
$shipObj->setUid($shipping->getUid());
|
||||
@ -56,17 +59,13 @@ class All extends AbstractController
|
||||
return $this->json(new Output($output));
|
||||
}
|
||||
|
||||
/**
|
||||
* get all shipments for shop Uuid
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="shipments",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\ShippingBundle\Dto\All\Output::class))
|
||||
* )
|
||||
* @OA\Tag(name="Shipping")
|
||||
* @Security(name="Bearer")
|
||||
*/
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'get shippments by shop uuid',
|
||||
content: new JsonContent(ref: new Model(type: Output::class)),
|
||||
)]
|
||||
#[Tag(name: 'Shipping')]
|
||||
#[Security(name: 'Bearer')]
|
||||
#[Route(path: '/by/shop/{shopUuid}', methods: ['GET'])]
|
||||
#[IsGranted('ROLE_SHOP')]
|
||||
public function byShops(string $shopUuid): JsonResponse
|
||||
@ -85,23 +84,20 @@ class All extends AbstractController
|
||||
return $this->json(new Output($output));
|
||||
}
|
||||
|
||||
/**
|
||||
* get all shipments
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="shipments",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\ShippingBundle\Dto\All\Output::class))
|
||||
* )
|
||||
* @OA\Tag(name="Shipping")
|
||||
* @Security(name="Bearer")
|
||||
*/
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'get my shipments',
|
||||
content: new JsonContent(ref: new Model(type: Output::class)),
|
||||
)]
|
||||
#[Tag(name: 'Shipping')]
|
||||
#[Security(name: 'Bearer')]
|
||||
#[Route(path: '/my', methods: ['GET'])]
|
||||
#[IsGranted('ROLE_USER')]
|
||||
public function my(): JsonResponse
|
||||
{
|
||||
$output = [];
|
||||
$result = $this->entityManager->getRepository(Shipping::class)->findBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0]);
|
||||
$result = $this->entityManager
|
||||
->getRepository(Shipping::class)
|
||||
->findBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0]);
|
||||
foreach ($result as $shipping) {
|
||||
$shipObj = new PSCShipping();
|
||||
$shipObj->setUid($shipping->getUid());
|
||||
|
||||
@ -3,15 +3,17 @@
|
||||
namespace PSC\Shop\ShippingBundle\Api;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use PSC\Component\ApiBundle\Dto\Error\NotFound;
|
||||
use PSC\Shop\EntityBundle\Entity\Shipping as PSCShipping;
|
||||
use PSC\Shop\ShippingBundle\Model\Shipping;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class One extends AbstractController
|
||||
{
|
||||
@ -25,20 +27,18 @@ class One extends AbstractController
|
||||
$this->shopService = $shopService;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all shipment
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="shippings",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\ShippingBundle\Model\Shipping::class))
|
||||
* )
|
||||
* @OA\Tag(name="Shipping")
|
||||
*/
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'get one shipping',
|
||||
content: new JsonContent(ref: new Model(type: Shipping::class)),
|
||||
)]
|
||||
#[Tag(name: 'Shipping')]
|
||||
#[Route(path: '/{id}', methods: ['GET'])]
|
||||
public function one(string $id): JsonResponse
|
||||
{
|
||||
$result = $this->entityManager->getRepository(PSCShipping::class)->findOneBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0, 'uid' => $id]);
|
||||
$result = $this->entityManager
|
||||
->getRepository(PSCShipping::class)
|
||||
->findOneBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0, 'uid' => $id]);
|
||||
|
||||
if ($result) {
|
||||
$output = new Shipping();
|
||||
|
||||
@ -4,34 +4,33 @@ namespace PSC\System\SettingsBundle\Api\Paper;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use Nelmio\ApiDocBundle\Attribute\Security;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use PSC\Shop\EntityBundle\Entity\Paper;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use PSC\System\SettingsBundle\Dto\Paper\All\Output;
|
||||
use PSC\System\SettingsBundle\Model\Paper as PSCPaper;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use OpenApi\Annotations as OA;
|
||||
use PSC\System\SettingsBundle\Dto\Paper\All\Output;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use PSC\System\SettingsBundle\Model\Paper as PSCPaper;
|
||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class All extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly DocumentManager $documentManager)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* get all paper
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="get all paper",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\System\SettingsBundle\Dto\Paper\All\Output::class))
|
||||
* )
|
||||
* @OA\Tag(name="PaperDB")
|
||||
* @Security(name="ApiKeyAuth")
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly DocumentManager $documentManager,
|
||||
) {}
|
||||
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'get all paper',
|
||||
content: new JsonContent(ref: new Model(type: Output::class)),
|
||||
)]
|
||||
#[Tag(name: 'PaperDB')]
|
||||
#[Security(name: 'ApiKeyAuth')]
|
||||
#[Route(path: '/paperdb', methods: ['GET'])]
|
||||
#[IsGranted('ROLE_API')]
|
||||
public function all(): JsonResponse
|
||||
@ -42,7 +41,7 @@ class All extends AbstractController
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Paper $paperDoc */
|
||||
$paperDoc = $this->documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Paper')
|
||||
->findOneBy(array('uid' => (string)$paper->getId()));
|
||||
->findOneBy(['uid' => (string) $paper->getId()]);
|
||||
$paperObj = new PSCPaper();
|
||||
if ($paperDoc) {
|
||||
if ($paperDoc->isPapierTyp1()) {
|
||||
|
||||
@ -4,34 +4,33 @@ namespace PSC\System\SettingsBundle\Api\Paper;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use Nelmio\ApiDocBundle\Attribute\Security;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use PSC\Component\ApiBundle\Dto\Error\NotFound;
|
||||
use PSC\Shop\EntityBundle\Entity\Paper;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use PSC\System\SettingsBundle\Model\Paper as PSCPaper;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class One extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly DocumentManager $documentManager)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* get one paper
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="get one paper",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\System\SettingsBundle\Model\Paper::class))
|
||||
* )
|
||||
* @Security(name="ApiKeyAuth")
|
||||
* @OA\Tag(name="PaperDB")
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly DocumentManager $documentManager,
|
||||
) {}
|
||||
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'get one paper',
|
||||
content: new JsonContent(ref: new Model(type: Paper::class)),
|
||||
)]
|
||||
#[Tag(name: 'PaperDB')]
|
||||
#[Security(name: 'ApiKeyAuth')]
|
||||
#[Route(path: '/paperdb/{artNr}', methods: ['GET'])]
|
||||
#[IsGranted('ROLE_API')]
|
||||
public function one(string $artNr): JsonResponse
|
||||
@ -41,7 +40,7 @@ class One extends AbstractController
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Paper $paperDoc */
|
||||
$paperDoc = $this->documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Paper')
|
||||
->findOneBy(array('uid' => (string)$paper->getId()));
|
||||
->findOneBy(['uid' => (string) $paper->getId()]);
|
||||
$paperObj = new PSCPaper();
|
||||
if ($paperDoc) {
|
||||
if ($paperDoc->isPapierTyp1()) {
|
||||
@ -116,7 +115,7 @@ class One extends AbstractController
|
||||
$paperObj->setGrammatur((int) $paper->getGrammatur());
|
||||
$paperObj->setPrice($paper->getPreis());
|
||||
} else {
|
||||
$paperObj = new NotFound("paper not found");
|
||||
$paperObj = new NotFound('paper not found');
|
||||
}
|
||||
return $this->json($paperObj);
|
||||
}
|
||||
|
||||
@ -2,19 +2,22 @@
|
||||
|
||||
namespace PSC\System\SettingsBundle\Api\Paper;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use Nelmio\ApiDocBundle\Attribute\Security;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\RequestBody;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use PSC\Component\ApiBundle\Dto\Error\NotFound;
|
||||
use PSC\Shop\EntityBundle\Entity\Paper as PSCPaper;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use PSC\System\SettingsBundle\Model\Paper;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class Update extends AbstractController
|
||||
{
|
||||
@ -25,25 +28,17 @@ class Update extends AbstractController
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* change paper
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="update paper",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\System\SettingsBundle\Model\Paper::class))
|
||||
* )
|
||||
* @OA\RequestBody(
|
||||
* description="This is a request body",
|
||||
* @Model(type=\PSC\System\SettingsBundle\Model\Paper::class)
|
||||
* )
|
||||
* @OA\Tag(name="PaperDB")
|
||||
* @Security(name="ApiKeyAuth")
|
||||
*/
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'update paper',
|
||||
content: new JsonContent(ref: new Model(type: Paper::class)),
|
||||
)]
|
||||
#[RequestBody(ref: new Model(type: Paper::class))]
|
||||
#[Tag(name: 'PaperDB')]
|
||||
#[Security(name: 'ApiKeyAuth')]
|
||||
#[Route(path: '/paperdb/update/{artNr}', methods: ['PUT'])]
|
||||
#[ParamConverter('paperObj', class: '\PSC\System\SettingsBundle\Model\Paper', converter: 'psc_rest.request_body')]
|
||||
#[IsGranted('ROLE_API')]
|
||||
public function update(string $artNr, Paper $paperObj): JsonResponse
|
||||
public function update(string $artNr, #[MapRequestPayload] Paper $paperObj): JsonResponse
|
||||
{
|
||||
$paper = $this->entityManager->getRepository(PSCPaper::class)->findOneBy(['artNr' => $artNr]);
|
||||
|
||||
|
||||
@ -2,38 +2,34 @@
|
||||
|
||||
namespace PSC\System\SettingsBundle\Api\Papercontainer;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use PSC\Component\ApiBundle\Dto\Error\NotFound;
|
||||
use PSC\Shop\EntityBundle\Entity\Paper;
|
||||
use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use Nelmio\ApiDocBundle\Attribute\Security;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use PSC\System\SettingsBundle\Model\Papercontainer;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use PSC\System\SettingsBundle\Model\Paper as PSCPaper;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class Get extends AbstractController
|
||||
{
|
||||
private Shop $shopService;
|
||||
|
||||
public function __construct(Shop $shopService)
|
||||
{
|
||||
$this->shopService = $shopService;
|
||||
}
|
||||
/**
|
||||
* get papercontainer
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="get papercontainer",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\System\SettingsBundle\Model\Papercontainer::class))
|
||||
* )
|
||||
* @Security(name="Bearer")
|
||||
* @OA\Tag(name="PaperDB")
|
||||
*/
|
||||
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'get papercontainer',
|
||||
content: new JsonContent(ref: new Model(type: Papercontainer::class)),
|
||||
)]
|
||||
#[Tag(name: 'PaperDB')]
|
||||
#[Security(name: 'Bearer')]
|
||||
#[Route(path: '/papercontainer', methods: ['GET'])]
|
||||
#[IsGranted('ROLE_USER')]
|
||||
public function getPapercontainer(): JsonResponse
|
||||
|
||||
@ -2,20 +2,20 @@
|
||||
|
||||
namespace PSC\System\SettingsBundle\Api\Papercontainer;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use PSC\Component\ApiBundle\Dto\Error\NotFound;
|
||||
use PSC\Shop\EntityBundle\Entity\Paper;
|
||||
use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use Nelmio\ApiDocBundle\Attribute\Security;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\RequestBody;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use PSC\System\SettingsBundle\Model\Papercontainer;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use PSC\System\SettingsBundle\Model\Paper as PSCPaper;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class Update extends AbstractController
|
||||
{
|
||||
@ -28,24 +28,22 @@ class Update extends AbstractController
|
||||
$this->shopService = $shopService;
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
/**
|
||||
* update papercontainer
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="update papercontainer",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\System\SettingsBundle\Model\Papercontainer::class))
|
||||
* )
|
||||
* @OA\RequestBody(
|
||||
* description="This is a request body",
|
||||
* @Model(type=\PSC\System\SettingsBundle\Model\Papercontainer::class))
|
||||
* )
|
||||
* @IsGranted("ROLE_USER")
|
||||
* @Security(name="Bearer")
|
||||
* @OA\Tag(name="PaperDB")
|
||||
*/
|
||||
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'update papercontainer',
|
||||
content: new JsonContent(ref: new Model(type: Papercontainer::class)),
|
||||
)]
|
||||
#[Tag(name: 'PaperDB')]
|
||||
#[Security(name: 'Bearer')]
|
||||
#[Route(path: '/papercontainer', methods: ['PUT'])]
|
||||
#[ParamConverter('papercontainer', class: '\PSC\System\SettingsBundle\Model\Papercontainer', converter: 'psc_rest.request_body')]
|
||||
#[RequestBody(ref: new Model(type: Papercontainer::class))]
|
||||
#[ParamConverter(
|
||||
'papercontainer',
|
||||
class: '\PSC\System\SettingsBundle\Model\Papercontainer',
|
||||
converter: 'psc_rest.request_body',
|
||||
)]
|
||||
#[IsGranted('ROLE_USER')]
|
||||
public function updatePapercontainer(Papercontainer $papercontainer): JsonResponse
|
||||
{
|
||||
$install = $this->shopService->getShopByDomain()->getInstall();
|
||||
|
||||
@ -3,16 +3,18 @@
|
||||
namespace PSC\System\SettingsBundle\Api\Status;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use Nelmio\ApiDocBundle\Attribute\Security;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use PSC\System\SettingsBundle\Document\Status as StatusDoc;
|
||||
use PSC\System\SettingsBundle\Dto\Status\All\Output;
|
||||
use PSC\System\SettingsBundle\Model\Status;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use OpenApi\Annotations as OA;
|
||||
use PSC\System\SettingsBundle\Dto\Status\All\Output;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||
use PSC\System\SettingsBundle\Model\Status;
|
||||
use PSC\System\SettingsBundle\Document\Status as StatusDoc;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class All extends AbstractController
|
||||
{
|
||||
@ -22,18 +24,14 @@ class All extends AbstractController
|
||||
{
|
||||
$this->documentManager = $documentManager;
|
||||
}
|
||||
/**
|
||||
* get all statuse
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="get all paper",
|
||||
* @OA\JsonContent(ref=@Model(type=\PSC\System\SettingsBundle\Dto\Status\All\Output::class))
|
||||
* )
|
||||
* @OA\Tag(name="Status")
|
||||
* @Security(name="ApiKeyAuth")
|
||||
* @Security(name="Bearer")
|
||||
*/
|
||||
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'get all paper',
|
||||
content: new JsonContent(ref: new Model(type: Output::class)),
|
||||
)]
|
||||
#[Tag(name: 'Status')]
|
||||
#[Security(name: 'ApiKeyAuth')]
|
||||
#[Route(path: '/status', methods: ['GET'])]
|
||||
#[IsGranted('ROLE_SHOP')]
|
||||
public function all(): JsonResponse
|
||||
|
||||
@ -52,5 +52,8 @@ class UploadTest extends WebTestCase
|
||||
$client->request('GET', '/api/media/' . $media['uuid'], [], []);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
$media = json_decode($client->getResponse()->getContent(), true);
|
||||
self::assertSame('kenney.jpg', $media['title']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,11 +2,10 @@
|
||||
|
||||
namespace App\Tests\PSC\Shop\Order\Service;
|
||||
|
||||
use PSC\Shop\ContactBundle\Model\AccountType;
|
||||
use PSC\Shop\ContactBundle\Model\Contact;
|
||||
use Tests\RefreshDatabaseTrait;
|
||||
use PSC\Component\ApiBundle\Model\Shop;
|
||||
use PSC\Shop\ContactBundle\Model\AccountType;
|
||||
use PSC\Shop\ContactBundle\Model\Address;
|
||||
use PSC\Shop\ContactBundle\Model\Contact;
|
||||
use PSC\Shop\OrderBundle\Model\Order\Position;
|
||||
use PSC\Shop\OrderBundle\Service\Calc;
|
||||
use PSC\Shop\PaymentBundle\Model\Payment;
|
||||
@ -14,6 +13,7 @@ use PSC\Shop\ProductBundle\Model\Product;
|
||||
use PSC\Shop\ProductBundle\Model\ProductSpecialObject;
|
||||
use PSC\Shop\ShippingBundle\Model\Shipping;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Tests\RefreshDatabaseTrait;
|
||||
|
||||
class CalcContactAccountTypeTest extends KernelTestCase
|
||||
{
|
||||
@ -29,7 +29,7 @@ class CalcContactAccountTypeTest extends KernelTestCase
|
||||
$calcService = $container->get(Calc::class);
|
||||
|
||||
$shop = new Shop();
|
||||
$shop->setUuid('shop1');
|
||||
$shop->setUuid('771a1176-d531-48ed-93b8-eec1fd4b917f');
|
||||
|
||||
$order = new \PSC\Shop\OrderBundle\Model\Order();
|
||||
$order->setShop($shop);
|
||||
@ -132,7 +132,7 @@ class CalcContactAccountTypeTest extends KernelTestCase
|
||||
$calcService = $container->get(Calc::class);
|
||||
|
||||
$shop = new Shop();
|
||||
$shop->setUuid('shop1');
|
||||
$shop->setUuid('771a1176-d531-48ed-93b8-eec1fd4b917f');
|
||||
|
||||
$order = new \PSC\Shop\OrderBundle\Model\Order();
|
||||
$order->setShop($shop);
|
||||
@ -232,7 +232,7 @@ class CalcContactAccountTypeTest extends KernelTestCase
|
||||
$calcService = $container->get(Calc::class);
|
||||
|
||||
$shop = new Shop();
|
||||
$shop->setUuid('shop1');
|
||||
$shop->setUuid('771a1176-d531-48ed-93b8-eec1fd4b917f');
|
||||
|
||||
$order = new \PSC\Shop\OrderBundle\Model\Order();
|
||||
$order->setShop($shop);
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Tests\PSC\Shop\Order\Service;
|
||||
|
||||
use Tests\RefreshDatabaseTrait;
|
||||
use PSC\Component\ApiBundle\Model\Shop;
|
||||
use PSC\Shop\ContactBundle\Model\Address;
|
||||
use PSC\Shop\OrderBundle\Model\Order\Position;
|
||||
@ -12,6 +11,7 @@ use PSC\Shop\ProductBundle\Model\Product;
|
||||
use PSC\Shop\ProductBundle\Model\ProductSpecialObject;
|
||||
use PSC\Shop\ShippingBundle\Model\Shipping;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Tests\RefreshDatabaseTrait;
|
||||
|
||||
class CalcTest extends KernelTestCase
|
||||
{
|
||||
@ -27,7 +27,7 @@ class CalcTest extends KernelTestCase
|
||||
$calcService = $container->get(Calc::class);
|
||||
|
||||
$shop = new Shop();
|
||||
$shop->setUuid('shop1');
|
||||
$shop->setUuid('771a1176-d531-48ed-93b8-eec1fd4b917f');
|
||||
|
||||
$order = new \PSC\Shop\OrderBundle\Model\Order();
|
||||
$order->setShop($shop);
|
||||
@ -117,3 +117,4 @@ class CalcTest extends KernelTestCase
|
||||
$this->assertSame(24749, $order->getGross());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,12 +14,17 @@ class GetPriceTest extends WebTestCase
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
$client->jsonRequest('POST', '/api/plugin/system/psc/xmlcalc/price', ['product' => '01938686-0e4d-7da9-bae3-b2e1b1681f9f'], []);
|
||||
$client->jsonRequest(
|
||||
'POST',
|
||||
'/api/plugin/system/psc/xmlcalc/price',
|
||||
['product' => '01938686-0e4d-7da9-bae3-b2e1b1681f9f'],
|
||||
[],
|
||||
);
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
$data = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
self::assertSame(2600, $data['netto']);
|
||||
self::assertSame(260, $data['netto']);
|
||||
}
|
||||
|
||||
public function testGetPriceWithCompany(): void
|
||||
@ -31,12 +36,17 @@ class GetPriceTest extends WebTestCase
|
||||
|
||||
$client->loginUser($testUser, 'api');
|
||||
|
||||
$client->jsonRequest('POST', '/api/plugin/system/psc/xmlcalc/price', ['product' => '01938686-0e4d-7da9-bae3-b2e1b1681f9f'], []);
|
||||
$client->jsonRequest(
|
||||
'POST',
|
||||
'/api/plugin/system/psc/xmlcalc/price',
|
||||
['product' => '01938686-0e4d-7da9-bae3-b2e1b1681f9f'],
|
||||
[],
|
||||
);
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
$data = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
self::assertSame(16640, $data['netto']);
|
||||
self::assertSame(1664, $data['netto']);
|
||||
}
|
||||
|
||||
public function testGetPriceWithAssociation(): void
|
||||
@ -48,11 +58,16 @@ class GetPriceTest extends WebTestCase
|
||||
|
||||
$client->loginUser($testUser, 'api');
|
||||
|
||||
$client->jsonRequest('POST', '/api/plugin/system/psc/xmlcalc/price', ['product' => '01938686-0e4d-7da9-bae3-b2e1b1681f9f'], []);
|
||||
$client->jsonRequest(
|
||||
'POST',
|
||||
'/api/plugin/system/psc/xmlcalc/price',
|
||||
['product' => '01938686-0e4d-7da9-bae3-b2e1b1681f9f'],
|
||||
[],
|
||||
);
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
$data = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
self::assertSame(1300, $data['netto']);
|
||||
self::assertSame(130, $data['netto']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import HiddenElement from './elements/HiddenElement.vue';
|
||||
import HeadlineElement from './elements/HeadlineElement.vue';
|
||||
import SelectElement from './elements/SelectElement.vue';
|
||||
import RowElement from './elements/RowElement.vue';
|
||||
import MediaElement from './elements/MediaElement.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
items: PreviewElement[]
|
||||
@ -28,6 +29,11 @@ const handleUpdate = (payload: { elementId: string, newValue: any }) => {
|
||||
:item="item"
|
||||
@update:value="handleUpdate"
|
||||
/>
|
||||
<MediaElement
|
||||
v-if="item.valid && item.htmlType === 'media'"
|
||||
:item="item"
|
||||
@update:value="handleUpdate"
|
||||
/>
|
||||
<HiddenElement
|
||||
v-if="item.valid && item.htmlType === 'hidden'"
|
||||
:item="item"
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
<script lang="ts" setup>
|
||||
import type { PreviewElement } from '../../../../model/preview/types';
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { fetchMediaUrl } from '../../../../lib/api';
|
||||
|
||||
const props = defineProps<{
|
||||
item: PreviewElement
|
||||
}>()
|
||||
|
||||
let src = ref('')
|
||||
|
||||
onMounted(async () => {
|
||||
if (props.item.value) {
|
||||
try {
|
||||
src = await fetchMediaUrl(props.item.value);
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch media URL', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex gap-2 flex-row">
|
||||
<img v-if="src != ''" class="" :src="src"/>
|
||||
</div>
|
||||
</template>
|
||||
@ -178,7 +178,7 @@ export const fetchMediaUrl = async (uuid: string) => {
|
||||
try {
|
||||
const response = await api.get(`api/media/${uuid}`);
|
||||
const data: any = await response.json();
|
||||
return data.data.attributes.url;
|
||||
return data.url;
|
||||
} catch (error) {
|
||||
console.error(`Error fetching media url for ${uuid}:`, error);
|
||||
throw error;
|
||||
|
||||
@ -33,7 +33,7 @@ export default defineConfig({
|
||||
changeOrigin: true,
|
||||
configure: (proxy) => {
|
||||
proxy.on('proxyReq', (proxyReq) => {
|
||||
proxyReq.setHeader('Authorization', 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE3NTY3MzE1MDEsImV4cCI6MTc1NjczNTEwMSwicm9sZXMiOlsiUk9MRV9BRE1JTiIsIlJPTEVfU0hPUF9PUEVSQVRPUiIsIlJPTEVfVVNFUiIsIlJPTEVfVVNFUiIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9FZGl0IiwiUk9MRV9QU0NfQ29sbGVjdF9Db250YWN0X0FkZCIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9EZWxldGUiLCJST0xFX1BTQ19Db2xsZWN0X0NvbnRhY3RfTG9jayIsIlJPTEVfUFNDX1IyX1NlbmRjbG91ZF9TaG93Il0sInVpZCI6MX0.Krs-TxmU9J3-p9Tt9cgFbm94wNz7wG9zRUe6yGMFG5USngDNzg4f3FL46JAWUx1liZBiU5K_Qnir5ol1--T6o2MNWIqxj3DTMgx6weWscv0Uw0eXOvhXhZp3wjaFnaqnqdN-vDqdEljs4V8ZA7RmbrL4SNgH-XoKrn0GEI9uVUYtd3wwR4SZFDEvZC1MTRi17zVMdpAxNaZ5KWTvcaARmUmDT5uKmgFOaM0z0mUT9mbL9KetqdId4aq_o6o6cPI--CDVmGNElvh4b3Ogf4yFe1hSuh9Yt1jM9rhqA7JDMpTRm3Ffx1nEdOyuA02hFFttuGICLc4NFTLbsY8qfp0H5A');
|
||||
proxyReq.setHeader('Authorization', 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE3NTY5OTYyODUsImV4cCI6MTc1Njk5OTg4NSwicm9sZXMiOlsiUk9MRV9BRE1JTiIsIlJPTEVfU0hPUF9PUEVSQVRPUiIsIlJPTEVfVVNFUiIsIlJPTEVfVVNFUiIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9FZGl0IiwiUk9MRV9QU0NfQ29sbGVjdF9Db250YWN0X0FkZCIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9EZWxldGUiLCJST0xFX1BTQ19Db2xsZWN0X0NvbnRhY3RfTG9jayIsIlJPTEVfUFNDX1IyX1NlbmRjbG91ZF9TaG93Il0sInVpZCI6MX0.GscgpB_vAN_oq4LHqzQ4K8vU0j4U9S4xLh0hCgRaAGTQuYpdHRzO21fCXob4-maN8njEtsHLq7Jpez4k0u47QhRknYrtDT_vw0EKilLpnTYFtxErAY7XqGgitam_C4BtjXKGybGkLrwfSFmlZh1yR_dJA2-hPcOlBjfpjLgOPGmpqClgLH3uv2kBn5E39kveNL5AtEOz18l--At6-UgGQDOXoKPxNNYokUK9_yaWEOezf7LThfBqgeKwOFzKlcbBNGkPWyQjbOaexWfv4DwVUtFuSJrJRYYAMbjPbx0sOThBI-AgpzooiXpLbEZFYOjkCXgyPBVBwp9JI-d0DbpGvA');
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -38,7 +38,8 @@
|
||||
{{ parent() }}
|
||||
|
||||
{% autoescape 'js' %}
|
||||
<script>
|
||||
<script type="module">
|
||||
import $ from 'jquery';
|
||||
var wto;
|
||||
window.addEventListener('bindForm', (event) => {
|
||||
bindForm();
|
||||
|
||||
@ -4,8 +4,11 @@ namespace Plugin\System\PSC\XmlCalc\Api;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Nelmio\ApiDocBundle\Attribute\Model;
|
||||
use OpenApi\Attributes\JsonContent;
|
||||
use OpenApi\Attributes\RequestBody;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use Plugin\System\PSC\XmlCalc\Dto\Input\PriceInput;
|
||||
use Plugin\System\PSC\XmlCalc\Dto\Output\Display\Group as DisplayGroup;
|
||||
use Plugin\System\PSC\XmlCalc\Dto\Output\PreCalc\Group;
|
||||
@ -15,6 +18,7 @@ use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Element;
|
||||
use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Option;
|
||||
use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Input\Max as PluginMax;
|
||||
use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Input\Min;
|
||||
use Plugin\System\PSC\XmlCalc\Dto\Output\PriceOutput;
|
||||
use PSC\Library\Calc\Engine;
|
||||
use PSC\Library\Calc\Error\Validation\Input\Max;
|
||||
use PSC\Library\Calc\Error\Validation\Input\Min as PSCMin;
|
||||
@ -28,15 +32,10 @@ use PSC\Shop\ContactBundle\Transformer\Model\Contact as ContactTransformer;
|
||||
use PSC\Shop\EntityBundle\Entity\Product;
|
||||
use PSC\System\SettingsBundle\Service\Help;
|
||||
use PSC\System\SettingsBundle\Service\PaperDB;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class GetPrice extends AbstractController
|
||||
{
|
||||
@ -77,20 +76,13 @@ class GetPrice extends AbstractController
|
||||
$this->helpService = $helpService;
|
||||
}
|
||||
|
||||
/**
|
||||
* get price
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="orders",
|
||||
* @OA\JsonContent(ref=@Model(type=\Plugin\System\PSC\XmlCalc\Dto\Output\PriceOutput::class))
|
||||
* )
|
||||
* @OA\RequestBody(
|
||||
*
|
||||
* @Model(type=\Plugin\System\PSC\XmlCalc\Dto\Input\PriceInput::class))
|
||||
* )
|
||||
* @OA\Tag(name="Plugin/System/psc/Xmlcalc/Price")
|
||||
*/
|
||||
#[Response(
|
||||
response: 200,
|
||||
description: 'get price',
|
||||
content: new JsonContent(ref: new Model(type: PriceOutput::class)),
|
||||
)]
|
||||
#[RequestBody(ref: new Model(type: PriceInput::class))]
|
||||
#[Tag(name: 'Plugin/System/psc/Xmlcalc/Price')]
|
||||
#[Route(path: '/price', methods: ['POST'])]
|
||||
#[ParamConverter(
|
||||
'data',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user