Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,16 +12,26 @@
|
||||
namespace IPS\nexus\tasks;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\nexus\Gateway;
|
||||
use IPS\nexus\Payout;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Task;
|
||||
use IPS\Task\Exception;
|
||||
use function defined;
|
||||
use function method_exists;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* payoutPending Task
|
||||
*/
|
||||
class _payoutPending extends \IPS\Task
|
||||
class payoutPending extends Task
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
@@ -31,12 +41,12 @@ class _payoutPending extends \IPS\Task
|
||||
* If an error occurs which means the task could not finish running, throw an \IPS\Task\Exception - do not log an error as a normal log.
|
||||
* Tasks should execute within the time of a normal HTTP request.
|
||||
*
|
||||
* @return mixed Message to log or NULL
|
||||
* @throws \IPS\Task\Exception
|
||||
* @return string|null Message to log or NULL
|
||||
* @throws Exception
|
||||
*/
|
||||
public function execute()
|
||||
public function execute() : string|null
|
||||
{
|
||||
$iterator = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_payouts', array( 'po_status=? AND po_gw_id IS NOT NULL', \IPS\nexus\Payout::STATUS_PROCESSING ) ), 'IPS\nexus\Payout' );
|
||||
$iterator = new ActiveRecordIterator( Db::i()->select( '*', 'nexus_payouts', array( 'po_status=? AND po_gw_id IS NOT NULL', Payout::STATUS_PROCESSING ) ), 'IPS\nexus\Payout' );
|
||||
|
||||
if( !$iterator->count() )
|
||||
{
|
||||
@@ -47,14 +57,14 @@ class _payoutPending extends \IPS\Task
|
||||
|
||||
foreach( $iterator as $payout )
|
||||
{
|
||||
$payoutClass = \IPS\nexus\Gateway::payoutGateways()[ $payout->gateway ];
|
||||
$payoutClass = Gateway::payoutGateways()[ $payout->gateway ];
|
||||
|
||||
if( !\method_exists( $payoutClass, 'checkStatus' ) )
|
||||
if( !method_exists( $payoutClass, 'checkStatus' ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( $payoutClass::checkStatus( $payout->gw_id ) == \IPS\nexus\Payout::STATUS_COMPLETE )
|
||||
if( $payoutClass::checkStatus( $payout->gw_id ) == Payout::STATUS_COMPLETE )
|
||||
{
|
||||
$payout->markCompleted();
|
||||
}
|
||||
@@ -72,7 +82,7 @@ class _payoutPending extends \IPS\Task
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cleanup()
|
||||
public function cleanup() : void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user