public function testSupport()
 {
     $customer = new CustomerIpStrategy();
     $this->assertTrue($customer->supports($order = new Order()));
     $order->setCustomerIp('123');
     $this->assertFalse($customer->supports($order));
 }
Example #2
0
 public function testValidationConfiguration()
 {
     $invalidOrderValidation = $this->validator->validate(new Order());
     $this->assertCount(6, $invalidOrderValidation);
     $validOrder = new Order();
     $validOrder->setCustomerIp('127.0.0.1')->setCurrencyCode('PLN')->setTotalAmount(new Money(10))->setDescription('Test')->setMerchantPosId('123')->setSignature('123');
     $validOrderValidation = $this->validator->validate($validOrder);
     $this->assertCount(0, $validOrderValidation);
 }
 /**
  * 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;
 }