Skip to content

Instantly share code, notes, and snippets.

@mklooss
Last active October 13, 2015 12:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mklooss/4193690 to your computer and use it in GitHub Desktop.
Save mklooss/4193690 to your computer and use it in GitHub Desktop.
Magento PayPal CronJob - Fraud False Positiv
<?php
class PaypalFraud
{
const PAYPAL_FRAUD_LOG = "paypal_cron_fraud.log";
public function changeFraudStatus()
{
$collection_of_orders = Mage::getModel('sales/order')->getCollection();
$collection_of_orders->addFieldToFilter('status',array('fraud', 'payment_review'));
foreach($collection_of_orders as $order)
{
self::Log("Suspected Fraud / Processing Review check: Changing order #" . $order->getIncrementId() . " to \"Processing\"");
$order_new = Mage::getModel('sales/order')->load($order->getId());
$order_new->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, "[CRON] Order automatically changed to \"Processing\"",false)->save();
if(!$order->getEmailSent()) {
self::Log("Send Order E-Mail#" . $order->getIncrementId());
$order_new->sendNewOrderEmail();
}
}
if(count($collection_of_orders) > 0)
{
self::Log("Fraud detected");
}
}
protected function Log($message)
{
return Mage::log($message,null,self::PAYPAL_FRAUD_LOG);
}
}
@Ph1975
Copy link

Ph1975 commented Jan 24, 2014

Hi,

could you put a short documentation on how to install this as a cron? Thanks in advance,

Philipp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment