Skip to content

Commit 411c565

Browse files
author
Denise Ignatova
committed
assign description as a value not with addChild
1 parent 28d5ad5 commit 411c565

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Message/AbstractRequest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected function getItemData()
167167
} else {
168168
$total = ($basketItem->getQuantity() * $basketItem->getPrice());
169169
$item = $xml->addChild('item');
170-
$item->addChild('description')->{0} = $basketItem->getName();
170+
$item->description = $basketItem->getName();
171171
$item->addChild('quantity', $basketItem->getQuantity());
172172
$item->addChild('unitNetAmount', $basketItem->getPrice());
173173
$item->addChild('unitTaxAmount', '0.00');
@@ -181,7 +181,8 @@ protected function getItemData()
181181
if ($discountItems->getPrice() < 0) {
182182
$discount = $discounts->addChild('discount');
183183
$discount->addChild('fixed', $discountItems->getPrice() * -1);
184-
$discount->addChild('description')->{0} = ($discountItems->getName());
184+
$discount->description = $discountItems->getName();
185+
// addChild('description', htmlspecialchars($discountItems->getName(), ENT_QUOTES, 'UTF-8'));
185186
}
186187
}
187188
}

tests/Message/DirectAuthorizeRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testBasket()
8888
// The element does exist, and must contain the basket XML, with optional XML header and
8989
// trailing newlines.
9090
$this->assertArrayHasKey('BasketXML', $data);
91-
$this->assertContains($basketXml, $data['BasketXML']);
91+
$this->assertContains($basketXml, $data);
9292
}
9393

9494
public function testGetDataNoReferrerId()
@@ -292,7 +292,7 @@ public function testBasketWithNotEscapedName()
292292
<totalGrossAmount>5</totalGrossAmount>";
293293

294294
$this->request->setItems($items);
295-
$data = $this->request->getData();
295+
$data = $this->request->getData();
296296

297297

298298
$this->assertNotContains($expected , $data['BasketXML'], "Should fail as name was not escaped" );

0 commit comments

Comments
 (0)