public function testSupports() { $signature = new SignatureStrategy($this->getSignatureCalculator()); $this->assertTrue($signature->supports($order = new Order())); $order->setSignature(self::SIGNATURE); $this->assertFalse($signature->supports($order)); }
public function testSupport() { $merchant = new MerchantPosIdStrategy(); $this->assertTrue($merchant->supports($order = new Order())); $order->setMerchantPosId('123'); $this->assertFalse($merchant->supports($order)); }
public function testSupport() { $customer = new CustomerIpStrategy(); $this->assertTrue($customer->supports($order = new Order())); $order->setCustomerIp('123'); $this->assertFalse($customer->supports($order)); }
public function testRespectingSupportMethod() { $autocomplete = new OrderAutocomplete($this->getLogger()); $autocomplete->addStrategy($this->getStrategy(false)); $autocomplete->autocomplete($order = new Order(), $this->configuration); $this->assertNull($order->getOrderId()); }
public function testParameters() { $order = new Order(); $order->setPayUOrderId(self::PAYU_ORDER_ID); $orderStatusRequest = new OrderRetrieveRequest($order); $this->assertNotEmpty($orderStatusRequest->getDataObject()); $this->assertEquals(sprintf('orders/%s', self::PAYU_ORDER_ID), $orderStatusRequest->getPath()); $this->assertEquals('GET', $orderStatusRequest->getMethod()); }
public function testParameters() { $order = new Order(); $order->setOrderId(self::ORDER_ID); $requestStatus = new RequestStatus(); $requestStatus->setCode(self::STATUS_CODE); $requestStatus->setDescription(self::DESCRIPTION); $orderStatusResponse = new OrderRetrieveResponse(); $orderStatusResponse->setOrders([$order]); $orderStatusResponse->setRequestStatus($requestStatus); $this->assertEquals(1, $orderStatusResponse->getOrdersCount()); $this->assertEquals(self::ORDER_ID, $orderStatusResponse->getFirstOrder()->getOrderId()); $this->assertTrue(is_array($orderStatusResponse->getOrders())); $this->assertCount(1, $orderStatusResponse->getOrders()); }
/** * @return OrderInterface */ private function getOrder() { $order = new Order(); $order->setPayUOrderId(self::PAYU_ORDER_ID); return $order; }
/** * Will return initialized order with parameters taken from * {@link http://developers.payu.com/pl/restapi.html#payment_form} * @return Order */ private function getOrder() { $order = new Order(); $order->setCustomerIp('123.123.123.123'); $order->setMerchantPosId('145227'); $order->setDescription('Order description'); $order->setTotalAmount(new Money(10)); /** * Documentation was mistaken in currency code. * Correct code was taken from {@link http://jsfiddle.net/FDrsF/177/} */ $order->setCurrencyCode('PLN'); $order->setContinueUrl('http://localhost/continue'); $order->setNotifyUrl('http://shop.url/notify.json'); $order->getProductCollection()->addProduct((new Product())->setName('Product 1')->setUnitPrice(new Money(10))->setQuantity(1)); return $order; }
public function testSetters() { $order = new Order(); $order->setBuyer(new Buyer()); $this->assertInstanceOf('Team3\\PayU\\Order\\Model\\Buyer\\BuyerInterface', $order->getBuyer()); $order->setProductCollection(new ProductCollection()); $this->assertInstanceOf('Team3\\PayU\\Order\\Model\\Products\\ProductCollectionInterface', $order->getProductCollection()); $order->setShippingMethodCollection(new ShippingMethodCollection()); $this->assertInstanceOf('Team3\\PayU\\Order\\Model\\ShippingMethods\\ShippingMethodCollectionInterface', $order->getShippingMethodCollection()); $order->setStatus(new OrderStatus()); $this->assertInstanceOf('Team3\\PayU\\Order\\Model\\OrderStatus', $order->getStatus()); $order->setShippingMethodCollectionFromDeserialization([new ShippingMethod(), new ShippingMethod()]); $this->assertCount(2, $order->getShippingMethodCollection()); $this->assertInstanceOf('Team3\\PayU\\Order\\Model\\ShippingMethods\\ShippingMethodCollection', $order->getShippingMethodCollection()); $order->setCreatedAt(new \DateTime(self::CREATED_AT)); $this->assertInstanceOf('\\DateTime', $order->getCreatedAt()); $this->assertEquals(self::CREATED_AT, $order->getCreatedAt()->format(self::CREATED_AT_FORMAT)); }
/** * @return Order */ private function getOrder() { $order = new Order(); $order->getProductCollection()->addProduct((new Product())->setUnitPrice(new Money(10))->setQuantity(3))->addProduct((new Product())->setUnitPrice(new Money(5))->setQuantity(2)); return $order; }