コード例 #1
0
 public function test_createOrder_usePayPage_redirects_to_paypage()
 {
     $config = Svea\SveaConfig::getDefaultConfig();
     $rowFactory = new TestUtil();
     $form = WebPay::createOrder($config)->addOrderRow(TestUtil::createOrderRow())->run($rowFactory->buildShippingFee())->addDiscount(WebPayItem::relativeDiscount()->setDiscountId("1")->setDiscountPercent(50)->setUnit("st")->setName('Relative')->setDescription("RelativeDiscount"))->setCountryCode("SE")->setClientOrderNumber("foobar" . date('c'))->setOrderDate("2012-12-12")->setCurrency("SEK")->usePayPage()->setReturnUrl("http://myurl.se")->getPaymentForm();
     $url = "https://test.sveaekonomi.se/webpay/payment";
     /** CURL  **/
     $fields = array('merchantid' => urlencode($form->merchantid), 'message' => urlencode($form->xmlMessageBase64), 'mac' => urlencode($form->mac));
     $fieldsString = "";
     foreach ($fields as $key => $value) {
         $fieldsString .= $key . '=' . $value . '&';
     }
     rtrim($fieldsString, '&');
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, count($fields));
     curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsString);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     // follow redirects
     curl_setopt($ch, CURLOPT_HEADER, true);
     // include headers in transfer history
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // return transfer history
     $cr = curl_exec($ch);
     $info = curl_getinfo($ch);
     curl_close($ch);
     //print_r( $cr);
     $this->assertEquals(200, $info['http_code']);
     $this->assertEquals(2, $info['redirect_count']);
     $expected_infourl = "https://test.sveaekonomi.se/webpay/public/static/paypage.html";
     $start_of_actual_infourl = substr($info['url'], 0, strlen($expected_infourl));
     $this->assertEquals($expected_infourl, $start_of_actual_infourl);
 }
コード例 #2
0
 public function testpayPagePaymentIncludePaymentMethods()
 {
     $config = SveaConfig::getDefaultConfig();
     $rowFactory = new \TestUtil();
     $form = \WebPay::createOrder($config)->addOrderRow(\TestUtil::createOrderRow())->run($rowFactory->buildShippingFee())->addDiscount(\WebPayItem::relativeDiscount()->setDiscountId("1")->setDiscountPercent(50)->setUnit("st")->setName('Relative')->setDescription("RelativeDiscount"))->addCustomerDetails(\WebPayItem::individualCustomer()->setNationalIdNumber(194605092222))->setCountryCode("SE")->setClientOrderNumber("33")->setOrderDate("2012-12-12")->setCurrency("SEK")->usePayPage()->setReturnUrl("http://myurl.se")->includePaymentMethods(\PaymentMethod::KORTCERT, \PaymentMethod::SKRILL)->getPaymentForm();
     $xmlMessage = new \SimpleXMLElement($form->xmlMessage);
     //check to see if the first value is one of the excluded ones
     $this->assertEquals(SystemPaymentMethod::BANKAXESS, $xmlMessage->excludepaymentmethods->exclude[0]);
 }
コード例 #3
0
 public function testBuildOrderWithInvoicefee()
 {
     $rowFactory = new \TestUtil();
     $config = SveaConfig::getDefaultConfig();
     $sveaRequest = \WebPay::createOrder($config)->addOrderRow(\TestUtil::createOrderRow())->run($rowFactory->buildInvoiceFee());
     $this->assertEquals("Svea fee", $sveaRequest->invoiceFeeRows[0]->name);
     $this->assertEquals("Fee for invoice", $sveaRequest->invoiceFeeRows[0]->description);
     $this->assertEquals(50, $sveaRequest->invoiceFeeRows[0]->amountExVat);
     $this->assertEquals("st", $sveaRequest->invoiceFeeRows[0]->unit);
     $this->assertEquals(25, $sveaRequest->invoiceFeeRows[0]->vatPercent);
     $this->assertEquals(0, $sveaRequest->invoiceFeeRows[0]->discountPercent);
 }
