public function test_createOrder_usePaymentMethod_KORTCERT_redirects_to_certitrade() { $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")->usePaymentMethod(PaymentMethod::KORTCERT)->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); $this->assertEquals(200, $info['http_code']); $this->assertEquals(1, $info['redirect_count']); $this->assertEquals("https://etest.certitrade.net/card/paywin/index", substr($info['url'], 0, 46)); }
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]); }
public function testBuildOrderWithRelativeDiscountAsFloat() { $config = SveaConfig::getDefaultConfig(); $sveaRequest = \WebPay::createOrder($config)->addDiscount(\WebPayItem::relativeDiscount()->setDiscountId("1")->setDiscountPercent(12.75)->setUnit("st")->setName('Relative')->setDescription("RelativeDiscount")); $this->assertEquals("1", $sveaRequest->relativeDiscountRows[0]->discountId); $this->assertEquals(12.75, $sveaRequest->relativeDiscountRows[0]->discountPercent); $this->assertEquals("RelativeDiscount", $sveaRequest->relativeDiscountRows[0]->description); //test type $this->assertInternalType("float", $sveaRequest->relativeDiscountRows[0]->discountPercent); }
public function testPayPagePaymentWithSetPaymentMethodInvoice() { $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::companyCustomer()->setNationalIdNumber(4608142222))->setCountryCode("SE")->setClientOrderNumber("33")->setOrderDate("2012-12-12")->setCurrency("SEK")->usePaymentMethod(\PaymentMethod::INVOICE)->setReturnUrl("http://myurl.se")->getPaymentForm(); $xmlMessage = new \SimpleXMLElement($form->xmlMessage); $this->assertEquals(SystemPaymentMethod::INVOICE_SE, $xmlMessage->paymentmethod[0]); $this->assertEquals("TRUE", $xmlMessage->iscompany); $this->assertEquals("4608142222", $xmlMessage->customer->ssn); }
public function testBuildDirectBankPayment() { $config = SveaConfig::getDefaultConfig(); $rowFactory = new \TestUtil(); $form = \WebPay::createOrder($config)->addOrderRow(\TestUtil::createOrderRow())->addFee(\WebPayItem::shippingFee()->setShippingId('33')->setName('shipping')->setDescription("Specification")->setAmountExVat(50)->setUnit("st")->setVatPercent(25)->setDiscountPercent(0))->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")->usePayPageDirectBankOnly()->setReturnUrl("http://myurl.se")->getPaymentForm(); $xmlMessage = new \SimpleXMLElement($form->xmlMessage); //test values are as expected avter transforming xml to php object $this->assertEquals('SEK', $xmlMessage->currency); $this->assertEquals('18750', $xmlMessage->amount); $this->assertEquals('3750', $xmlMessage->vat); //may change when we recaltulate in Cartpymentclass $this->assertEquals('12500', $xmlMessage->orderrows->row[0]->amount); $this->assertEquals('6250', $xmlMessage->orderrows->row[1]->amount); $this->assertEquals('-12500', $xmlMessage->orderrows->row[2]->amount); }
public function testBuildCardPayment() { $rowFactory = new \TestUtil(); $config = SveaConfig::getDefaultConfig(); $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::companyCustomer()->setNationalIdNumber("2345234"))->setCountryCode("SE")->setClientOrderNumber("33")->setOrderDate("2012-12-12")->setCurrency("SEK")->usePayPageCardOnly()->setReturnUrl("http://myurl.se")->getPaymentForm(); $xmlMessage = new \SimpleXMLElement($form->xmlMessage); $payment = base64_decode($form->xmlMessageBase64); $payment_decoded = new \SimpleXMLElement($payment); //test values are as expected avter transforming xml to php object $this->assertEquals('SEK', $xmlMessage->currency); $this->assertEquals('18750', $xmlMessage->amount); $this->assertEquals('3750', $xmlMessage->vat); $this->assertEquals('12500', $xmlMessage->orderrows->row[0]->amount); $this->assertEquals('6250', $xmlMessage->orderrows->row[1]->amount); $this->assertEquals('-12500', $xmlMessage->orderrows->row[2]->amount); }
public function testFormatRelativeDiscountRows_WithDifferentVatRatesPresent() { $config = Svea\SveaConfig::getDefaultConfig(); $order = WebPay::createOrder($config); $order->addOrderRow(WebPayItem::orderRow()->setAmountExVat(100.0)->setVatPercent(25)->setQuantity(2))->addOrderRow(WebPayItem::orderRow()->setAmountExVat(100.0)->setVatPercent(6)->setQuantity(1))->addDiscount(WebPayItem::relativeDiscount()->setDiscountId("42")->setName("->setDiscountPercent(10)")->setDescription("testFormatRelativeDiscountRows_WithDifferentVatRatesPresent")->setDiscountPercent(10)->setUnit("st")); $formatter = new WebServiceRowFormatter($order); $resultRows = $formatter->formatRows(); $testedRow = $resultRows[2]; $this->assertEquals("42", $testedRow->ArticleNumber); $this->assertEquals("->setDiscountPercent(10): testFormatRelativeDiscountRows_WithDifferentVatRatesPresent (25%)", $testedRow->Description); $this->assertEquals(-20.0, $testedRow->PricePerUnit); $this->assertEquals(25, $testedRow->VatPercent); $this->assertEquals(0, $testedRow->DiscountPercent); // not the same thing as in our WebPayItem... $this->assertEquals(1, $testedRow->NumberOfUnits); // 1 "discount unit" $this->assertEquals("st", $testedRow->Unit); $testedRow = $resultRows[3]; $this->assertEquals("42", $testedRow->ArticleNumber); $this->assertEquals("->setDiscountPercent(10): testFormatRelativeDiscountRows_WithDifferentVatRatesPresent (6%)", $testedRow->Description); $this->assertEquals(-10.0, $testedRow->PricePerUnit); $this->assertEquals(6, $testedRow->VatPercent); $this->assertEquals(0, $testedRow->DiscountPercent); // not the same thing as DiscountPercent in our WebPayItem... $this->assertEquals(1, $testedRow->NumberOfUnits); // 1 "discount unit" $this->assertEquals("st", $testedRow->Unit); }
public function testCreateOrderWithDiscountAsAmountExAndDeliverWithAmountIncvat() { $config = Svea\SveaConfig::getDefaultConfig(); $campaigncode = TestUtil::getGetPaymentPlanParamsForTesting(); $order = WebPay::createOrder($config)->addOrderRow(WebPayItem::orderRow()->setAmountIncVat(1239.876)->setVatPercent(24)->setQuantity(1))->addDiscount(WebPayItem::fixedDiscount()->setAmountIncVat(8)->setVatPercent(24))->addDiscount(WebPayItem::relativeDiscount()->setDiscountPercent(10))->addCustomerDetails(TestUtil::createIndividualCustomer("SE"))->setCountryCode("SE")->setOrderDate("2012-12-12")->usePaymentPlanPayment($campaigncode)->doRequest(); $request = WebPay::deliverOrder($config); $request = $request->addOrderRow(WebPayItem::orderRow()->setAmountExVat(999.9)->setVatPercent(24)->setQuantity(1))->addDiscount(WebPayItem::fixedDiscount()->setAmountExVat(8)->setVatPercent(24))->addDiscount(WebPayItem::relativeDiscount()->setDiscountPercent(10))->setOrderId($order->sveaOrderId)->setInvoiceDistributionType(DistributionType::POST)->setCountryCode("SE")->deliverPaymentPlanOrder()->doRequest(); $this->assertEquals(1, $request->accepted); }
public function test_relativeDiscount_amount_multiple_vat_rates_defined_incvat_creates_discount_rows_using_incvat_and_vatpercent() { $order = WebPay::createOrder(Svea\SveaConfig::getDefaultConfig())->addCustomerDetails(WebPayItem::individualCustomer()->setNationalIdNumber(194605092222))->setCountryCode("SE")->setCustomerReference("33")->setOrderDate("2012-12-12")->setCurrency("SEK")->addOrderRow(WebPayItem::orderRow()->setAmountIncVat(72.0)->setVatPercent(20)->setQuantity(1)->setName("exvatRow"))->addOrderRow(WebPayItem::orderRow()->setAmountIncVat(33.0)->setVatPercent(10)->setQuantity(1)->setName("exvatRow2"))->addFee(WebPayItem::invoiceFee()->setAmountIncVat(8.800000000000001)->setVatPercent(10)->setName("incvatInvoiceFee"))->addFee(WebPayItem::shippingFee()->setAmountIncVat(17.6)->setVatPercent(10)->setName("incvatShippingFee"))->addDiscount(WebPayItem::relativeDiscount()->setDiscountPercent(10.0)->setDiscountId("TenPercentOff")->setName("relativeDiscount")); $request = $order->useInvoicePayment()->prepareRequest(); // all order rows $this->assertEquals(72.0, $request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->PricePerUnit); $this->assertEquals(20, $request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->PriceIncludingVat); $this->assertEquals(33.0, $request->request->CreateOrderInformation->OrderRows['OrderRow'][1]->PricePerUnit); $this->assertEquals(10, $request->request->CreateOrderInformation->OrderRows['OrderRow'][1]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][1]->PriceIncludingVat); // all invoice fee rows $this->assertEquals(8.800000000000001, $request->request->CreateOrderInformation->OrderRows['OrderRow'][2]->PricePerUnit); $this->assertEquals(10, $request->request->CreateOrderInformation->OrderRows['OrderRow'][2]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][2]->PriceIncludingVat); // all shipping fee rows $this->assertEquals(17.6, $request->request->CreateOrderInformation->OrderRows['OrderRow'][3]->PricePerUnit); $this->assertEquals(10, $request->request->CreateOrderInformation->OrderRows['OrderRow'][3]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][3]->PriceIncludingVat); // all discount rows // expected: 10% off orderRow rows: 1x60.00 @20%, 1x30@10% => split proportionally across order row (only) vat rate: -6.0 @20%, -3.0 @10% $this->assertEquals(-7.2, $request->request->CreateOrderInformation->OrderRows['OrderRow'][4]->PricePerUnit); $this->assertEquals(20, $request->request->CreateOrderInformation->OrderRows['OrderRow'][4]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][4]->PriceIncludingVat); $this->assertEquals(-3.3, $request->request->CreateOrderInformation->OrderRows['OrderRow'][5]->PricePerUnit); $this->assertEquals(10, $request->request->CreateOrderInformation->OrderRows['OrderRow'][5]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][5]->PriceIncludingVat); }
public function testDeliverOrderSetAsMixedVatAndRelativeDiscount() { $config = Svea\SveaConfig::getDefaultConfig(); $request = WebPay::deliverOrder($config); $request = $request->addOrderRow(WebPayItem::orderRow()->setAmountIncVat(123.9876)->setVatPercent(24)->setQuantity(1))->addOrderRow(WebPayItem::orderRow()->setAmountExVat(99.98999999999999)->setVatPercent(24)->setQuantity(1))->addDiscount(WebPayItem::relativeDiscount()->setDiscountPercent(5))->setOrderId("id")->setInvoiceDistributionType(DistributionType::POST)->setCreditInvoice("id")->setCountryCode("SE")->deliverInvoiceOrder()->prepareRequest(); $this->assertEquals(99.98999999999999, $request->request->DeliverOrderInformation->DeliverInvoiceDetails->OrderRows['OrderRow'][0]->PricePerUnit); $this->assertEquals(24, $request->request->DeliverOrderInformation->DeliverInvoiceDetails->OrderRows['OrderRow'][0]->VatPercent); $this->assertFalse($request->request->DeliverOrderInformation->DeliverInvoiceDetails->OrderRows['OrderRow'][0]->PriceIncludingVat); $this->assertEquals(99.98999999999999, $request->request->DeliverOrderInformation->DeliverInvoiceDetails->OrderRows['OrderRow'][1]->PricePerUnit); $this->assertEquals(24, $request->request->DeliverOrderInformation->DeliverInvoiceDetails->OrderRows['OrderRow'][1]->VatPercent); $this->assertFalse($request->request->DeliverOrderInformation->DeliverInvoiceDetails->OrderRows['OrderRow'][1]->PriceIncludingVat); $this->assertEquals(-9.999000000000001, $request->request->DeliverOrderInformation->DeliverInvoiceDetails->OrderRows['OrderRow'][2]->PricePerUnit); $this->assertEquals(24, $request->request->DeliverOrderInformation->DeliverInvoiceDetails->OrderRows['OrderRow'][2]->VatPercent); $this->assertFalse($request->request->DeliverOrderInformation->DeliverInvoiceDetails->OrderRows['OrderRow'][2]->PriceIncludingVat); }
public function test_incvat_only_order_with_relativeDiscount_with_multiple_vat_rates_order_sent_with_PriceIncludingVat_true() { $order = $this->order; $order->addOrderRow(WebPayItem::orderRow()->setAmountIncVat(72.0)->setVatPercent(20)->setQuantity(1))->addOrderRow(WebPayItem::orderRow()->setAmountIncVat(33.0)->setVatPercent(10)->setQuantity(1))->addFee(WebPayItem::invoiceFee()->setAmountIncVat(8.800000000000001)->setVatPercent(10))->addFee(WebPayItem::shippingFee()->setAmountIncVat(17.6)->setVatPercent(10)); $order->addDiscount(WebPayItem::relativeDiscount()->setDiscountPercent(10)->setDiscountId("TenPercentOff")->setName("relativeDiscount")); $request = $order->useInvoicePayment()->prepareRequest(); // all order rows $this->assertEquals(72.0, $request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->PricePerUnit); $this->assertEquals(20, $request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->PriceIncludingVat); $this->assertEquals(33.0, $request->request->CreateOrderInformation->OrderRows['OrderRow'][1]->PricePerUnit); $this->assertEquals(10, $request->request->CreateOrderInformation->OrderRows['OrderRow'][1]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][1]->PriceIncludingVat); // all invoice fee rows $this->assertEquals(8.800000000000001, $request->request->CreateOrderInformation->OrderRows['OrderRow'][2]->PricePerUnit); $this->assertEquals(10, $request->request->CreateOrderInformation->OrderRows['OrderRow'][2]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][2]->PriceIncludingVat); // all shipping fee rows $this->assertEquals(17.6, $request->request->CreateOrderInformation->OrderRows['OrderRow'][3]->PricePerUnit); $this->assertEquals(10, $request->request->CreateOrderInformation->OrderRows['OrderRow'][3]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][3]->PriceIncludingVat); // all discount rows // expected: 10% off orderRow rows: 60.0 @20%, 30.0 @10% => split across order row (only) vat rate: 6.0ex @20% = 7.2inc, 3.0ex @10% = 3.3inc $this->assertEquals(-7.2, $request->request->CreateOrderInformation->OrderRows['OrderRow'][4]->PricePerUnit); $this->assertEquals(20, $request->request->CreateOrderInformation->OrderRows['OrderRow'][4]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][4]->PriceIncludingVat); $this->assertEquals(-3.3, $request->request->CreateOrderInformation->OrderRows['OrderRow'][5]->PricePerUnit); $this->assertEquals(10, $request->request->CreateOrderInformation->OrderRows['OrderRow'][5]->VatPercent); $this->assertEquals(true, $request->request->CreateOrderInformation->OrderRows['OrderRow'][5]->PriceIncludingVat); }
public static function relativeDiscount() { return WebPayItem::relativeDiscount(); }
public function testDiscountPercentAndVatPercentWhenPriceSetAsIncVatAndVatPercent() { $config = Svea\SveaConfig::getDefaultConfig(); $campaign = $this->getGetPaymentPlanParamsForTesting(); $request = WebPay::createOrder($config)->addOrderRow(WebPayItem::orderRow()->setAmountIncVat(123.9876)->setVatPercent(24)->setQuantity(1))->addDiscount(WebPayItem::relativeDiscount()->setDiscountPercent(10))->addCustomerDetails(TestUtil::createIndividualCustomer("SE"))->setCountryCode("SE")->setOrderDate("2012-12-12")->useInvoicePayment()->prepareRequest(); $this->assertEquals(123.9876, $request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->PricePerUnit); $this->assertEquals(24, $request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->VatPercent); $this->assertTrue($request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->PriceIncludingVat); $this->assertEquals(-12.39876, $request->request->CreateOrderInformation->OrderRows['OrderRow'][1]->PricePerUnit); $this->assertEquals(24, $request->request->CreateOrderInformation->OrderRows['OrderRow'][1]->VatPercent); $this->assertTrue($request->request->CreateOrderInformation->OrderRows['OrderRow'][0]->PriceIncludingVat); }
public function testCalculateRequestValues_CorrectTotalAmount_WithRelativeDiscount_WithDifferentVatRatesPresent() { $config = SveaConfig::getDefaultConfig(); $order = \WebPay::createOrder($config); $order->addOrderRow(\WebPayItem::orderRow()->setAmountExVat(100.0)->setVatPercent(25)->setQuantity(2))->addOrderRow(\WebPayItem::orderRow()->setAmountExVat(100.0)->setVatPercent(6)->setQuantity(1))->addDiscount(\WebPayItem::relativeDiscount()->setDiscountPercent(25)); // follows HostedPayment calculateRequestValues() outline: $formatter = new HostedRowFormatter(); $request = array(); $request['rows'] = $formatter->formatRows($order); $request['amount'] = $formatter->formatTotalAmount($request['rows']); $request['totalVat'] = $formatter->formatTotalVat($request['rows']); // 5000*.25 = 1250 // 600*.25 = 150 // matches 1400 discount $this->assertEquals(26700, $request['amount']); // 35600 - 8900 discount $this->assertEquals(4200, $request['totalVat']); // 5600 - 1400 discount (= 10000/35600 *5600) discount }
public function test_RelativeDiscount_in_order_with_single_vat_rate_php_original_version() { $this->order->addOrderRow(\WebPayItem::orderRow()->setAmountExVat(4.0)->setVatPercent(25)->setQuantity(1))->addOrderRow(\WebPayItem::orderRow()->setAmountIncVat(5.0)->setVatPercent(25)->setQuantity(1))->addOrderRow(\WebPayItem::orderRow()->setAmountExVat(4.0)->setAmountIncVat(5.0)->setQuantity(1))->addDiscount(\WebPayItem::relativeDiscount()->setDiscountId("r10")->setName("couponName")->setDescription("couponDesc")->setDiscountPercent(10)->setUnit("kr")); $formatter = new HostedRowFormatter(); $resultRows = $formatter->formatRows($this->order); $testedRow = $resultRows[3]; $this->assertEquals("r10", $testedRow->sku); $this->assertEquals("couponName", $testedRow->name); $this->assertEquals("couponDesc", $testedRow->description); $this->assertEquals(-150, $testedRow->amount); $this->assertEquals(-30, $testedRow->vat); }
public function testResponseOrderSetAsIncVatAndExVatAndRelativeDiscount() { $config = Svea\SveaConfig::getDefaultConfig(); $request = WebPay::createOrder($config)->addOrderRow(WebPayItem::orderRow()->setAmountIncVat(123.9876)->setAmountExVat(99.98999999999999)->setQuantity(1))->addDiscount(WebPayItem::relativeDiscount()->setDiscountPercent(10))->addCustomerDetails(TestUtil::createIndividualCustomer("SE"))->setCountryCode("SE")->setOrderDate("2012-12-12")->useInvoicePayment()->doRequest(); $this->assertEquals(1, $request->accepted); }
public function testOrderRowsInOrderAsAdded2OnHosted() { $config = SveaConfig::getDefaultConfig(); $request = \WebPay::createOrder($config); $form = $request->addFee(\WebPayItem::shippingFee()->setDescription("1")->setVatPercent(25)->setAmountIncVat(30))->addOrderRow(\WebPayItem::orderRow()->setDescription("2")->setQuantity(1)->setAmountIncVat(10.0)->setVatPercent(25))->addOrderRow(\WebPayItem::orderRow()->setDescription("3")->setQuantity(1)->setAmountIncVat(20.0)->setVatPercent(25))->addDiscount(\WebPayItem::relativeDiscount()->setDescription("4")->setDiscountPercent(10))->setCountryCode("SE")->setClientOrderNumber("33")->setOrderDate("2012-12-12")->setCurrency("SEK")->usePaymentMethod(\PaymentMethod::SVEACARDPAY)->setReturnUrl("http://myurl.se")->getPaymentForm(); $xmlMessage = new \SimpleXMLElement($form->xmlMessage); $this->assertEquals('1', $xmlMessage->orderrows->row[0]->description); $this->assertEquals('2', $xmlMessage->orderrows->row[1]->description); $this->assertEquals('3', $xmlMessage->orderrows->row[2]->description); $this->assertEquals('4', $xmlMessage->orderrows->row[3]->description); }