예제 #1
0
 /**
  * Export function:
  * - Returns false, if an error occured or if there are no orders to export
  * - Returns array, containing the filename and the file contents
  *
  * @return bool|array
  */
 public function export()
 {
     $collection = $this->_hasOrdersToExport();
     if (!$collection) {
         return false;
     }
     // Create new object and set store owner bank account data
     $file = new DTA(DTA_DEBIT);
     $file->setAccountFileSender($this->_getDebitHelper()->getBankAccount());
     // Add orders
     foreach ($collection as $order) {
         /* @var $orderModel Mage_Sales_Model_Order */
         $orderModel = Mage::getModel('sales/order')->load($order->getData('entity_id'));
         /* @var $payment Itabs_Debit_Model_Debit */
         $paymentMethod = $orderModel->getPayment()->getMethodInstance();
         $file->addExchange(array('name' => $paymentMethod->getAccountName(), 'bank_code' => $paymentMethod->getAccountBLZ(), 'account_number' => $paymentMethod->getAccountNumber()), round($order->getData('grand_total'), 2), array('Bestellung Nr. ' . $order->getData('increment_id')));
         $this->_getDebitHelper()->setStatusAsExported($order->getId());
     }
     $response = array('file_name' => $this->getFileName(), 'file_content' => $file->getFileContent());
     return $response;
 }
예제 #2
0
 * @package   Payment_DTA
 * @author    Hermann Stainer <*****@*****.**>
 * @copyright 2003-2005 Hermann Stainer, Web-Gear
 * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
 * @version   SVN: $Id: example_credit.php 300643 2010-06-22 00:21:19Z mschuett $
 * @link      http://pear.php.net/package/Payment_DTA
 */
require_once "Payment/DTA.php";
/**
* Initialize new DTA file.
* In this example the file contains credits.
* This means that in an exchange the sender is the person who pays money
* to the receiver.
*/
$dta_file = new DTA(DTA_CREDIT);
/**
* Set file sender. This is also the default sender for transactions.
*/
$dta_file->setAccountFileSender(array("name" => "Michael Mustermann", "bank_code" => 11112222, "account_number" => 654321));
/**
* Add transaction.
*/
$dta_file->addExchange(array("name" => "Franz Mueller", "bank_code" => 33334444, "account_number" => 13579000), 12.01, array("Credit Nr. 01234", "Information"));
/**
* Output DTA-File.
*/
echo $dta_file->getFileContent();
/**
* Write DTA-File.
*/
// $dta_file->saveFile("DTAUS0");