Check to see if new order email was sent

and to send one if not.  References GH Issue #85
This commit is contained in:
Rich Morgan 2014-12-30 13:18:56 -05:00
parent 9d9215c0d4
commit 8ce288db4b
1 changed files with 10 additions and 1 deletions

View File

@ -112,7 +112,16 @@ class Bitpay_Core_IpnController extends Mage_Core_Controller_Front_Action
if (true === isset($payment) && false === empty($payment)) { if (true === isset($payment) && false === empty($payment)) {
$payment->registerCaptureNotification($invoice->getPrice()); $payment->registerCaptureNotification($invoice->getPrice());
$order->addPayment($payment)->save(); $order->addPayment($payment);
// If the customer has not already been notified by email
// send the notification now that there's a new order.
if (!$order->getEmailSent()) {
Mage::helper('bitpay')->debugData('[INFO] Order email not sent so I am calling $order->sendNewOrderEmail() now...');
$order->sendNewOrderEmail();
}
$order->save();
} else { } else {
Mage::helper('bitpay')->debugData('[ERROR] Could not create a payment object in the Bitpay IPN controller.'); Mage::helper('bitpay')->debugData('[ERROR] Could not create a payment object in the Bitpay IPN controller.');
Mage::throwException('Could not create a payment object in the Bitpay IPN controller.'); Mage::throwException('Could not create a payment object in the Bitpay IPN controller.');