classname
stringlengths
2
79
method_name
stringlengths
3
5.05k
description
stringlengths
6
3.95k
method_code
stringlengths
7
8.51k
explanation
stringclasses
1 value
ProductInventoryServiceCacheProxy
addStock
* {@inheritdoc}
$this->triggerCacheChange($shopArticleId); return $this->subject->addStock($shopArticleId, $stock);
-
ProductInventoryServiceCacheProxy
setStock
* {@inheritdoc} * @psalm-suppress InvalidReturnStatement * @FIXME Returning a void return
$this->triggerCacheChange($shopArticleId); return $this->subject->setStock($shopArticleId, $stock);
-
ProductInventoryServiceCacheProxy
updateVariantParentStock
* {@inheritdoc} * @psalm-suppress InvalidReturnStatement * @FIXME Returning a void return
$this->triggerCacheChange($parentArticleId); return $this->subject->updateVariantParentStock($parentArticleId);
-
ProductStatisticsService
getStats
* @var Connection
$query = 'SELECT * FROM `shop_article_stats` WHERE `shop_article_id` = :articleId'; $data = $this->databaseConnection->fetchAssociative($query, array('articleId' => $articleId)); if (is_array($data)) { $stats = $this->createStatsObject($data);
-
ProductStatisticsService
add
* @param string $articleId * * @return ProductStatisticsInterface
$field = $this->getTargetField($type); $query = "INSERT INTO `shop_article_stats` SET `id` = :id, `{$field
-
ProductStatisticsService
set
* @param array<string, mixed> $row * * @return ProductStatistics
$field = $this->getTargetField($type); $query = "INSERT INTO `shop_article_stats` SET `id` = :id, `{$field
-
ProductStatisticsService
updateAllBasedOnVariants
* @param string $articleId * @param int $type * @param float $amount * @psalm-param self::TYPE_* $type * @return void
$query = 'SELECT SUM(`shop_article_stats`.stats_sales) AS stats_sales, SUM(`shop_article_stats`.`stats_detail_views`) AS stats_detail_views, (SUM(`shop_article_stats`.`stats_review_average`)/COUNT(`shop_article`.`id`)) AS stats_review_average, SUM(`shop_article_stats`.`stats_review_count`) AS stats_review_count FROM `shop_article_stats` INNER JOIN `shop_article` ON `shop_article_stats`.`shop_article_id` = `shop_article`.`id` WHERE `shop_article`.`variant_parent_id` = :articleId '; $result = $this->databaseConnection->fetchAssociative($query, array('articleId' => $parentArticleId)); if (is_array($result)) { $stats = $this->createStatsObject($result);
-
ProductStatisticsService
setDatabaseConnection
* @param string $articleId * @param int $type * @param float $amount * @psalm-param self::TYPE_* $type * @return void
$this->databaseConnection = $connection;
-
ProductVariantService
getProductBasedOnSelection: \TdbShopArticle
* {@inheritDoc}
if (true === $shopArticle->IsVariant() && \count($typeSelection) === 0) { return $shopArticle;
-
ShopSearchSuggest
__construct
* @var Connection
$this->databaseConnection = $databaseConnection;
-
ShopSearchSuggest
getSearchSuggestions
* @param Connection $databaseConnection
if ('' === trim($searchTerm)) { return array();
-
ShopService
setDatabaseConnection
* @var string|null
$this->databaseConnection = $connection;
-
ShopService
__construct
* @var TdbShop[] - key = portalId
$this->requestStack = $requestStack; $this->portalDomainService = $portalDomainService; $this->extranetUserProvider = $extranetUserProvider;
-
ShopService
getActiveShop
* @var Connection
return $this->getShopForPortalId($this->getActivePortalId());
-
ShopService
getShopForPortalId
* @var RequestStack
if (isset($this->shops[$cmsPortalId])) { return $this->shops[$cmsPortalId];
-
ShopService
getId
* @var PortalDomainServiceInterface
return $this->getActiveShop()->id;
-
ShopService
getConfiguration
* @var ExtranetUserProviderInterface
return $this->getActiveShop()->sqlData;
-
ShopService
getActiveProduct
* set to true if the recalculation of the basket has been called (and set back to false once that is done. * * @var bool
$request = $this->requestStack->getCurrentRequest(); if (null === $request) { return null;
-
ShopService
getActiveCategory
* @param Connection $connection * * @return void
$request = $this->requestStack->getCurrentRequest(); if (null === $request) { return null;
-
ShopService
getActiveBasket
* @param PortalDomainServiceInterface $portalDomainService * @param RequestStack $requestStack * @param ExtranetUserProviderInterface $extranetUserProvider
$request = $this->requestStack->getCurrentRequest(); if (null === $request) { return null;
-
ShopService
resetBasket
* @return string|null
$this->extranetUserProvider->getActiveUser()->ObserverUnregister('oUserBasket'); $request = $this->requestStack->getCurrentRequest(); if (null === $request || false == $request->hasSession()) { return ;
-
ShopService
getBasketLink
* {@inheritdoc}
$bTargetBasketPageWithoutRedirect = (false === $useRedirect); return $this->getActiveShop()->GetBasketLink(false, $bTargetBasketPageWithoutRedirect);
-
ShopService
getCheckoutLink
* {@inheritdoc} * * @param null|string $cmsPortalId
$bTargetBasketPageWithoutRedirect = (false === $useRedirect); return $this->getActiveShop()->GetBasketLink(true, $bTargetBasketPageWithoutRedirect);
-
BasketProductAmountValidatorTest
testIsAmountValid
* @var BasketProductAmountValidator
$this->givenABasketProductAmountValidator(); $this->whenICallIsAmountValid($requestedAmount); $this->thenTheExpectedValidityShouldBeReturned($expectedResult);
-
BasketProductAmountValidatorTest
getIsAmountValidData
* @var bool
return array( array( 0, true, ), array( 1, true, ), array( 2, true, ), array( -7, true, ), array( '0', true, ), array( '2', true, ), array( '-23', true, ), array( 3.14, false, ), array( 2.00000000001, false, ), array( '3.14', false, ), array( 'a1', false, ), array( '1a', false, ), );
-
SortStringTest
it_should_return_an_sort_array
* @var SortString
$this->givenASortTypeWith($sortString); $this->whenICallGetAsArray(); $this->thenIShouldHave($expectedArray);
-
SortStringTest
dataProviderSortRawData
* @test * @dataProvider dataProviderSortRawData * * @param $sortString * @param $expectedArray
return array( array('', array()), array('field2 ASC, field3 DESC, field4', array('field2' => 'ASC', 'field3' => 'DESC', 'field4' => 'ASC')), array('field2 ASC, field3 DESC, field4', array('field2' => 'ASC', 'field3' => 'DESC', 'field4' => 'ASC')), array('field2 bar, field3 DESC, field4', array('field2 bar' => 'ASC', 'field3' => 'DESC', 'field4' => 'ASC')), array('field2 some expression ASC, some expression desc, some other expression', array('field2 some expression' => 'ASC', 'some expression' => 'DESC', 'some other expression' => 'ASC')), );
-
StateFactoryTest
it_creates_state_object_from_user_input
* @var array
$this->givenUserData($userData); $this->whenWeCallTheFactoryMethod(); $this->thenWeExpectTheState($expectedState);
-
StateFactoryTest
dataProviderUserInput
* @var \ChameleonSystem\ShopBundle\objects\ArticleList\Interfaces\StateInterface
$data = array(); // from state string plus param $expectedState = self::getStateFactory()->createState(); $expectedState->setState(StateInterface::PAGE, 4); $expectedState->setState(StateInterface::PAGE_SIZE, 20); $stateString = $expectedState->getStateString(array(StateInterface::PAGE)); $userData = array(StateInterface::STATE_STRING => $stateString, StateInterface::PAGE => 4); $data[] = array($userData, $expectedState); // from parameter array $param = array( StateInterface::PAGE => 5, StateInterface::PAGE_SIZE => 21, StateInterface::SORT => 'somesortid', ); $expectedState = self::getStateFactory()->createState(); $expectedState->setState(StateInterface::PAGE, 5); $expectedState->setState(StateInterface::PAGE_SIZE, 21); $expectedState->setState(StateInterface::SORT, 'somesortid'); $data[] = array($param, $expectedState); // nothing $expectedState = self::getStateFactory()->createState(); $data[] = array(array(), $expectedState); $data[] = array(null, $expectedState); return $data;
-
StateFactoryTest
it_should_create_a_state_based_on_another_state_enriched_by_default_values
* @var StateFactory
$this->givenAState($state); $this->givenDefaultStateValues($defaultStateValues); $this->whenWeCallTheEnrichFactoryMethod(); $this->thenWeExpectTheEnrichedStateToHave($expectedStateData);
-
StateFactoryTest
dataProviderEnrichedStates
* @var ConfigurationInterface
$data = array(); $state = self::getStateFactory()->createState(); $defaultStateValues = array( StateInterface::PAGE_SIZE => 10, StateInterface::SORT => 'somesortid', ); $data[] = array($state, $defaultStateValues, $defaultStateValues); $state = self::getStateFactory()->createState(); $state->setState(StateInterface::SORT, 'newsortid'); $state->setState(StateInterface::QUERY, 'somequery'); $expectedResult = $defaultStateValues; $expectedResult[StateInterface::SORT] = 'newsortid'; $expectedResult[StateInterface::QUERY] = 'somequery'; $data[] = array($state, $defaultStateValues, $expectedResult); $state = self::getStateFactory()->createState(); $state->setState(StateInterface::PAGE_SIZE, 20); $expectedResult = $defaultStateValues; $expectedResult[StateInterface::PAGE_SIZE] = 20; $data[] = array($state, $defaultStateValues, $expectedResult); $state = self::getStateFactory()->createState(); $state->setState(StateInterface::PAGE, 2); $expectedResult = $defaultStateValues; $expectedResult[StateInterface::PAGE] = 2; $data[] = array($state, $defaultStateValues, $expectedResult); $state = self::getStateFactory()->createState(); $state->setState(StateInterface::SORT, 'newsortid'); $expectedResult = $defaultStateValues; $expectedResult[StateInterface::SORT] = 'newsortid'; $data[] = array($state, $defaultStateValues, $expectedResult); return $data;
-
StateTest
it_should_construct_from_state_string
* @var \ChameleonSystem\ShopBundle\objects\ArticleList\State
$this->givenAStateString($stateString); $this->whenIConstructTheStateWithTheStateStringAndQueryParameter(); $this->thenIShouldGetAStateWithThatStateString($expectedStateString);
-
StateTest
dataProviderStateString
* @var \ChameleonSystem\ShopBundle\objects\ArticleList\Exceptions\StateParameterException
return array( array(null, '', null), array('', '', null), array('p:1,s:sortid,ps:10', 'p:1,s:sortid,ps:10'), array('p:0,s:sortid,ps:10', 's:sortid,ps:10'), array('p:-1', ''), array('p:', ''), array('p:invalid', ''), array('ps:-1', 'ps:-1'), array('ps:', ''), array('ps:0', ''), array('ps:invalid', ''), array('sortid:', ''), );
-
StateTest
it_should_set_state_from_string
* @test * @dataProvider dataProviderStateString
$this->givenAStateString($stateString); $this->givenANewStateInstance(); $this->whenISetTheStateFromString($stateString); $this->thenIShouldGetAStateWithThatStateString($expectedStateString);
-
StateTest
it_should_set_a_state
* @test * @dataProvider dataProviderStateString
$this->givenANewStateInstance(); $this->whenISetTheStateKeyWithTheStateValue($stateKey, $stateValue); if (null === $exception) { $this->thenTheStateShouldHaveTheStateValueForTheStateKey($stateKey, $resultValue);
-
StateTest
dataProviderStateKeyAndValue
* @test * @dataProvider dataProviderStateKeyAndValue
$invalidValueException = new StateParameterException('', StateInterface::ERROR_CODE_INVALID_STATE_VALUE); return array( array(StateInterface::SORT, '1234', '1234', null), array(StateInterface::SORT, '', null, null), array(StateInterface::PAGE, '-1', null, $invalidValueException), array(StateInterface::PAGE, '0', null, null), array(StateInterface::PAGE, '5', '5', null), array(StateInterface::PAGE, 'invalid', null, $invalidValueException), array(StateInterface::PAGE_SIZE, '-1', '-1', null), array(StateInterface::PAGE_SIZE, '0', null, $invalidValueException), array(StateInterface::PAGE_SIZE, '5', '5', null), array(StateInterface::PAGE_SIZE, 'invalid', null, $invalidValueException), array(StateInterface::QUERY, array('fo' => 'bar'), array('fo' => 'bar'), null), );
-
StateTest
it_should_return_a_state_as_array
* @test * @dataProvider dataProviderStateArray
$this->givenAStateString($stateString); $this->givenAQueryParameter($queryParameter); $this->whenIConstructTheStateWithTheStateStringAndQueryParameter(); $this->thenTheStateShouldReturnAStateArrayThatMatches($expectedOutput);
-
StateTest
dataProviderStateArray
* @test * @dataProvider dataProviderStateArrayWithoutQueryParameter
return array( array('p:1,s:sortid,ps:10', null, array(StateInterface::PAGE => 1, StateInterface::SORT => 'sortid', StateInterface::PAGE_SIZE => 10)), array('p:0,s:sortid,ps:10', null, array(StateInterface::SORT => 'sortid', StateInterface::PAGE_SIZE => 10)), array('p:1,s:sortid,ps:10', array('some' => 'data', 'and' => 'somemore'), array(StateInterface::PAGE => 1, StateInterface::SORT => 'sortid', StateInterface::PAGE_SIZE => 10, StateInterface::QUERY => array('some' => 'data', 'and' => 'somemore'))), );
-
StateTest
it_should_return_a_state_as_array_without_query_parameter
* @test * @dataProvider dataProviderInputOutputStateString * * @param $inputStateString * @param $queryParameter * @param $outputStateString * @param array $varyingParameters
$this->givenAStateString($stateString); $this->givenAQueryParameter($queryParameter); $this->whenIConstructTheStateWithTheStateStringAndQueryParameter(); $this->thenTheStateShouldReturnAStateArrayWithoutQueryParameterThatMatches($expectedOutput);
-
StateTest
dataProviderStateArrayWithoutQueryParameter
* @test * @dataProvider dataProviderQueryParameter
return array( array('p:1,s:sortid,ps:10', null, array(StateInterface::PAGE => 1, StateInterface::SORT => 'sortid', StateInterface::PAGE_SIZE => 10)), array('p:0,s:sortid,ps:10', null, array(StateInterface::SORT => 'sortid', StateInterface::PAGE_SIZE => 10)), array('p:1,s:sortid,ps:10', array('some' => 'data', 'and' => 'somemore'), array(StateInterface::PAGE => 1, StateInterface::SORT => 'sortid', StateInterface::PAGE_SIZE => 10)), );
-
StateTest
it_should_return_the_state_as_string
* @test * @dataProvider dataProviderUrlQueryOutputTester * * @param $parameterIdentifier * @param $stateString * @param $queryData * @param $expectedOutput
$this->givenAStateString($inputStateString); $this->givenAQueryParameter($queryParameter); $this->whenIConstructTheStateWithTheStateStringAndQueryParameter(); $this->whenIAmVaryingTheParameter($varyingParameters); $this->thenIShouldGetAStateWithThatStateString($outputStateString);
-
StateTest
dataProviderInputOutputStateString
* @test * @dataProvider dataProviderSetUnsetStates * * @param $inputStateString * @param $valuesSet * @param $expectedStateValues
return array( array('p:1,s:sortid,ps:10', null, 'p:1,s:sortid,ps:10', null), array('p:1,s:sortid,ps:10', null, 's:sortid,ps:10', array(StateInterface::PAGE)), array('p:1,s:sortid,ps:10', null, 's:sortid', array(StateInterface::PAGE, StateInterface::PAGE_SIZE)), array('p:1,s:sortid,ps:10', array('some' => 'value'), 'p:1,s:sortid,ps:10', null), );
-
TShopPaymentHandlerPayPalExpressTest
it_switches_zip_and_city_when_city_is_numeric_and_zip_is_not
* @test
$testCases = array( array( 'adr' => array( 'postalcode' => 'Freiburg', 'city' => '79098', ), 'expectedAdr' => array( 'postalcode' => '79098', 'city' => 'Freiburg', ), ), array( 'adr' => array( 'postalcode' => 'Freiburg', 'city' => ' 79098', ), 'expectedAdr' => array( 'postalcode' => '79098', 'city' => 'Freiburg', ), ), array( 'adr' => array( 'postalcode' => 'Freiburg', 'city' => '079098', ), 'expectedAdr' => array( 'postalcode' => '079098', 'city' => 'Freiburg', ), ), array( 'adr' => array( 'postalcode' => '123 Freiburg', 'city' => '79098', ), 'expectedAdr' => array( 'postalcode' => '79098', 'city' => '123 Freiburg', ), ), ); $reflectionMethod = new \ReflectionMethod('TShopPaymentHandlerPayPalExpress', 'postProcessBillingAndShippingAddress'); $reflectionMethod->setAccessible(true); $object = new \TShopPaymentHandlerPayPalExpress(); foreach ($testCases as $testCase) { $adrBilling = $testCase['adr']; $adrShipping = $testCase['adr']; $reflectionMethod->invokeArgs($object, array($adrBilling, $adrShipping)); $this->assertEquals($testCase['expectedAdr'], $adrBilling, 'billing does not match'); $this->assertEquals($testCase['expectedAdr'], $adrShipping, 'shipping does not match');
-
TShopPaymentHandlerPayPalExpressTest
it_does_not_switches_zip_and_city_when_zip_is_numeric_and_city_is_not
* @test
$testCases = array( array( 'adr' => array( 'postalcode' => '79098', 'city' => 'Freiburg', ), 'expectedAdr' => array( 'postalcode' => '79098', 'city' => 'Freiburg', ), ), array( 'adr' => array( 'postalcode' => ' 79098', 'city' => 'Freiburg', ), 'expectedAdr' => array( 'postalcode' => '79098', 'city' => 'Freiburg', ), ), array( 'adr' => array( 'postalcode' => '079098', 'city' => 'Freiburg', ), 'expectedAdr' => array( 'postalcode' => '079098', 'city' => 'Freiburg', ), ), array( 'adr' => array( 'postalcode' => '79098', 'city' => '123 Freiburg', ), 'expectedAdr' => array( 'postalcode' => '79098', 'city' => '123 Freiburg', ), ), ); $reflectionMethod = new \ReflectionMethod('TShopPaymentHandlerPayPalExpress', 'postProcessBillingAndShippingAddress'); $reflectionMethod->setAccessible(true); $object = new \TShopPaymentHandlerPayPalExpress(); foreach ($testCases as $testCase) { $adrBilling = $testCase['adr']; $adrShipping = $testCase['adr']; $reflectionMethod->invokeArgs($object, array($adrBilling, $adrShipping)); $this->assertEquals($testCase['expectedAdr'], $adrBilling, 'billing does not match'); $this->assertEquals($testCase['expectedAdr'], $adrShipping, 'shipping does not match');
-
TShopPaymentHandlerPayPalExpressTest
it_does_not_switch_zip_and_city_when_both_are_numeric
* @test
$testCases = array( array( 'adr' => array( 'postalcode' => '79098', 'city' => '24234345', ), 'expectedAdr' => array( 'postalcode' => '79098', 'city' => '24234345', ), ), ); $reflectionMethod = new \ReflectionMethod('TShopPaymentHandlerPayPalExpress', 'postProcessBillingAndShippingAddress'); $reflectionMethod->setAccessible(true); $object = new \TShopPaymentHandlerPayPalExpress(); foreach ($testCases as $testCase) { $adrBilling = $testCase['adr']; $adrShipping = $testCase['adr']; $reflectionMethod->invokeArgs($object, array($adrBilling, $adrShipping)); $this->assertEquals($testCase['expectedAdr'], $adrBilling, 'billing does not match'); $this->assertEquals($testCase['expectedAdr'], $adrShipping, 'shipping does not match');
-
TdbShopArticle
it_should_keep_custom_data_even_when_serializing_and_unserializing
* @test
$testCustomData = array('custom' => 'data'); $basketArticle = new TShopBasketArticleCore(); $basketArticle->setCustomData($testCustomData); $basketArticleSerialized = serialize($basketArticle); $unserializedArticle = unserialize($basketArticleSerialized); $this->assertEquals($testCustomData, $unserializedArticle->getCustomData());
-
TPkgShopViewMyOrderDetailsTest
it_addsAnOrderToAGuestsOrderList
* Class TPkgShopViewMyOrderDetailsTest. * * @covers \TPkgShopViewMyOrderDetails
$this->mockSessionAdapter->addOrderId('ORDERID')->shouldBeCalled(null); $viewMyOrderDetails = new TPkgShopViewMyOrderDetails($this->mockDbAdapter->reveal(), $this->mockSessionAdapter->reveal()); $viewMyOrderDetails->addOrderIdToMyList('ORDERID');
-
TPkgShopViewMyOrderDetailsTest
it_addsAnOrderToAUsersOrderList
* @var IPkgShopViewMyOrderDetailsDbAdapter|ObjectProphecy
$viewMyOrderDetails = new TPkgShopViewMyOrderDetails($this->mockDbAdapter->reveal(), $this->mockSessionAdapter->reveal()); $viewMyOrderDetails->addOrderIdToMyList('ORDERID', 'USERID');
-
TPkgShopViewMyOrderDetailsTest
it_confirmsOrderInUsersOrderList
* @var IPkgShopViewMyOrderDetailsSessionAdapter|ObjectProphecy
$this->mockDbAdapter->hasOrder('USERID', 'ORDERID')->willReturn(true); $viewMyOrderDetails = new TPkgShopViewMyOrderDetails($this->mockDbAdapter->reveal(), $this->mockSessionAdapter->reveal()); $this->assertTrue($viewMyOrderDetails->orderIdBelongsToUser('ORDERID', 'USERID'));
-
TPkgShopViewMyOrderDetailsTest
it_confirmsOrderInGuestsOrderList
* @test
$this->mockSessionAdapter->hasOrder('ORDERID')->willReturn(true); $viewMyOrderDetails = new TPkgShopViewMyOrderDetails($this->mockDbAdapter->reveal(), $this->mockSessionAdapter->reveal()); $this->assertTrue($viewMyOrderDetails->orderIdBelongsToUser('ORDERID'));
-
TPkgShopViewMyOrderDetailsTest
it_deniesOrderInUsersOrderList
* @test
$this->mockDbAdapter->hasOrder('USERID', 'ORDERID')->willReturn(false); $viewMyOrderDetails = new TPkgShopViewMyOrderDetails($this->mockDbAdapter->reveal(), $this->mockSessionAdapter->reveal()); $this->assertFalse($viewMyOrderDetails->orderIdBelongsToUser('ORDERID', 'USERID'));
-
TPkgShopViewMyOrderDetailsTest
it_deniesOrderInGuestsOrderList
* @test
$this->mockSessionAdapter->hasOrder('ORDERID')->willReturn(false); $viewMyOrderDetails = new TPkgShopViewMyOrderDetails($this->mockDbAdapter->reveal(), $this->mockSessionAdapter->reveal()); $this->assertFalse($viewMyOrderDetails->orderIdBelongsToUser('ORDERID'));
-
ShopPaymentConfigLoaderTest
it_loads_empty_values_on_empty_configuration_in_loadFromPaymentHandlerId
* @test
$this->shopPaymentConfigLoaderDataAccess->getEnvironment('groupId')->willReturn(\IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX); $this->shopPaymentConfigLoaderDataAccess->loadPaymentHandlerGroupConfig('groupId')->willReturn(array()); $this->shopPaymentConfigLoaderDataAccess->loadPaymentHandlerConfig('handlerId')->willReturn(array()); $expected = array(); $loader = $this->getShopPaymentConfigLoader(\IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX); $config = $loader->loadFromPaymentHandlerId('handlerId', 'portalId1'); $allValues = $config->getAllValues(); $this->assertEquals($expected, $allValues);
-
ShopPaymentConfigLoaderTest
it_loads_correct_sandbox_configuration_in_loadFromOrderId
* @test
$this->shopPaymentConfigLoaderDataAccess->getEnvironment('groupId')->willReturn( \IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX ); $this->shopPaymentConfigLoaderDataAccess->getDataFromOrderId('orderId')->willReturn(new OrderPaymentInfo('orderId', 'handlerId', 'portalId1')); $this->initFullConfig(); $this->initFullExpectedValue(); $loader = $this->getShopPaymentConfigLoader(\IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX); $loader->addConfigProvider('groupSystemName', $this->shopPaymentConfigProvider->reveal()); $config = $loader->loadFromOrderId('orderId'); $allValues = $config->getAllValues(); ksort($allValues); $this->assertEquals($this->expectedConfig, $allValues);
-
ShopPaymentConfigLoaderTest
it_loads_correct_sandbox_configuration_in_loadFromPaymentHandlerId
* @test
$this->shopPaymentConfigLoaderDataAccess->getEnvironment('groupId')->willReturn( \IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX ); $this->initFullConfig(); $this->initFullExpectedValue(); $loader = $this->getShopPaymentConfigLoader(\IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX); $loader->addConfigProvider('groupSystemName', $this->shopPaymentConfigProvider->reveal()); $config = $loader->loadFromPaymentHandlerId('handlerId', 'portalId1'); $allValues = $config->getAllValues(); ksort($allValues); $this->assertEquals($this->expectedConfig, $allValues);
-
ShopPaymentConfigLoaderTest
it_loads_correct_sandbox_configuration_with_default_environment_in_loadFromPaymentHandlerId
* @test
$this->shopPaymentConfigLoaderDataAccess->getEnvironment('groupId')->willReturn('default'); $this->initFullConfig(); $this->initFullExpectedValue(); $loader = $this->getShopPaymentConfigLoader(\IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX); $loader->addConfigProvider('groupSystemName', $this->shopPaymentConfigProvider->reveal()); $config = $loader->loadFromPaymentHandlerId('handlerId', 'portalId1'); $allValues = $config->getAllValues(); ksort($allValues); $this->assertEquals($this->expectedConfig, $allValues);
-
ShopPaymentConfigLoaderTest
it_loads_correct_sandbox_configuration_in_loadFromPaymentHandlerGroupId
* @test
$this->shopPaymentConfigLoaderDataAccess->getEnvironment('groupId')->willReturn( \IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX ); $this->initFullConfig(false); $this->initPaymentHandlerGroupOnlyExpectedValue(); $loader = $this->getShopPaymentConfigLoader(\IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX); $loader->addConfigProvider('groupSystemName', $this->shopPaymentConfigProvider->reveal()); $config = $loader->loadFromPaymentHandlerGroupId('groupId', 'portalId1'); $allValues = $config->getAllValues(); ksort($allValues); $this->assertEquals($this->expectedConfig, $allValues);
-
ShopPaymentConfigLoaderTest
it_loads_correct_sandbox_configuration_in_loadFromPaymentHandlerGroupSystemName
* @test
$this->shopPaymentConfigLoaderDataAccess->getEnvironment('groupId')->willReturn( \IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX ); $this->shopPaymentConfigLoaderDataAccess->getPaymentHandlerGroupIdFromSystemName('groupSystemName')->willReturn('groupId'); $this->initFullConfig(false); $this->initPaymentHandlerGroupOnlyExpectedValue(); $loader = $this->getShopPaymentConfigLoader(\IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX); $loader->addConfigProvider('groupSystemName', $this->shopPaymentConfigProvider->reveal()); $config = $loader->loadFromPaymentHandlerGroupSystemName('groupSystemName', 'portalId1'); $allValues = $config->getAllValues(); ksort($allValues); $this->assertEquals($this->expectedConfig, $allValues);
-
ShopPaymentConfigLoaderTest
it_throws_configuration_exception_on_error
* @test
$this->shopPaymentConfigLoaderDataAccess->getEnvironment('groupId')->willReturn( \IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX ); $this->shopPaymentConfigLoaderDataAccess->getPaymentHandlerGroupIdFromSystemName('groupSystemName')->willThrow(new DataAccessException('This is a test exception.')); $loader = $this->getShopPaymentConfigLoader(\IPkgShopOrderPaymentConfig::ENVIRONMENT_SANDBOX); $loader->addConfigProvider('groupSystemName', $this->shopPaymentConfigProvider->reveal()); try { $config = $loader->loadFromPaymentHandlerGroupSystemName('groupSystemName', 'portalId1'); $this->fail();
-
ShopPaymentHandlerMock
getUserPaymentDataWithoutLoading
* @var array
return $this->paymentUserData;
-
ShopPaymentHandlerMock
SetPaymentUserData
* @return array
$this->paymentUserData = $paymentUserData;
-
TPkgShopPaymentIPayment_TPkgShopPaymentIPNHandler_BaseResponse
handleIPN
* process the IPN request - the request object contains all details (payment handler, group, order etc) * the call should return true if processing should continue, false if it is to stop. On Error it should throw an error * extending AbstractPkgShopPaymentIPNHandlerException. * * @param TPkgShopPaymentIPNRequest $oRequest * @trows AbstractPkgShopPaymentIPNHandlerException * * @return bool
$oStatus = $oRequest->getIpnStatus(); if ($oStatus && 'success' === $oStatus->fieldCode) { // #23380 some payment methods redirect the user in the last order step to an external source - there the user // confirms (and executes) the payment and is then sent back to our thank-you-page. Only if the user arrives there is // the order marked as completed - some users close the browser before arriving back at the shop. these orders are then never // marked as completed - even though they are paid. This case should be handled here $oOrder = $oRequest->getOrder(); $aPayload = $oRequest->getRequestPayload(); $oPaymentHandler = $oOrder->GetPaymentHandler(); if (!is_null($oPaymentHandler)) { $oPaymentHandler->SetPaymentUserData($aPayload); $oPaymentHandler->SaveUserPaymentDataToOrder($oOrder->id);
-
TPkgShopPaymentIPayment_TPkgShopPaymentIPNHandler_BaseResponse
getIPNTransactionDetails
* return an instance of TPkgShopPaymentIPN_TransactionDetails if your IPN should trigger a transaction for the order * (ie payment or refunds etc). if you return null, then no transaction will be triggered. * * @param TPkgShopPaymentIPNRequest $oRequest * * @return TPkgShopPaymentIPN_TransactionDetails|null
$oStatus = $oRequest->getIpnStatus(); if (null === $oStatus) { return null;
-
CurrencyBasket
SetActivePaymentMethod
* Reloads the active payment method on currency change, * so that the payment method holds the payment charges in the correct currency. * * {@inheritdoc}
$oldActivePaymentMethod = $this->GetActivePaymentMethod(); $isPaymentSet = parent::SetActivePaymentMethod($oShopPayment); $newActivePaymentMethod = $this->GetActivePaymentMethod(); if (null === $oldActivePaymentMethod || null === $newActivePaymentMethod) { return $isPaymentSet;
-
ChameleonSystemShopCurrencyExtension
load
* @return void
$loader = new XMLFileLoader($container, new FileLocator(__DIR__.'/../Resources/config/')); $loader->load('services.xml');
-
CurrencyChangedEvent
__construct
* @var string|null
$this->newCurrencyId = $newCurrencyId;
-
CurrencyChangedEvent
getNewCurrencyId
* @param string|null $newCurrencyId
return $this->newCurrencyId;
-
TPkgShopCurrencyMapper
GetRequirements
* {@inheritdoc}
$oRequirements->NeedsSourceObject('oCurrency', 'TdbPkgShopCurrency', TdbPkgShopCurrency::GetActiveInstance(), true);
-
TPkgShopCurrencyMapper
Accept
* {@inheritdoc}
/** @var $oCurrency TdbPkgShopCurrency */ $oCurrency = $oVisitor->GetSourceObject('oCurrency'); if ($oCurrency && $bCachingEnabled) { $oCacheTriggerManager->addTrigger($oCurrency->table, $oCurrency->id);
-
TPkgShopCurrency
GetFormattedCurrency
* format the double value as a string. includes the currency symbol as part of the response. * note: will not do any conversion (we assume that dValue is already in the correct currency). * * @param float $dValue * * @return string
$oLocal = TCMSLocal::GetActive(); $sValue = $oLocal->FormatNumber($dValue, 2).' '.$this->GetCurrencyDisplaySymbol(); return $sValue;
-
TPkgShopCurrency
getISO4217Code
* return the ISO-4217 code for the currency. * * @return string
return $this->fieldIso4217;
-
TPkgShopCurrency
GetCurrencyDisplaySymbol
* return the symbol used to mark the currency in the shop. * * @return string
return $this->fieldSymbol;
-
TPkgShopCurrency
SetAsActive
* return the active currency. Currency is set defined via * - user session * - user cookie * - user profile * note: passing bReset will reset and return NOTHING. * * @static * * @return TdbPkgShopCurrency|false * * @deprecated use the service chameleon_system_shop_currency.shop_currency instead * * @param bool $bReset
$sCurrencyId = $this->id; /** @var Request $request */ $request = ServiceLocator::get('request_stack')->getCurrentRequest(); if (null !== $request && true === $request->hasSession()) { $request->getSession()->set(TdbPkgShopCurrency::SESSION_NAME, $sCurrencyId);
-
TPkgShopCurrency
Convert
@var $currencyService ShopCurrencyServiceInterface
if (null == $oBaseCurrency) { $oBaseCurrency = TdbPkgShopCurrency::GetBaseCurrency();
-
TPkgShopCurrency_CMSFieldPrice
RenderFieldPostLoadString
* @return string
$oViewParser = new TViewParser(); /** @var $oViewParser TViewParser */ $oViewParser->bShowTemplatePathAsHTMLHint = false; $aData = $this->GetFieldWriterData(); $aData['numberOfDecimals'] = $this->_GetNumberOfDecimals(); $aData['sValueTypeFieldName'] = $this->oDefinition->GetFieldtypeConfigKey('sValueTypeFieldName'); $oViewParser->AddVarArray($aData); return $oViewParser->RenderObjectPackageView('postload', 'pkgShopCurrency/views/TCMSFields/TPkgShopCurrency_CMSFieldPrice');
-
TPkgShopCurrency_CMSFieldPrice
RenderFieldPostWakeupString
@var $oViewParser TViewParser
$oViewParser = new TViewParser(); $oViewParser->bShowTemplatePathAsHTMLHint = false; $aData = $this->GetFieldWriterData(); $aData['numberOfDecimals'] = $this->_GetNumberOfDecimals(); $oViewParser->AddVarArray($aData); return $oViewParser->RenderObjectPackageView('postwakeup', 'pkgShopCurrency/views/TCMSFields/TPkgShopCurrency_CMSFieldPrice');
-
TPkgShopCurrency_CMSFieldPrice
RenderFieldPropertyString
* injected into the PostWakeupHook in the auto class. * * @return string
$sNormalfield = parent::RenderFieldPropertyString(); $oViewParser = new TViewParser(); $oViewParser->bShowTemplatePathAsHTMLHint = false; $aData = $this->GetFieldWriterData(); $aData['sFieldName'] = $aData['sFieldName'].'Original'; $aData['sFieldType'] = 'double'; $oViewParser->AddVarArray($aData); $sNormalfield .= "\n".$oViewParser->RenderObjectView('property', 'TCMSFields/TCMSField'); return $sNormalfield;
-
MTPkgShopCurrencyChangeCurrencyCore
Execute
* used to show available currencies to the user and to provide a method to change the currency. /*
parent::Execute(); $this->data['oActiveCurrency'] = TdbPkgShopCurrency::GetActiveInstance(); $this->data['oCurrencyList'] = TdbPkgShopCurrencyList::GetList(); return $this->data;
-
MTPkgShopCurrencyChangeCurrencyCore
_AllowCache
* @return void
return true;
-
MTPkgShopCurrencyChangeCurrencyCore
_GetCacheParameters
* if this function returns true, then the result of the execute function will be cached. * * @return bool
$parameters = parent::_GetCacheParameters(); $parameters['sActiveCurrency'] = TdbPkgShopCurrency::GetActiveCurrencyId(); return $parameters;
-
MTPkgShopCurrencyChangeCurrencyCore
_GetCacheTableInfos
* return an assoc array of parameters that describe the state of the module. * * @return array
$aTrigger = parent::_GetCacheTableInfos(); if (!is_array($aTrigger)) { $aTrigger = array();
-
TPkgShopCurrency_PkgCmsActionPlugin
ChangeCurrency
* @param array<string, mixed> $aData * @param bool $bRedirect * @return void
$sId = (isset($aData['sPkgShopCurrencyId'])) ? ($aData['sPkgShopCurrencyId']) : (''); if (empty($sId)) { return;
-
TPkgCmsNavigation_CurrencySelection
GetRequirements
* add currency selection menu. /*
$oRequirements->NeedsSourceObject('aTree', 'array', array());
-
TPkgCmsNavigation_CurrencySelection
Accept
* A mapper has to specify its requirements by providing th passed MapperRequirements instance with the * needed information and returning it. * * example: * * $oRequirements->NeedsSourceObject("foo",'stdClass','default-value'); * $oRequirements->NeedsSourceObject("bar"); * $oRequirements->NeedsMappedValue("baz"); * * @param IMapperRequirementsRestricted $oRequirements
$oCurrencyList = TdbPkgShopCurrencyList::GetList(); if ($oCurrencyList->Length() < 2) { return;
-
CurrencyRequestStateProvider
__construct( RequestInfoServiceInterface $requestInfoService, ShopCurrencyServiceInterface $currencyService )
* @var RequestInfoServiceInterface
$this->requestInfoService = $requestInfoService; $this->currencyService = $currencyService;
-
CurrencyRequestStateProvider
getStateElements
* @var ShopCurrencyServiceInterface
if (false === $this->requestInfoService->isChameleonRequestType(RequestTypeInterface::REQUEST_TYPE_FRONTEND)) { return [];
-
ShopCurrencyService
__construct
* @var RequestStack
$this->requestStack = $requestStack; $this->extranetUserProvider = $extranetUserProvider;
-
ShopCurrencyService
getSymbol
* @var ExtranetUserProviderInterface
return $this->getObject()->GetCurrencyDisplaySymbol();
-
ShopCurrencyService
getIso4217Code
* {@inheritdoc}
return $this->getObject()->getISO4217Code();
-
ShopCurrencyService
formatNumber
* {@inheritdoc}
return $this->getObject()->GetFormattedCurrency($value);
-
ShopCurrencyService
getObject
* {@inheritdoc}
$activeCurrencyId = $this->getActiveCurrencyId(); if (null === $activeCurrencyId || $activeCurrencyId === TdbPkgShopCurrency::GetDefaultCurrency()->id) { return TdbPkgShopCurrency::GetDefaultCurrency();
-
ShopCurrencyService
reset
* {@inheritdoc}
// in the past there was built-in cache logic in this class - moved to ShopCurrencyServiceRequestLevelCacheDecorator.
-
ShopCurrencyService
getActiveCurrencyId
* {@inheritdoc}
$request = $this->requestStack->getCurrentRequest(); if (null === $request || false === $request->hasSession() || false === $request->getSession()->isStarted()) { return null;
-
ShopCurrencyServiceRequestLevelCacheDecorator
__construct
* @var array
$this->subject = $subject;
-
ShopCurrencyServiceRequestLevelCacheDecorator
getSymbol
* @var ShopCurrencyServiceInterface
$cacheKey = 'getSymbol'; if (isset($this->cache[$cacheKey])) { return $this->cache[$cacheKey];
-
ShopCurrencyServiceRequestLevelCacheDecorator
getIso4217Code
* @param ShopCurrencyServiceInterface $subject
$cacheKey = 'getIso4217Code'; if (isset($this->cache[$cacheKey])) { return $this->cache[$cacheKey];
-
ShopCurrencyServiceRequestLevelCacheDecorator
formatNumber
* {@inheritdoc}
return $this->subject->formatNumber($value);
-
ShopCurrencyServiceRequestLevelCacheDecorator
reset
* {@inheritdoc}
$this->subject->reset(); $this->cache = array();
-
ShopCurrencyServiceRequestLevelCacheDecorator
getObject
* {@inheritdoc}
$cacheKey = 'getObject'; if (isset($this->cache[$cacheKey])) { return $this->cache[$cacheKey];
-
ShopCurrencyServiceRequestLevelCacheDecorator
getActiveCurrencyId
* {@inheritdoc}
$cacheKey = "getActiveCurrencyId-$bUseDefaultIfNotDefinedForUser"; if (isset($this->cache[$cacheKey])) { return $this->cache[$cacheKey];
-