Skip to content

Commit

Permalink
Merge pull request #159 from bestit/develop
Browse files Browse the repository at this point in the history
Release 3.6.9
  • Loading branch information
ralfnitzer authored Sep 30, 2021
2 parents b6890e8 + ec93570 commit a8f92ea
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 51 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec2.0.0.html).
## [3.6.9] - 2021-09-14
### Changed
- Amazon login activated permanently, removed from module settings
- Link existing newsletter subscription to new created accounts, when guest/newsletter accounts get deleted

## [3.6.8] - 2020-02-09
### Fixed
- Fixed an include
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
'[{$smarty.session.amazonOrderReferenceId}]',
function (confirmationFlow) {
$.ajax({
url: "/index.php",
url: "[{$oViewConf->getSslSelfLink()|html_entity_decode}]index.php",
data: {
cl: "order",
fnc: "confirmAmazonOrderReference",
Expand All @@ -84,7 +84,7 @@
},
error: function (data) {
confirmationFlow.error();
window.location = '/index.php?cl=user&fnc=cleanAmazonPay';
window.location = '[{$oViewConf->getSslSelfLink()|html_entity_decode}]index.php?cl=user&fnc=cleanAmazonPay';
},
timeout: 0
});
Expand Down
43 changes: 42 additions & 1 deletion application/models/bestitamazonpay4oxidloginclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function isActive()
$sellerId = null;

if ($this->_isActive === null) {
$loginActive = ((bool)$this->getConfig()->getConfigParam('blAmazonLoginActive') === true);
$loginActive = true;
$clientId = ((string)$this->getConfig()->getConfigParam('sAmazonLoginClientId') !== '');
$sellerId = ((string)$this->getConfig()->getConfigParam('sAmazonSellerId') !== '');
//Checkbox for active Login checked
Expand Down Expand Up @@ -175,6 +175,47 @@ public function oxidUserExists($oUserData)
return $this->getDatabase()->getRow($sSql);
}

/**
* Check if user with Email from Amazon exists
*
* @param string $sId The id of the user
*
* @return boolean
* @throws oxConnectionException
*/
public function oxidNewsletterSubscriptionExists($sId)
{
$sSql = "SELECT OXUSERID
FROM oxnewssubscribed
WHERE OXUSERID = {$this->getDatabase()->quote($sId)}";

return $this->getDatabase()->getOne($sSql);
}

/**
* Delete OXID user by ID
*
* @param string $sOldId The id of the old user
* @param string $sNewId The id of the new user
*
* @return object
* @throws oxConnectionException
*/
public function linkNewsletterToNewUser($sOldId, $sNewId)
{
$this->getLogger()->debug(
'Link newsletter subscription from old oxuser to new oxuser',
array('oldOxId' => $sOldId,
'newOxId' => $sNewId)
);

$sSql = "UPDATE oxnewssubscribed
SET OXUSERID = {$this->getDatabase()->quote($sNewId)}
WHERE OXUSERID = {$this->getDatabase()->quote($sOldId)}";

return $this->getDatabase()->execute($sSql);
}

/**
* Create new oxid user with details from Amazon
*
Expand Down
1 change: 0 additions & 1 deletion application/views/admin/de/bestitamazonpay4oxid_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
'SHOP_MODULE_blAmazonLoggingLevel_error' => 'Error',

'SHOP_MODULE_GROUP_bestitAmazonPay4OxidLoginSettings' => 'Amazon Login-Einstellungen',
'SHOP_MODULE_blAmazonLoginActive' => 'Amazon Login aktiv',
'SHOP_MODULE_sAmazonLoginClientId' => 'Client-ID',
'SHOP_MODULE_sAmazonLoginButtonStyle' => 'Login-Button Design',
'SHOP_MODULE_sAmazonPayButtonStyle' => 'Bezahlen-Button Design',
Expand Down
1 change: 0 additions & 1 deletion application/views/admin/en/bestitamazonpay4oxid_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
'SHOP_MODULE_blAmazonLoggingLevel_error' => 'Error',

'SHOP_MODULE_GROUP_bestitAmazonPay4OxidLoginSettings' => 'Amazon Login Settings',
'SHOP_MODULE_blAmazonLoginActive' => 'Amazon Login active',
'SHOP_MODULE_sAmazonLoginClientId' => 'Client ID',
'SHOP_MODULE_sAmazonLoginButtonStyle' => 'Login Button style',
'SHOP_MODULE_sAmazonPayButtonStyle' => 'Pay Button style',
Expand Down
6 changes: 6 additions & 0 deletions ext/bestitamazonpay4oxid_oxcmp_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ public function amazonLogin()
array('oxId' => $sUserId)
);

// Check if a newsletter subscription existed on the old account
$aNewsletterId = $oLoginClient->oxidNewsletterSubscriptionExists($aUserData['OXID']);
if ($aNewsletterId) {
$oLoginClient->linkNewsletterToNewUser($aUserData['OXID'], $sUserId);
}

$oSession->setVariable('usr', $sUserId);
$oUtils->redirect($sRedirectUrl, false);
return;
Expand Down
3 changes: 1 addition & 2 deletions ext/bestitamazonpay4oxid_oxdeliverysetlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ protected function _processResult($aResult, $oUser, $oBasket)
if ($sAmazonOrderReferenceId === null
&& ($this->_getContainer()->getModule()->getIsSelectedCurrencyAvailable() === false
|| $oBasket->getPrice()->getBruttoPrice() === 0
|| ((bool)$oConfig->getConfigParam('blAmazonLoginActive') === true
&& $this->_getContainer()->getLoginClient()->showAmazonPayButton() === false)
|| $this->_getContainer()->getLoginClient()->showAmazonPayButton() === false
)
) {
$logger->debug(
Expand Down
22 changes: 2 additions & 20 deletions metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<b style="color: red">Wenn Sie das Modul von einer vorhergehenden Version updaten muss das Module deaktivert und erneut aktiviert werden</b>'
),
'thumbnail' => 'bestitamazonpay4oxid_logo.png',
'version' => '3.6.8',
'version' => '3.6.9',
'author' => 'best it GmbH & Co. KG',
'url' => 'http://www.bestit-online.de',
'email' => 'support@bestit-online.de',
Expand Down Expand Up @@ -233,13 +233,6 @@
'value' => 'error',
'constraints' => 'debug|error'
),
array(
'group' => 'bestitAmazonPay4OxidLoginSettings',
'name' => 'blAmazonLoginActive',
'type' => 'bool',
'value' => 'true',
'position' => 1
),
array(
'group' => 'bestitAmazonPay4OxidLoginSettings',
'name' => 'sAmazonLoginClientId',
Expand Down Expand Up @@ -322,18 +315,7 @@
'type' => 'select',
'value' => '',
'position' => 6,
'constraints' => '
|SetOrderReferenceDetailsPaymentMethodNotAllowed
|CloseOrderReferenceAmazonClosed
|AuthorizeInvalidPaymentMethod
|AuthorizeAmazonRejected
|AuthorizeTransactionTimedOut
|AuthorizeExpiredUnused
|AuthorizeAmazonClosed
|CapturePending
|CaptureAmazonRejected
|CaptureAmazonClosed
|RefundAmazonRejected'
'constraints' => '|SetOrderReferenceDetailsPaymentMethodNotAllowed|CloseOrderReferenceAmazonClosed|AuthorizeInvalidPaymentMethod|AuthorizeAmazonRejected|AuthorizeTransactionTimedOut|AuthorizeExpiredUnused|AuthorizeAmazonClosed|CapturePending|CaptureAmazonRejected|CaptureAmazonClosed|RefundAmazonRejected'
),
array(
'group' => 'bestitAmazonPay4OxidConfiguration',
Expand Down
5 changes: 0 additions & 5 deletions tests/acceptance/config_data.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ return array(
'value' => '<AmazonPay LoginClientId>',
'module' => 'module:bestitamazonpay4oxid'
),
'blAmazonLoginActive' => array(
'type' => 'bool',
'value' => 'true',
'module' => 'module:bestitamazonpay4oxid'
),
'blAmazonSandboxActive' => array(
'type' => 'bool',
'value' => 'true',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,33 +77,21 @@ public function testCreateInstance()
public function testIsActive()
{
$oConfig = $this->_getConfigMock();
$oConfig->expects($this->exactly(12))
$oConfig->expects($this->exactly(6))
->method('getConfigParam')
->withConsecutive(
array('blAmazonLoginActive'),
array('sAmazonLoginClientId'),
array('sAmazonSellerId'),
array('blAmazonLoginActive'),
array('sAmazonLoginClientId'),
array('sAmazonSellerId'),
array('blAmazonLoginActive'),
array('sAmazonLoginClientId'),
array('sAmazonSellerId'),
array('blAmazonLoginActive'),
array('sAmazonLoginClientId'),
array('sAmazonSellerId')
)
->will($this->onConsecutiveCalls(
false,
'clientId',
'sellerId',
true,
'',
'sellerId',
true,
'clientId',
'',
true,
'clientId',
'sellerId'
));
Expand All @@ -121,8 +109,6 @@ public function testIsActive()
$this->_getObjectFactoryMock()
);

self::assertFalse($oLoginClient->isActive());

self::setValue($oLoginClient, '_isActive', null);
self::assertFalse($oLoginClient->isActive());

Expand Down
4 changes: 0 additions & 4 deletions tests/unit/ext/bestitAmazonPay4OxidOxDeliverySetListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ public function testGetDeliverySetData()
'some'
));

$oConfig->expects($this->once())
->method('getConfigParam')
->will($this->returnValue(1));

$oContainer->expects($this->exactly(4))
->method('getConfig')
->will($this->returnValue($oConfig));
Expand Down

0 comments on commit a8f92ea

Please sign in to comment.