<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * List all the Checkout Notify items.
 *
 * @package    Checkout
 * @category   Tasks
 * @author     Deon George
 * @copyright  (c) 2009-2013 Open Source Billing
 * @license    http://dev.osbill.net/license.html
 */
class Task_Checkout_Notify_List extends Minion_Task {
	protected function _execute(array $params) {
		$header = "%03s %11s %03s %10s %1s %1s %8s %8s %15s %25s %16s %30s\n";

		$output = sprintf($header,'ID','DateRun','CID','Checkout','S','P','Total','Fee','ID','Cart','TXN ID','Item1');

		foreach (ORM::factory('Checkout_Notify')->find_all() as $cno)
			$output .= sprintf($header,
				$cno->id,
				$cno->display('date_orig'),
				$cno->checkout_id,
				$cno->checkout->name,
				$cno->active ? 'A' : 'I',
				$cno->processed ? 'A' : 'I',
				$cno->data['mc_gross'],
				$cno->data['mc_fee'],
				$cno->data['payer_id'],
				$cno->data['custom'],
				$cno->data['txn_id'],
				$cno->data['item_name1']
			);

		return $output;
	}
}
?>