示例#1
0
 public function testReturn()
 {
     $order = Cart::getOrder();
     $order->createReturn(array("items" => array(array("identifier" => 2, "quantity" => 1)), "note" => "Client not satisfied with quality"));
     $this->assertEquals(70, $order->getAmountItemsSubTotal());
     $this->assertEquals(27, $order->getAmountDiscounts());
     $this->assertEquals(43, $order->getAmountSubTotal());
 }
示例#2
0
 public function testBoth()
 {
     $order = Cart::getOrder();
     $item = $order->addItem(array("name" => "test product", "description" => "Product description...", "price" => 100, "quantity" => 1, "taxable" => true, "identifier" => 1));
     $order->editShippingAddress(TestFactory::createQuebecAddress());
     $order->addDiscountCode(array("amount" => 5, "title" => "Promo 5 dollars", "type" => OrderDiscountCode::TYPE_FIXED));
     $order->addDiscountCode(array("amount" => 10, "title" => "Promo 10%", "type" => OrderDiscountCode::TYPE_PERCENT));
     $this->assertEquals(15, Cart::getOrder()->getAmountDiscounts());
     $this->assertEquals(85, Cart::getOrder()->getAmountSubTotal());
 }
示例#3
0
 public function testTypeHarmonized()
 {
     $order = Cart::getOrder();
     $item = $order->addItem(array("name" => "test product", "description" => "Product description...", "price" => 100, "quantity" => 1, "taxable" => true, "identifier" => 1));
     $order->editShippingAddress(TestFactory::createOntarioAddress());
     $GST = $order->getTaxByTitle("GST");
     $HST = $order->getTaxByTitle("HST");
     $this->assertEquals(0, $GST->getAmount());
     $this->assertEquals(13, $HST->getAmount());
     $this->assertEquals(13, $order->getAmountTaxes());
     $this->assertEquals(13, $item->getAmountTaxes());
 }
示例#4
0
 public function testFixed()
 {
     $order = Cart::getOrder();
     $item = $order->addItem(array("name" => "test product", "description" => "Product description...", "price" => 100, "quantity" => 1, "taxable" => true, "identifier" => 1));
     $item2 = $order->addItem(array("name" => "test product 2", "description" => "Product description...", "price" => 50, "quantity" => 2, "taxable" => true, "identifier" => 2));
     $order->editShippingAddress(TestFactory::createQuebecAddress());
     $this->assertEquals(200, Cart::getOrder()->getAmountSubTotal());
     $order->createReturn(array("items" => array(array("identifier" => 2, "quantity" => 1)), "note" => "Client not satisfied with quality"));
     $this->assertEquals(150, Cart::getOrder()->getAmountSubTotal());
     $order->createReturn(array("items" => array(array("identifier" => 1, "quantity" => 1)), "note" => "Client not satisfied with quality"));
     $this->assertEquals(50, Cart::getOrder()->getAmountSubTotal());
     $this->setExpectedException('Exception', '', Order::EXCEPTION_RETURN_ITEM_QUANTITY);
     $order->createReturn(array("items" => array(array("identifier" => 2, "quantity" => 2)), "note" => "Client not satisfied with quality"));
 }
示例#5
0
 public function testTotal()
 {
     $this->assertEquals(31003.01, Cart::getOrder()->getAmountTotal());
 }