Skip to content

Commit

Permalink
Merge pull request #195 from michielgerritsen/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Marvin-Magmodules authored Jan 19, 2021
2 parents 13dec20 + eb65dac commit bf897b2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/code/community/Mollie/Mpm/Model/Client/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,13 @@ public function processTransaction(Mage_Sales_Model_Order $order, $type = 'webho
$invoice = $order->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->setTransactionId($transactionId);
$invoice->register();

$invoice->setState($this->mollieHelper->getInvoiceMomentPaidStatus($order));
$invoiceStatus = $this->mollieHelper->getInvoiceMomentPaidStatus($order);
if ($invoiceStatus == \Mage_Sales_Model_Order_Invoice::STATE_PAID) {
$invoice->register();
}

$invoice->setState($invoiceStatus);

Mage::getModel('core/resource_transaction')
->addObject($invoice)
Expand Down
15 changes: 14 additions & 1 deletion app/code/community/Mollie/Mpm/Model/OrderLines.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function getOrderLines(Mage_Sales_Model_Order $order)
$orderLine = array(
'item_id' => $item->getId(),
'type' => $item->getProduct()->getTypeId() != 'downloadable' ? 'physical' : 'digital',
'name' => preg_replace("/[^A-Za-z0-9 -]/", "", $item->getName()),
'name' => $this->getProductName($item->getName()),
'quantity' => round($item->getQtyOrdered()),
'unitPrice' => $this->mollieHelper->getAmountArray($currency, $unitPrice),
'totalAmount' => $this->mollieHelper->getAmountArray($currency, $totalAmount),
Expand Down Expand Up @@ -503,4 +503,17 @@ public function getOpenForRefundQty($orderId)

return $qty;
}

/**
* @param string $name
* @return string
*/
private function getProductName($name)
{
$search = explode('','', 'ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,ø,Ø,Å,Á,À,Â,Ä,È,É,Ê,Ë,Í,Î,Ï,Ì,Ò,Ó,Ô,Ö,Ú,Ù,Û,Ü,Ÿ,Ç,Æ,Œ');
$replace = explode('','', 'c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,o,O,A,A,A,A,A,E,E,E,E,I,I,I,I,O,O,O,O,U,U,U,U,Y,C,AE,OE');
$name = str_replace($search, $replace, $name);

return preg_replace('/[^A-Za-z0-9 -]/', '', $name);
}
}

0 comments on commit bf897b2

Please sign in to comment.