/** * @param string $processName * * @return array */ public function prepareItems($processName) { $orderItemsArray = $this->getOrderItems($processName); $orders = []; $txtArray = []; foreach ($orderItemsArray as $orderItemArray) { if (!isset($orders[$orderItemArray['orderId']])) { $order = new SpySalesOrder(); $order->setGrandTotal(10000); $order->setSubtotal(9900); $order->setIsTest(false); $address = new SpySalesOrderAddress(); $address->setLastName('Doe'); $address->setFirstName('John'); $address->setCity('Berlin'); $address->setZipCode('12345'); $address->setAddress1('Blastr 1'); $country = SpyCountryQuery::create()->findOneByIdCountry(1); $address->setCountry($country); $order->setBillingAddress($address); $order->setShippingAddress($address); $orders[$orderItemArray['orderId']] = $order; } } $states = []; $orderItems = []; foreach ($orderItemsArray as $orderItemArray) { if (isset($states[$orderItemArray['state']])) { $state = $states[$orderItemArray['state']]; } else { $state = new SpyOmsOrderItemState(); $state->setName($orderItemArray['state']); $state->save(); $states[$orderItemArray['state']] = $state; } $txtArray[] = 'State: ' . $state->getName(); $process = SpyOmsOrderProcessQuery::create()->filterByName($orderItemArray['process'])->findOneOrCreate(); $process->setName($orderItemArray['process']); $process->save(); $txtArray[] = 'Process: ' . $process->getName(); $item = new SpySalesOrderItem(); $item->setState($state); $item->setProcess($process); $item->setName('Testproduct'); $item->setSku('12345ABC'); $item->setGrossPrice(10); $orders[$orderItemArray['orderId']]->addItem($item); $orderItems[] = $item; } foreach ($orderItems as $orderItem) { $orderItem->save(); $txtArray[] = 'orderItem saved: ' . $orderItem->getIdSalesOrderItem(); } return $txtArray; }
/** * @param \Generated\Shared\Transfer\AddressTransfer $addressTransfer * @param \Orm\Zed\Sales\Persistence\SpySalesOrderAddress $addressEntity * * @return void */ protected function hydrateAddressEntityFromTransfer(AddressTransfer $addressTransfer, SpySalesOrderAddress $addressEntity) { $addressEntity->fromArray($addressTransfer->modifiedToArray()); }
/** * @param \Generated\Shared\Transfer\AddressTransfer $addressTransfer * @param \Orm\Zed\Sales\Persistence\SpySalesOrderAddress $salesOrderAddressEntity * * @return void */ protected function hydrateSalesOrderAddress(AddressTransfer $addressTransfer, SpySalesOrderAddress $salesOrderAddressEntity) { $salesOrderAddressEntity->fromArray($addressTransfer->toArray()); $salesOrderAddressEntity->setFkCountry($this->countryFacade->getIdCountryByIso2Code($addressTransfer->getIso2Code())); }
/** * @return \Orm\Zed\Sales\Persistence\SpySalesOrderAddress */ protected function createSalesOrderAddress() { $salesOrderAddressEntity = new SpySalesOrderAddress(); $salesOrderAddressEntity->setAddress1(1); $salesOrderAddressEntity->setAddress2(2); $salesOrderAddressEntity->setSalutation('Mr'); $salesOrderAddressEntity->setCellPhone('123456789'); $salesOrderAddressEntity->setCity('City'); $salesOrderAddressEntity->setCreatedAt(new \DateTime()); $salesOrderAddressEntity->setUpdatedAt(new \DateTime()); $salesOrderAddressEntity->setComment('Comment'); $salesOrderAddressEntity->setDescription('Description'); $salesOrderAddressEntity->setCompany('Company'); $salesOrderAddressEntity->setFirstName('FirstName'); $salesOrderAddressEntity->setLastName('LastName'); $salesOrderAddressEntity->setFkCountry(1); $salesOrderAddressEntity->setEmail('Email'); $salesOrderAddressEntity->setZipCode(12345); $salesOrderAddressEntity->save(); return $salesOrderAddressEntity; }
/** * @param \Spryker\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer $personalContainer * @param \Orm\Zed\Sales\Persistence\SpySalesOrderAddress $billingAddressEntity * * @return void */ protected function mapBillingAddressToPersonalContainer(PersonalContainer $personalContainer, SpySalesOrderAddress $billingAddressEntity) { //dump($billingAddressEntity);die(); $personalContainer->setCountry($billingAddressEntity->getCountry()->getIso2Code()); $personalContainer->setLastName($billingAddressEntity->getLastName()); //$personalContainer->setCustomerId($billingAddressEntity->getM); $personalContainer->setSalutation($billingAddressEntity->getSalutation()); //$personalContainer->setTitle($billingAddressEntity->getTitle()); $personalContainer->setFirstName($billingAddressEntity->getFirstName()); $personalContainer->setLastName($billingAddressEntity->getLastName()); $personalContainer->setCompany($billingAddressEntity->getCompany()); $personalContainer->setStreet($billingAddressEntity->getAddress1() . ' ' . $billingAddressEntity->getAddress2()); $personalContainer->setAddressAddition($billingAddressEntity->getAddress3()); $personalContainer->setZip($billingAddressEntity->getZipCode()); $personalContainer->setCity($billingAddressEntity->getCity()); //$personalContainer->setState($billingAddressEntity->getState()); $personalContainer->setEmail($billingAddressEntity->getEmail()); //$personalContainer->setBirthday($billingAddressEntity->getBirthday()); $personalContainer->setTelephoneNumber($billingAddressEntity->getPhone()); //$personalContainer->setLanguage($billingAddressEntity->getLanguage()); //$personalContainer->setVatId($billingAddressEntity->getVatId()); //$personalContainer->setGender($billingAddressEntity->getGender()); //$personalContainer->setPersonalid($billingAddressEntity->getPersonalId()); //$personalContainer->setIp($billingAddressEntity->getIp()); }
/** * @return \Orm\Zed\Sales\Persistence\SpySalesOrderAddress */ protected function createBillingAddress() { $billingAddressEntity = new SpySalesOrderAddress(); $countryEntity = $this->getCountryEntity(); $billingAddressEntity->setCountry($countryEntity); $billingAddressEntity->setSalutation(SpySalesOrderAddressTableMap::COL_SALUTATION_MR); $billingAddressEntity->setFirstName('FirstName'); $billingAddressEntity->setLastName('LastName'); $billingAddressEntity->setAddress1('Address1'); $billingAddressEntity->setAddress2('Address2'); $billingAddressEntity->setCity('City'); $billingAddressEntity->setZipCode('12345'); $billingAddressEntity->save(); return $billingAddressEntity; }