コード例 #4
0
 /**
  * @expectedException Svea\ValidationException
  * @expectedExceptionMessage -missing value : InvoiceDistributionType is required for deliverInvoiceOrder. Use function setInvoiceDistributionType().
  */
 public function testFailOnMissingInvoiceDetailsOnInvoiceDeliver()
 {
     $config = Svea\SveaConfig::getDefaultConfig();
     $builder = WebPay::deliverOrder($config);
     $object = $builder->addOrderRow(TestUtil::createOrderRow())->addFee(WebPayItem::shippingFee()->setShippingId('33')->setName('shipping')->setDescription("Specification")->setAmountExVat(50)->setUnit("st")->setVatPercent(25)->setDiscountPercent(0))->setOrderId('id')->deliverInvoiceOrder();
     $object->prepareRequest();
 }
コード例 #5
0
 public function testOrderWithSEConfigFromFunction()
 {
     $request = \WebPay::createOrder(SveaConfig::getTestConfig())->addOrderRow(\TestUtil::createOrderRow())->addCustomerDetails(\WebPayItem::individualCustomer()->setNationalIdNumber(194605092222))->setCountryCode("SE")->setCustomerReference("33")->setOrderDate("2012-12-12")->setCurrency("SEK")->useInvoicePayment()->prepareRequest();
     $this->assertEquals("sverigetest", $request->request->Auth->Username);
     $this->assertEquals("sverigetest", $request->request->Auth->Password);
     $this->assertEquals(79021, $request->request->Auth->ClientNumber);
 }
コード例 #6
0
 protected function setUp()
 {
     if (!isset(self::$_sharedConn)) {
         self::$_sharedConn = TestUtil::getConnection();
     }
     $this->_conn = self::$_sharedConn;
 }
コード例 #7
0
 public function testPaymentPlanRequestReturnsAcceptedResult()
 {
     $config = Svea\SveaConfig::getDefaultConfig();
     $campaigncode = TestUtil::getGetPaymentPlanParamsForTesting();
     $request = WebPay::createOrder($config)->addOrderRow(WebPayItem::orderRow()->setArticleNumber("1")->setQuantity(2)->setAmountExVat(1000.0)->setDescription("Specification")->setName('Prod')->setUnit("st")->setVatPercent(25)->setDiscountPercent(0))->addCustomerDetails(WebPayItem::individualCustomer()->setNationalIdNumber(194605092222)->setInitials("SB")->setBirthDate(1923, 12, 12)->setName("Tess", "Testson")->setEmail("test@svea.com")->setPhoneNumber(999999)->setIpAddress("123.123.123")->setStreetAddress("Gatan", 23)->setCoAddress("c/o Eriksson")->setZipCode(9999)->setLocality("Stan"))->setCountryCode("SE")->setCustomerReference("33")->setClientOrderNumber("nr26")->setOrderDate("2012-12-12")->setCurrency("SEK")->usePaymentPlanPayment($campaigncode)->doRequest();
     $this->assertEquals(1, $request->accepted);
 }
コード例 #8
0
 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);
 }
 public function test_deliver_multiple_invoice_orderRows_returns_accepted_with_invoiceId()
 {
     // create order
     $country = "SE";
     $order = TestUtil::createOrder(TestUtil::createIndividualCustomer($country))->addOrderRow(WebPayItem::orderRow()->setDescription("second row")->setQuantity(1)->setAmountExVat(16.0)->setVatPercent(25))->addOrderRow(WebPayItem::orderRow()->setDescription("third row")->setQuantity(1)->setAmountExVat(24.0)->setVatPercent(25));
     $orderResponse = $order->useInvoicePayment()->doRequest();
     ////print_r( $orderResponse );
     $this->assertEquals(1, $orderResponse->accepted);
     $myOrderId = $orderResponse->sveaOrderId;
     // deliver first row in order
     $deliverOrderRowsRequest = WebPayAdmin::deliverOrderRows(Svea\SveaConfig::getDefaultConfig());
     $deliverOrderRowsRequest->setCountryCode($country);
     $deliverOrderRowsRequest->setOrderId($myOrderId);
     $deliverOrderRowsRequest->setInvoiceDistributionType(DistributionType::POST);
     $deliverOrderRowsRequest->setRowsToDeliver(array(1, 2));
     $deliverOrderRowsResponse = $deliverOrderRowsRequest->deliverInvoiceOrderRows()->doRequest();
     ////print_r( $deliverOrderRowsResponse );
     $this->assertInstanceOf('Svea\\AdminService\\DeliverPartialResponse', $deliverOrderRowsResponse);
     $this->assertEquals(true, $deliverOrderRowsResponse->accepted);
     // truth
     $this->assertEquals(1, $deliverOrderRowsResponse->accepted);
     // equals literal 1
     $this->assertEquals(0, $deliverOrderRowsResponse->resultcode);
     $this->assertEquals(270.0, $deliverOrderRowsResponse->amount);
     $this->assertEquals("Invoice", $deliverOrderRowsResponse->orderType);
     $this->assertNotNull($deliverOrderRowsResponse->invoiceId);
 }
