Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,20 +2,21 @@
|
||||
/**
|
||||
* @brief Send/Discard handler for pending support replies
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Nexus
|
||||
* @since 25 Apr 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
require_once '../../../../init.php';
|
||||
\IPS\Dispatcher\Front::i();
|
||||
|
||||
try
|
||||
{
|
||||
$reply = \IPS\nexus\Support\Reply::load( \IPS\Request::i()->id );
|
||||
if ( \IPS\Request::i()->key !== md5( $reply->item()->email_key . $reply->date ) )
|
||||
if ( !\IPS\Login::compareHashes( md5( $reply->item()->email_key . $reply->date ), (string) \IPS\Request::i()->key ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief 2Checkout Gateway
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Nexus
|
||||
* @since 18 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
@@ -18,17 +18,17 @@ try
|
||||
|
||||
if ( $transaction->status !== \IPS\nexus\Transaction::STATUS_PENDING )
|
||||
{
|
||||
throw new \OutofRangeException;
|
||||
throw new \OutOfRangeException();
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=nexus&module=payments&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->nexustransactionid, 'front', 'nexus_checkout', \IPS\Settings::i()->nexus_https ) );
|
||||
\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', \IPS\Settings::i()->nexus_https ) );
|
||||
}
|
||||
|
||||
$settings = json_decode( $transaction->method->settings, TRUE );
|
||||
$hash = mb_strtoupper( md5( $settings['word'] . $settings['sid'] . ( \IPS\NEXUS_TEST_GATEWAYS ? 1 : \IPS\Request::i()->order_number ) . number_format( $transaction->amount->amount, 2 ) ) );
|
||||
if ( $hash !== \IPS\Request::i()->key )
|
||||
$hash = mb_strtoupper( md5( $settings['word'] . $settings['sid'] . ( \IPS\NEXUS_TEST_GATEWAYS ? 1 : \IPS\Request::i()->order_number ) . number_format( $transaction->amount->amountAsString(), 2 ) ) );
|
||||
if ( !\IPS\Login::compareHashes( (string) $hash, (string) \IPS\Request::i()->key ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( $transaction->invoice->checkoutUrl()->setQueryString( array( '_step' => 'checkout_pay', 'err' => $transaction->member->language()->get('gateway_err') ) ) );
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Authorize.Net DPM Gateway
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Nexus
|
||||
* @since 17 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
@@ -29,7 +29,7 @@ try
|
||||
$settings = json_decode( $gateway->settings, TRUE );
|
||||
|
||||
/* Check MD5 hash */
|
||||
if ( \IPS\Request::i()->x_MD5_Hash != mb_strtoupper( md5( $settings['hash'] . $settings['login'] . \IPS\Request::i()->x_trans_id . \IPS\Request::i()->x_amount ) ) )
|
||||
if ( !\IPS\Login::compareHashes( mb_strtoupper( md5( $settings['hash'] . $settings['login'] . \IPS\Request::i()->x_trans_id . \IPS\Request::i()->x_amount ) ), \IPS\Request::i()->x_MD5_Hash ) )
|
||||
{
|
||||
throw new \Exception( $invoice->member->language()->addToStack('gateway_err') );
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief PayPal Gateway
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Nexus
|
||||
* @since 07 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
@@ -13,6 +13,7 @@
|
||||
require_once '../../../../init.php';
|
||||
\IPS\Session\Front::i();
|
||||
|
||||
/* Load Transaction */
|
||||
try
|
||||
{
|
||||
$transaction = \IPS\nexus\Transaction::load( \IPS\Request::i()->nexusTransactionId );
|
||||
@@ -24,15 +25,13 @@ try
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=nexus&module=payments&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->nexusTransactionId, 'front', 'nexus_checkout', \IPS\Settings::i()->nexus_https ) );
|
||||
\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', \IPS\Settings::i()->nexus_https ) );
|
||||
}
|
||||
|
||||
/* Process */
|
||||
try
|
||||
{
|
||||
$response = $transaction->method->api( "payments/payment/{$transaction->gw_id}/execute", array(
|
||||
'payer_id' => \IPS\Request::i()->PayerID,
|
||||
) );
|
||||
|
||||
/* Check fraud rules */
|
||||
$maxMind = NULL;
|
||||
if ( \IPS\Settings::i()->maxmind_key )
|
||||
{
|
||||
@@ -40,13 +39,123 @@ try
|
||||
$maxMind->setTransaction( $transaction );
|
||||
$maxMind->setTransactionType( 'paypal' );
|
||||
}
|
||||
$fraudResult = $transaction->runFraudCheck( $maxMind );
|
||||
if ( $fraudResult === \IPS\nexus\Transaction::STATUS_REFUSED )
|
||||
{
|
||||
$transaction->executeFraudAction( $fraudResult, FALSE );
|
||||
$transaction->sendNotification();
|
||||
\IPS\Session::i()->setMember( $transaction->invoice->member ); // This is in case the checkout was a guest, meaning checkFraudRulesAndCapture() may have just created an account. There is no security issue as we have just verified they were just bounced back from PayPal
|
||||
\IPS\Output::i()->redirect( $transaction->url() );
|
||||
}
|
||||
|
||||
$transaction->checkFraudRulesAndCapture( $maxMind );
|
||||
/* Billing Agreement */
|
||||
if ( isset( \IPS\Request::i()->billingAgreement ) )
|
||||
{
|
||||
/* Execute */
|
||||
$response = $transaction->method->api( "payments/billing-agreements/" . \IPS\Request::i()->token . "/agreement-execute" );
|
||||
$agreementId = $response['id'];
|
||||
if ( isset( $response['payer'] ) and isset( $response['payer']['status'] ) )
|
||||
{
|
||||
$extra = $transaction->extra;
|
||||
$extra['verified'] = $response['payer']['status'];
|
||||
$transaction->extra = $extra;
|
||||
}
|
||||
|
||||
/* Create Billing Agreement */
|
||||
$billingAgreement = new \IPS\nexus\Gateway\PayPal\BillingAgreement;
|
||||
$billingAgreement->gw_id = $agreementId;
|
||||
$billingAgreement->method = $transaction->method;
|
||||
$billingAgreement->member = $transaction->member;
|
||||
$billingAgreement->started = \IPS\DateTime::create();
|
||||
$billingAgreement->next_cycle = \IPS\DateTime::create()->add( new \DateInterval( 'P' . $response['plan']['payment_definitions'][0]['frequency_interval'] . mb_substr( $response['plan']['payment_definitions'][0]['frequency'], 0, 1 ) ) );
|
||||
$billingAgreement->save();
|
||||
$transaction->billing_agreement = $billingAgreement;
|
||||
$transaction->save();
|
||||
|
||||
/* Get the initial setup transaction if possible */
|
||||
$haveInitialTransaction = FALSE;
|
||||
$transactions = $transaction->method->api( "payments/billing-agreements/{$agreementId}/transactions?start_date=" . date( 'Y-m-d', time() - 86400 ) . '&end_date=' . date( 'Y-m-d' ), NULL, 'get' );
|
||||
foreach ( $transactions['agreement_transaction_list'] as $t )
|
||||
{
|
||||
if ( $t['status'] == 'Completed' )
|
||||
{
|
||||
$transaction->gw_id = $t['transaction_id'];
|
||||
$transaction->save();
|
||||
|
||||
if ( $fraudResult and $fraudResult !== \IPS\nexus\Transaction::STATUS_PAID )
|
||||
{
|
||||
$transaction->executeFraudAction( $fraudResult, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
$transaction->member->log( 'transaction', array(
|
||||
'type' => 'paid',
|
||||
'status' => $transaction::STATUS_PAID,
|
||||
'id' => $transaction->id,
|
||||
'invoice_id' => $transaction->invoice->id,
|
||||
'invoice_title' => $transaction->invoice->title,
|
||||
) );
|
||||
|
||||
$transaction->approve();
|
||||
}
|
||||
|
||||
$transaction->sendNotification();
|
||||
|
||||
if ( $transaction->invoice->member->member_id )
|
||||
{
|
||||
\IPS\Session::i()->setMember( $transaction->invoice->member );
|
||||
}
|
||||
\IPS\Output::i()->redirect( $transaction->url() );
|
||||
}
|
||||
}
|
||||
|
||||
/* If it hasn't been processed yet (PayPal is a bit flakey), we need to try again in a few minutes */
|
||||
$transaction->status = \IPS\nexus\Transaction::STATUS_GATEWAY_PENDING;
|
||||
$transaction->save();
|
||||
$transaction->sendNotification();
|
||||
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), "`key`='gatewayPending'" );
|
||||
\IPS\Output::i()->redirect( $transaction->url() );
|
||||
}
|
||||
|
||||
/* Normal */
|
||||
else
|
||||
{
|
||||
$response = $transaction->method->api( "payments/payment/{$transaction->gw_id}/execute", array(
|
||||
'payer_id' => \IPS\Request::i()->PayerID,
|
||||
) );
|
||||
$transaction->gw_id = $response['transactions'][0]['related_resources'][0]['authorization']['id']; // Was previously a payment ID. This sets it to the actual transaction ID for the authorization. At capture, it will be updated again to the capture transaction ID
|
||||
$transaction->auth = \IPS\DateTime::ts( strtotime( $response['transactions'][0]['related_resources'][0]['authorization']['valid_until'] ) );
|
||||
if ( isset( $response['payer'] ) and isset( $response['payer']['status'] ) )
|
||||
{
|
||||
$extra = $transaction->extra;
|
||||
$extra['verified'] = $response['payer']['status'];
|
||||
$transaction->extra = $extra;
|
||||
}
|
||||
$transaction->save();
|
||||
}
|
||||
|
||||
/* Capture */
|
||||
if ( $fraudResult )
|
||||
{
|
||||
$transaction->executeFraudAction( $fraudResult, TRUE );
|
||||
}
|
||||
if ( !$fraudResult or $fraudResult === \IPS\nexus\Transaction::STATUS_PAID )
|
||||
{
|
||||
$transaction->captureAndApprove();
|
||||
}
|
||||
$transaction->sendNotification();
|
||||
\IPS\Session::i()->setMember( $transaction->invoice->member ); // This is in case the checkout was a guest, meaning checkFraudRulesAndCapture() may have just created an account. There is no security issue as we have just verified they were just bounced back from PayPal
|
||||
|
||||
/* If we checked out as a guest, and captureAndApprove() created an account, we need to log them in. There is no security issue as we have just verified they were just bounced back from PayPal */
|
||||
if ( $transaction->invoice->member->member_id )
|
||||
{
|
||||
\IPS\Session::i()->setMember( $transaction->invoice->member );
|
||||
}
|
||||
|
||||
/* Redirect */
|
||||
\IPS\Output::i()->redirect( $transaction->url() );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Log::log( $e, 'paypal' );
|
||||
\IPS\Output::i()->redirect( $transaction->invoice->checkoutUrl()->setQueryString( array( '_step' => 'checkout_pay', 'err' => $e->getMessage() ) ) );
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief SagePay Gateway
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Nexus
|
||||
* @since 19 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
require_once '../../../../init.php';
|
||||
|
||||
function returnData( $status, $detail, $returnUrl )
|
||||
{
|
||||
echo "Status={$status}\r\nStatusDetail={$detail}\r\nRedirectURL={$returnUrl}";
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Load */
|
||||
try
|
||||
{
|
||||
$transaction = \IPS\nexus\Transaction::load( \IPS\Request::i()->VendorTxCode );
|
||||
|
||||
if ( $transaction->status !== \IPS\nexus\Transaction::STATUS_PENDING )
|
||||
{
|
||||
throw new \OutofRangeException;
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
returnData( 'ERROR', 'NO_TRANSACTION', \IPS\Settings::i()->base_url );
|
||||
}
|
||||
|
||||
/* Authenticate */
|
||||
$settings = json_decode( $transaction->method->settings, TRUE );
|
||||
$extra = $transaction->extra;
|
||||
|
||||
if ( \IPS\Request::i()->VPSSignature !== mb_strtoupper( md5( \IPS\Request::i()->VPSTxId . \IPS\Request::i()->VendorTxCode . \IPS\Request::i()->Status . \IPS\Request::i()->TxAuthNo . mb_strtolower( $settings['vendor'] ) . \IPS\Request::i()->AVSCV2 . $extra['sagepaySecurityKey'] . \IPS\Request::i()->AddressResult . \IPS\Request::i()->PostCodeResult . \IPS\Request::i()->CV2Result . \IPS\Request::i()->GiftAid . \IPS\Request::i()->__get('3DSecureStatus') . \IPS\Request::i()->CAVV . \IPS\Request::i()->AddressStatus . \IPS\Request::i()->PayerStatus . \IPS\Request::i()->CardType . \IPS\Request::i()->Last4Digits . \IPS\Request::i()->DeclineCode . \IPS\Request::i()->ExpiryDate . \IPS\Request::i()->FraudResponse . \IPS\Request::i()->BankAuthCode ) ) )
|
||||
{
|
||||
returnData( 'INVALID', 'MD5', $transaction->invoice->checkoutUrl()->setQueryString( array( '_step' => 'checkout_pay', 'err' => $transaction->member->language()->get( 'gateway_err' ) ) ) );
|
||||
}
|
||||
|
||||
/* Save the auth code */
|
||||
$extra['sagepayAuth'] = \IPS\Request::i()->TxAuthNo;
|
||||
$transaction->extra = $extra;
|
||||
$transaction->save();
|
||||
|
||||
/* Handle */
|
||||
if ( \IPS\Request::i()->Status === 'OK' )
|
||||
{
|
||||
$maxMind = NULL;
|
||||
if ( \IPS\Settings::i()->maxmind_key )
|
||||
{
|
||||
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request;
|
||||
$maxMind->setTransaction( $transaction );
|
||||
}
|
||||
$transaction->checkFraudRulesAndCapture( $maxMind );
|
||||
$transaction->sendNotification();
|
||||
}
|
||||
|
||||
/* Respond */
|
||||
returnData( 'OK', 'MD5', $transaction->url() );
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief License Key API
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Nexus
|
||||
* @since 01 Apr 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
/**
|
||||
* @brief Monitoring Respond
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Nexus
|
||||
* @since 07 Aug 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
require_once '../../../../init.php';
|
||||
|
||||
\IPS\Dispatcher\External::i();
|
||||
try
|
||||
{
|
||||
$server = \IPS\nexus\Hosting\Server::load( \IPS\Request::i()->server );
|
||||
|
||||
Reference in new issue
Block a user