public function refund($line_items, $refund_apply_order = 'credit')
{
if (isset($line_items['uuid'])) {
$line_items = array($line_items);
}
$doc = $this->createDocument();
$root = $doc->appendChild($doc->createElement($this->getNodeName()));
$root->appendChild($doc->createElement('refund_apply_order', $refund_apply_order));
$line_items_node = $root->appendChild($doc->createElement('line_items'));
foreach ($line_items as $line_item) {
$adjustment_node = $line_items_node->appendChild($doc->createElement('adjustment'));
$adjustment_node->appendChild($doc->createElement('uuid', $line_item['uuid']));
$adjustment_node->appendChild($doc->createElement('quantity', $line_item['quantity']));
$adjustment_node->appendChild($doc->createElement('prorate', $line_item['prorate'] ? 'true' : 'false'));
}
return $this->createRefundInvoice($this->renderXML($doc));
}