Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,42 +12,63 @@
namespace IPS\nexus\Gateway\Manual;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use DomainException;
use Exception;
use IPS\Helpers\Form\Text;
use IPS\Helpers\Form\TextArea;
use IPS\nexus\Payout as NexusPayout;
use IPS\Request;
use IPS\Settings;
use IPS\Theme;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Manual Pay Out Gateway
*/
class _Payout extends \IPS\nexus\Payout
class Payout extends NexusPayout
{
/**
* @brief Requires manual approval?
*/
public static $requiresApproval = TRUE;
public static bool $requiresApproval = TRUE;
/**
* Extra HTML to display when the admin view the Payout in the ACP
*
* @return string
*/
public function acpHtml() : string
{
return Theme::i()->getTemplate( 'payouts', 'nexus' )->Manual( $this );
}
/**
* ACP Settings
*
* @return array
*/
public static function settings()
public static function settings() : array
{
$settings = json_decode( \IPS\Settings::i()->nexus_payout, TRUE );
$settings = json_decode( Settings::i()->nexus_payout, TRUE );
$return = array();
$return[] = new \IPS\Helpers\Form\Text( 'manual_name', isset( $settings['Manual'] ) ? $settings['Manual']['name'] : '' , NULL, array(), function( $val ) {
if ( !$val AND isset( \IPS\Request::i()->nexus_payout['Manual'] ) AND \IPS\Request::i()->nexus_payout['Manual'] == 1 )
$return[] = new Text( 'manual_name', isset( $settings['Manual'] ) ? $settings['Manual']['name'] : '' , NULL, array(), function( $val ) {
if ( !$val AND isset( Request::i()->nexus_payout['Manual'] ) AND Request::i()->nexus_payout['Manual'] == 1 )
{
throw new \DomainException( 'form_required' );
throw new DomainException( 'form_required' );
}
});
$return[] = new \IPS\Helpers\Form\Text( 'manual_title', isset( $settings['Manual'] ) ? $settings['Manual']['title'] : '', NULL, array(), function( $val ) {
if ( !$val AND isset( \IPS\Request::i()->nexus_payout['Manual'] ) AND \IPS\Request::i()->nexus_payout['Manual'] == 1 )
$return[] = new Text( 'manual_title', isset( $settings['Manual'] ) ? $settings['Manual']['title'] : '', NULL, array(), function( $val ) {
if ( !$val AND isset( Request::i()->nexus_payout['Manual'] ) AND Request::i()->nexus_payout['Manual'] == 1 )
{
throw new \DomainException( 'form_required' );
throw new DomainException( 'form_required' );
}
});
@@ -59,11 +80,11 @@ class _Payout extends \IPS\nexus\Payout
*
* @return array
*/
public static function form()
public static function form() : array
{
$settings = json_decode( \IPS\Settings::i()->nexus_payout, TRUE );
$settings = json_decode( Settings::i()->nexus_payout, TRUE );
$field = new \IPS\Helpers\Form\TextArea( 'manual_details', NULL, TRUE, array() );
$field = new TextArea( 'manual_details', NULL, TRUE, array() );
$field->label = $settings['Manual']['title'];
return array( $field );
}
@@ -73,23 +94,22 @@ class _Payout extends \IPS\nexus\Payout
*
* @param array $values Values from form
* @return mixed
* @throws \DomainException
* @throws DomainException
*/
public function getData( array $values )
public function getData( array $values ) : mixed
{
return $values['manual_details'];
}
/**
* Process
/**
* Process the payout
* Return the new status for this payout record
*
* @return void
* @throws \Exception
* @return string
* @throws Exception
*/
public function process()
public function process() : string
{
$this->status = static::STATUS_COMPLETE;
$this->completed = new \IPS\DateTime;
$this->save();
return static::STATUS_COMPLETE;
}
}