mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Merge pull request #4742 from GSadee/admin-payment-method
[Admin][PaymentMethod] Payment method features
This commit is contained in:
commit
f906b51ab1
29 changed files with 1047 additions and 3 deletions
|
|
@ -31,6 +31,7 @@ sylius_payment:
|
|||
cc: Credit Card
|
||||
test: Test
|
||||
stripe: Stripe
|
||||
paypal_express_checkout: Paypal Express Checkout
|
||||
|
||||
sylius_rbac:
|
||||
authorization_checker: sylius.authorization_checker.toggleable
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@
|
|||
<argument type="service" id="sylius.repository.payment_method" container="symfony" />
|
||||
<argument type="service" id="sylius.factory.payment_method" container="symfony" />
|
||||
<argument type="service" id="sylius.payment_method_name_to_gateway_converter" container="symfony" />
|
||||
<argument type="service" id="doctrine.orm.entity_manager" container="symfony" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
<parameter key="sylius.behat.context.transform.lexical.class">Sylius\Behat\Context\Transform\LexicalContext</parameter>
|
||||
<parameter key="sylius.behat.context.transform.locale.class">Sylius\Behat\Context\Transform\LocaleContext</parameter>
|
||||
<parameter key="sylius.behat.context.transform.payment.class">Sylius\Behat\Context\Transform\PaymentContext</parameter>
|
||||
<parameter key="sylius.behat.context.transform.payment_method.class">Sylius\Behat\Context\Transform\PaymentMethodContext</parameter>
|
||||
<parameter key="sylius.behat.context.transform.product.class">Sylius\Behat\Context\Transform\ProductContext</parameter>
|
||||
<parameter key="sylius.behat.context.transform.product_variant.class">Sylius\Behat\Context\Transform\ProductVariantContext</parameter>
|
||||
<parameter key="sylius.behat.context.transform.promotion.class">Sylius\Behat\Context\Transform\PromotionContext</parameter>
|
||||
|
|
@ -76,6 +77,11 @@
|
|||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.behat.context.transform.payment_method" class="%sylius.behat.context.transform.payment_method.class%" scope="scenario">
|
||||
<argument type="service" id="sylius.repository.payment_method" container="symfony" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.behat.context.transform.product" class="%sylius.behat.context.transform.product.class%" scope="scenario">
|
||||
<argument type="service" id="sylius.repository.product" container="symfony" />
|
||||
<tag name="sylius.behat.context" />
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
<parameter key="sylius.behat.context.ui.admin.managing_countries.class">Sylius\Behat\Context\Ui\Admin\ManagingCountriesContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.admin.managing_customers.class">Sylius\Behat\Context\Ui\Admin\ManagingCustomersContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.admin.managing_locale.class">Sylius\Behat\Context\Ui\Admin\ManagingLocalesContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.admin.managing_payment_methods.class">Sylius\Behat\Context\Ui\Admin\ManagingPaymentMethodsContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.admin.managing_promotions.class">Sylius\Behat\Context\Ui\Admin\ManagingPromotionsContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.admin.managing_shipping_methods.class">Sylius\Behat\Context\Ui\Admin\ManagingShippingMethodsContext</parameter>
|
||||
<parameter key="sylius.behat.context.ui.admin.managing_tax_category.class">Sylius\Behat\Context\Ui\Admin\ManagingTaxCategoryContext</parameter>
|
||||
|
|
@ -57,6 +58,15 @@
|
|||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.behat.context.ui.admin.managing_payment_methods" class="%sylius.behat.context.ui.admin.managing_payment_methods.class%" scope="scenario">
|
||||
<argument type="service" id="sylius.behat.page.admin.payment_method.create" />
|
||||
<argument type="service" id="sylius.behat.page.admin.payment_method.index" />
|
||||
<argument type="service" id="sylius.behat.page.admin.payment_method.update" />
|
||||
<argument type="service" id="sylius.behat.current_page_resolver" />
|
||||
<argument type="service" id="sylius.behat.notification_checker" />
|
||||
<tag name="sylius.behat.context" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.behat.context.ui.admin.managing_promotions" class="%sylius.behat.context.ui.admin.managing_promotions.class%" scope="scenario">
|
||||
<argument type="service" id="sylius.behat.page.admin.promotion.index" />
|
||||
<argument type="service" id="sylius.behat.page.admin.promotion.create" />
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@
|
|||
<parameter key="sylius.behat.page.admin.locale.create.class">Sylius\Behat\Page\Admin\Locale\CreatePage</parameter>
|
||||
<parameter key="sylius.behat.page.admin.locale.index.class">Sylius\Behat\Page\Admin\Locale\IndexPage</parameter>
|
||||
<parameter key="sylius.behat.page.admin.locale.update.class">Sylius\Behat\Page\Admin\Locale\UpdatePage</parameter>
|
||||
<parameter key="sylius.behat.page.admin.payment_method.create.class">Sylius\Behat\Page\Admin\PaymentMethod\CreatePage</parameter>
|
||||
<parameter key="sylius.behat.page.admin.payment_method.index.class">%sylius.behat.page.admin.crud.index.class%</parameter>
|
||||
<parameter key="sylius.behat.page.admin.payment_method.update.class">Sylius\Behat\Page\Admin\PaymentMethod\UpdatePage</parameter>
|
||||
<parameter key="sylius.behat.page.admin.product.show.class">Sylius\Behat\Page\Admin\Product\ShowPage</parameter>
|
||||
<parameter key="sylius.behat.page.admin.product.index.class">Sylius\Behat\Page\Admin\Product\IndexPage</parameter>
|
||||
<parameter key="sylius.behat.page.admin.promotion.create.class">Sylius\Behat\Page\Admin\Promotion\CreatePage</parameter>
|
||||
|
|
@ -114,6 +117,15 @@
|
|||
<service id="sylius.behat.page.admin.locale.update" class="%sylius.behat.page.admin.locale.update.class%" parent="sylius.behat.page.admin.crud.update" scope="scenario" public="false">
|
||||
<argument type="string">locale</argument>
|
||||
</service>
|
||||
<service id="sylius.behat.page.admin.payment_method.create" class="%sylius.behat.page.admin.payment_method.create.class%" parent="sylius.behat.page.admin.crud.create" scope="scenario" public="false">
|
||||
<argument type="string">payment_method</argument>
|
||||
</service>
|
||||
<service id="sylius.behat.page.admin.payment_method.index" class="%sylius.behat.page.admin.payment_method.index.class%" parent="sylius.behat.page.admin.crud.index" scope="scenario" public="false">
|
||||
<argument type="string">payment_method</argument>
|
||||
</service>
|
||||
<service id="sylius.behat.page.admin.payment_method.update" class="%sylius.behat.page.admin.payment_method.update.class%" parent="sylius.behat.page.admin.crud.update" scope="scenario" public="false">
|
||||
<argument type="string">payment_method</argument>
|
||||
</service>
|
||||
<service id="sylius.behat.page.admin.shipping_method.create" class="%sylius.behat.page.admin.shipping_method.create.class%" parent="sylius.behat.page.admin.crud.create" scope="scenario" public="false">
|
||||
<argument type="string">shipping_method</argument>
|
||||
</service>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ imports:
|
|||
- suites/ui/checkout.yml
|
||||
- suites/ui/customer/managing_customers.yml
|
||||
- suites/ui/locale.yml
|
||||
- suites/ui/payment/managing_payment_methods.yml
|
||||
- suites/ui/product.yml
|
||||
- suites/ui/promotion.yml
|
||||
- suites/ui/promotion/managing_promotions.yml
|
||||
|
|
|
|||
20
etc/behat/suites/ui/payment/managing_payment_methods.yml
Normal file
20
etc/behat/suites/ui/payment/managing_payment_methods.yml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
default:
|
||||
suites:
|
||||
ui_managing_payment_methods:
|
||||
contexts_as_services:
|
||||
- sylius.behat.context.hook.doctrine_orm
|
||||
|
||||
- sylius.behat.context.setup.channel
|
||||
- sylius.behat.context.setup.payment
|
||||
- sylius.behat.context.setup.security
|
||||
|
||||
- sylius.behat.context.transform.locale
|
||||
- sylius.behat.context.transform.payment_method
|
||||
- sylius.behat.context.transform.shared_storage
|
||||
|
||||
- sylius.behat.context.ui.admin.managing_payment_methods
|
||||
filters:
|
||||
tags: "@managing_payment_methods && @ui"
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
@managing_payment_methods
|
||||
Feature: Adding a new payment method
|
||||
In order to pay for orders in different ways
|
||||
As an Administrator
|
||||
I want to add a new payment method to the registry
|
||||
|
||||
Background:
|
||||
Given the store operates on a single channel in "France"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Adding a new payment method
|
||||
Given I want to create a new payment method
|
||||
When I name it "Paypal Express Checkout" in "English (United States)"
|
||||
And I specify its code as "PEC"
|
||||
And I choose "Paypal Express Checkout" gateway
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the payment method "Paypal Express Checkout" should appear in the registry
|
||||
|
||||
@ui
|
||||
Scenario: Adding a new payment method with description
|
||||
Given I want to create a new payment method
|
||||
When I name it "Paypal Express Checkout" in "English (United States)"
|
||||
And I specify its code as "PEC"
|
||||
And I choose "Paypal Express Checkout" gateway
|
||||
And I describe it as "Payment method Paypal Express Checkout" in "English (United States)"
|
||||
And I add it
|
||||
Then I should be notified that it has been successfully created
|
||||
And the payment method "Paypal Express Checkout" should appear in the registry
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
@managing_payment_methods
|
||||
Feature: Browsing payment methods
|
||||
In order to see all payment methods in the store
|
||||
As an Administrator
|
||||
I want to be able to browse payment methods
|
||||
|
||||
Background:
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Browsing defined payment methods
|
||||
Given the store has a payment method "Offline" with a code "OFF"
|
||||
And the store has a payment method "PayPal Express Checkout" with a code "PEC"
|
||||
When I browse payment methods
|
||||
Then I should see 2 payment methods in the list
|
||||
And the payment method "PayPal Express Checkout" should be in the registry
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
@managing_payment_methods
|
||||
Feature: Deleting payment methods
|
||||
In order to remove test, obsolete or incorrect payment methods
|
||||
As an Administrator
|
||||
I want to be able to delete a payment method
|
||||
|
||||
Background:
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Deleted payment method should disappear from the registry
|
||||
Given the store has a payment method "Offline" with a code "offline"
|
||||
When I delete the "Offline" payment method
|
||||
Then I should be notified that it has been successfully deleted
|
||||
And this payment method should no longer exist in the registry
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@managing_payment_methods
|
||||
Feature: Editing payment methods
|
||||
In order to change which payment methods are available in my store
|
||||
As an Administrator
|
||||
I want to be able to edit payment method
|
||||
|
||||
Background:
|
||||
Given the store has a payment method "Offline" with a code "offline"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Renaming the payment method
|
||||
Given I want to modify the "Offline" payment method
|
||||
When I rename it to "Cash on delivery" in "English (United States)"
|
||||
And I save my changes
|
||||
Then I should be notified that it has been successfully edited
|
||||
And this payment method name should be "Cash on delivery"
|
||||
|
||||
@ui
|
||||
Scenario: Modifying payment method gateway
|
||||
Given I want to modify the "Offline" payment method
|
||||
When I choose "Paypal Express Checkout" gateway
|
||||
And I save my changes
|
||||
Then I should be notified that it has been successfully edited
|
||||
And this payment method gateway should be "paypal_express_checkout"
|
||||
|
||||
@ui
|
||||
Scenario: Disabling payment method
|
||||
Given I want to modify the "Offline" payment method
|
||||
When I disable it
|
||||
And I save my changes
|
||||
Then I should be notified that it has been successfully edited
|
||||
And this payment method should be disabled
|
||||
|
||||
@ui
|
||||
Scenario: Enabling payment method
|
||||
Given the payment method "Offline" is disabled
|
||||
And I want to modify the "Offline" payment method
|
||||
When I enable it
|
||||
And I save my changes
|
||||
Then I should be notified that it has been successfully edited
|
||||
And this payment method should be enabled
|
||||
|
||||
@ui
|
||||
Scenario: Seeing disabled code field while editing payment method
|
||||
When I want to modify the "Offline" payment method
|
||||
Then the code field should be disabled
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
@managing_payment_methods
|
||||
Feature: Payment method unique code validation
|
||||
In order to uniquely identify payment methods
|
||||
As an Administrator
|
||||
I want to be prevented from adding two payment methods with the same code
|
||||
|
||||
Background:
|
||||
Given the store operates on a single channel in "France"
|
||||
And the store has a payment method "Offline" with a code "offline"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Trying to add payment method with taken code
|
||||
Given I want to create a new payment method
|
||||
When I name it "Paypal Express Checkout" in "English (United States)"
|
||||
And I specify its code as "offline"
|
||||
And I choose "Offline" gateway
|
||||
And I try to add it
|
||||
Then I should be notified that payment method with this code already exists
|
||||
And there should still be only one payment method with code "offline"
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
@managing_payment_methods
|
||||
Feature: Payment method validation
|
||||
In order to avoid making mistakes when managing a payment method
|
||||
As an Administrator
|
||||
I want to be prevented from adding it without specifying required fields
|
||||
|
||||
Background:
|
||||
Given the store operates on a single channel in "France"
|
||||
And the store has a payment method "Offline" with a code "offline"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Trying to add a new payment method without specifying its code
|
||||
Given I want to create a new payment method
|
||||
When I name it "Paypal Express Checkout" in "English (United States)"
|
||||
But I do not specify its code
|
||||
And I choose "Paypal Express Checkout" gateway
|
||||
And I add it
|
||||
Then I should be notified that code is required
|
||||
And the payment method with name "Paypal Express Checkout" should not be added
|
||||
|
||||
@ui
|
||||
Scenario: Trying to add a new payment method without specifying its name
|
||||
Given I want to create a new payment method
|
||||
When I specify its code as "PEC"
|
||||
And I choose "Paypal Express Checkout" gateway
|
||||
But I do not name it
|
||||
And I add it
|
||||
Then I should be notified that name is required
|
||||
And the payment method with code "PEC" should not be added
|
||||
|
||||
@ui
|
||||
Scenario: Trying to remove name from an existing payment method
|
||||
Given I want to modify the "Offline" payment method
|
||||
When I remove its name from "English (United States)" translation
|
||||
And I try to save my changes
|
||||
Then I should be notified that name is required
|
||||
And this payment method should still be named "Offline"
|
||||
|
|
@ -12,14 +12,17 @@
|
|||
namespace Sylius\Behat\Context\Setup;
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Sylius\Bundle\CoreBundle\Test\Services\PaymentMethodNameToGatewayConverterInterface;
|
||||
use Sylius\Component\Core\Test\Services\SharedStorageInterface;
|
||||
use Sylius\Component\Payment\Model\PaymentMethodInterface;
|
||||
use Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface;
|
||||
use Sylius\Component\Resource\Factory\FactoryInterface;
|
||||
|
||||
/**
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
* @author Łukasz Chruściel <lukasz.chrusciel@lakion.com>
|
||||
* @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
|
||||
*/
|
||||
final class PaymentContext implements Context
|
||||
{
|
||||
|
|
@ -43,22 +46,30 @@ final class PaymentContext implements Context
|
|||
*/
|
||||
private $paymentMethodNameToGatewayConverter;
|
||||
|
||||
/**
|
||||
* @var ObjectManager
|
||||
*/
|
||||
private $objectManager;
|
||||
|
||||
/**
|
||||
* @param SharedStorageInterface $sharedStorage
|
||||
* @param PaymentMethodRepositoryInterface $paymentMethodRepository
|
||||
* @param FactoryInterface $paymentMethodFactory
|
||||
* @param PaymentMethodNameToGatewayConverterInterface $paymentMethodNameToGatewayConverter
|
||||
* @param ObjectManager $objectManager
|
||||
*/
|
||||
public function __construct(
|
||||
SharedStorageInterface $sharedStorage,
|
||||
PaymentMethodRepositoryInterface $paymentMethodRepository,
|
||||
FactoryInterface $paymentMethodFactory,
|
||||
PaymentMethodNameToGatewayConverterInterface $paymentMethodNameToGatewayConverter
|
||||
PaymentMethodNameToGatewayConverterInterface $paymentMethodNameToGatewayConverter,
|
||||
ObjectManager $objectManager
|
||||
) {
|
||||
$this->sharedStorage = $sharedStorage;
|
||||
$this->paymentMethodRepository = $paymentMethodRepository;
|
||||
$this->paymentMethodFactory = $paymentMethodFactory;
|
||||
$this->paymentMethodNameToGatewayConverter = $paymentMethodNameToGatewayConverter;
|
||||
$this->objectManager = $objectManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -78,4 +89,42 @@ final class PaymentContext implements Context
|
|||
|
||||
$this->paymentMethodRepository->add($paymentMethod);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the store has a payment method :paymentMethodName with a code :paymentMethodCode
|
||||
*/
|
||||
public function theStoreHasAPaymentMethodWithACode($paymentMethodName, $paymentMethodCode)
|
||||
{
|
||||
$paymentMethod = $this->createPaymentMethodFromNameAndCode($paymentMethodName, $paymentMethodCode);
|
||||
|
||||
$this->sharedStorage->set('payment_method', $paymentMethod);
|
||||
$this->paymentMethodRepository->add($paymentMethod);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the payment method :paymentMethod is disabled
|
||||
*/
|
||||
public function theStoreHasAPaymentMethodDisabled(PaymentMethodInterface $paymentMethod)
|
||||
{
|
||||
$paymentMethod->disable();
|
||||
|
||||
$this->objectManager->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $code
|
||||
*
|
||||
* @return PaymentMethodInterface
|
||||
*/
|
||||
private function createPaymentMethodFromNameAndCode($name, $code)
|
||||
{
|
||||
/** @var PaymentMethodInterface $paymentMethod */
|
||||
$paymentMethod = $this->paymentMethodFactory->createNew();
|
||||
$paymentMethod->setName($name);
|
||||
$paymentMethod->setCode($code);
|
||||
$paymentMethod->setGateway($this->paymentMethodNameToGatewayConverter->convert($name));
|
||||
|
||||
return $paymentMethod;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
47
src/Sylius/Behat/Context/Transform/PaymentMethodContext.php
Normal file
47
src/Sylius/Behat/Context/Transform/PaymentMethodContext.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Behat\Context\Transform;
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
*/
|
||||
final class PaymentMethodContext implements Context
|
||||
{
|
||||
/**
|
||||
* @var PaymentMethodRepositoryInterface
|
||||
*/
|
||||
private $paymentMethodRepository;
|
||||
|
||||
/**
|
||||
* @param PaymentMethodRepositoryInterface $paymentMethodRepository
|
||||
*/
|
||||
public function __construct(PaymentMethodRepositoryInterface $paymentMethodRepository)
|
||||
{
|
||||
$this->paymentMethodRepository = $paymentMethodRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Transform :paymentMethod
|
||||
*/
|
||||
public function getPaymentMethodByName($name)
|
||||
{
|
||||
$paymentMethod = $this->paymentMethodRepository->findOneByName($name);
|
||||
|
||||
Assert::notNull($paymentMethod, sprintf('Cannot find payment method named %s', $name));
|
||||
|
||||
return $paymentMethod;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,372 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Behat\Context\Ui\Admin;
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPageInterface;
|
||||
use Sylius\Behat\Page\Admin\PaymentMethod\CreatePageInterface;
|
||||
use Sylius\Behat\Page\Admin\PaymentMethod\UpdatePageInterface;
|
||||
use Sylius\Behat\Service\CurrentPageResolverInterface;
|
||||
use Sylius\Behat\Service\NotificationCheckerInterface;
|
||||
use Sylius\Component\Payment\Model\PaymentMethodInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
* @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
|
||||
*/
|
||||
final class ManagingPaymentMethodsContext implements Context
|
||||
{
|
||||
const RESOURCE_NAME = 'payment_method';
|
||||
|
||||
/**
|
||||
* @var CreatePageInterface
|
||||
*/
|
||||
private $createPage;
|
||||
|
||||
/**
|
||||
* @var IndexPageInterface
|
||||
*/
|
||||
private $indexPage;
|
||||
|
||||
/**
|
||||
* @var UpdatePageInterface
|
||||
*/
|
||||
private $updatePage;
|
||||
|
||||
/**
|
||||
* @var CurrentPageResolverInterface
|
||||
*/
|
||||
private $currentPageResolver;
|
||||
|
||||
/**
|
||||
* @var NotificationCheckerInterface
|
||||
*/
|
||||
private $notificationChecker;
|
||||
|
||||
/**
|
||||
* @param CreatePageInterface $createPage
|
||||
* @param IndexPageInterface $indexPage
|
||||
* @param UpdatePageInterface $updatePage
|
||||
* @param CurrentPageResolverInterface $currentPageResolver
|
||||
* @param NotificationCheckerInterface $notificationChecker
|
||||
*/
|
||||
public function __construct(
|
||||
CreatePageInterface $createPage,
|
||||
IndexPageInterface $indexPage,
|
||||
UpdatePageInterface $updatePage,
|
||||
CurrentPageResolverInterface $currentPageResolver,
|
||||
NotificationCheckerInterface $notificationChecker
|
||||
) {
|
||||
$this->createPage = $createPage;
|
||||
$this->indexPage = $indexPage;
|
||||
$this->updatePage = $updatePage;
|
||||
$this->currentPageResolver = $currentPageResolver;
|
||||
$this->notificationChecker = $notificationChecker;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I want to modify the :paymentMethod payment method
|
||||
*/
|
||||
public function iWantToModifyAPaymentMethod(PaymentMethodInterface $paymentMethod)
|
||||
{
|
||||
$this->updatePage->open(['id' => $paymentMethod->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I name it :name in :language
|
||||
* @When I rename it to :name in :language
|
||||
* @When I remove its name from :language translation
|
||||
*/
|
||||
public function iNameItIn($name = null, $language)
|
||||
{
|
||||
$currentPage = $this->currentPageResolver->getCurrentPageWithForm($this->createPage, $this->updatePage);
|
||||
|
||||
$currentPage->nameIt($name, $language);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I do not name it
|
||||
*/
|
||||
public function iDoNotNameIt()
|
||||
{
|
||||
// Intentionally left blank to fulfill context expectation
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I enable it
|
||||
*/
|
||||
public function iEnableIt()
|
||||
{
|
||||
$this->updatePage->enable();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I disable it
|
||||
*/
|
||||
public function iDisableIt()
|
||||
{
|
||||
$this->updatePage->disable();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I save my changes
|
||||
* @When I try to save my changes
|
||||
*/
|
||||
public function iSaveMyChanges()
|
||||
{
|
||||
$this->updatePage->saveChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I delete the :paymentMethod payment method
|
||||
*/
|
||||
public function iDeletePaymentMethod(PaymentMethodInterface $paymentMethod)
|
||||
{
|
||||
$this->indexPage->open();
|
||||
$this->indexPage->deleteResourceOnPage(['code' => $paymentMethod->getCode(), 'name' => $paymentMethod->getName()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I choose :gatewayName gateway
|
||||
*/
|
||||
public function iChooseGateway($gatewayName)
|
||||
{
|
||||
$currentPage = $this->currentPageResolver->getCurrentPageWithForm($this->createPage, $this->updatePage);
|
||||
|
||||
$currentPage->chooseGateway($gatewayName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that it has been successfully edited
|
||||
*/
|
||||
public function iShouldBeNotifiedAboutSuccessfulEdition()
|
||||
{
|
||||
$this->notificationChecker->checkEditionNotification(self::RESOURCE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then this payment method :element should be :value
|
||||
*/
|
||||
public function thisPaymentMethodElementShouldBe($element, $value)
|
||||
{
|
||||
Assert::true(
|
||||
$this->updatePage->hasResourceValues([$element => $value]),
|
||||
sprintf('Payment method %s should be %s', $element, $value)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I want to create a new payment method
|
||||
*/
|
||||
public function iWantToCreateANewPaymentMethod()
|
||||
{
|
||||
$this->createPage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I specify its code as :code
|
||||
* @When I do not specify its code
|
||||
*/
|
||||
public function iSpecifyItsCodeAs($code = null)
|
||||
{
|
||||
$this->createPage->specifyCode($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I describe it as :description in :language
|
||||
*/
|
||||
public function iDescribeItAsIn($description, $language)
|
||||
{
|
||||
$this->createPage->describeIt($description, $language);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I add it
|
||||
* @When I try to add it
|
||||
*/
|
||||
public function iAddIt()
|
||||
{
|
||||
$this->createPage->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that it has been successfully created
|
||||
*/
|
||||
public function iShouldBeNotifiedItHasBeenSuccessfullyCreated()
|
||||
{
|
||||
$this->notificationChecker->checkCreationNotification(self::RESOURCE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the payment method :paymentMethodName should appear in the registry
|
||||
* @Then the payment method :paymentMethodName should be in the registry
|
||||
*/
|
||||
public function thePaymentMethodShouldAppearInTheRegistry($paymentMethodName)
|
||||
{
|
||||
$this->indexPage->open();
|
||||
|
||||
Assert::true(
|
||||
$this->indexPage->isResourceOnPage(['name' => $paymentMethodName]),
|
||||
sprintf('Payment method with name %s has not been found.', $paymentMethodName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I browse payment methods
|
||||
*/
|
||||
public function iBrowsePaymentMethods()
|
||||
{
|
||||
$this->indexPage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see :amount payment methods in the list
|
||||
*/
|
||||
public function iShouldSeePaymentMethodsInTheList($amount)
|
||||
{
|
||||
$foundRows = $this->indexPage->countItems();
|
||||
|
||||
Assert::eq(
|
||||
((int) $amount),
|
||||
$foundRows,
|
||||
'%2$s rows with payment methods should appear on page, %s rows has been found'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that :element is required
|
||||
*/
|
||||
public function iShouldBeNotifiedThatIsRequired($element)
|
||||
{
|
||||
$this->assertFieldValidationMessage($element, sprintf('Please enter payment method %s.', $element));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the payment method with :element :value should not be added
|
||||
*/
|
||||
public function thePaymentMethodWithElementValueShouldNotBeAdded($element, $value)
|
||||
{
|
||||
$this->iBrowsePaymentMethods();
|
||||
|
||||
Assert::false(
|
||||
$this->indexPage->isResourceOnPage([$element => $value]),
|
||||
sprintf('Payment method with %s %s was created, but it should not.', $element, $value)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this payment method) should still be named "([^"]+)"$/
|
||||
*/
|
||||
public function thisShippingMethodNameShouldBe(PaymentMethodInterface $paymentMethod, $paymentMethodName)
|
||||
{
|
||||
$this->iBrowsePaymentMethods();
|
||||
|
||||
Assert::true(
|
||||
$this->indexPage->isResourceOnPage([
|
||||
'code' => $paymentMethod->getCode(),
|
||||
'name' => $paymentMethodName,
|
||||
]),
|
||||
sprintf('Payment method name %s has not been assigned properly.', $paymentMethodName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $element
|
||||
* @param string $expectedMessage
|
||||
*/
|
||||
private function assertFieldValidationMessage($element, $expectedMessage)
|
||||
{
|
||||
$currentPage = $this->currentPageResolver->getCurrentPageWithForm($this->createPage, $this->updatePage);
|
||||
|
||||
Assert::true(
|
||||
$currentPage->checkValidationMessageFor($element, $expectedMessage),
|
||||
sprintf('Payment method %s should be required.', $element)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the code field should be disabled
|
||||
*/
|
||||
public function theCodeFieldShouldBeDisabled()
|
||||
{
|
||||
Assert::true(
|
||||
$this->updatePage->isCodeDisabled(),
|
||||
'Code field should be disabled'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then this payment method should be enabled
|
||||
*/
|
||||
public function thisPaymentMethodShouldBeEnabled()
|
||||
{
|
||||
Assert::true(
|
||||
$this->updatePage->isPaymentMethodEnabled(),
|
||||
'Payment method should be enabled'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then this payment method should be disabled
|
||||
*/
|
||||
public function thisPaymentMethodShouldBeDisabled()
|
||||
{
|
||||
Assert::false(
|
||||
$this->updatePage->isPaymentMethodEnabled(),
|
||||
'Payment method should be disabled'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that it has been successfully deleted
|
||||
*/
|
||||
public function iShouldBeNotifiedThatItHasBeenSuccessfullyDeleted()
|
||||
{
|
||||
$this->notificationChecker->checkDeletionNotification(self::RESOURCE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(this payment method) should no longer exist in the registry$/
|
||||
*/
|
||||
public function thisPaymentMethodShouldNoLongerExistInTheRegistry(PaymentMethodInterface $paymentMethod)
|
||||
{
|
||||
Assert::false(
|
||||
$this->indexPage->isResourceOnPage(['code' => $paymentMethod->getCode(), 'name' => $paymentMethod->getName()]),
|
||||
sprintf('Payment method %s should no longer exist in the registry', $paymentMethod->getName())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that payment method with this code already exists
|
||||
*/
|
||||
public function iShouldBeNotifiedThatPaymentMethodWithThisCodeAlreadyExists()
|
||||
{
|
||||
Assert::true(
|
||||
$this->createPage->checkValidationMessageFor('code', 'The payment method with given code already exists.'),
|
||||
'Unique code violation message should appear on page, but it does not.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then there should still be only one payment method with :element :code
|
||||
*/
|
||||
public function thereShouldStillBeOnlyOnePaymentMethodWith($element, $code)
|
||||
{
|
||||
$this->iBrowsePaymentMethods();
|
||||
|
||||
Assert::true(
|
||||
$this->indexPage->isResourceOnPage([$element => $code]),
|
||||
sprintf('Payment method with %s %s cannot be found.', $element, $code)
|
||||
);
|
||||
}
|
||||
}
|
||||
94
src/Sylius/Behat/Page/Admin/PaymentMethod/CreatePage.php
Normal file
94
src/Sylius/Behat/Page/Admin/PaymentMethod/CreatePage.php
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Behat\Page\Admin\PaymentMethod;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\SpecifiesItsCode;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
|
||||
|
||||
/**
|
||||
* @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
|
||||
*/
|
||||
class CreatePage extends BaseCreatePage implements CreatePageInterface
|
||||
{
|
||||
use ChecksCodeImmutability;
|
||||
use Toggles;
|
||||
use SpecifiesItsCode;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function nameIt($name, $languageCode)
|
||||
{
|
||||
$this->getDocument()->fillField(
|
||||
sprintf('sylius_payment_method_translations_%s_name', $languageCode), $name
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function chooseGateway($gateway)
|
||||
{
|
||||
$this->getElement('gateway')->selectOption($gateway);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function describeIt($description, $languageCode)
|
||||
{
|
||||
$this->getDocument()->fillField(
|
||||
sprintf('sylius_payment_method_translations_%s_description', $languageCode), $description
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isPaymentMethodEnabled()
|
||||
{
|
||||
return (bool) $this->getToggleableElement()->getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getCodeElement()
|
||||
{
|
||||
return $this->getElement('code');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getToggleableElement()
|
||||
{
|
||||
return $this->getElement('enabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getDefinedElements()
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
'code' => '#sylius_payment_method_code',
|
||||
'name' => '#sylius_payment_method_translations_en_US_name',
|
||||
'gateway' => '#sylius_payment_method_gateway',
|
||||
'enabled' => '#sylius_payment_method_enabled',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Behat\Page\Admin\PaymentMethod;
|
||||
|
||||
use Sylius\Behat\Page\Admin\Crud\CreatePageInterface as BaseCreatePageInterface;
|
||||
|
||||
/**
|
||||
* @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
|
||||
*/
|
||||
interface CreatePageInterface extends BaseCreatePageInterface
|
||||
{
|
||||
public function enable();
|
||||
public function disable();
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $languageCode
|
||||
*/
|
||||
public function nameIt($name, $languageCode);
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
*/
|
||||
public function specifyCode($code);
|
||||
|
||||
/**
|
||||
* @param string $gateway
|
||||
*/
|
||||
public function chooseGateway($gateway);
|
||||
|
||||
/**
|
||||
* @param string $description
|
||||
* @param string $languageCode
|
||||
*/
|
||||
public function describeIt($description, $languageCode);
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCodeDisabled();
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaymentMethodEnabled();
|
||||
}
|
||||
80
src/Sylius/Behat/Page/Admin/PaymentMethod/UpdatePage.php
Normal file
80
src/Sylius/Behat/Page/Admin/PaymentMethod/UpdatePage.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Behat\Page\Admin\PaymentMethod;
|
||||
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
|
||||
use Sylius\Behat\Behaviour\Toggles;
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
|
||||
|
||||
/**
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
*/
|
||||
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
||||
{
|
||||
use ChecksCodeImmutability;
|
||||
use Toggles;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function chooseGateway($gateway)
|
||||
{
|
||||
$this->getElement('gateway')->selectOption($gateway);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function nameIt($name, $languageCode)
|
||||
{
|
||||
$this->getDocument()->fillField(sprintf('sylius_payment_method_translations_%s_name', $languageCode), $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isPaymentMethodEnabled()
|
||||
{
|
||||
return (bool) $this->getToggleableElement()->getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getCodeElement()
|
||||
{
|
||||
return $this->getElement('code');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getToggleableElement()
|
||||
{
|
||||
return $this->getElement('enabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getDefinedElements()
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
'code' => '#sylius_payment_method_code',
|
||||
'name' => '#sylius_payment_method_translations_en_US_name',
|
||||
'gateway' => '#sylius_payment_method_gateway',
|
||||
'enabled' => '#sylius_payment_method_enabled',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Behat\Page\Admin\PaymentMethod;
|
||||
|
||||
use Sylius\Behat\Page\Admin\Crud\UpdatePageInterface as BaseUpdatePageInterface;
|
||||
|
||||
/**
|
||||
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
|
||||
*/
|
||||
interface UpdatePageInterface extends BaseUpdatePageInterface
|
||||
{
|
||||
public function enable();
|
||||
public function disable();
|
||||
|
||||
/**
|
||||
* @param string $gateway
|
||||
*/
|
||||
public function chooseGateway($gateway);
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCodeDisabled();
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaymentMethodEnabled();
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $languageCode
|
||||
*/
|
||||
public function nameIt($name, $languageCode);
|
||||
}
|
||||
|
|
@ -73,6 +73,12 @@ final class MainMenuBuilder extends AbstractAdminMenuBuilder
|
|||
->setLabelAttribute('icon', 'translate')
|
||||
;
|
||||
|
||||
$configurationSubMenu
|
||||
->addChild('payment_methods', ['route' => 'sylius_admin_payment_method_index'])
|
||||
->setLabel('sylius.menu.admin.main.configuration.payment_methods')
|
||||
->setLabelAttribute('icon', 'payment')
|
||||
;
|
||||
|
||||
$configurationSubMenu
|
||||
->addChild('shipping_methods', ['route' => 'sylius_admin_shipping_method_index'])
|
||||
->setLabel('sylius.menu.admin.main.configuration.shipping_methods')
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ imports:
|
|||
- { resource: "@SyliusAdminBundle/Resources/config/grids/country.yml" }
|
||||
- { resource: "@SyliusAdminBundle/Resources/config/grids/customer.yml" }
|
||||
- { resource: "@SyliusAdminBundle/Resources/config/grids/locale.yml" }
|
||||
- { resource: "@SyliusAdminBundle/Resources/config/grids/payment_method.yml" }
|
||||
- { resource: "@SyliusAdminBundle/Resources/config/grids/promotion.yml" }
|
||||
- { resource: "@SyliusAdminBundle/Resources/config/grids/shipping_method.yml" }
|
||||
- { resource: "@SyliusAdminBundle/Resources/config/grids/tax_category.yml" }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
sylius_grid:
|
||||
grids:
|
||||
sylius_admin_payment_method:
|
||||
driver:
|
||||
name: doctrine/orm
|
||||
options:
|
||||
class: %sylius.model.payment_method.class%
|
||||
fields:
|
||||
code:
|
||||
type: string
|
||||
label: sylius.ui.code
|
||||
name:
|
||||
type: string
|
||||
label: sylius.ui.name
|
||||
gateway:
|
||||
type: string
|
||||
label: sylius.ui.gateway
|
||||
enabled:
|
||||
type: twig
|
||||
label: sylius.ui.enabled
|
||||
options:
|
||||
template: SyliusAdminBundle:Grid/Field:enabled.html.twig
|
||||
actions:
|
||||
main:
|
||||
create:
|
||||
type: create
|
||||
item:
|
||||
update:
|
||||
type: update
|
||||
delete:
|
||||
type: delete
|
||||
|
|
@ -19,6 +19,9 @@ sylius_admin_customer:
|
|||
sylius_admin_locale:
|
||||
resource: "@SyliusAdminBundle/Resources/config/routing/locale.yml"
|
||||
|
||||
sylius_admin_payment_method:
|
||||
resource: "@SyliusAdminBundle/Resources/config/routing/payment_method.yml"
|
||||
|
||||
sylius_admin_promotion:
|
||||
resource: "@SyliusAdminBundle/Resources/config/routing/promotion.yml"
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
sylius_admin_payment_method:
|
||||
resource: |
|
||||
alias: sylius.payment_method
|
||||
section: admin
|
||||
templates: SyliusAdminBundle:Crud
|
||||
except: ['show']
|
||||
redirect: update
|
||||
grid: sylius_admin_payment_method
|
||||
vars:
|
||||
all:
|
||||
subheader: sylius.ui.manage_payment_method
|
||||
templates:
|
||||
form: SyliusAdminBundle:PaymentMethod:_form.html.twig
|
||||
index:
|
||||
icon: payment
|
||||
type: sylius.resource
|
||||
|
|
@ -6,6 +6,7 @@ sylius:
|
|||
countries: Countries
|
||||
header: Configuration
|
||||
locales: Locales
|
||||
payment_methods: Payment methods
|
||||
shipping_methods: Shipping methods
|
||||
tax_categories: Tax categories
|
||||
tax_rates: Tax rates
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<div class="ui one column stackable grid">
|
||||
<div class="column">
|
||||
<div class="ui segment">
|
||||
{{ form_errors(form) }}
|
||||
<div class="two fields">
|
||||
{{ form_row(form.code) }}
|
||||
{{ form_row(form.gateway) }}
|
||||
</div>
|
||||
{{ form_row(form.enabled) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="ui segment">
|
||||
{% for locale, translationForm in form.translations %}
|
||||
<h4 class="ui dividing header"><i class="{{ locale|slice(3, 2)|lower }} flag"></i> {{ locale|sylius_locale_name }}</h4>
|
||||
<div class="two fields">
|
||||
{{ form_row(translationForm.name) }}
|
||||
{{ form_row(translationForm.description) }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{{ form_rest(form) }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -198,6 +198,7 @@ sylius_payment:
|
|||
choice: Sylius\Bundle\CoreBundle\Form\Type\Payment\PaymentMethodChoiceType
|
||||
gateways:
|
||||
offline: Offline
|
||||
paypal_express_checkout: Paypal Express Checkout
|
||||
|
||||
sylius_payum: ~
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ sylius:
|
|||
edit: Edit
|
||||
edit_country: Edit country
|
||||
edit_customer: Edit customer
|
||||
edit_payment_method: Edit payment method
|
||||
edit_promotion: Edit promotion
|
||||
edit_tax_category: Edit tax category
|
||||
edit_tax_rate: Edit tax rate
|
||||
|
|
@ -36,11 +37,13 @@ sylius:
|
|||
info: Info
|
||||
last_updated: Last updated
|
||||
locales: Locales
|
||||
manage_country: Manage country
|
||||
manage_customer: Manage customers
|
||||
manage_shipping_destinations: Manage shipping destinations
|
||||
manage_languages_available_in_the_store: Manage languages available in the store
|
||||
manage_taxation_of_your_products: Manage taxation of your products
|
||||
manage_payment_method: Manage payment methods
|
||||
manage_shipping_destinations: Manage shipping destinations
|
||||
manage_shipping_methods_for_your_store: Manage shipping methods for your store
|
||||
manage_taxation_of_your_products: Manage taxation of your products
|
||||
new: New
|
||||
new_country: New country
|
||||
new_locale: New locale
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue