Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -28,9 +28,7 @@ catch ( \OutOfRangeException $e )
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=nexus&module=checkout&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->nexusTransactionId, 'front', 'nexus_checkout' ) );
|
||||
}
|
||||
|
||||
/* Process */
|
||||
try
|
||||
{
|
||||
$fraudCheck = function( $transaction, $refuseExecute=TRUE ) {
|
||||
/* Check fraud rules */
|
||||
$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 ) ) ) )
|
||||
@@ -40,13 +38,19 @@ try
|
||||
$maxMind->setTransactionType( 'paypal' );
|
||||
}
|
||||
$fraudResult = $transaction->runFraudCheck( $maxMind );
|
||||
if ( $fraudResult === \IPS\nexus\Transaction::STATUS_REFUSED )
|
||||
if ( $refuseExecute AND $fraudResult === \IPS\nexus\Transaction::STATUS_REFUSED )
|
||||
{
|
||||
$transaction->executeFraudAction( $fraudResult, FALSE );
|
||||
$transaction->sendNotification();
|
||||
\IPS\Output::i()->redirect( $transaction->url() );
|
||||
}
|
||||
|
||||
|
||||
return $fraudResult;
|
||||
};
|
||||
|
||||
/* Process */
|
||||
try
|
||||
{
|
||||
/* Subscription */
|
||||
if ( isset( \IPS\Request::i()->subscription ) )
|
||||
{
|
||||
@@ -70,7 +74,10 @@ try
|
||||
}
|
||||
$transaction->billing_agreement = $billingAgreement;
|
||||
$transaction->save();
|
||||
|
||||
|
||||
/* Check Fraud */
|
||||
$fraudResult = $fraudCheck( $transaction, FALSE );
|
||||
|
||||
/* Just save that we're waiting for the webhook, but also try again in a few minutes because PayPal is flakey */
|
||||
$transaction->status = \IPS\nexus\Transaction::STATUS_GATEWAY_PENDING;
|
||||
$transaction->save();
|
||||
@@ -113,6 +120,8 @@ try
|
||||
$transaction->gw_id = $t['transaction_id'];
|
||||
$transaction->save();
|
||||
|
||||
/* Check Fraud Actions */
|
||||
$fraudResult = $fraudCheck( $transaction );
|
||||
if ( $fraudResult and $fraudResult !== \IPS\nexus\Transaction::STATUS_PAID )
|
||||
{
|
||||
$transaction->executeFraudAction( $fraudResult, TRUE );
|
||||
@@ -163,6 +172,9 @@ try
|
||||
$transaction->extra = $extra;
|
||||
}
|
||||
$transaction->save();
|
||||
|
||||
/* Fraud Check */
|
||||
$fraudResult = $fraudCheck( $transaction, FALSE );
|
||||
}
|
||||
|
||||
/* Capture */
|
||||
|
||||
Reference in new issue
Block a user