コード例 #10
0
 public function testPaymentMethodInvoiceNLCallbackUrl()
 {
     $config = SveaConfig::getDefaultConfig();
     $form = \WebPay::createOrder($config)->addOrderRow(\TestUtil::createOrderRow())->addCustomerDetails(\WebPayItem::individualCustomer()->setInitials("SB")->setBirthDate(1923, 12, 12)->setName("Sneider", "Boasman")->setEmail("test@svea.com")->setPhoneNumber(999999)->setIpAddress("123.123.123")->setStreetAddress("Gatan", 23)->setCoAddress("c/o Eriksson")->setZipCode(9999)->setLocality("Stan"))->setCountryCode("NL")->setClientOrderNumber("33")->setOrderDate("2012-12-12")->setCurrency("SEK")->usePaymentMethod(\PaymentMethod::INVOICE)->setReturnUrl("http://myurl.se")->setCallbackUrl("http://myurl.se")->getPaymentForm();
     $xmlMessage = new \SimpleXMLElement($form->xmlMessage);
     $this->assertEquals("http://myurl.se", $xmlMessage->callbackurl);
 }
コード例 #11
0
 public function test_setPayPageLanguage_with_recognised_language()
 {
     $orderLanguage = "sv";
     $order = \TestUtil::createOrder();
     $payment = $order->usePaymentMethod(\PaymentMethod::KORTCERT)->setPayPageLanguage($orderLanguage);
     $this->assertEquals($orderLanguage, $payment->langCode);
 }
コード例 #12
0
 /**
  * Creates a connection to the test database, if there is none yet, and
  * creates the necessary tables.
  */
 protected function setUp()
 {
     $forceCreateTables = false;
     if (!isset($this->sharedFixture['conn'])) {
         $this->sharedFixture['conn'] = TestUtil::getConnection();
         if ($this->sharedFixture['conn']->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
             $forceCreateTables = true;
         }
     }
     if (!$this->_em) {
         $this->_em = $this->_getEntityManager();
         $this->_schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em);
     }
     $classes = array();
     foreach ($this->_usedModelSets as $setName => $bool) {
         if (!isset(self::$_tablesCreated[$setName]) || $forceCreateTables) {
             foreach (self::$_modelSets[$setName] as $className) {
                 $classes[] = $this->_em->getClassMetadata($className);
             }
             self::$_tablesCreated[$setName] = true;
         }
     }
     if ($classes) {
         try {
             $this->_schemaTool->createSchema($classes);
         } catch (\Exception $e) {
             // Suppress "xxx already exists" messages
             if (stripos($e->getMessage(), 'already exists') === false) {
                 throw $e;
             }
         }
     }
 }
コード例 #13
0
ファイル: DebugBuilderTest.php プロジェクト: trashtoy/peach2
 /**
  * コンストラクタ引数に false を指定して DebugBuilder を初期化した場合,
  * 自動 echo がされないことを確認します.
  * 
  * @covers Peach\Markup\DebugBuilder::__construct
  * @covers Peach\Markup\DebugBuilder::build
  * @covers Peach\Markup\DebugBuilder::createContext
  * @covers Peach\Markup\Context::handle
  */
 public function testBuildNotEcho()
 {
     $builder = new DebugBuilder(false);
     $node = TestUtil::getTestNode();
     $expected = TestUtil::getDebugBuildResult();
     $this->expectOutputString("");
     $this->assertSame($expected, $builder->build($node));
 }
コード例 #14
0
 public function testBuildDirectBankPaymentCallBackUrl()
 {
     $config = SveaConfig::getDefaultConfig();
     $rowFactory = new \TestUtil();
     $form = \WebPay::createOrder($config)->addOrderRow(\TestUtil::createOrderRow())->addCustomerDetails(\WebPayItem::individualCustomer()->setNationalIdNumber(194605092222))->setCountryCode("SE")->setClientOrderNumber("33")->setOrderDate("2012-12-12")->setCurrency("SEK")->usePayPageDirectBankOnly()->setReturnUrl("http://myurl.se")->setCallbackUrl("http://myurl.se")->getPaymentForm();
     $xmlMessage = new \SimpleXMLElement($form->xmlMessage);
     $this->assertEquals("http://myurl.se", $xmlMessage->callbackurl);
 }
