diff --git a/services.yaml b/services.yaml index e91ab78a..7a063965 100644 --- a/services.yaml +++ b/services.yaml @@ -18,7 +18,9 @@ services: OxidEsales\GraphQL\Storefront\: resource: 'src/*' - exclude: 'src/**/{DataType,Exception,Shop,Event,Subscriber}' + exclude: + - 'src/**/{DataType,Exception,Shop,Event,Subscriber}' + - 'src/Customer' public: true OxidEsales\GraphQL\Storefront\Shared\Service\NamespaceMapper: diff --git a/src/Address/Service/InvoiceAddressInput.php b/src/Address/Service/InvoiceAddressInput.php index 569477cc..c1333f38 100644 --- a/src/Address/Service/InvoiceAddressInput.php +++ b/src/Address/Service/InvoiceAddressInput.php @@ -12,7 +12,7 @@ use OxidEsales\GraphQL\Base\Service\Authentication; use OxidEsales\GraphQL\Storefront\Address\DataType\InvoiceAddress; use OxidEsales\GraphQL\Storefront\Address\Infrastructure\InvoiceAddressFactory; -use OxidEsales\GraphQL\Storefront\Customer\Service\Customer as CustomerService; +use OxidEsales\GraphQL\Storefront\Customer\Service\CustomerInterface as CustomerService; use TheCodingMachine\GraphQLite\Annotations\Factory; use TheCodingMachine\GraphQLite\Types\ID; diff --git a/src/Basket/Service/Basket.php b/src/Basket/Service/Basket.php index 868d4c53..e3139fd9 100644 --- a/src/Basket/Service/Basket.php +++ b/src/Basket/Service/Basket.php @@ -37,7 +37,7 @@ use OxidEsales\GraphQL\Storefront\Country\Service\Country as CountryService; use OxidEsales\GraphQL\Storefront\Customer\Exception\CustomerNotFound; use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Customer as CustomerInfrastructure; -use OxidEsales\GraphQL\Storefront\Customer\Service\Customer as CustomerService; +use OxidEsales\GraphQL\Storefront\Customer\Service\CustomerInterface as CustomerService; use OxidEsales\GraphQL\Storefront\DeliveryMethod\DataType\BasketDeliveryMethod as BasketDeliveryMethodDataType; use OxidEsales\GraphQL\Storefront\DeliveryMethod\Exception\UnavailableDeliveryMethod; use OxidEsales\GraphQL\Storefront\Payment\DataType\BasketPayment; diff --git a/src/Basket/Service/PlaceOrder.php b/src/Basket/Service/PlaceOrder.php index 72b08fb7..aae098bc 100644 --- a/src/Basket/Service/PlaceOrder.php +++ b/src/Basket/Service/PlaceOrder.php @@ -17,7 +17,7 @@ use OxidEsales\GraphQL\Storefront\Basket\Infrastructure\Basket as BasketInfrastructure; use OxidEsales\GraphQL\Storefront\Basket\Service\Basket as BasketService; use OxidEsales\GraphQL\Storefront\Customer\DataType\Customer as CustomerDataType; -use OxidEsales\GraphQL\Storefront\Customer\Service\Customer as CustomerService; +use OxidEsales\GraphQL\Storefront\Customer\Service\CustomerInterface as CustomerService; use OxidEsales\GraphQL\Storefront\DeliveryMethod\DataType\DeliveryMethod as DeliveryMethodDataType; use OxidEsales\GraphQL\Storefront\DeliveryMethod\Exception\MissingDeliveryMethod; use OxidEsales\GraphQL\Storefront\DeliveryMethod\Exception\UnavailableDeliveryMethod; diff --git a/src/Customer/Controller/Customer.php b/src/Customer/Controller/Customer.php index c8e4871e..72f198b9 100644 --- a/src/Customer/Controller/Customer.php +++ b/src/Customer/Controller/Customer.php @@ -12,7 +12,7 @@ use DateTimeInterface; use OxidEsales\GraphQL\Base\Service\Authentication; use OxidEsales\GraphQL\Storefront\Customer\DataType\Customer as CustomerDataType; -use OxidEsales\GraphQL\Storefront\Customer\Service\Customer as CustomerService; +use OxidEsales\GraphQL\Storefront\Customer\Service\CustomerInterface as CustomerService; use TheCodingMachine\GraphQLite\Annotations\HideIfUnauthorized; use TheCodingMachine\GraphQLite\Annotations\Logged; use TheCodingMachine\GraphQLite\Annotations\Mutation; diff --git a/src/Customer/Service/Customer.php b/src/Customer/Service/Customer.php index 95673938..3a123ed0 100644 --- a/src/Customer/Service/Customer.php +++ b/src/Customer/Service/Customer.php @@ -19,7 +19,7 @@ use OxidEsales\GraphQL\Storefront\Customer\Exception\CustomerNotDeletable; use OxidEsales\GraphQL\Storefront\Customer\Exception\CustomerNotFound; use OxidEsales\GraphQL\Storefront\Customer\Exception\InvalidEmail; -use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Repository as CustomerRepository; +use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\RepositoryInterface as CustomerRepository; use OxidEsales\GraphQL\Storefront\Shared\Infrastructure\Repository; use TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface; diff --git a/src/Customer/Service/CustomerRegisterInput.php b/src/Customer/Service/CustomerRegisterInput.php index 29b2b0ce..6aa9aed0 100644 --- a/src/Customer/Service/CustomerRegisterInput.php +++ b/src/Customer/Service/CustomerRegisterInput.php @@ -16,12 +16,12 @@ use OxidEsales\GraphQL\Storefront\Customer\Exception\InvalidEmail; use OxidEsales\GraphQL\Storefront\Customer\Exception\PasswordValidationException; use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\CustomerRegisterFactory; -use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Repository; +use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\RepositoryInterface; use TheCodingMachine\GraphQLite\Annotations\Factory; final class CustomerRegisterInput { - /** @var Repository */ + /** @var RepositoryInterface */ private $repository; /** @var Legacy */ @@ -31,7 +31,7 @@ final class CustomerRegisterInput private $customerRegisterFactory; public function __construct( - Repository $repository, + RepositoryInterface $repository, Legacy $legacyService, CustomerRegisterFactory $customerRegisterFactory ) { diff --git a/src/Customer/Service/RelationService.php b/src/Customer/Service/RelationService.php index 4a6501ef..2a802d9d 100644 --- a/src/Customer/Service/RelationService.php +++ b/src/Customer/Service/RelationService.php @@ -18,7 +18,7 @@ use OxidEsales\GraphQL\Storefront\Basket\Service\BasketFinder as BasketFinderService; use OxidEsales\GraphQL\Storefront\Customer\DataType\Customer as CustomerDataType; use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Customer as CustomerInfrastructure; -use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Repository as CustomerRepository; +use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\RepositoryInterface as CustomerRepository; use OxidEsales\GraphQL\Storefront\NewsletterStatus\DataType\NewsletterStatus as NewsletterStatusType; use OxidEsales\GraphQL\Storefront\NewsletterStatus\Exception\NewsletterStatusForUserNotFound; use OxidEsales\GraphQL\Storefront\NewsletterStatus\Service\NewsletterStatus as NewsletterStatusService; diff --git a/src/Customer/services.yaml b/src/Customer/services.yaml index 32f8aa9c..bd7f2d2b 100644 --- a/src/Customer/services.yaml +++ b/src/Customer/services.yaml @@ -2,18 +2,37 @@ services: _defaults: public: false autowire: true -# bind: -# OxidEsales\Eshop\Core\InputValidator: '@=service("OxidEsales\\Storefront\\Core\\Registry").getInputValidator()' -# + bind: + OxidEsales\Eshop\Core\InputValidator: '@=service("OxidEsales\\Storefront\\Core\\Registry").getInputValidator()' - OxidEsales\GraphQL\Storefront\Customer\Service\PasswordInterface: - class: OxidEsales\GraphQL\Storefront\Customer\Service\Password + OxidEsales\GraphQL\Storefront\Customer\Controller\: + resource: 'Controller' + public: true + + OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Customer: + public: true + + OxidEsales\GraphQL\Storefront\Customer\Infrastructure\CustomerRegisterFactory: OxidEsales\GraphQL\Storefront\Customer\Infrastructure\PasswordInterface: class: OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Password + OxidEsales\GraphQL\Storefront\Customer\Infrastructure\RepositoryInterface: + class: OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Repository + public: true + OxidEsales\GraphQL\Storefront\Customer\Service\CustomerInterface: class: OxidEsales\GraphQL\Storefront\Customer\Service\Customer + public: true + + OxidEsales\GraphQL\Storefront\Customer\Service\CustomerRegisterInput: + public: true + + OxidEsales\GraphQL\Storefront\Customer\Service\PasswordInterface: + class: OxidEsales\GraphQL\Storefront\Customer\Service\Password + + OxidEsales\GraphQL\Storefront\Customer\Service\RelationService: + public: true TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface: class: OxidEsales\GraphQL\Storefront\Shared\Service\Authorization @@ -24,8 +43,3 @@ services: OxidEsales\Storefront\Core\Registry: class: OxidEsales\Eshop\Core\Registry public: true - - OxidEsales\Eshop\Core\InputValidator: - # the first argument is the class and the second argument is the static method - factory: [ '@OxidEsales\Storefront\Core\Registry', 'getInputValidator' ] - diff --git a/src/NewsletterStatus/Infrastructure/NewsletterStatus.php b/src/NewsletterStatus/Infrastructure/NewsletterStatus.php index 6ae34b61..d8270930 100644 --- a/src/NewsletterStatus/Infrastructure/NewsletterStatus.php +++ b/src/NewsletterStatus/Infrastructure/NewsletterStatus.php @@ -14,7 +14,7 @@ use OxidEsales\GraphQL\Base\Infrastructure\Legacy as LegacyService; use OxidEsales\GraphQL\Storefront\Customer\DataType\Customer as CustomerDataType; use OxidEsales\GraphQL\Storefront\Customer\Exception\CustomerNotFound; -use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Repository as CustomerRepository; +use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\RepositoryInterface as CustomerRepository; use OxidEsales\GraphQL\Storefront\NewsletterStatus\DataType\NewsletterStatus as NewsletterStatusType; use OxidEsales\GraphQL\Storefront\NewsletterStatus\DataType\NewsletterStatusSubscribe as NewsletterStatusSubscribeType; use OxidEsales\GraphQL\Storefront\NewsletterStatus\DataType\Subscriber as SubscriberDataType; diff --git a/tests/Integration/Customer/Infrastructure/RepositoryTest.php b/tests/Integration/Customer/Infrastructure/RepositoryTest.php index 6181e27f..27a5435f 100644 --- a/tests/Integration/Customer/Infrastructure/RepositoryTest.php +++ b/tests/Integration/Customer/Infrastructure/RepositoryTest.php @@ -11,7 +11,7 @@ use OxidEsales\Eshop\Application\Model\User; use OxidEsales\Eshop\Application\Model\User as EshopModelUser; -use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Repository; +use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\RepositoryInterface; use OxidEsales\GraphQL\Storefront\Tests\Integration\BaseTestCase; use PHPUnit\Framework\Attributes\Test; @@ -25,8 +25,8 @@ public function testChangePassword(): void { $customer = $this->createTestUserWithUpdateKey('coolUpdateKey_123'); - /** @var Repository $sut */ - $sut = $this->get(Repository::class); + /** @var RepositoryInterface $sut */ + $sut = $this->get(RepositoryInterface::class); $sut->saveNewPasswordForCustomer($customer, 'newPassword'); $customerAfterSave = oxNew(User::class); @@ -43,8 +43,8 @@ public function testGetCustomerByPasswordUpdateHashReturnsUser(): void $updateId = 'foobar'; $customer = $this->createTestUserWithUpdateKey($updateId); - /** @var Repository $sut */ - $sut = $this->get(Repository::class); + /** @var RepositoryInterface $sut */ + $sut = $this->get(RepositoryInterface::class); $updateHash = md5($customer->getId() . $customer->getShopId() . $updateId); $customerByUpdateId = $sut->getCustomerByPasswordUpdateHash($updateHash); diff --git a/tests/Integration/Customer/Service/CustomerServiceTest.php b/tests/Integration/Customer/Service/CustomerServiceTest.php index 012693ff..14c28860 100644 --- a/tests/Integration/Customer/Service/CustomerServiceTest.php +++ b/tests/Integration/Customer/Service/CustomerServiceTest.php @@ -17,9 +17,10 @@ use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface; use OxidEsales\Eshop\Core\Registry as EshopRegistry; use OxidEsales\GraphQL\Storefront\Customer\Exception\CustomerNotDeletable; +use OxidEsales\GraphQL\Storefront\Customer\Service\Customer; use OxidEsales\GraphQL\Storefront\Shared\Service\Authorization; -use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Repository as CustomerRepository; -use OxidEsales\GraphQL\Storefront\Customer\Service\Customer as CustomerService; +use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\RepositoryInterface as CustomerRepository; +use OxidEsales\GraphQL\Storefront\Customer\Service\CustomerInterface as CustomerService; use OxidEsales\GraphQL\Storefront\Shared\Infrastructure\Repository; use OxidEsales\GraphQL\Storefront\Customer\Exception\CustomerNotFound; use OxidEsales\GraphQL\Base\Tests\Integration\TestCase; @@ -102,7 +103,7 @@ public function testDeleteCustomerNotPossible(): void ->method('getUser') ->willReturn($userDataType); - $customerService = new CustomerService( + $customerService = new Customer( new Repository( $container->get(QueryBuilderFactoryInterface::class), new ListConfiguration() diff --git a/tests/Integration/Service/BasketServiceTest.php b/tests/Integration/Service/BasketServiceTest.php index 1e1b9aec..d89a7636 100644 --- a/tests/Integration/Service/BasketServiceTest.php +++ b/tests/Integration/Service/BasketServiceTest.php @@ -22,7 +22,7 @@ use OxidEsales\GraphQL\Storefront\Basket\Service\BasketFinder; use OxidEsales\GraphQL\Storefront\Country\Service\Country as CountryService; use OxidEsales\GraphQL\Storefront\Customer\Infrastructure\Customer as CustomerInfrastructure; -use OxidEsales\GraphQL\Storefront\Customer\Service\Customer as CustomerService; +use OxidEsales\GraphQL\Storefront\Customer\Service\CustomerInterface as CustomerService; use OxidEsales\GraphQL\Storefront\Shared\Infrastructure\Basket as SharedBasketInfrastructure; use OxidEsales\GraphQL\Storefront\Shared\Infrastructure\ListConfiguration; use OxidEsales\GraphQL\Storefront\Shared\Infrastructure\Repository;