Version 4.7.13
This commit is contained in:
1 parent
fd22d99e69
commit
7124a02564
954 files changed
+29277
-59308
No files matched your search
@@ -141,14 +141,24 @@ class _payouts extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Output::i()->error( $e->getMessage(), '1X200/1', 500, '' );
|
||||
}
|
||||
|
||||
$payout->status = $payout::STATUS_COMPLETE;
|
||||
|
||||
$payout->processed_by = \IPS\Member::loggedIn();
|
||||
$payout->save();
|
||||
\IPS\Session::i()->log( 'acplogs__payout_processed', array( $payout->id => FALSE ) );
|
||||
$payout->member->log( 'payout', array( 'type' => 'processed', 'amount' => $payout->amount->amount, 'currency' => $payout->amount->currency, 'payout_id' => $payout->id ) );
|
||||
|
||||
\IPS\Email::buildFromTemplate( 'nexus', 'payoutComplete', array( $payout ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $payout->member );
|
||||
|
||||
/* If the payout was actually completed, notify the user */
|
||||
if( $payout->status == \IPS\nexus\Payout::STATUS_COMPLETE )
|
||||
{
|
||||
$payout->markCompleted();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use task if the payout is pending */
|
||||
$task = \IPS\Task::load( 'payoutPending', 'key', [ 'app=?', 'nexus' ] );
|
||||
$task->enabled = TRUE;
|
||||
$task->save();
|
||||
}
|
||||
|
||||
$this->_redirect( $payout );
|
||||
}
|
||||
@@ -179,17 +189,31 @@ class _payouts extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Output::i()->error( $e->getMessage(), '1X200/9', 403, '' );
|
||||
}
|
||||
|
||||
|
||||
$pending = 0;
|
||||
foreach ( $payouts as $payout )
|
||||
{
|
||||
$payout->status = $payout::STATUS_COMPLETE;
|
||||
$payout->completed = new \IPS\DateTime;
|
||||
$payout->processed_by = \IPS\Member::loggedIn();
|
||||
$payout->save();
|
||||
\IPS\Session::i()->log( 'acplogs__payout_processed', array( $payout->id => FALSE ) );
|
||||
$payout->member->log( 'payout', array( 'type' => 'processed', 'amount' => $payout->amount->amount, 'currency' => $payout->amount->currency, 'payout_id' => $payout->id ) );
|
||||
|
||||
\IPS\Email::buildFromTemplate( 'nexus', 'payoutComplete', array( $payout ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $payout->member );
|
||||
|
||||
/* Only do this if the payout is actually complete! */
|
||||
if( $payout->status == \IPS\nexus\Payout::STATUS_COMPLETE )
|
||||
{
|
||||
$payout->markCompleted();
|
||||
continue;
|
||||
}
|
||||
|
||||
$pending++;
|
||||
}
|
||||
|
||||
/* Use task if there are incomplete payouts */
|
||||
if( $pending )
|
||||
{
|
||||
$task = \IPS\Task::load( 'payoutPending', 'key', [ 'app=?', 'nexus' ] );
|
||||
$task->enabled = TRUE;
|
||||
$task->save();
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=payments&controller=payouts') );
|
||||
@@ -374,6 +398,12 @@ class _payouts extends \IPS\Dispatcher\Controller
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
\IPS\Session::i()->log( 'acplogs__payout_settings' );
|
||||
|
||||
/* Remove any ACP notifications related to Payout Settings */
|
||||
foreach( \IPS\nexus\Gateway::payoutGateways() as $key => $class )
|
||||
{
|
||||
\IPS\core\AdminNotification::remove( 'nexus', 'ConfigurationError', "po{$key}" );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=payments&controller=payouts'), 'saved' );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user