Added Crazydomains and fixed payment updates

This commit is contained in:
Deon George 2014-06-24 14:38:39 +10:00
parent cbd10347a5
commit fadd59b20f
7 changed files with 104 additions and 17 deletions

View File

@ -0,0 +1,35 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is able to interact with CrazyDomains
*
* @package Domain
* @category Service
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Service_Domain_CrazyDomain extends Service_Domain {
private $login_acnt_field = '';
private $login_user_field = 'member_username';
private $login_pass_field = 'member_password';
// Our required abstract classes
public function manage_button(Model_Service_Plugin_Domain $spdo,$t) {
$debug = FALSE;
$output = '';
$output .= Form::open(
$debug ? 'debug/site' : $this->so->manage_url,
array('target'=>'crazy','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t))
);
$output .= Form::input($this->login_user_field,$spdo->username(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
$output .= Form::input($this->login_pass_field,substr(md5($spdo->password()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
$output .= Form::hidden('submitted','TRUE');
$output .= Form::close();
$output .= Form::button('submit',_('Login'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t)));
return $output;
}
}
?>

View File

@ -20,13 +20,13 @@ class Service_Domain_TPP extends Service_Domain {
$output = '';
$output .= Form::open(
$debug ? 'debug/site' : sprintf('%s/%s',$this->so->whitelabel_url,'execute/logon'),
$debug ? 'debug/site' : $this->so->manage_url,
array('target'=>'tpp','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t))
);
$output .= Form::input($this->login_user_field,$spdo->username(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
$output .= Form::input($this->login_pass_field,substr(md5($spdo->password()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
$output .= Form::close();
$output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t)));
$output .= Form::button('submit',_('Login'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t)));
return $output;
}

View File

@ -6,13 +6,11 @@
<dt>Domain Name</dt>
<dd><?php echo $o->name(); ?></dd>
<?php if (! $o->service->external_billing) : ?>
<dt>Domain Expire</dt>
<dd><?php echo $o->display('domain_expire'); ?></dd>
<dt>Domain Auth Password</dt>
<dd><?php echo ! $o->service->expiring() ? $o->display('registrar_auth_password') : 'EXPIRED'; ?></dd>
<?php endif ?>
<?php if ($x=$o->manage_button()) : ?>
<dt>Registrar</dt>
@ -29,8 +27,6 @@
<dd><?php echo HTML::anchor($o->registrar->whitelabel_url,NULL); ?></dd>
<dt>Username</dt>
<dd><?php echo $o->registrar_username; ?></dd>
<dt>Password</dt>
<dd><?php echo $o->registrar_password; ?></dd>
<?php endif ?>
</div> <!-- dl-horizontal -->
</fieldset>

View File

@ -0,0 +1,53 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides Crazy Domains support
*
* @package Host
* @category Plugins
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Host_Plugin_CrazyDomains extends Host_Plugin {
// Manage UI Login Attributes
protected $login_acnt_field = '';
protected $login_user_field = 'user';
protected $login_pass_field = 'pass';
// Our required abstract classes
public function __get($key) {}
public function admin_update() {}
public function serialize() {
return (string)$this->_object;
}
public function unserialize($s) {
$this->_object = XML::factory(NULL,NULL,$s);
}
public function manage_button(Model_Service_Plugin_Host $spho,$t) {
return $this->render_button($t,$spho->service_id,$spho->username(),substr(md5($spho->password()),0,8));
}
public function admin_manage_button(Model_Host_Server $hso,$t) {
return $this->render_button($t,$hso->id,substr(md5($hso->manage_username),0,8),substr(md5($hso->manage_password),0,8));
}
protected function render_button($t,$sid,$u,$p) {
$debug = FALSE;
$output = '';
$output .= Form::open(
$debug ? 'debug/site' : $this->hso->manage_url,
array('target'=>'w24','method'=>'post','id'=>sprintf('id_%s_%s',$sid,$t))
);
$output .= Form::input($this->login_user_field,$u,array('type'=>'hidden','id'=>sprintf('u_%s_%s',$sid,$t)));
$output .= Form::input($this->login_pass_field,$p,array('type'=>'hidden','id'=>sprintf('p_%s_%s',$sid,$t)));
$output .= Form::hidden('submitted','TRUE');
$output .= Form::close();
$output .= Form::button('submit',_('Login'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$sid,$t),'nocg'=>TRUE));
return $output;
}
}
?>

View File

@ -10,10 +10,15 @@
<dd><?php echo $o->display('host_expire'); ?></dd>
<?php if ($x=$o->manage_button()) : ?>
<div class="offset1">
<?php echo $x; ?>
</div>
<dt>Panel</dt>
<dd><?php echo $x; ?></dd>
<?php endif ?>
<?php if ($o->service->external_billing) : ?>
<dt>Provider</dt>
<dd><?php echo HTML::anchor($o->host->whitelabel_url,NULL); ?></dd>
<dt>Username</dt>
<dd><?php echo $o->host_username; ?></dd>
<?php endif ?>
</div> <!-- dl-horizontal -->
</fieldset>

View File

@ -189,10 +189,8 @@ class Model_Payment extends ORM_OSB {
if (! $pio->check())
throw HTTP_Exception::factory(501,'Problem saving payment_item for invoice :invoice - Failed check()',array(':invoice'=>$pio->invoice_id));
$pio->save();
// @todo Mark payment as cancelled and write a memo, then...
if (! $pio->saved())
if ($pio->changed() AND ! $pio->save())
throw HTTP_Exception::factory(501,'Problem saving payment_item for invoice :invoice - Failed save()',array(':invoice'=>$pio->invoice_id));
}

View File

@ -38,7 +38,7 @@ abstract class Model_Service_Plugin extends ORM_OSB {
*/
protected function manage() {
// Dont show the manage button for expired or inactive services
if (! $this->service->status OR $this->service->expiring() OR $this->service->external_billing)
if (! $this->service->status OR $this->service->expiring())
return FALSE;
static $x = '';