コード例 #15
0
ファイル: HtmlTest.php プロジェクト: trashtoy/peach2
 /**
  * getBuilder() のテストです.
  * 返り値の Builder に対する変更が, グローバル Helper に適用されることを確認します.
  * 
  * @covers Peach\Markup\Html::getBuilder
  */
 public function testGetBuilder()
 {
     $builder = Html::getBuilder();
     $builder->setRenderer("html");
     $builder->setIndent(new Indent(0, "  ", Indent::LF));
     $result = Html::tag(TestUtil::getTestNode())->write();
     $this->assertSame(TestUtil::getCustomBuildResult(), $result);
 }
コード例 #16
0
 function test_CancelOrderBuilder_PaymentPlan_success()
 {
     $country = "SE";
     $order = TestUtil::createOrder(TestUtil::createIndividualCustomer($country))->addOrderRow(WebPayItem::orderRow()->setQuantity(1)->setAmountExVat(1000.0)->setVatPercent(25));
     $orderResponse = $order->usePaymentPlanPayment(TestUtil::getGetPaymentPlanParamsForTesting())->doRequest();
     $this->assertEquals(1, $orderResponse->accepted);
     $cancelResponse = WebPayAdmin::cancelOrder(Svea\SveaConfig::getDefaultConfig())->setOrderId($orderResponse->sveaOrderId)->setCountryCode($country)->cancelPaymentPlanOrder()->doRequest();
     $this->assertEquals(1, $cancelResponse->accepted);
 }
コード例 #17
0
 protected function setUp()
 {
     if (!isset(self::$_sharedConn)) {
         self::$_sharedConn = TestUtil::getConnection();
     }
     $this->_conn = self::$_sharedConn;
     $this->_sqlLoggerStack = new \Doctrine\DBAL\Logging\DebugStack();
     $this->_conn->getConfiguration()->setSQLLogger($this->_sqlLoggerStack);
 }
コード例 #18
0
ファイル: DebugContextTest.php プロジェクト: trashtoy/peach2
 /**
  * getResult() のテストです.
  * 各ノードのクラス名とその入れ子構造が出力されることを確認します.
  * 
  * @covers Peach\Markup\DebugContext::getResult
  */
 public function testGetResult()
 {
     $expected = TestUtil::getDebugBuildResult();
     $node = TestUtil::getTestNode();
     $context = $this->object;
     $this->expectOutputString($expected);
     $context->handle($node);
     $this->assertSame($expected, $context->getResult());
 }
コード例 #19
0
 protected function setUp()
 {
     if (isset($this->sharedFixture['conn'])) {
         $this->_conn = $this->sharedFixture['conn'];
     } else {
         if (!isset(self::$_sharedConn)) {
             self::$_sharedConn = TestUtil::getConnection();
         }
         $this->_conn = self::$_sharedConn;
     }
 }
コード例 #20
0
 /**
  * @depends testSetup
  */
 function testPutStream()
 {
     $children = $this->calendar->getChildren();
     $this->assertTrue($children[0] instanceof CalendarObject);
     $newData = TestUtil::getTestCalendarData();
     $stream = fopen('php://temp', 'r+');
     fwrite($stream, $newData);
     rewind($stream);
     $children[0]->put($stream);
     $this->assertEquals($newData, $children[0]->get());
 }
コード例 #21
0
 public function testGetRequests()
 {
     global $SINGLESTEP_REQUESTS;
     $this->tempDir = TestUtil::extractToTemp(__DIR__ . "/data/singlestepResults.zip");
     if (!$this->tempDir) {
         $this->fail("Failed to extract results to temp dir");
     }
     $testPath = $this->tempDir . "/singlestepResults";
     $actualRequests = getRequests("testId", $testPath, 1, 0, $hasSecure, $hasLocations, false, false);
     $this->assertEquals($SINGLESTEP_REQUESTS, $actualRequests);
 }
コード例 #22
0
 public function test_generate_prepareRequest_addOrderRowsSoapRequest()
 {
     // Stop here and mark this test as incomplete.
     $this->markTestIncomplete('run once to generate testdata for prepareRequest_addOrderRowsSoapRequest()');
     // add order rows to builderobject
     $this->builderObject->orderRows[] = TestUtil::createOrderRow(1.0, 1);
     $this->builderObject->orderId = 123456;
     $addOrderRowsRequest = new Svea\AdminService\AddOrderRowsRequest($this->builderObject);
     $addOrderRowsSoapRequest = $addOrderRowsRequest->prepareRequest();
     // used once to get data for addOrderRowsRequest() below
     //print_r( "\ncopy the following to prepareRequest_addOrderRowsSoapRequest:\n\n".serialize($addOrderRowsSoapRequest)."\n\n" );
 }
コード例 #23
0
 public function test_add_new_notes_invoice()
 {
     $config = Svea\SveaConfig::getDefaultConfig();
     $orderResponse = WebPay::createOrder($config)->addOrderRow(WebPayItem::orderRow()->setAmountExVat(145.0)->setVatPercent(24)->setQuantity(1))->addCustomerDetails(TestUtil::createIndividualCustomer("SE"))->setCountryCode("SE")->setOrderDate("2012-12-12")->useInvoicePayment()->doRequest();
     $this->assertEquals(1, $orderResponse->accepted);
     $response = WebPayAdmin::updateOrder($config)->setCountryCode('SE')->setOrderId($orderResponse->sveaOrderId)->setNotes($this->notes)->updateInvoiceOrder()->doRequest();
     $this->assertEquals(1, $response->accepted);
     // query order and assert row totals
     $query2 = WebPayAdmin::queryOrder($config)->setOrderId($orderResponse->sveaOrderId)->setCountryCode('SE')->queryInvoiceOrder()->doRequest();
     $this->assertEquals(1, $query2->accepted);
     $this->assertEquals($this->notes, $query2->notes);
     //print_r($orderResponse->sveaOrderId);
 }
コード例 #24
0
 /**
  * test_confirmTransaction_card_success creates an order using card payment, 
  * pays using card & receives a transaction id, then confirms the transaction
  * 
  * used as acceptance criteria/smoke test for credit transaction feature
  */
 function test_confirmTransaction_card_success()
 {
     // not yet implemented, requires webdriver support
     // Stop here and mark this test as incomplete.
     $this->markTestIncomplete('not yet implemented, requires webdriver support');
     // also, needs to have SUCCESS status set on transaction
     // set up order (from testUtil?)
     $order = TestUtil::createOrder();
     // pay with card, receive transactionId
     $form = $order->UsePaymentMethod(PaymentMethod::KORTCERT)->setReturnUrl("http://myurl.se")->getPaymentForm();
     $url = "https://test.sveaekonomi.se/webpay/payment";
     // do request modeled on CardPaymentIntegrationTest.php
     // make sure the transaction has status AUTHORIZED at Svea
     // confirm transcation using above the transaction transactionId
     // assert response from confirmTransaction equals success
 }
コード例 #25
0
 /** helper function, returns invoice for delivered order with one row, sent with PriceIncludingVat flag set to false */
 public function get_orderInfo_sent_ex_vat($amount, $vat, $quantity, $is_paymentplan = NULL)
 {
     $config = Svea\SveaConfig::getDefaultConfig();
     if ($is_paymentplan) {
         $campaignCode = TestUtil::getGetPaymentPlanParamsForTesting();
     }
     $orderResponse = WebPay::createOrder($config)->addOrderRow(WebPayItem::orderRow()->setAmountExVat($amount)->setVatPercent($vat)->setQuantity($quantity))->addCustomerDetails(TestUtil::createIndividualCustomer("SE"))->setCountryCode("SE")->setOrderDate("2012-12-12");
     if ($is_paymentplan) {
         $orderResponse = $orderResponse->usePaymentPlanPayment($campaignCode)->doRequest();
     }
     $this->assertEquals(1, $orderResponse->accepted);
     if ($is_paymentplan) {
         $deliver = WebPay::deliverOrder($config)->setOrderId($orderResponse->sveaOrderId)->setCountryCode('SE')->deliverPaymentPlanOrder()->doRequest();
     }
     $this->assertEquals(1, $deliver->accepted);
     return new orderToCreditAmount($orderResponse->sveaOrderId, NULL, $deliver->contractNumber);
 }
