Skip to content

Commit

Permalink
AD-72/api platform (#69)
Browse files Browse the repository at this point in the history
* Added api platform

* Remove collectionOperation responses

* Moved api platform to a different resource, added response examples

* ecs fix
  • Loading branch information
pbalcerzak authored Sep 6, 2022
1 parent 8e36bb4 commit ceb2912
Show file tree
Hide file tree
Showing 5 changed files with 270 additions and 38 deletions.
237 changes: 237 additions & 0 deletions src/Resources/config/api_resources/Adyen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
<?xml version="1.0" ?>

<!--
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.
-->

<resources xmlns="https://api-platform.com/schema/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%bitbag_sylius_adyen_plugin.model.adyen_token.class%" shortName="Adyen">
<attribute name="validation_groups">sylius</attribute>

<collectionOperations>
<collectionOperation name="shop_get_dropin_configuration">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/payment/adyen/{code}/{orderToken}</attribute>
<attribute name="controller">bitbag.sylius_adyen_plugin.controller.shop.dropin_configuration_action</attribute>
<attribute name="pagination_enabled">false</attribute>
<attribute name="openapi_context">
<attribute name="summary">Fetches dropin configuration</attribute>
<attribute name="responses">
<attribute name="200">
<attribute name="description">Adyen dropin configuration</attribute>
<attribute name="content">
<attribute name="application/json">
<attribute name="schema">
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="billingAddress">
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="firstName">
<attribute name="type">string</attribute>
</attribute>
<attribute name="lastName">
<attribute name="type">string</attribute>
</attribute>
<attribute name="countryCode">
<attribute name="type">string</attribute>
</attribute>
<attribute name="province">
<attribute name="type">string</attribute>
</attribute>
<attribute name="city">
<attribute name="type">string</attribute>
</attribute>
<attribute name="postcode">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
<attribute name="paymentMethods">
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="paymentMethods">
<attribute name="type">array</attribute>
<attribute name="items">
<attribute name="oneOf">
<attribute>
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="issuers">
<attribute name="type">array</attribute>
<attribute name="items">
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="disabled">
<attribute name="type">boolean</attribute>
</attribute>
<attribute name="id">
<attribute name="type">string</attribute>
</attribute>
<attribute name="name">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
<attribute name="name">
<attribute name="type">string</attribute>
</attribute>
<attribute name="type">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
<attribute>
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="brands">
<attribute name="type">array</attribute>
<attribute name="items">
<attribute name="type">string</attribute>
</attribute>
</attribute>
<attribute name="configuration">
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="merchantId">
<attribute name="type">string</attribute>
</attribute>
<attribute name="gatewayMerchantId">
<attribute name="type">string</attribute>
</attribute>
<attribute name="merchantName">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
<attribute name="name">
<attribute name="type">string</attribute>
</attribute>
<attribute name="type">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
<attribute name="clientKey">
<attribute name="type">string</attribute>
</attribute>
<attribute name="locale">
<attribute name="type">string</attribute>
</attribute>
<attribute name="environment">
<attribute name="type">string</attribute>
</attribute>
<attribute name="canBeStored">
<attribute name="type">boolean</attribute>
</attribute>
<attribute name="amount">
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="currency">
<attribute name="type">string</attribute>
</attribute>
<attribute name="value">
<attribute name="type">integer</attribute>
</attribute>
</attribute>
</attribute>
<attribute name="path">
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="payments">
<attribute name="type">string</attribute>
</attribute>
<attribute name="paymentDetails">
<attribute name="type">string</attribute>
</attribute>
<attribute name="deleteToken">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
<attribute name="translations">
<attribute name="type">object</attribute>
<attribute name="properties">
<attribute name="bitbag_sylius_adyen_plugin.runtime.payment_failed_try_again">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
<attribute name="parameters">
<attribute>
<attribute name="name">code</attribute>
<attribute name="in">path</attribute>
<attribute name="required">true</attribute>
<attribute name="schema">
<attribute name="type">string</attribute>
</attribute>
</attribute>
<attribute>
<attribute name="name">orderToken</attribute>
<attribute name="in">path</attribute>
<attribute name="required">true</attribute>
<attribute name="schema">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</collectionOperation>

<collectionOperation name="shop_get_custom_thank_you_page">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/payment/adyen/{code}/thanks</attribute>
<attribute name="controller">bitbag.sylius_adyen_plugin.controller.shop.redirect_target_action</attribute>
<attribute name="pagination_enabled">false</attribute>
<attribute name="openapi_context">
<attribute name="summary">Custom thank-you page, that needs to be intercepted.</attribute>
<attribute name="responses">
<attribute name="200">
<attribute name="description">HTML response</attribute>
<attribute name="content">
<attribute name="text/html">
<attribute name="schema">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
<attribute name="parameters">
<attribute>
<attribute name="name">code</attribute>
<attribute name="in">path</attribute>
<attribute name="required">true</attribute>
<attribute name="schema">
<attribute name="type">string</attribute>
</attribute>
</attribute>
</attribute>
</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations />
</resource>
</resources>
2 changes: 1 addition & 1 deletion tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['all' => true],
Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true],
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
BitBag\SyliusAdyenPlugin\BitBagSyliusAdyenPlugin::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true],
Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true],
BitBag\SyliusAdyenPlugin\BitBagSyliusAdyenPlugin::class => ['all' => true],
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
Sylius\RefundPlugin\SyliusRefundPlugin::class => ['all' => true],
Expand Down
Loading

0 comments on commit ceb2912

Please sign in to comment.