/** * @param OrderInterface $order * * @return UserOrderTransformerStrategyInterface */ private function getStrategy(OrderInterface $order) { $strategy = $this->getMock('\\Team3\\PayU\\Order\\Transformer\\UserOrder\\Strategy\\UserOrderTransformerStrategyInterface'); $strategy->expects($this->any())->method('supports')->withAnyParameters()->willReturn(true); $strategy->expects($this->any())->method('transform')->willReturnCallback(function (OrderInterface $order, $extractorResult) use($order) { $order->setOrderId(self::ORDER_ID); }); return $strategy; }
/** * @inheritdoc */ public function transform(OrderInterface $order, ExtractorResult $extractorResult) { $usersProductCollection = $extractorResult->getValue(); $this->checkProductCollection($usersProductCollection); foreach ($usersProductCollection as $userProduct) { $order->getProductCollection()->addProduct($this->singleProductTransformer->transform($userProduct)); } return $order; }
/** * @inheritdoc */ public function transform(OrderInterface $order, ExtractorResult $extractorResult) { /** @var \Traversable $shippingMethodCollection */ $shippingMethodCollection = $extractorResult->getValue(); $this->checkCollection($shippingMethodCollection); foreach ($shippingMethodCollection as $usersShippingMethod) { $order->getShippingMethodCollection()->addShippingMethod($this->singleShippingMethodTransformer->transform($usersShippingMethod)); } }
public function it_should_call_helper(SingleShippingMethodTransformer $singleShippingMethodTransformer, ExtractorResult $extractorResult, OrderInterface $order, \stdClass $usersShippingMethod) { $extractorResult->getValue()->willReturn([$usersShippingMethod]); $extractorResult->getValue()->shouldBeCalledTimes(1); $order->getShippingMethodCollection()->willReturn(new ShippingMethodCollection()); $order->getShippingMethodCollection()->shouldBeCalledTimes(1); $singleShippingMethodTransformer->transform($usersShippingMethod)->willReturn(new ShippingMethod()); $singleShippingMethodTransformer->transform($usersShippingMethod)->shouldBeCalledTimes(1); $this->transform($order, $extractorResult); }
/** * @param OrderInterface $order * @param $propertyName * @param $value */ private function copyValue(OrderInterface $order, $propertyName, $value) { switch ($propertyName) { case TransformerProperties::GENERAL_CUSTOMER_IP: $order->setCustomerIp($value); break; case TransformerProperties::GENERAL_ORDER_ID: $order->setOrderId($value); break; case TransformerProperties::GENERAL_ADDITIONAL_DESC: $order->setAdditionalDescription($value); break; case TransformerProperties::GENERAL_CURRENCY_CODE: $order->setCurrencyCode($value); break; case TransformerProperties::GENERAL_DESCRIPTION: $order->setDescription($value); break; case TransformerProperties::GENERAL_MERCHANT_POS_ID: $order->setMerchantPosId($value); break; case TransformerProperties::GENERAL_SIGNATURE: $order->setSignature($value); break; case TransformerProperties::GENERAL_TOTAL_AMOUNT: $order->setTotalAmount($value); 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 OrderInterface $order */ public function __construct(OrderInterface $order) { $this->data = $order; $this->path = sprintf('orders/%s', $order->getPayUOrderId()); }
/** * @param OrderInterface $order * @param ConfigurationInterface $configuration */ public function autocomplete(OrderInterface $order, ConfigurationInterface $configuration) { $order->setCustomerIp(getenv('REMOTE_ADDR')); }
public function let(OrderInterface $order, BuyerInterface $buyer, DeliveryInterface $delivery) { $order->getBuyer()->willReturn($buyer); $buyer->getDelivery()->willReturn($delivery); }
/** * @param OrderInterface $order * @param string $signature */ private function logCalculatedSignature(OrderInterface $order, $signature) { $this->logger->debug(sprintf('Signature for order with id %s was calculated to "%s"', $order->getOrderId(), $signature)); }
/** * @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()); }
/** * @inheritdoc */ public function transform(OrderInterface $order, ExtractorResult $extractorResult) { $this->copyValue($order->getBuyer(), $extractorResult); }
public function it_should_get_buyer_from_order(OrderInterface $order, ExtractorResult $extractorResult) { $order->getBuyer()->shouldBeCalledTimes(1); $this->transform($order, $extractorResult); }
/** * @param OrderInterface $order * @param string $description * @param string|null $bankDescription * @param MoneyInterface|null $amount */ public function __construct(OrderInterface $order, $description, $bankDescription = null, MoneyInterface $amount = null) { $this->orderId = $order->getOrderId(); $this->refund = new RefundModel($description, $bankDescription, $amount); }
protected function _before() { $this->serializer = new Serializer(SerializerBuilder::create()->build(), new GroupsSpecifier($this->getLogger()), $this->getLogger()); $this->order = new Order(); $this->order->setMerchantPosId(123)->setDescription('test')->setContinueUrl('test')->setCustomerIp('127.0.0.1')->setOrderId('123'); }
/** * @param OrderInterface $order * @param AutocompleteStrategyInterface $strategy */ private function logAutocompletion(OrderInterface $order, AutocompleteStrategyInterface $strategy) { $this->logger->info(sprintf('Order with ID %s parameters were autocompleted by %s', $order->getOrderId(), get_class($strategy)), ['order' => $order, 'strategy' => $strategy]); }
/** * @param OrderInterface $order * @param ConfigurationInterface $configuration */ public function autocomplete(OrderInterface $order, ConfigurationInterface $configuration) { $order->setTotalAmount($this->getProductsCost($order->getProductCollection())); }
/** * @param OrderInterface $order * @param ConfigurationInterface $configuration */ public function autocomplete(OrderInterface $order, ConfigurationInterface $configuration) { $order->setMerchantPosId($configuration->getCredentials()->getMerchantPosId()); }
/** * @param OrderInterface $order * @param ConfigurationInterface $configuration */ public function autocomplete(OrderInterface $order, ConfigurationInterface $configuration) { $order->setSignature($this->getSignature($order, $configuration)); }
/** * @param OrderInterface $order */ private function logSpecifiedGroups(OrderInterface $order) { $this->logger->debug(sprintf('Serialization groups for order %s were specified to %s', $order->getOrderId(), print_r($this->groups, true))); }