/** * @param DeliveryInterface $delivery * @param ExtractorResult $extractorResult */ private function copyValue(DeliveryInterface $delivery, ExtractorResult $extractorResult) { switch ($extractorResult->getPropertyName()) { case TransformerProperties::DELIVERY_RECIPIENT_PHONE: $delivery->setRecipientPhone($extractorResult->getValue()); break; case TransformerProperties::DELIVERY_RECIPIENT_NAME: $delivery->setRecipientName($extractorResult->getValue()); break; case TransformerProperties::DELIVERY_RECIPIENT_EMAIL: $delivery->setRecipientEmail($extractorResult->getValue()); break; case TransformerProperties::DELIVERY_POSTAL_CODE: $delivery->setPostalCode($extractorResult->getValue()); break; case TransformerProperties::DELIVERY_CITY: $delivery->setCity($extractorResult->getValue()); break; case TransformerProperties::DELIVERY_COUNTRY_CODE: $delivery->setCountryCode($extractorResult->getValue()); break; case TransformerProperties::DELIVERY_NAME: $delivery->setName($extractorResult->getValue()); break; case TransformerProperties::DELIVERY_STREET: $delivery->setStreet($extractorResult->getValue()); break; default: } }
/** * @param ProductInterface $product * @param ExtractorResult $extractionResult */ private function transformParameter(ProductInterface $product, ExtractorResult $extractionResult) { switch ($extractionResult->getPropertyName()) { case TransformerProperties::PRODUCT_UNIT_PRICE: $product->setUnitPrice($extractionResult->getValue()); break; case TransformerProperties::PRODUCT_QUANTITY: $product->setQuantity($extractionResult->getValue()); break; case TransformerProperties::PRODUCT_NAME: $product->setName($extractionResult->getValue()); break; default: } }
/** * @param OrderInterface $order * @param ExtractorResult $extractorResult */ private function copyValue(OrderInterface $order, ExtractorResult $extractorResult) { switch ($extractorResult->getPropertyName()) { case TransformerProperties::URLS_NOTIFY: $order->setNotifyUrl($extractorResult->getValue()); break; case TransformerProperties::URLS_CONTINUE: $order->setContinueUrl($extractorResult->getValue()); break; case TransformerProperties::URLS_ORDER: $order->setOrderUrl($extractorResult->getValue()); break; default: } }
/** * @param ShippingMethodInterface $shippingMethod * @param ExtractorResult $extractorResult */ protected function copyValue(ShippingMethodInterface $shippingMethod, ExtractorResult $extractorResult) { switch ($extractorResult->getPropertyName()) { case TransformerProperties::SHIPPING_METHOD_NAME: $shippingMethod->setName($extractorResult->getValue()); break; case TransformerProperties::SHIPPING_METHOD_PRICE: $shippingMethod->setPrice($extractorResult->getValue()); break; case TransformerProperties::SHIPPING_METHOD_COUNTRY: $shippingMethod->setCountry($extractorResult->getValue()); break; default: } }
/** * @param BuyerInterface $buyer * @param ExtractorResult $extractorResult */ private function copyValue(BuyerInterface $buyer, ExtractorResult $extractorResult) { switch ($extractorResult->getPropertyName()) { case TransformerProperties::BUYER_EMAIL: $buyer->setEmail($extractorResult->getValue()); break; case TransformerProperties::BUYER_PHONE: $buyer->setPhone($extractorResult->getValue()); break; case TransformerProperties::BUYER_FIRST_NAME: $buyer->setFirstName($extractorResult->getValue()); break; case TransformerProperties::BUYER_LAST_NAME: $buyer->setLastName($extractorResult->getValue()); break; default: } }
/** * @inheritdoc */ public function transform(OrderInterface $order, ExtractorResult $extractorResult) { $this->copyValue($order, $extractorResult->getPropertyName(), $extractorResult->getValue()); }
public function it_should_get_property_name_from_extractor(OrderInterface $order, ExtractorResult $extractorResult) { $extractorResult->getPropertyName()->shouldBeCalled(); $this->transform($order, $extractorResult); }
/** * @inheritdoc */ public function transform(OrderInterface $order, ExtractorResult $extractorResult) { $this->copyValue($order->getBuyer()->getInvoice(), $extractorResult->getPropertyName(), $extractorResult->getValue())->copyRecipientValue($order->getBuyer()->getInvoice(), $extractorResult->getPropertyName(), $extractorResult->getValue()); }
/** * @param ExtractorResult $extractorResult * @param object $object */ private function logExtractedResult(ExtractorResult $extractorResult, $object) { $this->logger->debug(sprintf('Successfully extracted parameter %s with value "%s" from object %s', $extractorResult->getPropertyName(), print_r($extractorResult->getValue(), true), get_class($object))); }