예제 #1
0
 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));
 }
 /**
  * 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;
 }
 /**
  * @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;
 }