public static function GetInstance() { if (self::$Instance === null) { self::$Instance = new PaymentModuleFactory(); } return self::$Instance; }
public function ConvertInvoices() { $this->Log('Convert invoices'); $this->TruncateTable('invoices', 'orders'); $PaymentFactory = PaymentModuleFactory::GetInstance(); $same_keys = array('id', 'userid', 'dtcreated', 'status', 'description', 'notes', 'orderid', 'vat'); $invoice_data = $this->DbOld->GetAll('SELECT * FROM invoices'); foreach ($invoice_data as &$old_row) { if ($old_row['gate'] == 'offline_payment') { $old_row['gate'] = 'OfflineBank'; } // Copy data with same keys foreach ($same_keys as $key) { $new_row[$key] = $old_row[$key]; } // Convert data $new_row['total'] = $old_row['amount']; $new_row['itemid'] = $old_row['domainid']; $new_row['purpose'] = 'Domain_' . $old_row['command']; try { $PaymentModule = $PaymentFactory->GetModuleObjectByName($old_row['gate']); $payment_module = $PaymentModule->GetModuleName(); } catch (Exception $e) { $payment_module = $old_row['gate']; } $new_row['payment_module'] = $payment_module; $new_row['dtupdated'] = $new_row['dtcreated']; $this->Insert("invoices", $new_row); } if ($this->OldTableExists('orders')) { $this->CopyTable('orders'); } }
public function ConvertInvoicing() { $same_keys = array('id', 'userid', 'dtcreated', 'status', 'description', 'notes', 'orderid', 'vat'); $PaymentFactory = PaymentModuleFactory::GetInstance(); $rs = $this->Db->Execute("SELECT * FROM `invoices_old`"); while ($old_row = $rs->FetchRow()) { $new_row = array(); // Copy data with same keys foreach ($same_keys as $key) { $new_row[$key] = $old_row[$key]; } // Convert data $new_row['total'] = $old_row['amount']; $new_row['itemid'] = $old_row['domainid']; $new_row['purpose'] = 'Domain_' . $old_row['command']; try { $PaymentModule = $PaymentFactory->GetModuleObjectByName($old_row['gate']); $payment_module = $PaymentModule->GetModuleName(); } catch (Exception $e) { $payment_module = $old_row['gate']; } $new_row['payment_module'] = $payment_module; $new_row['dtupdated'] = $new_row['dtcreated']; // Save $this->Insert('invoices', $new_row); } $rs->Close(); }
$field->Value = $val; } } else $Config = null; } else $Config = null; switch($observer['interface']) { case "IInvoiceObserver": Invoice::AttachObserver(new $observer['name']($Config), $observer["phace"]); break; case "IRegistryObserver": Registry::AttachClassObserver(new $observer['name']($Config), $observer["phace"]); break; case "IPaymentObserver": PaymentModuleFactory::AddModuleObserver(new $observer['name']($Config), $observer["phace"]); break; case "IGlobalObserver": Application::AttachObserver(new $observer['name']($Config), $observer["phace"]); break; } } ?>
function __construct() { parent::__construct("Sermepa"); $Factory = PaymentModuleFactory::GetInstance(); $this->Module = $Factory->GetModuleObjectByName("Sermepa"); }