This commit is contained in:
Thomas Peterson 2024-12-16 19:18:34 +01:00
parent 1706480be9
commit 748ff5802f
15 changed files with 291 additions and 100 deletions

File diff suppressed because one or more lines are too long

View File

@ -70,6 +70,16 @@ class Address
#[OA\Property(type: 'string')] #[OA\Property(type: 'string')]
private string $ustid = ""; private string $ustid = "";
#[OA\Property(type: 'string')]
private string $steuerid = "";
#[OA\Property(type: 'string')]
private string $lid = "";
#[OA\Property(type: 'string')]
private string $iban = "";
#[OA\Property(type: 'string')] #[OA\Property(type: 'string')]
private string $zusatz1 = ""; private string $zusatz1 = "";
@ -89,7 +99,7 @@ class Address
{ {
return $this->uid; return $this->uid;
} }
public function setUid(int $uid): void public function setUid(int $uid): void
{ {
$this->uid = $uid; $this->uid = $uid;
@ -114,32 +124,32 @@ class Address
{ {
$this->firstname = $firstname; $this->firstname = $firstname;
} }
public function getLastname(): string public function getLastname(): string
{ {
return $this->lastname; return $this->lastname;
} }
public function setLastname(string $lastname): void public function setLastname(string $lastname): void
{ {
$this->lastname = $lastname; $this->lastname = $lastname;
} }
public function getStreet(): string public function getStreet(): string
{ {
return $this->street; return $this->street;
} }
public function setStreet(string $street): void public function setStreet(string $street): void
{ {
$this->street = $street; $this->street = $street;
} }
public function getHouseNumber(): string public function getHouseNumber(): string
{ {
return $this->houseNumber; return $this->houseNumber;
} }
public function setHouseNumber(string $houseNumber): void public function setHouseNumber(string $houseNumber): void
{ {
$this->houseNumber = $houseNumber; $this->houseNumber = $houseNumber;
@ -149,7 +159,7 @@ class Address
{ {
return $this->zip; return $this->zip;
} }
public function setZip(string $zip): void public function setZip(string $zip): void
{ {
$this->zip = $zip; $this->zip = $zip;
@ -159,12 +169,12 @@ class Address
{ {
return $this->city; return $this->city;
} }
public function setCity(string $city): void public function setCity(string $city): void
{ {
$this->city = $city; $this->city = $city;
} }
public function getPhone(): string public function getPhone(): string
{ {
return $this->phone; return $this->phone;
@ -174,7 +184,7 @@ class Address
{ {
$this->phone = $phone; $this->phone = $phone;
} }
public function getMobilPhone(): string public function getMobilPhone(): string
{ {
return $this->mobilPhone; return $this->mobilPhone;
@ -184,7 +194,7 @@ class Address
{ {
$this->mobilPhone = $mobilPhone; $this->mobilPhone = $mobilPhone;
} }
public function getEmail(): string public function getEmail(): string
{ {
return $this->email; return $this->email;
@ -209,7 +219,7 @@ class Address
{ {
return $this->anrede; return $this->anrede;
} }
public function setAnrede(string $anrede): void public function setAnrede(string $anrede): void
{ {
$this->anrede = $anrede; $this->anrede = $anrede;
@ -219,13 +229,13 @@ class Address
{ {
return $this->country; return $this->country;
} }
public function setCountry(string $country): void public function setCountry(string $country): void
{ {
$this->country = $country; $this->country = $country;
} }
public function getFax(): string public function getFax(): string
{ {
return $this->fax; return $this->fax;
@ -250,12 +260,12 @@ class Address
{ {
return $this->kostenstellung; return $this->kostenstellung;
} }
public function setKostenstellung(string $kostenstellung): void public function setKostenstellung(string $kostenstellung): void
{ {
$this->kostenstellung = $kostenstellung; $this->kostenstellung = $kostenstellung;
} }
public function getAbteilung(): string public function getAbteilung(): string
{ {
return $this->abteilung; return $this->abteilung;
@ -265,7 +275,7 @@ class Address
{ {
$this->abteilung = $abteilung; $this->abteilung = $abteilung;
} }
public function getPosition(): string public function getPosition(): string
{ {
return $this->position; return $this->position;
@ -276,16 +286,46 @@ class Address
$this->position = $position; $this->position = $position;
} }
public function getUstid(): string public function getUstId(): string
{ {
return $this->ustid; return (string)$this->ustid;
} }
public function setUstid(string $ustid): void public function setUstId(string $ustid): void
{ {
$this->ustid = $ustid; $this->ustid = $ustid;
} }
public function getSteuerId(): string
{
return (string)$this->steuerid;
}
public function setSteuerId(string $var): void
{
$this->steuerid = $var;
}
public function getLId(): string
{
return (string)$this->lid;
}
public function setLId(string $var): void
{
$this->lid = $var;
}
public function getIban(): string
{
return (string)$this->iban;
}
public function setIban(string $var): void
{
$this->iban = $var;
}
public function getZusatz1(): string public function getZusatz1(): string
{ {
return $this->zusatz1; return $this->zusatz1;
@ -295,27 +335,27 @@ class Address
{ {
$this->zusatz1 = $zusatz1; $this->zusatz1 = $zusatz1;
} }
public function getZusatz2(): string public function getZusatz2(): string
{ {
return $this->zusatz2; return $this->zusatz2;
} }
public function setZusatz2(string $zusatz2): void public function setZusatz2(string $zusatz2): void
{ {
$this->zusatz2 = $zusatz2; $this->zusatz2 = $zusatz2;
} }
public function getPos(): int public function getPos(): int
{ {
return $this->pos; return $this->pos;
} }
public function setPos(int $pos): void public function setPos(int $pos): void
{ {
$this->pos = $pos; $this->pos = $pos;
} }
public function getKundenNr(): string public function getKundenNr(): string
{ {
return $this->kundenNr; return $this->kundenNr;

View File

@ -19,10 +19,10 @@ use PSC\Shop\EntityBundle\Entity\Contact;
use PSC\Shop\EntityBundle\Entity\Shop; use PSC\Shop\EntityBundle\Entity\Shop;
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface; use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException; use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
class ContactRepository extends ServiceEntityRepository implements UserLoaderInterface class ContactRepository extends ServiceEntityRepository implements UserLoaderInterface
{ {
public function __construct(ManagerRegistry $registry, private readonly \PSC\System\SettingsBundle\Service\Shop $shopService) public function __construct(ManagerRegistry $registry, private readonly \PSC\System\SettingsBundle\Service\Shop $shopService)
{ {
@ -38,7 +38,7 @@ class ContactRepository extends ServiceEntityRepository implements UserLoaderIn
->getOneOrNullResult(); ->getOneOrNullResult();
if (null === $user) { if (null === $user) {
$message = sprintf('Unable to find an active admin AppBundle:User object identified by "%s".', $username); $message = sprintf('Unable to find an active admin AppBundle:User object identified by "%s".', $username);
throw new UsernameNotFoundException($message); throw new UserNotFoundException($message);
} }
return $user; return $user;

View File

@ -3,11 +3,6 @@
namespace PSC\Shop\ContactBundle\Transformer\Order; namespace PSC\Shop\ContactBundle\Transformer\Order;
use PSC\Shop\EntityBundle\Document\Embed\ContactAddress; use PSC\Shop\EntityBundle\Document\Embed\ContactAddress;
use PSC\Shop\EntityBundle\Entity\Orderpos;
use PSC\Shop\EntityBundle\Entity\Product;
use PSC\System\SettingsBundle\Service\Shop;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class Address class Address
{ {
@ -25,9 +20,12 @@ class Address
$addressDoc->setHouseNumber((string)$address->getHouseNumber()); $addressDoc->setHouseNumber((string)$address->getHouseNumber());
$addressDoc->setPhone((string)$address->getPhone()); $addressDoc->setPhone((string)$address->getPhone());
$addressDoc->setCountry((string)$address->getCountry()); $addressDoc->setCountry((string)$address->getCountry());
$addressDoc->setUstid((string)$address->getUstid()); $addressDoc->setUstId((string)$address->getUstId());
$addressDoc->setPosition((string)$address->getPosition()); $addressDoc->setPosition((string)$address->getPosition());
$addressDoc->setUuid((string)$address->getUuid()); $addressDoc->setUuid((string)$address->getUuid());
$addressDoc->setIban((string)$address->getIban());
$addressDoc->setLId((string)$address->getLId());
$addressDoc->setSteuerId((string)$address->getSteuerId());
} }
@ -41,12 +39,15 @@ class Address
$address->setFax((string)$addressDoc->getFax()); $address->setFax((string)$addressDoc->getFax());
$address->setFirstname((string)$addressDoc->getFirstname()); $address->setFirstname((string)$addressDoc->getFirstname());
$address->setCountry((string)$addressDoc->getCountry()); $address->setCountry((string)$addressDoc->getCountry());
$address->setUstid((string)$addressDoc->getUstid()); $address->setUstId((string)$addressDoc->getUstId());
$address->setLastname((string)$addressDoc->getLastname()); $address->setLastname((string)$addressDoc->getLastname());
$address->setStreet((string)$addressDoc->getStreet()); $address->setStreet((string)$addressDoc->getStreet());
$address->setHouseNumber((string)$addressDoc->getHouseNumber()); $address->setHouseNumber((string)$addressDoc->getHouseNumber());
$address->setPhone((string)$addressDoc->getPhone()); $address->setPhone((string)$addressDoc->getPhone());
$address->setPosition((string)$addressDoc->getPosition()); $address->setPosition((string)$addressDoc->getPosition());
$address->setUuid((string)$addressDoc->getUuid()); $address->setUuid((string)$addressDoc->getUuid());
$address->setIban((string)$addressDoc->getIban());
$address->setLId((string)$addressDoc->getLId());
$address->setSteuerId((string)$addressDoc->getSteuerId());
} }
} }

View File

@ -219,6 +219,9 @@ class Contact
public function getAccountType(): AccountType public function getAccountType(): AccountType
{ {
if ($this->accountType == null) {
return AccountType::tryFrom(1);
}
return AccountType::tryFrom($this->accountType); return AccountType::tryFrom($this->accountType);
} }

View File

@ -108,14 +108,15 @@ class ContactAddress
*/ */
#[Field(type: 'string')] #[Field(type: 'string')]
private $position; private $position;
/**
* @var string
*/
#[Field(type: 'string')] #[Field(type: 'string')]
private $ustid; private $ustid;
/** #[Field(type: 'string')]
* @var string private $steuerid;
*/ #[Field(type: 'string')]
private $iban;
#[Field(type: 'string')]
private $lid;
#[Field(type: 'string')] #[Field(type: 'string')]
private $zusatz1; private $zusatz1;
/** /**
@ -133,9 +134,7 @@ class ContactAddress
*/ */
#[Field(type: 'string')] #[Field(type: 'string')]
private $kundenNr; private $kundenNr;
/**
* @return string
*/
public function getFirstname() public function getFirstname()
{ {
return $this->firstname; return $this->firstname;
@ -437,25 +436,6 @@ class ContactAddress
$this->position = $position; $this->position = $position;
} }
/**
* @return string
*/
public function getUstid()
{
return $this->ustid;
}
/**
* @param string $ustid
*/
public function setUstid($ustid)
{
$this->ustid = $ustid;
}
/**
* @return string
*/
public function getZusatz1() public function getZusatz1()
{ {
return $this->zusatz1; return $this->zusatz1;
@ -526,4 +506,44 @@ class ContactAddress
{ {
$this->uuid = $uuid; $this->uuid = $uuid;
} }
public function getUstId(): string
{
return (string)$this->ustid;
}
public function setUstId(string $ustid): void
{
$this->ustid = $ustid;
}
public function getSteuerId(): string
{
return (string)$this->steuerid;
}
public function setSteuerId(string $var): void
{
$this->steuerid = $var;
}
public function getLId(): string
{
return (string)$this->lid;
}
public function setLId(string $var): void
{
$this->lid = $var;
}
public function getIban(): string
{
return (string)$this->iban;
}
public function setIban(string $var): void
{
$this->iban = $var;
}
} }

View File

@ -515,6 +515,15 @@ class Shop
protected $senderMobile; protected $senderMobile;
#[Field(type: 'string')] #[Field(type: 'string')]
protected $senderEmail; protected $senderEmail;
#[Field(type: 'string')]
protected $senderIban;
#[Field(type: 'string')]
protected $senderLId;
#[Field(type: 'string')]
protected $senderUstId;
#[Field(type: 'string')]
protected $senderSteuerId;
#[Field(type: 'bool')] #[Field(type: 'bool')]
protected bool $docInvoiceXML = false; protected bool $docInvoiceXML = false;
#[Field(type: 'bool')] #[Field(type: 'bool')]
@ -3119,6 +3128,13 @@ class Shop
$address->setZip((string)$this->getSenderZip()); $address->setZip((string)$this->getSenderZip());
$address->setCity((string)$this->getSenderCity()); $address->setCity((string)$this->getSenderCity());
$address->setCountry((string)$this->getSenderCountry()); $address->setCountry((string)$this->getSenderCountry());
$address->setEmail((string)$this->getSenderEmail());
$address->setIban((string)$this->getSenderIban());
$address->setLId((string)$this->getSenderLId());
$address->setUstId((string)$this->getSenderUstId());
$address->setSteuerId((string)$this->getSenderSteuerId());
$address->setMobilPhone((string)$this->getSenderMobile());
return $address; return $address;
} }
@ -3191,5 +3207,44 @@ class Shop
$this->docOfferXML = $value; $this->docOfferXML = $value;
} }
public function getSenderIban(): string
{
return (string)$this->senderIban;
}
public function setSenderIban(string $var): void
{
$this->senderIban = $var;
}
public function getSenderLId(): string
{
return (string)$this->senderLId;
}
public function setSenderLId(string $var): void
{
$this->senderLId = $var;
}
public function getSenderUstId(): string
{
return (string)$this->senderUstId;
}
public function setSenderUstId(string $var): void
{
$this->senderUstId = $var;
}
public function getSenderSteuerId(): string
{
return (string)$this->senderSteuerId;
}
public function setSenderSteuerId(string $var): void
{
$this->senderSteuerId = $var;
}
} }

View File

@ -49,15 +49,11 @@ class Calc
$order->addTax($order->getPayment()->getCalcPrice()->tax); $order->addTax($order->getPayment()->getCalcPrice()->tax);
$this->shippingTransformer->parseModel($order->getShipping()); $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());
var_dump($order->getAllTaxes());
var_dump("1");
$priceNet = $priceNet->plus(Money::ofMinor($order->getShipping()->getCalcPrice()->net, 'EUR')); $priceNet = $priceNet->plus(Money::ofMinor($order->getShipping()->getCalcPrice()->net, 'EUR'));
$priceVat = $priceVat->plus(Money::ofMinor($order->getShipping()->getCalcPrice()->vat, 'EUR')); $priceVat = $priceVat->plus(Money::ofMinor($order->getShipping()->getCalcPrice()->vat, 'EUR'));
$priceGross = $priceGross->plus(Money::ofMinor($order->getShipping()->getCalcPrice()->gross, '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); $order->addTax($order->getShipping()->getCalcPrice()->tax);
var_dump($order->getAllTaxes());
var_dump("2");
foreach ($order->getPositions() as $position) { foreach ($order->getPositions() as $position) {
$position->getProduct()->setShopUuid($order->getShop()->getUuid()); $position->getProduct()->setShopUuid($order->getShop()->getUuid());
if ($this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())) { if ($this->productTypeRegistry->getProductType($position->getProduct()->getSpecialProductTypeObject()->getTyp())) {
@ -76,8 +72,6 @@ class Calc
$priceGross = $priceGross->plus(Money::ofMinor($position->getPrice()->getAllGross(), 'EUR')); $priceGross = $priceGross->plus(Money::ofMinor($position->getPrice()->getAllGross(), 'EUR'));
$order->addTax($position->getPrice()->tax); $order->addTax($position->getPrice()->tax);
} }
var_dump($order->getAllTaxes());
var_dump("test");
$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());

View File

@ -151,7 +151,8 @@ class Order extends Base
$orderEntity->setMwertAlle(json_encode($mwertAlle)); $orderEntity->setMwertAlle(json_encode($mwertAlle));
$orderEntity->setVersion(1); $orderEntity->setVersion(1);
$orderEntity->setShop($this->shopService->getShopByUid($order->getShop()->getUuid())); $shopEntity = $this->shopService->getShopByUid($order->getShop()->getUuid());
$orderEntity->setShop($shopEntity);
$this->paymentTransformer->toDb($order->getPayment(), $orderEntity); $this->paymentTransformer->toDb($order->getPayment(), $orderEntity);
$this->shippingTransformer->toDb($order->getShipping(), $orderEntity); $this->shippingTransformer->toDb($order->getShipping(), $orderEntity);
@ -172,9 +173,12 @@ class Order extends Base
$orderDoc->setDeliveryAddressSaved($deliveryDoc); $orderDoc->setDeliveryAddressSaved($deliveryDoc);
$senderDoc = new ContactAddress(); $senderDoc = new ContactAddress();
$senderAddress = $order->getSenderAddress();
if ($senderAddress->getUid() == 0 && $senderAddress->getType() == 0 && $senderAddress->getCompany() == "" && $senderAddress->getFirstname() == "" && $senderAddress->getLastname() == "") {
$order->setSenderAddress($this->shopService->getMongoShopByUid($shopEntity->getUID())->getSenderAddress());
}
$this->addressTransformer->toDb($order->getSenderAddress(), $senderDoc); $this->addressTransformer->toDb($order->getSenderAddress(), $senderDoc);
$orderDoc->setSenderAddressSaved($senderDoc); $orderDoc->setSenderAddressSaved($senderDoc);
$orderDoc->setExternalOrderNumber($order->getExternalOrderNumber()); $orderDoc->setExternalOrderNumber($order->getExternalOrderNumber());
$orderDoc->setDraft($order->isDraft()); $orderDoc->setDraft($order->isDraft());

View File

@ -95,6 +95,8 @@ class ShopSettingsType extends AbstractType
->add('senderEmail', TextType::class, array('required' => false, 'label' => 'EMail')) ->add('senderEmail', TextType::class, array('required' => false, 'label' => 'EMail'))
->add('senderIban', TextType::class, array('required' => false, 'label' => 'Iban')) ->add('senderIban', TextType::class, array('required' => false, 'label' => 'Iban'))
->add('senderLId', TextType::class, array('required' => false, 'label' => 'Leitweg Id')) ->add('senderLId', TextType::class, array('required' => false, 'label' => 'Leitweg Id'))
->add('senderUstId', TextType::class, array('required' => false, 'label' => 'Umsatzsteuer Nr'))
->add('senderSteuerId', TextType::class, array('required' => false, 'label' => 'Steuer Nr'))
->add('priceFactor', NumberType::class, array('required' => false, 'label' => 'Factor', 'scale' => 5, 'html5' => true, ->add('priceFactor', NumberType::class, array('required' => false, 'label' => 'Factor', 'scale' => 5, 'html5' => true,
'attr' => array( 'attr' => array(

View File

@ -571,6 +571,54 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-6">
<div class="row mb-3">
<label class="col-md-3 form-control-label">
{{ form_label(form.senderIban) }}
</label>
<div class="col-md-9">
{{ form_widget(form.senderIban) }}
</div>
{{ form_errors(form.senderIban) }}
</div>
</div>
<div class="col-md-6">
<div class="row mb-3">
<label class="col-md-3 form-control-label">
{{ form_label(form.senderLId) }}
</label>
<div class="col-md-9">
{{ form_widget(form.senderLId) }}
</div>
{{ form_errors(form.senderLId) }}
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="row mb-3">
<label class="col-md-3 form-control-label">
{{ form_label(form.senderUstId) }}
</label>
<div class="col-md-9">
{{ form_widget(form.senderUstId) }}
</div>
{{ form_errors(form.senderUstId) }}
</div>
</div>
<div class="col-md-6">
<div class="row mb-3">
<label class="col-md-3 form-control-label">
{{ form_label(form.senderSteuerId) }}
</label>
<div class="col-md-9">
{{ form_widget(form.senderSteuerId) }}
</div>
{{ form_errors(form.senderSteuerId) }}
</div>
</div>
</div>
</div> </div>
<div class="tab-pane" id="meta" role="tabpanel"> <div class="tab-pane" id="meta" role="tabpanel">
<div class="row"> <div class="row">

View File

@ -73,8 +73,7 @@ class Printing
->setDocumentInformation($orderModel->getAlias(), "380", $orderModel->getCreated(), "EUR") ->setDocumentInformation($orderModel->getAlias(), "380", $orderModel->getCreated(), "EUR")
->addDocumentNote('Rechnung gemäß Bestellung vom ' . $orderModel->getCreated()->format('d.m.Y')) ->addDocumentNote('Rechnung gemäß Bestellung vom ' . $orderModel->getCreated()->format('d.m.Y'))
->setDocumentSupplyChainEvent($orderModel->getCreated()) ->setDocumentSupplyChainEvent($orderModel->getCreated())
->setDocumentBuyerReference("leitwegId") ->setDocumentBuyerReference($orderModel->getInvoiceAddress()->getLId())
// ->addDocumentSellerGlobalId("4000001123452", "0088")
->setDocumentSeller($orderModel->getSenderAddress()->getCompany() . ' ' . $orderModel->getSenderAddress()->getFirstname() . ' ' . $orderModel->getSenderAddress()->getLastname(), "") ->setDocumentSeller($orderModel->getSenderAddress()->getCompany() . ' ' . $orderModel->getSenderAddress()->getFirstname() . ' ' . $orderModel->getSenderAddress()->getLastname(), "")
->setDocumentSellerAddress($orderModel->getSenderAddress()->getStreet() . ' ' . $orderModel->getSenderAddress()->getHouseNumber(), "", "", $orderModel->getSenderAddress()->getZip(), $orderModel->getSenderAddress()->getCity(), $orderModel->getSenderAddress()->getCountry() ?? 'DE') ->setDocumentSellerAddress($orderModel->getSenderAddress()->getStreet() . ' ' . $orderModel->getSenderAddress()->getHouseNumber(), "", "", $orderModel->getSenderAddress()->getZip(), $orderModel->getSenderAddress()->getCity(), $orderModel->getSenderAddress()->getCountry() ?? 'DE')
->setDocumentSellerContact($orderModel->getSenderAddress()->getFirstname() . ' ' . $orderModel->getSenderAddress()->getLastname(), $orderModel->getSenderAddress()->getCompany(), $orderModel->getSenderAddress()->getPhone(), $orderModel->getSenderAddress()->getMobilPhone(), $orderModel->getSenderAddress()->getEmail()) ->setDocumentSellerContact($orderModel->getSenderAddress()->getFirstname() . ' ' . $orderModel->getSenderAddress()->getLastname(), $orderModel->getSenderAddress()->getCompany(), $orderModel->getSenderAddress()->getPhone(), $orderModel->getSenderAddress()->getMobilPhone(), $orderModel->getSenderAddress()->getEmail())
@ -82,11 +81,11 @@ class Printing
->setDocumentBuyer($orderModel->getInvoiceAddress()->getCompany() . ' ' . $orderModel->getInvoiceAddress()->getFirstname() . ' ' . $orderModel->getInvoiceAddress()->getLastname(), $orderModel->getInvoiceAddress()->getKundenNr()) ->setDocumentBuyer($orderModel->getInvoiceAddress()->getCompany() . ' ' . $orderModel->getInvoiceAddress()->getFirstname() . ' ' . $orderModel->getInvoiceAddress()->getLastname(), $orderModel->getInvoiceAddress()->getKundenNr())
->setDocumentBuyerAddress($orderModel->getInvoiceAddress()->getStreet() . ' ' . $orderModel->getInvoiceAddress()->getHouseNumber(), "", "", $orderModel->getInvoiceAddress()->getZip(), $orderModel->getInvoiceAddress()->getCity(), $orderModel->getInvoiceAddress()->getCountry() ?? 'DE') ->setDocumentBuyerAddress($orderModel->getInvoiceAddress()->getStreet() . ' ' . $orderModel->getInvoiceAddress()->getHouseNumber(), "", "", $orderModel->getInvoiceAddress()->getZip(), $orderModel->getInvoiceAddress()->getCity(), $orderModel->getInvoiceAddress()->getCountry() ?? 'DE')
->setDocumentBuyerCommunication("EM", $orderModel->getInvoiceAddress()->getEmail()) ->setDocumentBuyerCommunication("EM", $orderModel->getInvoiceAddress()->getEmail())
->addDocumentPaymentMean(ZugferdPaymentMeans::UNTDID_4461_58, null, null, null, null, null, "DE12500105170648489890", null, null, null) ->addDocumentPaymentMean(ZugferdPaymentMeans::UNTDID_4461_58, null, null, null, null, null, $orderModel->getSenderAddress()->getIban(), null, null, null)
->addDocumentPaymentTermXRechnung("Zahlungsbedingungen", [], [], [], null, null) ->addDocumentPaymentTermXRechnung($orderModel->getPayment()->getTitle(), [], [], [], null, null)
->addDocumentSellerVATRegistrationNumber("DEumsatzsteuer") ->addDocumentSellerVATRegistrationNumber($orderModel->getSenderAddress()->getUstId())
->addDocumentSellerTaxNumber("steuernummer") ->addDocumentSellerTaxNumber($orderModel->getSenderAddress()->getSteuerId())
; ;
@ -156,6 +155,9 @@ class Printing
'ShippingCoast' 'ShippingCoast'
); );
} }
dump($orderModel);
dump($document);
die();
return $document->getContent(); return $document->getContent();
} }

View File

@ -1,4 +1,5 @@
<?php <?php
namespace App\Tests\PSC\Shop\Order\Api; namespace App\Tests\PSC\Shop\Order\Api;
use PSC\Shop\EntityBundle\Repository\JobRepository; use PSC\Shop\EntityBundle\Repository\JobRepository;
@ -21,7 +22,7 @@ class CreateTest extends WebTestCase
$shopRepository = static::getContainer()->get(ShopRepository::class); $shopRepository = static::getContainer()->get(ShopRepository::class);
/** /**
* @var Shop $shop * @var Shop $shop
*/ */
$shop = $shopRepository->findOneBy(['title' => 'Printchampion']); $shop = $shopRepository->findOneBy(['title' => 'Printchampion']);
@ -30,9 +31,11 @@ class CreateTest extends WebTestCase
$paymentRepository = static::getContainer()->get(PaymentRepository::class); $paymentRepository = static::getContainer()->get(PaymentRepository::class);
$client->jsonRequest( $client->jsonRequest(
'POST', '/api/order/create', [ 'POST',
'/api/order/create',
[
'shop' => [ 'shop' => [
'uuid' => (String)$shop->getUuid() 'uuid' => (string)$shop->getUuid()
], ],
'type' => 2, 'type' => 2,
'shipping' => [ 'shipping' => [
@ -96,7 +99,8 @@ class CreateTest extends WebTestCase
] ]
] ]
] ]
], ['HTTP_apiKey' => $shop->getApiKey()] ],
['HTTP_apiKey' => $shop->getApiKey()]
); );
self::assertSame(200, $client->getResponse()->getStatusCode()); self::assertSame(200, $client->getResponse()->getStatusCode());
@ -104,9 +108,12 @@ class CreateTest extends WebTestCase
$data = json_decode($client->getResponse()->getContent(), true); $data = json_decode($client->getResponse()->getContent(), true);
$client->jsonRequest( $client->jsonRequest(
'POST', '/api/order/getonebyuuid', [ 'POST',
'/api/order/getonebyuuid',
[
'uuid' => $data['uuid'], 'uuid' => $data['uuid'],
], ['HTTP_apiKey' => $shop->getApiKey()] ],
['HTTP_apiKey' => $shop->getApiKey()]
); );
$data = json_decode($client->getResponse()->getContent(), true); $data = json_decode($client->getResponse()->getContent(), true);
@ -118,10 +125,13 @@ class CreateTest extends WebTestCase
self::assertSame('Gribow', $data['deliveryAddress']['city']); self::assertSame('Gribow', $data['deliveryAddress']['city']);
self::assertSame('ShopMusterOrt', $data['senderAddress']['city']);
self::assertSame('ShopMusterIban', $data['senderAddress']['iban']);
self::assertSame(200, $client->getResponse()->getStatusCode()); self::assertSame(200, $client->getResponse()->getStatusCode());
/** /**
* @var JobRepository $jobs * @var JobRepository $jobs
*/ */
$jobs = static::getContainer()->get(JobRepository::class); $jobs = static::getContainer()->get(JobRepository::class);
@ -136,7 +146,7 @@ class CreateTest extends WebTestCase
$shopRepository = static::getContainer()->get(ShopRepository::class); $shopRepository = static::getContainer()->get(ShopRepository::class);
/** /**
* @var Shop $shop * @var Shop $shop
*/ */
$shop = $shopRepository->findOneBy(['title' => 'Printchampion']); $shop = $shopRepository->findOneBy(['title' => 'Printchampion']);
@ -145,9 +155,11 @@ class CreateTest extends WebTestCase
$paymentRepository = static::getContainer()->get(PaymentRepository::class); $paymentRepository = static::getContainer()->get(PaymentRepository::class);
$client->jsonRequest( $client->jsonRequest(
'POST', '/api/order/create', [ 'POST',
'/api/order/create',
[
'shop' => [ 'shop' => [
'uuid' => (String)$shop->getUuid() 'uuid' => (string)$shop->getUuid()
], ],
'type' => 2, 'type' => 2,
'shipping' => [ 'shipping' => [
@ -211,7 +223,8 @@ class CreateTest extends WebTestCase
] ]
] ]
] ]
], ['HTTP_apiKey' => $shop->getApiKey()] ],
['HTTP_apiKey' => $shop->getApiKey()]
); );
self::assertSame(200, $client->getResponse()->getStatusCode()); self::assertSame(200, $client->getResponse()->getStatusCode());
@ -219,9 +232,12 @@ class CreateTest extends WebTestCase
$data = json_decode($client->getResponse()->getContent(), true); $data = json_decode($client->getResponse()->getContent(), true);
$client->jsonRequest( $client->jsonRequest(
'POST', '/api/order/getonebyuuid', [ 'POST',
'/api/order/getonebyuuid',
[
'uuid' => $data['uuid'], 'uuid' => $data['uuid'],
], ['HTTP_apiKey' => $shop->getApiKey()] ],
['HTTP_apiKey' => $shop->getApiKey()]
); );
$data = json_decode($client->getResponse()->getContent(), true); $data = json_decode($client->getResponse()->getContent(), true);
@ -238,13 +254,16 @@ class CreateTest extends WebTestCase
self::assertSame(200, $client->getResponse()->getStatusCode()); self::assertSame(200, $client->getResponse()->getStatusCode());
/** /**
* @var JobRepository $jobs * @var JobRepository $jobs
*/ */
$jobs = static::getContainer()->get(JobRepository::class); $jobs = static::getContainer()->get(JobRepository::class);
$client->jsonRequest( $client->jsonRequest(
'GET', '/api/order/action/create/' . $data['uuid'], [ 'GET',
], ['HTTP_apiKey' => $shop->getApiKey()] '/api/order/action/create/' . $data['uuid'],
[
],
['HTTP_apiKey' => $shop->getApiKey()]
); );
self::assertCount(1, $jobs->findBy(['data.order' => $data['uuid']])); self::assertCount(1, $jobs->findBy(['data.order' => $data['uuid']]));

View File

@ -211,8 +211,6 @@ class CreateOrderTest extends WebTestCase
self::assertSame(200, $client->getResponse()->getStatusCode()); self::assertSame(200, $client->getResponse()->getStatusCode());
$data = json_decode($client->getResponse()->getContent(), true); $data = json_decode($client->getResponse()->getContent(), true);
var_dump($data['allTaxes']);
var_dump($data['payment']);
self::assertSame(9520, $data['gross']); self::assertSame(9520, $data['gross']);
$client->jsonRequest( $client->jsonRequest(
@ -227,8 +225,6 @@ class CreateOrderTest extends WebTestCase
self::assertSame(200, $client->getResponse()->getStatusCode()); self::assertSame(200, $client->getResponse()->getStatusCode());
$data = json_decode($client->getResponse()->getContent(), true); $data = json_decode($client->getResponse()->getContent(), true);
var_dump($data['allTaxes']);
var_dump($data['payment']);
self::assertSame(9520, $data['gross']); self::assertSame(9520, $data['gross']);
$jobs = static::getContainer()->get(JobRepository::class); $jobs = static::getContainer()->get(JobRepository::class);

View File

@ -110,6 +110,13 @@ trait RefreshDatabaseTrait
$shop->setParcelCancelationNumberPattern('STS-{{ "now"|date("Ym") }}-{{number}}'); $shop->setParcelCancelationNumberPattern('STS-{{ "now"|date("Ym") }}-{{number}}');
$shop->setParcelInvoiceNumberPattern('STR-{{ "now"|date("Ym") }}-{{number}}'); $shop->setParcelInvoiceNumberPattern('STR-{{ "now"|date("Ym") }}-{{number}}');
$shop->setSenderZip(12345);
$shop->setSenderCity("ShopMusterOrt");
$shop->setSenderCompany("ShopMusterCompany");
$shop->setSenderLId("ShopMusterLeitwegId");
$shop->setSenderIban("ShopMusterIban");
$shop->setSenderEmail("ShopMusterEmail");
$doc->persist($shop); $doc->persist($shop);
$doc->flush(); $doc->flush();
$doc->clear(); $doc->clear();