Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @version 3.2.5
- * @package Joomla 3.x
- * @subpackage DT Register
- * @copyright Copyright (C) 2006 DTH Development
- * @copyright contact dthdev@dthdevelopment.com
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
- */
- defined( '_JEXEC' ) or die( 'Restricted access' );
- class DtregisterModelPayoption extends DtrModel {
- function __construct($config = array()){
- parent::__construct($config);
- $this->table = DtrTable::getInstance('Payoption','DtrTable'); // new TablePayoption($this->getDBO());
- }
- }
- class DtrTablePayoption extends DtrTable {
- var $id;
- var $name;
- var $default = 0;
- var $user_id;
- var $public = 0;
- function __construct( $db = null ) {
- $db = JFactory::getDBO();
- $this->db = $db;
- parent::__construct( '#__dtregister_payment', 'id', $db );
- $this->TablePayoptionconfig = DtrTable::getInstance('Payoptionconfig','DtrTable');
- $this->TablePaylater = DtrTable::getInstance('paylater','DtrTable');
- }
- function save($data, $orderingFilter = '', $ignore = ''){
- parent::save($data['payment']);
- $this->TablePayoptionconfig->payment_id = $this->id;
- $this->getPaylaterIds($data);
- $this->TablePayoptionconfig->removeByPaymentid();
- $this->TablePayoptionconfig->saveAll($data['config']);
- }
- function getPaylaterIds($data){
- $this->TablePaylater->truncate();
- $paylaters = array();
- if (is_array($data['paylater']))
- foreach($data['paylater'] as $key=>$name){
- if($data['paylaterIds'][$key] != 'new'){
- $paylater = array('name'=>$name,'id'=>$data['paylaterIds'][$key]);
- }else{
- $paylater = array('name'=>$name);
- }
- $this->TablePaylater->save($paylater);
- if($data['paylaterIds'][$key] == 'new'){
- $data['paylaterIds'][$key] = $this->TablePaylater->_db->insertid();
- if(isset($data['config']['pay_later_options'][$key]))
- $data['config']['pay_later_options'][$key] = $this->TablePaylater->_db->insertid();
- }
- }
- }
- function loaddefault() {
- $query = 'Select id from #__dtregister_payment where `default` = 1';
- $this->db->setQuery($query);
- $id = $this->db->loadResult();
- //$this->load($id);
- $this->name = "";
- $this->id = 0;
- $this->default = 0;
- $this->config = $this->get_blank_config($id);
- }
- public function load($id = null, $reset = true){
- parent::load($id,$reset);
- $this->config = $this->getConfig();
- }
- function getConfig(){
- $temp = array();
- $data = $this->TablePayoptionconfig->find(' payment_id = "'.$this->id.'"');
- $config_array = array(
- 'paymentmethod',
- 'cardtype',
- 'pay_later_options',
- 'cardtype',
- 'field_options',
- 'paylater_field_options'
- );
- if (is_array($data))
- foreach($data as $val){
- if(in_array($val->key,$config_array) && !is_array($val->value)){
- $val->value = explode(",",$val->value);
- }
- $temp[$val->key] = $val->value;
- }
- $configs = $this->get_blank_config();
- foreach($configs as $key => $value) {
- if(!isset($temp[$key])){
- $temp[$key] = $value;
- }
- }
- return $temp;
- }
- function get_blank_config($default_id = 0) {
- return array (
- 'payfast_merchant_id' => '',
- 'worldpay_instId' => '',
- 'payfast_merchant_key' => '',
- 'payfast_accountname' => '',
- 'pay_later_options' =>
- array (
- ),
- 'quickbook_app_login' => '',
- 'payfast_username' => '',
- 'quickbook_connection_ticket' => '',
- 'quickbook_app_ID' => '',
- 'netdeposit_clientid' => '',
- 'netdeposit_clientcode' => '',
- 'sage_M_key' => '',
- 'sage_M_id' => '',
- 'idealLiteHashKey' => '',
- 'idealLiteMerchantId' => '',
- 'partner_id' => '',
- 'usaepay_key' => '',
- 'ewaytype' => '',
- 'eway_username' => '',
- 'psitype' => '',
- 'eway_customerid' => '',
- 'psi_live_url' => '',
- 'psi_storeid' => '',
- 'psi_passphrase' => '',
- 'psi_merchantId' => '',
- 'safe_pay_account_id' => '',
- 'paypal_pro_country' => '',
- 'paypal_api_user' => '',
- 'paypalid' => '',
- 'paypal_api_signature' => '',
- 'paypal_api_password' => '',
- 'transkey' => '',
- 'merchid' => '',
- 'field_options' =>
- array (
- ),
- 'depend_on_field' => '',
- 'offline_zero_credit' => '',
- 'cardtype' =>
- array (
- ),
- 'godaddy_hosting' => '',
- 'paymentmethod' =>
- array (
- ),
- 'paymentmode' => '',
- 'currency_separator' => '',
- 'currency_code' => '',
- 'transfirst_merchid' => '',
- 'transfirst_transkey' => '',
- 'paylater_field' => '',
- 'paylater_field_options' => array (
- ),
- 'korta_merchant' => '',
- 'korta_terminal' => '',
- 'korta_secretcode' => '',
- 'authorizenet_type' => 'aim',
- 'ps_store_id' =>'',
- 'hpp_key' => '',
- 'moneris_type' => 'hosted',
- 'moneris_cvv_enable'=> '0',
- 'pxpay_username'=>'',
- 'pxpay_password'=>'',
- 'epdq_id'=>'',
- 'epdq_pass'=>'',
- 'sagpay_email_to'=>'',
- 'sagpay_etype'=>'AES',
- 'sagpay_protocol'=>'2.23',
- 'sagpay_password'=>'',
- 'sagpay_vendor_email'=>'',
- 'sagpay_vendor'=>'',
- 'sofort_config_id'=>'',
- 'sofort_project_id'=>'',
- 'authorizenet_header_txt'=>''
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement