diff --git a/features/admin/payment/managing_payments/payment_request/browsing_payment_requests.feature b/features/admin/payment/managing_payments/payment_request/browsing_payment_requests.feature new file mode 100644 index 0000000000..3b53205378 --- /dev/null +++ b/features/admin/payment/managing_payments/payment_request/browsing_payment_requests.feature @@ -0,0 +1,25 @@ +@managing_payments +Feature: Browsing payment requests + In order to have an overview of all payment requests of a specific payment + As an Administrator + I want to browse all payment requests of a payment + + Background: + Given the store operates on a single channel in "United States" + And the store has a product "PHP T-Shirt" + And the store ships everywhere for Free + And the store allows paying with "Cash on Delivery" + And there is an "#00000001" order with "PHP T-Shirt" product + And the payment request action "authorize" has been executed for order "#00000001" with the payment method "Cash on Delivery" + And the payment request action "capture" has been executed for order "#00000001" with the payment method "Cash on Delivery" + And the payment request action "sync" has been executed for order "#00000001" with the payment method "Cash on Delivery" + And I am logged in as an administrator + + @api @ui + Scenario: Browsing payment requests of a payment + When I browse payments + And I want to view the payment request of the first payment + Then there should be 3 payment requests on the list + And it should be the payment request with action "authorize" + And it should be the payment request with action "capture" + And it should be the payment request with action "sync" diff --git a/features/admin/payment/managing_payments/payment_request/filtering_payment_requests.feature b/features/admin/payment/managing_payments/payment_request/filtering_payment_requests.feature new file mode 100644 index 0000000000..444c4d18d0 --- /dev/null +++ b/features/admin/payment/managing_payments/payment_request/filtering_payment_requests.feature @@ -0,0 +1,46 @@ +@managing_payments +Feature: Filtering payment requests + In order to see specific payment requests + As an Administrator + I want to be able to filter payment requests on the list + + Background: + Given the store operates on a single channel in "United States" + And the store has a product "PHP T-Shirt" + And the store ships everywhere for Free + And the store allows paying with "Cash on Delivery" + And the store allows paying with "Credit Card" + And there is an "#00000001" order with "PHP T-Shirt" product + And there is an "#00000002" order with "PHP T-Shirt" product + And the payment request action "authorize" has been executed for order "#00000001" with the payment method "Credit Card" + And the payment request action "authorize" has been executed for order "#00000001" with the payment method "Cash on Delivery" + And the payment request action "capture" has been executed for order "#00000001" with the payment method "Cash on Delivery" + And the payment request action "sync" has been executed for order "#00000001" with the payment method "Cash on Delivery" + And the payment request action "capture" has been executed for order "#00000002" with the payment method "Cash on Delivery" + And I am logged in as an administrator + + @api @ui + Scenario: Filtering payment requests by action + When I browse payment requests of an order "#00000001" + And I filter by the "capture" action + Then there should be 1 payment request on the list + And it should be the payment request with action "capture" + + @api @ui @mink:chromedriver + Scenario: Filtering payment requests by payment method + When I browse payment requests of an order "#00000001" + And I filter by the "Credit Card" payment method + Then there should be 1 payment request on the list + And it should be the payment request with payment method "Credit Card" + + @api @ui + Scenario: Filtering payment requests by state "New" + When I browse payment requests of an order "#00000001" + And I filter by the "new" state + Then there should be 4 payment requests on the list + + @api @ui + Scenario: Filtering payment requests by state "Completed" + When I browse payment requests of an order "#00000001" + And I filter by the "completed" state + Then there should be 0 payment request on the list diff --git a/features/admin/payment/managing_payments/payment_request/seeing_payment_request_details.feature b/features/admin/payment/managing_payments/payment_request/seeing_payment_request_details.feature new file mode 100644 index 0000000000..f51af8331a --- /dev/null +++ b/features/admin/payment/managing_payments/payment_request/seeing_payment_request_details.feature @@ -0,0 +1,23 @@ +@managing_payments +Feature: Seeing payment request details + In order to have an overview of one of payment requests + As an Administrator + I want to be able to see its details + + Background: + Given the store operates on a single channel in "United States" + And the store has a product "PHP T-Shirt" + And the store ships everywhere for Free + And the store allows paying with "Cash on Delivery" + And there is an "#00000001" order with "PHP T-Shirt" product + And the payment request action "authorize" has been executed for order "#00000001" with the payment method "Cash on Delivery" + And I am logged in as an administrator + + @api @ui + Scenario: Seeing payment request's details + When I view details of the payment request for the "#00000001" order + Then its method should be "Cash on Delivery" + And its action should be "Authorize" + And its state should be "New" + And its payload should has empty value + And its response data should has empty value diff --git a/features/shop/checkout/paying_for_order/changing_offline_payment_method_after_order_confirmation.feature b/features/shop/checkout/paying_for_order/changing_offline_payment_method_after_order_confirmation.feature index e27714f35c..1c5517809d 100644 --- a/features/shop/checkout/paying_for_order/changing_offline_payment_method_after_order_confirmation.feature +++ b/features/shop/checkout/paying_for_order/changing_offline_payment_method_after_order_confirmation.feature @@ -21,7 +21,7 @@ Feature: Changing the offline payment method after order confirmation And I retry the payment with "Offline" payment method Then I should have chosen "Offline" payment method - @api @ui @javascript + @api Scenario: Retrying the payment with different Offline payment works correctly together with inventory Given there is 1 unit of product "PHP T-Shirt" available in the inventory And this product is tracked by the inventory diff --git a/src/Sylius/Behat/Client/ApiPlatformClient.php b/src/Sylius/Behat/Client/ApiPlatformClient.php index a93447efe2..32833811e2 100644 --- a/src/Sylius/Behat/Client/ApiPlatformClient.php +++ b/src/Sylius/Behat/Client/ApiPlatformClient.php @@ -55,10 +55,10 @@ final class ApiPlatformClient implements ApiClientInterface /** @param array $queryParameters */ public function subResourceIndex(string $resource, string $subResource, string $id, array $queryParameters = [], bool $forgetResponse = false): Response { - $request = $this->requestFactory->subResourceIndex($this->section, $resource, $id, $subResource, $queryParameters); - $request->authorize($this->getToken(), $this->authorizationHeader); + $this->request = $this->requestFactory->subResourceIndex($this->section, $resource, $id, $subResource, $queryParameters); + $this->request->authorize($this->getToken(), $this->authorizationHeader); - return $this->request($request, $forgetResponse); + return $this->request($this->request, $forgetResponse); } public function show(string $resource, string $id, bool $forgetResponse = false): Response diff --git a/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentRequestsContext.php b/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentRequestsContext.php new file mode 100644 index 0000000000..7fcded27b0 --- /dev/null +++ b/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentRequestsContext.php @@ -0,0 +1,156 @@ +client->subResourceIndex( + Resources::PAYMENTS, + Resources::PAYMENT_REQUESTS, + (string) $order->getLastPayment()->getId() + ); + } + + /** + * @When I view details of the payment request for the :order order + */ + public function iViewDetailsOfThePaymentRequestForTheOrder(OrderInterface $order): void + { + $paymentRequest = $this->paymentRequestRepository->findOneBy(['payment' => $order->getLastPayment()]); + + $this->client->show(Resources::PAYMENT_REQUESTS, (string) $paymentRequest->getHash()); + } + + /** + * @When I filter by the :action action + */ + public function iFilterByTheAction(string $action): void + { + $this->client->addFilter('action', $action); + $this->client->filter(); + } + + /** + * @When I filter by the :paymentMethod payment method + */ + public function iFilterByThePaymentMethod(PaymentMethodInterface $paymentMethod): void + { + $this->client->addFilter('method.code', $paymentMethod->getCode()); + $this->client->filter(); + } + + /** + * @When I filter by the :state state + */ + public function iFilterByTheState(string $state): void + { + $this->client->addFilter('state', $state); + $this->client->filter(); + } + + /** + * @Then /^there should be (\d+) payment requests? on the list$/ + */ + public function thereShouldBeProductVariantsOnTheList(int $count): void + { + Assert::same($this->responseChecker->countCollectionItems($this->client->getLastResponse()), $count); + } + + /** + * @Then it should be the payment request with action :action + */ + public function itShouldBeThePaymentRequestWithAction(string $action): void + { + Assert::true($this->responseChecker->hasItemWithValue($this->client->getLastResponse(), 'action', $action)); + } + + /** + * @Then it should be the payment request with payment method :paymentMethod + */ + public function itShouldBeThePaymentRequestWithPaymentMethod(PaymentMethodInterface $paymentMethod): void + { + Assert::true( + $this->responseChecker->hasItemWithValue( + $this->client->getLastResponse(), + 'method', + $this->iriConverter->getIriFromResourceInSection($paymentMethod, 'admin'), + ), + ); + } + + /** + * @Then its method should be :paymentMethod + */ + public function itsMethodShouldBe(PaymentMethodInterface $paymentMethod): void + { + Assert::true($this->responseChecker->hasValue( + $this->client->getLastResponse(), + 'method', + $this->iriConverter->getIriFromResourceInSection($paymentMethod, 'admin')) + ); + } + + /** + * @Then /^its (action|state) should be "([^"]+)"$/ + */ + public function itsActionStateShouldBe(string $field, string $value): void + { + Assert::true($this->responseChecker->hasValue($this->client->getLastResponse(), $field, strtolower($value))); + } + + /** + * @Then its payload should has empty value + */ + public function itsPayloadShouldHasEmptyValue(): void + { + Assert::isEmpty($this->responseChecker->getValue($this->client->getLastResponse(), 'payload')); + } + + /** + * @Then its response data should has empty value + */ + public function itsResponseDataShouldHasEmptyValue(): void + { + Assert::isEmpty($this->responseChecker->getValue($this->client->getLastResponse(), 'responseData')); + } + +} diff --git a/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentsContext.php b/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentsContext.php index d79eb9302a..8175dde7a4 100644 --- a/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentsContext.php +++ b/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentsContext.php @@ -58,6 +58,20 @@ final readonly class ManagingPaymentsContext implements Context $this->client->customItemAction(Resources::ORDERS, $order->getTokenValue(), HttpRequest::METHOD_GET, 'payments'); } + /** + * @When I want to view the payment request of the first payment + */ + public function iWantToViewThePaymentRequestOfTheFirstPayment(): void + { + $response = $this->client->getLastResponse(); + + $this->client->subResourceIndex( + Resources::PAYMENTS, + Resources::PAYMENT_REQUESTS, + (string) $this->responseChecker->getCollection($response)[0]['id'] + ); + } + /** * @Then I should see the details of order :order */ diff --git a/src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php b/src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php index 2b42fc164e..e8cae881e5 100644 --- a/src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php +++ b/src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php @@ -15,14 +15,13 @@ use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface; use Symfony\Component\HttpFoundation\Request as HTTPRequest; -final class PaymentRequestContext implements Context +final readonly class PaymentRequestContext implements Context { public function __construct( private SharedStorageInterface $sharedStorage, private ApiClientInterface $client, private ResponseCheckerInterface $responseChecker, private RequestFactoryInterface $requestFactory, - private PaymentMethodRepositoryInterface $paymentMethodRepository, ) { } diff --git a/src/Sylius/Behat/Context/Setup/PaymentContext.php b/src/Sylius/Behat/Context/Setup/PaymentContext.php index 9a7fe0dd2e..2de4188c42 100644 --- a/src/Sylius/Behat/Context/Setup/PaymentContext.php +++ b/src/Sylius/Behat/Context/Setup/PaymentContext.php @@ -20,12 +20,10 @@ use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface; use Sylius\Bundle\PayumBundle\Model\GatewayConfigInterface; use Sylius\Component\Core\Formatter\StringInflector; use Sylius\Component\Core\Model\ChannelInterface; -use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Payment\Model\PaymentMethodTranslationInterface; use Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface; use Sylius\Resource\Factory\FactoryInterface; -use Webmozart\Assert\Assert; final readonly class PaymentContext implements Context { @@ -72,7 +70,7 @@ final readonly class PaymentContext implements Context /** * @Given /^the store allows paying (\w+) for (all channels)$/ */ - public function storeAllowsPayingForAllChannels($paymentMethodName, array $channels) + public function storeAllowsPayingForAllChannels($paymentMethodName, array $channels): void { $paymentMethod = $this->createPaymentMethod($paymentMethodName, StringInflector::nameToUppercaseCode($paymentMethodName), 'Offline', 'Payment method', false); @@ -92,7 +90,7 @@ final readonly class PaymentContext implements Context /** * @Given /^(this payment method) is named "([^"]+)" in the "([^"]+)" locale$/ */ - public function thisPaymentMethodIsNamedIn(PaymentMethodInterface $paymentMethod, $name, $locale) + public function thisPaymentMethodIsNamedIn(PaymentMethodInterface $paymentMethod, $name, $locale): void { /** @var PaymentMethodTranslationInterface $translation */ $translation = $this->paymentMethodTranslationFactory->createNew(); @@ -109,7 +107,7 @@ final readonly class PaymentContext implements Context * @Given /^(this payment method) (?:has been|is) disabled$/ * @When the payment method :paymentMethod gets disabled */ - public function theStoreHasAPaymentMethodDisabled(PaymentMethodInterface $paymentMethod) + public function theStoreHasAPaymentMethodDisabled(PaymentMethodInterface $paymentMethod): void { $paymentMethod->disable(); @@ -119,7 +117,7 @@ final readonly class PaymentContext implements Context /** * @Given /^(it) has instructions "([^"]+)"$/ */ - public function itHasInstructions(PaymentMethodInterface $paymentMethod, $instructions) + public function itHasInstructions(PaymentMethodInterface $paymentMethod, $instructions): void { $paymentMethod->setInstructions($instructions); @@ -129,7 +127,7 @@ final readonly class PaymentContext implements Context /** * @Given the store has :paymentMethodName payment method not assigned to any channel */ - public function theStoreHasPaymentMethodNotAssignedToAnyChannel($paymentMethodName) + public function theStoreHasPaymentMethodNotAssignedToAnyChannel($paymentMethodName): void { $this->createPaymentMethod($paymentMethodName, 'PM_' . $paymentMethodName, 'Offline', 'Payment method', false); } @@ -137,7 +135,7 @@ final readonly class PaymentContext implements Context /** * @Given the payment method :paymentMethod requires authorization before capturing */ - public function thePaymentMethodRequiresAuthorizationBeforeCapturing(PaymentMethodInterface $paymentMethod) + public function thePaymentMethodRequiresAuthorizationBeforeCapturing(PaymentMethodInterface $paymentMethod): void { /** @var GatewayConfigInterface $config */ $config = $paymentMethod->getGatewayConfig(); @@ -163,16 +161,6 @@ final readonly class PaymentContext implements Context $paymentMethod->addChannel($channel); } - /** - * @Then /^the (latest order) should have a payment with state "([^"]+)"$/ - */ - public function theLatestOrderHasAuthorizedPayment(OrderInterface $order, string $state) - { - $payment = $order->getLastPayment(); - - Assert::eq($payment->getState(), $state); - } - private function createPaymentMethod( string $name, string $code, diff --git a/src/Sylius/Behat/Context/Setup/PaymentRequestContext.php b/src/Sylius/Behat/Context/Setup/PaymentRequestContext.php new file mode 100644 index 0000000000..652a7becd0 --- /dev/null +++ b/src/Sylius/Behat/Context/Setup/PaymentRequestContext.php @@ -0,0 +1,45 @@ +getLastPayment()->getId(), + paymentMethodCode: $paymentMethod->getCode(), + action: $action, + ); + + $this->commandBus->dispatch($addPaymentRequest); + } +} diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingPaymentRequestsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingPaymentRequestsContext.php new file mode 100644 index 0000000000..95aec44a99 --- /dev/null +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingPaymentRequestsContext.php @@ -0,0 +1,132 @@ +indexPage->open(['id' => $order->getLastPayment()->getId()]); + } + + /** + * @When I view details of the payment request for the :order order + */ + public function iViewDetailsOfThePaymentRequestForTheOrder(OrderInterface $order): void + { + $payment = $order->getLastPayment(); + $paymentRequest = $this->paymentRequestRepository->findOneBy(['payment' => $payment]); + + $this->showPage->open([ + 'hash' => $paymentRequest->getHash(), + 'paymentId' => $payment->getId() + ]); + } + + /** + * @When I filter by the :action action + */ + public function iFilterByTheAction(string $action): void + { + $this->indexPage->chooseActionToFilter($action); + $this->indexPage->filter(); + } + + /** + * @When I filter by the :paymentMethod payment method + */ + public function iFilterByThePaymentMethod(PaymentMethodInterface $paymentMethod): void + { + $this->indexPage->choosePaymentMethodToFilter($paymentMethod->getName()); + $this->indexPage->filter(); + } + + /** + * @When I filter by the :state state + */ + public function iFilterByTheState(string $state): void + { + $this->indexPage->chooseStateToFilter($state); + $this->indexPage->filter(); + } + + /** + * @Then /^there should be (\d+) payment requests? on the list$/ + */ + public function thereShouldBeProductVariantsOnTheList(int $count): void + { + Assert::same( + $this->indexPage->countItems(), + $count, + ); + } + + /** + * @Then it should be the payment request with action :action + */ + public function itShouldBeThePaymentRequestWithAction(string $action): void + { + Assert::true($this->indexPage->isSingleResourceOnPage(['action' => $action])); + } + + /** + * @Then it should be the payment request with payment method :paymentMethod + */ + public function itShouldBeThePaymentRequestWithPaymentMethod(PaymentMethodInterface $paymentMethod): void + { + Assert::true($this->indexPage->isSingleResourceOnPage(['method' => $paymentMethod->getName()])); + } + + /** + * @Then its :field should be :value + */ + public function itsFieldShouldBe(string $field, string $value): void + { + Assert::same($this->showPage->getFieldText($field), $value); + } + + /** + * @Then its payload should has empty value + */ + public function itsPayloadShouldHasEmptyValue(): void + { + Assert::same($this->showPage->getFieldText('payload'), 'null'); + } + + /** + * @Then its response data should has empty value + */ + public function itsResponseDataShouldBe(): void + { + Assert::same($this->showPage->getFieldText('response_data'), json_encode([])); + } +} diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingPaymentsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingPaymentsContext.php index 3effca2332..e9cf67042b 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingPaymentsContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingPaymentsContext.php @@ -80,6 +80,14 @@ final class ManagingPaymentsContext implements Context $this->indexPage->chooseChannelFilter($channelName); } + /** + * @When I want to view the payment request of the first payment + */ + public function iWantToViewThePaymentRequestOfTheFirstPayment(): void + { + $this->indexPage->showPaymentRequestOfNthPayment(1); + } + /** * @Then I should see :count payments in the list * @Then I should see a single payment in the list diff --git a/src/Sylius/Behat/Page/Admin/Payment/IndexPage.php b/src/Sylius/Behat/Page/Admin/Payment/IndexPage.php index 0a2d7bef50..a62f87753a 100644 --- a/src/Sylius/Behat/Page/Admin/Payment/IndexPage.php +++ b/src/Sylius/Behat/Page/Admin/Payment/IndexPage.php @@ -48,6 +48,17 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface $this->getOrderLinkForRow($position)->clickLink('#'); } + public function showPaymentRequestOfNthPayment(int $position): void + { + $tableAccessor = $this->getTableAccessor(); + $table = $this->getElement('table'); + + $row = $tableAccessor->getRowsWithFields($table, [])[$position]; + $field = $tableAccessor->getFieldFromRow($table, $row, 'actions'); + + $field->find('css', '[data-test-show-action="List payment requests"]')->click(); + } + public function chooseChannelFilter(string $channelName): void { $this->getElement('filter_channel')->selectOption($channelName); diff --git a/src/Sylius/Behat/Page/Admin/Payment/IndexPageInterface.php b/src/Sylius/Behat/Page/Admin/Payment/IndexPageInterface.php index d02b24a266..e7f3ec27c0 100644 --- a/src/Sylius/Behat/Page/Admin/Payment/IndexPageInterface.php +++ b/src/Sylius/Behat/Page/Admin/Payment/IndexPageInterface.php @@ -27,5 +27,7 @@ interface IndexPageInterface extends BaseIndexPageInterface public function showOrderPageForNthPayment(int $position): void; + public function showPaymentRequestOfNthPayment(int $position): void; + public function chooseChannelFilter(string $channelName): void; } diff --git a/src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/IndexPage.php b/src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/IndexPage.php new file mode 100644 index 0000000000..3ac6d0a016 --- /dev/null +++ b/src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/IndexPage.php @@ -0,0 +1,74 @@ +specifyAutocompleteFilter($this->getElement('filter_payment_method'), $paymentMethodName); + } + + public function chooseActionToFilter(string $action): void + { + $this->getElement('filter_action')->selectOption($action); + } + + public function chooseStateToFilter(string $state): void + { + $this->getElement('filter_state')->selectOption($state); + } + + protected function getDefinedElements(): array + { + return array_merge(parent::getDefinedElements(), [ + 'filter_action' => '#criteria_action', + 'filter_payment_method' => '#criteria_payment_method', + 'filter_state' => '#criteria_state', + ]); + } + + private function specifyAutocompleteFilter(NodeElement $autocomplete, string $value): void + { + if (!$this->areFiltersVisible()) { + $this->toggleFilters(); + } + + $this->autocompleteHelper->selectByName( + $this->getDriver(), + $autocomplete->getXpath(), + $value, + ); + + $this->waitForFormUpdate(); + } +} diff --git a/src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/IndexPageInterface.php b/src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/IndexPageInterface.php new file mode 100644 index 0000000000..348607d720 --- /dev/null +++ b/src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/IndexPageInterface.php @@ -0,0 +1,26 @@ +getElement($fieldName)->getText(); + } + + protected function getDefinedElements(): array + { + return array_merge(parent::getDefinedElements(), [ + 'action' => '[data-test-action]', + 'method' => '[data-test-method]', + 'payload' => '[data-test-payload]', + 'response_data' => '[data-test-response-data]', + 'state' => '[data-test-state]', + ]); + } +} diff --git a/src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/ShowPageInterface.php b/src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/ShowPageInterface.php new file mode 100644 index 0000000000..61e2309546 --- /dev/null +++ b/src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/ShowPageInterface.php @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/src/Sylius/Behat/Resources/config/services/contexts/api/shop.xml b/src/Sylius/Behat/Resources/config/services/contexts/api/shop.xml index 6fe24f8604..8591a4a31d 100644 --- a/src/Sylius/Behat/Resources/config/services/contexts/api/shop.xml +++ b/src/Sylius/Behat/Resources/config/services/contexts/api/shop.xml @@ -166,7 +166,6 @@ - diff --git a/src/Sylius/Behat/Resources/config/services/contexts/setup.xml b/src/Sylius/Behat/Resources/config/services/contexts/setup.xml index 4738917e42..6827a6e528 100644 --- a/src/Sylius/Behat/Resources/config/services/contexts/setup.xml +++ b/src/Sylius/Behat/Resources/config/services/contexts/setup.xml @@ -142,7 +142,6 @@ Offline - @@ -320,5 +319,9 @@ + + + + diff --git a/src/Sylius/Behat/Resources/config/services/contexts/ui.xml b/src/Sylius/Behat/Resources/config/services/contexts/ui.xml index 29ad8a5557..9d737355d2 100644 --- a/src/Sylius/Behat/Resources/config/services/contexts/ui.xml +++ b/src/Sylius/Behat/Resources/config/services/contexts/ui.xml @@ -613,5 +613,11 @@ + + + + + + diff --git a/src/Sylius/Behat/Resources/config/services/pages/admin/payment.xml b/src/Sylius/Behat/Resources/config/services/pages/admin/payment.xml index 6aa10f4483..415f7382a4 100644 --- a/src/Sylius/Behat/Resources/config/services/pages/admin/payment.xml +++ b/src/Sylius/Behat/Resources/config/services/pages/admin/payment.xml @@ -14,6 +14,8 @@ Sylius\Behat\Page\Admin\Payment\IndexPage + Sylius\Behat\Page\Admin\Payment\PaymentRequest\IndexPage + Sylius\Behat\Page\Admin\Payment\PaymentRequest\ShowPage @@ -22,5 +24,21 @@ sylius_admin_payment_index + + + sylius_admin_payment_payment_request_index + + + + + diff --git a/src/Sylius/Behat/Resources/config/suites/api/payment/managing_payments.yml b/src/Sylius/Behat/Resources/config/suites/api/payment/managing_payments.yml index 0df135235c..38f71963a6 100644 --- a/src/Sylius/Behat/Resources/config/suites/api/payment/managing_payments.yml +++ b/src/Sylius/Behat/Resources/config/suites/api/payment/managing_payments.yml @@ -11,6 +11,7 @@ default: - sylius.behat.context.transform.customer - sylius.behat.context.transform.lexical - sylius.behat.context.transform.order + - sylius.behat.context.transform.payment - sylius.behat.context.transform.product - sylius.behat.context.transform.shared_storage @@ -18,10 +19,12 @@ default: - sylius.behat.context.setup.channel - sylius.behat.context.setup.order - sylius.behat.context.setup.payment + - sylius.behat.context.setup.payment_request - sylius.behat.context.setup.product - sylius.behat.context.setup.shipping - sylius.behat.context.api.admin.managing_payments + - sylius.behat.context.api.admin.managing_payment_requests filters: tags: "@managing_payments&&@api" diff --git a/src/Sylius/Behat/Resources/config/suites/ui/payment/managing_payments.yml b/src/Sylius/Behat/Resources/config/suites/ui/payment/managing_payments.yml index 20797a92d1..b8bd2d9a81 100644 --- a/src/Sylius/Behat/Resources/config/suites/ui/payment/managing_payments.yml +++ b/src/Sylius/Behat/Resources/config/suites/ui/payment/managing_payments.yml @@ -23,6 +23,7 @@ default: - sylius.behat.context.setup.geographical - sylius.behat.context.setup.order - sylius.behat.context.setup.payment + - sylius.behat.context.setup.payment_request - sylius.behat.context.setup.product - sylius.behat.context.setup.shipping - sylius.behat.context.setup.zone @@ -30,6 +31,7 @@ default: - sylius.behat.context.ui.email - sylius.behat.context.ui.admin.managing_payments + - sylius.behat.context.ui.admin.managing_payment_requests - sylius.behat.context.ui.shop.cart filters: tags: "@managing_payments&&@ui" diff --git a/tests/Api/Responses/admin/payment_request/get_payment_requests_for_payment.json b/tests/Api/Responses/admin/payment_request/get_payment_requests_for_payment.json index 3f3ebee59c..a242e65a17 100644 --- a/tests/Api/Responses/admin/payment_request/get_payment_requests_for_payment.json +++ b/tests/Api/Responses/admin/payment_request/get_payment_requests_for_payment.json @@ -2,6 +2,7 @@ "@context": "\/api\/v2\/contexts\/PaymentRequest", "@id": "\/api\/v2\/admin\/payments\/@integer@\/payment-requests", "@type": "hydra:Collection", + "hydra:totalItems": 3, "hydra:member": [ { "@id": "\/api\/v2\/admin\/payment-requests\/@string@", @@ -31,5 +32,47 @@ "method": "\/api\/v2\/admin\/payment-methods\/CASH_ON_DELIVERY" } ], - "hydra:totalItems": 3 + "hydra:search": { + "@type": "hydra:IriTemplate", + "hydra:template": "\/api\/v2\/admin\/payments\/@integer@\/payment-requests{?action,action[],method.code,method.code[],state,state[]}", + "hydra:variableRepresentation": "BasicRepresentation", + "hydra:mapping": [ + { + "@type": "IriTemplateMapping", + "variable": "action", + "property": "action", + "required": false + }, + { + "@type": "IriTemplateMapping", + "variable": "action[]", + "property": "action", + "required": false + }, + { + "@type": "IriTemplateMapping", + "variable": "method.code", + "property": "method.code", + "required": false + }, + { + "@type": "IriTemplateMapping", + "variable": "method.code[]", + "property": "method.code", + "required": false + }, + { + "@type": "IriTemplateMapping", + "variable": "state", + "property": "state", + "required": false + }, + { + "@type": "IriTemplateMapping", + "variable": "state[]", + "property": "state", + "required": false + } + ] + } }