diff --git a/src/Message/PurchaseRequest.php b/src/Message/PurchaseRequest.php
index 4bec2bf..6bc1983 100644
--- a/src/Message/PurchaseRequest.php
+++ b/src/Message/PurchaseRequest.php
@@ -138,9 +138,17 @@ public function getData()
$transaction->addChild('var1', $this->getExtraData1());
$transaction->addChild('var2', $this->getExtraData2());
$transaction->addChild('var3', $this->getExtraData3());
- $transaction->addChild('items', $this->getItems());
$transaction->addChild('gateway', $this->getGateway());
+ if ($items = $this->getItems()) {
+ $itemsHtml = '
';
+ foreach ($items as $item) {
+ $itemsHtml .= "- {$item['quantity']} x {$item['name']}
";
+ }
+ $itemsHtml .= '
';
+ $transaction->addChild('items', $itemsHtml);
+ }
+
if ('IDEAL' === $this->getGateway() && $this->getIssuer()) {
$gatewayInfo = $data->addChild('gatewayinfo');
$gatewayInfo->addChild('issuerid', $this->getIssuer());
diff --git a/tests/Message/PurchaseRequestTest.php b/tests/Message/PurchaseRequestTest.php
index 5b641c9..1d84b15 100644
--- a/tests/Message/PurchaseRequestTest.php
+++ b/tests/Message/PurchaseRequestTest.php
@@ -32,7 +32,10 @@ protected function setUp()
'extraData2' => 'extra 2',
'extraData3' => 'extra 3',
'language' => 'a language',
- 'items' => 'the items',
+ 'items' => array(
+ array('name' => 'item 1', 'quantity' => 1),
+ array('name' => 'item 2', 'quantity' => 2)
+ ),
'clientIp' => '127.0.0.1',
'googleAnalyticsCode' => 'analytics code',
'card' => array(
@@ -165,8 +168,8 @@ public function allDataProvider()
extra 1
extra 2
extra 3
- the items
IDEAL
+ <ul><li>1 x item 1</li><li>2 x item 2</li></ul>
issuer
@@ -216,8 +219,8 @@ public function noIssuerDataProvider()
extra 1
extra 2
extra 3
- the items
another
+ <ul><li>1 x item 1</li><li>2 x item 2</li></ul>
ad447bab87b8597853432c891e341db1
@@ -264,8 +267,8 @@ public function specialCharsDataProvider()
extra 1
extra 2
extra 3
- the items
IDEAL
+ <ul><li>1 x item 1</li><li>2 x item 2</li></ul>
issuer