コード例 #26
0
 function test_UpdateOrderRows_updatePaymentPlanOrderRows_multiple_row_success()
 {
     $country = "SE";
     // create order
     $order = TestUtil::createOrderWithoutOrderRows(TestUtil::createIndividualCustomer($country));
     $order->addOrderRow(WebPayItem::orderRow()->setArticleNumber("1")->setQuantity(1)->setAmountExVat(1000.0)->setVatPercent(25)->setDescription("A Specification")->setName('A Name')->setUnit("st")->setDiscountPercent(0));
     $order->addOrderRow(WebPayItem::orderRow()->setArticleNumber("2")->setQuantity(1)->setAmountExVat(2000.0)->setVatPercent(25)->setDescription("B Specification")->setName('B Name')->setUnit("st")->setDiscountPercent(0));
     $order->addOrderRow(WebPayItem::orderRow()->setArticleNumber("3")->setQuantity(1)->setAmountExVat(3000.0)->setVatPercent(25)->setDescription("C Specification")->setName('C Name')->setUnit("st")->setDiscountPercent(0));
     $orderResponse = $order->usePaymentPlanPayment(TestUtil::getGetPaymentPlanParamsForTesting())->doRequest();
     $this->assertEquals(1, $orderResponse->accepted);
     // update all attributes for a numbered orderRow
     $updateOrderRowsResponse = WebPayAdmin::updateOrderRows(Svea\SveaConfig::getDefaultConfig())->setOrderId($orderResponse->sveaOrderId)->setCountryCode($country)->updateOrderRow(WebPayItem::numberedOrderRow()->setArticleNumber("10")->setQuantity(1)->setAmountExVat(10.0)->setVatPercent(25)->setDescription("K Specification")->setName('K Name')->setUnit("st")->setDiscountPercent(1)->setRowNumber(1)->setStatus(Svea\NumberedOrderRow::ORDERROWSTATUS_NOTDELIVERED))->updateOrderRows(array(WebPayItem::numberedOrderRow()->setArticleNumber("20")->setQuantity(2)->setAmountExVat(20.0)->setVatPercent(25)->setDescription("K2 Specification")->setName('K2 Name')->setUnit("st")->setDiscountPercent(1)->setRowNumber(2)->setStatus(Svea\NumberedOrderRow::ORDERROWSTATUS_NOTDELIVERED), WebPayItem::numberedOrderRow()->setArticleNumber("30")->setQuantity(3)->setAmountExVat(30.0)->setVatPercent(25)->setDescription("K3 Specification")->setName('K3 Name')->setUnit("st")->setDiscountPercent(1)->setRowNumber(3)->setStatus(Svea\NumberedOrderRow::ORDERROWSTATUS_NOTDELIVERED)))->updatePaymentPlanOrderRows()->doRequest();
     ////print_r( $updateOrderRowsResponse );
     ////print_r("test_UpdateOrderRows_updateInvoiceOrderRows_single_row_success: "); //print_r( $orderResponse->sveaOrderId );
     $this->assertEquals(1, $updateOrderRowsResponse->accepted);
     // todo query result & check amounts, description automatically
 }
