Merge pull request #130 from rafaldr91/master
IPN creates second invoice in database issue fix
This commit is contained in:
commit
9a33a88b5b
|
@ -1,3 +1,5 @@
|
|||
2.1.16
|
||||
Fixed creating after payment a second invoice in database instead of update invoice issue
|
||||
2.1.14
|
||||
Use Magento shop base currency to create a BitPay invoice (instead of the shopper's selected currency)
|
||||
2.1.13
|
||||
|
|
|
@ -116,13 +116,15 @@ class Bitpay_Core_IpnController extends Mage_Core_Controller_Front_Action
|
|||
$transactionSpeed = \Mage::getStoreConfig('payment/bitpay/speed');
|
||||
if ($ipn->status === 'paid'
|
||||
|| ($ipn->status === 'confirmed' && $transactionSpeed === 'high')) {
|
||||
|
||||
$payment = \Mage::getModel('sales/order_payment')->setOrder($order);
|
||||
|
||||
if (true === isset($payment) && false === empty($payment)) {
|
||||
$payment->registerCaptureNotification($invoice->getPrice());
|
||||
$order->addPayment($payment);
|
||||
|
||||
|
||||
if ($payments = $order->getPaymentsCollection())
|
||||
{
|
||||
$payment = count($payments->getItems())>0 ? end($payments->getItems()) : \Mage::getModel('sales/order_payment')->setOrder($order);
|
||||
}
|
||||
|
||||
if (true === isset($payment) && false === empty($payment)) {
|
||||
$payment->registerCaptureNotification($invoice->getPrice());
|
||||
$order->setPayment($payment);
|
||||
// If the customer has not already been notified by email
|
||||
// send the notification now that there's a new order.
|
||||
if (!$order->getEmailSent()) {
|
||||
|
|
Loading…
Reference in New Issue