Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -43,7 +43,8 @@ $transaction->save();
|
||||
$maxMind = NULL;
|
||||
if ( \IPS\Settings::i()->maxmind_key and ( !\IPS\Settings::i()->maxmind_gateways or \IPS\Settings::i()->maxmind_gateways == '*' or in_array( $transaction->method->id, explode( ',', \IPS\Settings::i()->maxmind_gateways ) ) ) )
|
||||
{
|
||||
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request;
|
||||
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request( FALSE );
|
||||
$maxMind->setIpAddress( $transaction->ip );
|
||||
$maxMind->setTransaction( $transaction );
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ require_once '../../../../init.php';
|
||||
try
|
||||
{
|
||||
$transaction = \IPS\nexus\Transaction::load( \IPS\Request::i()->nexusTransactionId );
|
||||
$source = $transaction->method->api( 'sources/' . preg_replace( '/[^A-Z0-9_]/i', '', \IPS\Request::i()->source ) );
|
||||
$source = $transaction->method->api( 'sources/' . preg_replace( '/[^A-Z0-9_]/i', '', \IPS\Request::i()->source ), NULL, 'get' );
|
||||
if ( $source['client_secret'] != \IPS\Request::i()->client_secret )
|
||||
{
|
||||
throw new \Exception;
|
||||
|
||||
@@ -83,18 +83,50 @@ try
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Don't need to do anything for cards, since this is only for asynchronous payments */
|
||||
if ( isset( $data['data']['object']['type'] ) and in_array( $data['data']['object']['type'], array( 'card' ) ) )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'NO_PROCESSING_REQUIRED', 200, 'text/plain' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Load the transaction */
|
||||
if ( isset( $data['data']['object']['metadata']['Transaction ID'] ) )
|
||||
{
|
||||
$transaction = \IPS\nexus\Transaction::load( $data['data']['object']['metadata']['Transaction ID'] );
|
||||
}
|
||||
else
|
||||
elseif ( isset( $data['data']['object']['redirect']['return_url'] ) )
|
||||
{
|
||||
$transaction = loadTransaction( $data['data']['object']['redirect']['return_url'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$where = array( array( 't_gw_id=?', $data['data']['object']['id'] ) );
|
||||
if ( isset( $data['data']['object']['metadata']['Invoice ID'] ) )
|
||||
{
|
||||
$where[] = array( 't_invoice=?', $data['data']['object']['metadata']['Invoice ID'] );
|
||||
}
|
||||
|
||||
$transaction = \IPS\nexus\Transaction::constructFromData( \IPS\Db::i()->select( '*', 'nexus_transactions', $where )->first() );
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'COULD_NOT_FIND_TRANSACTION', 403, 'text/plain' );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ( $transaction->status !== \IPS\nexus\Transaction::STATUS_PENDING and $transaction->status !== \IPS\nexus\Transaction::STATUS_WAITING )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'BAD_STATUS', 403, 'text/plain' );
|
||||
if ( $transaction->status === \IPS\nexus\Transaction::STATUS_GATEWAY_PENDING )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'ALREADY_PROCESSED', 200, 'text/plain' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'BAD_STATUS', 403, 'text/plain' );
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -110,7 +142,8 @@ try
|
||||
$maxMind = NULL;
|
||||
if ( \IPS\Settings::i()->maxmind_key and ( !\IPS\Settings::i()->maxmind_gateways or \IPS\Settings::i()->maxmind_gateways == '*' or in_array( $transaction->method->id, explode( ',', \IPS\Settings::i()->maxmind_gateways ) ) ) )
|
||||
{
|
||||
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request;
|
||||
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request( FALSE );
|
||||
$maxMind->setIpAddress( $transaction->ip );
|
||||
$maxMind->setTransaction( $transaction );
|
||||
}
|
||||
$fraudResult = $transaction->runFraudCheck( $maxMind );
|
||||
@@ -140,13 +173,38 @@ try
|
||||
{
|
||||
$transaction = \IPS\nexus\Transaction::load( $data['data']['object']['metadata']['Transaction ID'] );
|
||||
}
|
||||
else
|
||||
elseif ( isset( $data['data']['object']['source']['redirect']['return_url'] ) )
|
||||
{
|
||||
$transaction = loadTransaction( $data['data']['object']['source']['redirect']['return_url'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$where = array( array( 't_gw_id=?', $data['data']['object']['id'] ) );
|
||||
if ( isset( $data['data']['object']['metadata']['Invoice ID'] ) )
|
||||
{
|
||||
$where[] = array( 't_invoice=?', $data['data']['object']['metadata']['Invoice ID'] );
|
||||
}
|
||||
|
||||
$transaction = \IPS\nexus\Transaction::constructFromData( \IPS\Db::i()->select( '*', 'nexus_transactions', $where )->first() );
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'COULD_NOT_FIND_TRANSACTION', 403, 'text/plain' );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ( $transaction->status !== \IPS\nexus\Transaction::STATUS_GATEWAY_PENDING )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'BAD_STATUS', 403, 'text/plain' );
|
||||
if ( $transaction->status === \IPS\nexus\Transaction::STATUS_PAID )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'ALREADY_PROCESSED', 200, 'text/plain' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'BAD_STATUS', 403, 'text/plain' );
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -154,7 +212,8 @@ try
|
||||
$maxMind = NULL;
|
||||
if ( \IPS\Settings::i()->maxmind_key and ( !\IPS\Settings::i()->maxmind_gateways or \IPS\Settings::i()->maxmind_gateways == '*' or in_array( $transaction->method->id, explode( ',', \IPS\Settings::i()->maxmind_gateways ) ) ) )
|
||||
{
|
||||
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request;
|
||||
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request( FALSE );
|
||||
$maxMind->setIpAddress( $transaction->ip );
|
||||
$maxMind->setTransaction( $transaction );
|
||||
}
|
||||
|
||||
@@ -193,13 +252,38 @@ try
|
||||
{
|
||||
$transaction = \IPS\nexus\Transaction::load( $data['data']['object']['metadata']['Transaction ID'] );
|
||||
}
|
||||
else
|
||||
elseif ( isset( $data['data']['object']['source']['redirect']['return_url'] ) )
|
||||
{
|
||||
$transaction = loadTransaction( $data['data']['object']['source']['redirect']['return_url'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$where = array( array( 't_gw_id=?', $data['data']['object']['id'] ) );
|
||||
if ( isset( $data['data']['object']['metadata']['Invoice ID'] ) )
|
||||
{
|
||||
$where[] = array( 't_invoice=?', $data['data']['object']['metadata']['Invoice ID'] );
|
||||
}
|
||||
|
||||
$transaction = \IPS\nexus\Transaction::constructFromData( \IPS\Db::i()->select( '*', 'nexus_transactions', $where )->first() );
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'COULD_NOT_FIND_TRANSACTION', 403, 'text/plain' );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ( $transaction->status !== \IPS\nexus\Transaction::STATUS_GATEWAY_PENDING )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'BAD_STATUS', 403, 'text/plain' );
|
||||
if ( $transaction->status === \IPS\nexus\Transaction::STATUS_REFUSED )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'ALREADY_PROCESSED', 200, 'text/plain' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( 'BAD_STATUS', 403, 'text/plain' );
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user