public function test_DeliverOrdersRequest_on_open_order_returns_accepted_true() { // create order $country = "SE"; $order = TestUtil::createOrder(TestUtil::createIndividualCustomer($country)); $orderResponse = $order->useInvoicePayment()->doRequest(); ////print_r( $orderResponse ); $this->assertEquals(1, $orderResponse->accepted); $myOrderId = $orderResponse->sveaOrderId; // deliver order $DeliverOrderBuilder = new Svea\DeliverOrderBuilder(Svea\SveaConfig::getDefaultConfig()); $DeliverOrderBuilder->setCountryCode($country); $DeliverOrderBuilder->setOrderId($myOrderId); $DeliverOrderBuilder->setInvoiceDistributionType(DistributionType::POST); $DeliverOrderBuilder->orderType = ConfigurationProvider::INVOICE_TYPE; $request = new Svea\AdminService\DeliverOrdersRequest($DeliverOrderBuilder); $response = $request->doRequest(); ////print_r( $response ); $this->assertInstanceOf('Svea\\AdminService\\DeliverordersResponse', $response); $this->assertEquals(true, $response->accepted); // truth $this->assertEquals(1, $response->accepted); // equals literal 1 $this->assertEquals(0, $response->resultcode); $this->assertEquals(250.0, $response->amount); $this->assertEquals("Invoice", $response->orderType); $this->assertNotNull($response->invoiceId); $this->assertNull($response->contractNumber); }
/** * @expectedException Svea\ValidationException * @expectedExceptionMessage No rows has been included. Use function beginOrderRow(), beginShippingfee() or beginInvoiceFee(). * * 2.0 goes directly to DeliverInvoice */ public function testFailOnMissingOrderRowsOnInvoiceDeliver() { $config = Svea\SveaConfig::getDefaultConfig(); $builder = new \Svea\DeliverOrderBuilder($config); $builder->setOrderId('id')->setInvoiceDistributionType('Post'); $object = new \Svea\WebService\DeliverInvoice($builder); $object->prepareRequest(); }