コード例 #27
0
 public function testWithSinglestepResults()
 {
     $this->tempDir = TestUtil::extractToTemp(__DIR__ . '/data/singlestepResults.zip');
     $resultdir = $this->tempDir . '/singlestepResults';
     $testInfo = TestInfo::fromFiles($resultdir);
     $this->assertTrue($testInfo->isComplete());
     $this->assertTrue($testInfo->isFirstViewOnly());
     $this->assertEquals(1, $testInfo->getRuns());
     $this->assertTrue($testInfo->isRunComplete(1));
     $this->assertFalse($testInfo->isRunComplete(2));
     $this->assertEquals(1, $testInfo->stepsInRun(1));
     $this->assertEquals($resultdir, $testInfo->getRootDirectory());
     // these values are static from a test, but the assertions make sure we don't break the methods
     $this->assertEquals("160620_DQ_7", $testInfo->getId());
     $this->assertEquals("http://www.google.de", $testInfo->getUrl());
     $this->assertEquals("Firefox, Internet Explorer and Chrome - <b>Chrome</b> - <b>Cable</b>", $testInfo->getTestLocation());
     $this->assertEquals("ITERAHH-VBOX-01-192.168.188.112", $testInfo->getTester(1));
 }
 public function test_cancel_multiple_paymentplan_orderRows_()
 {
     // create order
     $country = "SE";
     $campaigncode = TestUtil::getGetPaymentPlanParamsForTesting();
     $order = TestUtil::createOrder(TestUtil::createIndividualCustomer($country))->addOrderRow(WebPayItem::orderRow()->setDescription("second row")->setQuantity(1)->setAmountExVat(1600.0)->setVatPercent(25))->addOrderRow(WebPayItem::orderRow()->setDescription("third row")->setQuantity(1)->setAmountExVat(2400.0)->setVatPercent(25));
     $orderResponse = $order->usePaymentPlanPayment($campaigncode)->doRequest();
     ////print_r( $orderResponse );
     $this->assertEquals(1, $orderResponse->accepted);
     $myOrderId = $orderResponse->sveaOrderId;
     // cancel first row in order
     $cancelOrderRowsRequest = WebPayAdmin::cancelOrderRows(Svea\SveaConfig::getDefaultConfig());
     $cancelOrderRowsRequest->setCountryCode($country);
     $cancelOrderRowsRequest->setOrderId($myOrderId);
     $cancelOrderRowsRequest->setRowsToCancel(array(1, 2));
     $cancelOrderRowsResponse = $cancelOrderRowsRequest->cancelPaymentPlanOrderRows()->doRequest();
     ////print_r( $cancelOrderRowsResponse );
     $this->assertInstanceOf('Svea\\AdminService\\CancelOrderRowsResponse', $cancelOrderRowsResponse);
     $this->assertEquals(1, $cancelOrderRowsResponse->accepted);
 }
コード例 #29
0
 public function testJsonResultArrayGeneration()
 {
     global $SINGLESTEP_JSON_RESULT_ARRAY;
     $this->tempDir = TestUtil::extractToTemp(__DIR__ . '/data/singlestepResults.zip');
     $testInfo = TestInfo::fromFiles($this->tempDir . '/singlestepResults');
     $imitatedPath = $this->imitatedResultPath($testInfo->getId());
     // we need to move the results to a directory structure that equal to the real one.
     // Then, we can go into the parent directory, so the relatece "testRoot" is the same as it would be in production
     // This is important, as during XML generation, some URLs contain the test path
     mkdir($this->tempDir . $imitatedPath, 0777, true);
     rename($this->tempDir . '/singlestepResults', $this->tempDir . $imitatedPath);
     $this->orgDir = getcwd();
     chdir($this->tempDir);
     $testRoot = "." . $imitatedPath;
     $testInfo = TestInfo::fromFiles($testRoot);
     $testResults = TestResults::fromFiles($testInfo);
     $jsonGenerator = new JsonResultGenerator($testInfo, "http://wpt-test-vm", new FileHandler());
     $resultArray = $jsonGenerator->resultDataArray($testResults, "loadTime");
     $this->assertThat($resultArray, new IsArraySubsetConstraint($SINGLESTEP_JSON_RESULT_ARRAY));
 }
コード例 #30
0
 public function testCompleteXmlGeneration()
 {
     $this->tempDir = TestUtil::extractToTemp(__DIR__ . '/data/singlestepResults.zip');
     $testInfo = TestInfo::fromFiles($this->tempDir . '/singlestepResults');
     $imitatedPath = $this->imitatedResultPath($testInfo->getId());
     // we need to move the results to a directory structure that equal to the real one.
     // Then, we can go into the parent directory, so the relatece "testRoot" is the same as it would be in production
     // This is important, as during XML generation, some URLs contain the test path
     mkdir($this->tempDir . $imitatedPath, 0777, true);
     rename($this->tempDir . '/singlestepResults', $this->tempDir . $imitatedPath);
     $this->orgDir = getcwd();
     chdir($this->tempDir);
     $testRoot = "." . $imitatedPath;
     $testInfo = TestInfo::fromFiles($testRoot);
     $expectedXmlFile = __DIR__ . '/data/singlestepXmlResult.xml.gz';
     $testResults = TestResults::fromFiles($testInfo);
     $xmlGenerator = new XmlResultGenerator($testInfo, "http://wpt-test-vm", new FileHandler(), $this->allAdditionalInfo, true);
     $xmlGenerator->printAllResults($testResults, "loadTime", null);
     $this->assertThat(ob_get_contents(), IsCompatibleXMLConstraint::fromFile($expectedXmlFile));
 }