diff --git a/src/Transaction.php b/src/Transaction.php index 6b07e63..c800fed 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -84,9 +84,19 @@ protected function append(array $params, SimpleXMLElement $type) { foreach ($params as $key => $value) { if (is_array($value)) { - $parent = $type->addChild($key); + if ($key === 'items') { + foreach ($value as $item) { + $parent = $type->addChild('item'); + $parent->addChild('name', isset($item['name']) ? $item['name'] : ''); + $parent->addChild('quantity', isset($item['quantity']) ? $item['quantity'] : ''); + $parent->addChild('product_code', isset($item['product_code']) ? $item['product_code'] : ''); + $parent->addChild('extended_amount', isset($item['extended_amount']) ? $item['extended_amount'] : ''); + } + } else { + $parent = $type->addChild($key); - $this->append($value, $parent); + $this->append($value, $parent); + } } else { $type->addChild($key, $value); }