Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Checkout
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Nexus
|
||||
* @since 10 Feb 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\nexus\modules\front\checkout;
|
||||
@@ -189,7 +188,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/* Init */
|
||||
$buttonLang = 'continue_to_review';
|
||||
$needBillingInfo = $this->invoice->hasItemsRequiringBillingAddress() or $this->invoice->hasPhysicalItems();
|
||||
$needBillingInfo = ( $this->invoice->hasItemsRequiringBillingAddress() or $this->invoice->hasPhysicalItems() );
|
||||
|
||||
if ( $this->invoice->hasPhysicalItems() )
|
||||
{
|
||||
@@ -529,7 +528,8 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
if ( $field->purchase_show )
|
||||
{
|
||||
$column = $field->column;
|
||||
$member->$column = $values["nexus_ccfield_{$field->id}"];
|
||||
$helper = $field->buildHelper();
|
||||
$member->$column = $helper::stringValue( $values["nexus_ccfield_{$field->id}"] );
|
||||
}
|
||||
|
||||
if ( $field->type === 'Editor' )
|
||||
@@ -575,10 +575,10 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
foreach ( array( 'cm_first_name', 'cm_last_name' ) as $k )
|
||||
{
|
||||
if ( $values[ $k ] != $this->invoice->member->$k )
|
||||
if ( $values[ $k ] != \IPS\nexus\Customer::loggedIn()->$k )
|
||||
{
|
||||
$changes['name'] = $this->invoice->member->cm_name;
|
||||
$this->invoice->member->$k = $values[ $k ];
|
||||
$changes['name'] = \IPS\nexus\Customer::loggedIn()->cm_name;
|
||||
\IPS\nexus\Customer::loggedIn()->$k = $values[ $k ];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -587,27 +587,29 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
if ( $field->purchase_show )
|
||||
{
|
||||
$column = $field->column;
|
||||
if ( $this->invoice->member->$column != $values["nexus_ccfield_{$field->id}"] )
|
||||
$helper = $field->buildHelper();
|
||||
$valueToSave = $helper::stringValue( $values["nexus_ccfield_{$field->id}"] );
|
||||
if ( \IPS\nexus\Customer::loggedIn()->$column != $valueToSave )
|
||||
{
|
||||
$changes['other'][] = array( 'name' => 'nexus_ccfield_' . $field->id, 'value' => $field->displayValue( $values["nexus_ccfield_{$field->id}"] ), 'old' => $this->invoice->member->$column );
|
||||
$changes['other'][] = array( 'name' => 'nexus_ccfield_' . $field->id, 'value' => $field->displayValue( $valueToSave ), 'old' => $field->displayValue( \IPS\nexus\Customer::loggedIn()->$column ) );
|
||||
}
|
||||
$this->invoice->member->$column = $values["nexus_ccfield_{$field->id}"];
|
||||
\IPS\nexus\Customer::loggedIn()->$column = $valueToSave;
|
||||
}
|
||||
}
|
||||
if ( !empty( $changes ) )
|
||||
{
|
||||
$this->invoice->member->log( 'info', $changes );
|
||||
\IPS\nexus\Customer::loggedIn()->log( 'info', $changes );
|
||||
}
|
||||
|
||||
/* We only want to do this if it's an actual account */
|
||||
if ( $this->invoice->member->member_id )
|
||||
if ( \IPS\nexus\Customer::loggedIn()->member_id )
|
||||
{
|
||||
$this->invoice->member->save();
|
||||
\IPS\nexus\Customer::loggedIn()->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, we need to store this as guest data */
|
||||
$this->invoice->guest_data = array( 'member' => $this->invoice->member->changed, 'profileFields' => array(), 'securityAnswers' => array() );
|
||||
$this->invoice->guest_data = array( 'member' => \IPS\nexus\Customer::loggedIn()->changed, 'profileFields' => array(), 'securityAnswers' => array() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,14 +706,13 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Session::i()->setAnon();
|
||||
}
|
||||
$member->checkLoginKey();
|
||||
if ( $rememberMe )
|
||||
{
|
||||
$expire = new \IPS\DateTime;
|
||||
$expire->add( new \DateInterval( 'P3M' ) );
|
||||
\IPS\Request::i()->setCookie( 'member_id', $member->member_id, $expire );
|
||||
\IPS\Request::i()->setCookie( 'pass_hash', $member->member_login_key, $expire );
|
||||
}
|
||||
|
||||
/* Log device */
|
||||
$device = \IPS\Member\Device::loadOrCreate( $member, FALSE );
|
||||
$device->anonymous = $anonymous and !\IPS\Settings::i()->disable_anonymous;
|
||||
$device->updateAfterAuthentication( $rememberMe );
|
||||
|
||||
/* Member Sync */
|
||||
$member->memberSync( 'onLogin', array( $this->invoice->checkoutUrl() ) );
|
||||
|
||||
/* Set the invoice owner */
|
||||
@@ -1047,10 +1048,12 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$addressLines = $address->addressLines;
|
||||
|
||||
$response = \IPS\Http\Url::external( 'https://api.easypost.com/v2/addresses' )->request()->login( \IPS\Settings::i()->easypost_api_key, '' )->post( array( 'address' => array(
|
||||
'street1' => array_shift( $address->addressLines ),
|
||||
'street2' => count( $address->addressLines ) ? implode( ', ', $address->addressLines ) : NULL,
|
||||
'street1' => array_shift( $addressLines ),
|
||||
'street2' => count( $addressLines ) ? implode( ', ', $addressLines ) : NULL,
|
||||
'city' => $address->city,
|
||||
'state' => $address->region,
|
||||
'zip' => $address->postalCode,
|
||||
@@ -1117,6 +1120,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
if ( $memberJustCreated )
|
||||
{
|
||||
\IPS\Session::i()->setMember( $memberJustCreated );
|
||||
\IPS\Member\Device::loadOrCreate( $memberJustCreated, FALSE )->updateAfterAuthentication( NULL );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $destination );
|
||||
@@ -1332,7 +1336,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
't_member=? AND t_invoice=? AND t_method=? AND t_status=? AND t_amount=? AND t_currency=?',
|
||||
\IPS\Member::loggedIn()->member_id,
|
||||
$this->invoice->id,
|
||||
$gateway->_id,
|
||||
( $gateway === NULL ) ? 0 : $gateway->_id,
|
||||
\IPS\nexus\Transaction::STATUS_WAITING,
|
||||
(string) $amountToPay->amount,
|
||||
$amountToPay->currency
|
||||
@@ -1391,7 +1395,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Create a MaxMind request */
|
||||
$maxMind = NULL;
|
||||
if ( \IPS\Settings::i()->maxmind_key )
|
||||
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->setTransaction( $transaction );
|
||||
@@ -1437,6 +1441,7 @@ class _checkout extends \IPS\Dispatcher\Controller
|
||||
if ( $memberJustCreated )
|
||||
{
|
||||
\IPS\Session::i()->setMember( $memberJustCreated );
|
||||
\IPS\Member\Device::loadOrCreate( $memberJustCreated, FALSE )->updateAfterAuthentication( NULL );
|
||||
}
|
||||
|
||||
/* Send email receipt */
|
||||
|
||||
Reference in new issue
Block a user