Skip to content

Commit

Permalink
Merge pull request #44 from shopware/next-37028/iaf-filter-gateway
Browse files Browse the repository at this point in the history
NEXT-37028 - IAP filter gateway
  • Loading branch information
lernhart authored Dec 17, 2024
2 parents 25ac90b + 6071078 commit 45f54f8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"php": ">=8.1",
"symfony/psr-http-message-bridge": "2.* || ^7.0",
"symfony/routing": "^6.4 || ^7.0",
"shopware/app-php-sdk": ">=3.1.4",
"shopware/app-php-sdk": ">=4.0.1",
"symfony/http-client": "^6.4 || ^7.0",
"nyholm/psr7": "^1.8"
},
Expand Down
4 changes: 4 additions & 0 deletions src/ArgumentValueResolver/ContextArgumentResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Shopware\App\SDK\Context\ActionButton\ActionButtonAction;
use Shopware\App\SDK\Context\ContextResolver;
use Shopware\App\SDK\Context\Gateway\Checkout\CheckoutGatewayAction;
use Shopware\App\SDK\Context\Gateway\InAppFeatures\FilterAction;
use Shopware\App\SDK\Context\Module\ModuleAction;
use Shopware\App\SDK\Context\Payment\PaymentCaptureAction;
use Shopware\App\SDK\Context\Payment\PaymentFinalizeAction;
Expand Down Expand Up @@ -41,6 +42,7 @@ final class ContextArgumentResolver implements ValueResolverInterface
RefundAction::class => true,
StorefrontAction::class => true,
CheckoutGatewayAction::class => true,
FilterAction::class => true,
];

private const SIGNING_REQUIRED_TYPES = [
Expand Down Expand Up @@ -68,6 +70,7 @@ public function supports(Request $request, ArgumentMetadata $argument): bool

/**
* @return iterable<object>
* @throws \JsonException|\RuntimeException
*/
public function resolve(Request $request, ArgumentMetadata $argument): iterable
{
Expand Down Expand Up @@ -118,6 +121,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable
RefundAction::class => yield $this->contextResolver->assemblePaymentRefund($psrRequest, $shop),
StorefrontAction::class => yield $this->contextResolver->assembleStorefrontRequest($psrRequest, $shop),
CheckoutGatewayAction::class => yield $this->contextResolver->assembleCheckoutGatewayRequest($psrRequest, $shop),
FilterAction::class => yield $this->contextResolver->assembleInAppPurchasesFilterRequest($psrRequest, $shop),
default => throw new \RuntimeException(sprintf('Unsupported type %s', $type)),
};
}
Expand Down
20 changes: 19 additions & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,25 @@

<service id="Shopware\App\SDK\Authentication\RequestVerifier"/>
<service id="Shopware\App\SDK\Authentication\ResponseSigner"/>
<service id="Shopware\App\SDK\Context\ContextResolver"/>

<service id="Symfony\Component\Cache\Psr16Cache">
<argument type="service" id="cache.app"/>
</service>

<service id="Shopware\App\SDK\Context\InAppPurchase\SBPStoreKeyFetcher">
<argument type="service" id="Psr\Http\Client\ClientInterface"/>
<argument type="service" id="Symfony\Component\Cache\Psr16Cache"/>
<argument type="service" id="Psr\Log\LoggerInterface"/>
</service>

<service id="Shopware\App\SDK\Context\InAppPurchase\InAppPurchaseProvider">
<argument type="service" id="Shopware\App\SDK\Context\InAppPurchase\SBPStoreKeyFetcher"/>
<argument type="service" id="Psr\Log\LoggerInterface"/>
</service>

<service id="Shopware\App\SDK\Context\ContextResolver">
<argument type="service" id="Shopware\App\SDK\Context\InAppPurchase\InAppPurchaseProvider"/>
</service>

<service id="Shopware\App\SDK\Shop\ShopResolver">
<argument type="service" id="Shopware\App\SDK\Shop\ShopRepositoryInterface"/>
Expand Down
2 changes: 2 additions & 0 deletions tests/ArgumentValueResolver/ContextArgumentResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Shopware\App\SDK\Context\ActionButton\ActionButtonAction;
use Shopware\App\SDK\Context\ContextResolver;
use Shopware\App\SDK\Context\Gateway\Checkout\CheckoutGatewayAction;
use Shopware\App\SDK\Context\Gateway\InAppFeatures\FilterAction;
use Shopware\App\SDK\Context\Module\ModuleAction;
use Shopware\App\SDK\Context\Payment\PaymentCaptureAction;
use Shopware\App\SDK\Context\Payment\PaymentFinalizeAction;
Expand Down Expand Up @@ -238,6 +239,7 @@ public static function provideActions(): \Generator
yield [RefundAction::class];
yield [StorefrontAction::class];
yield [CheckoutGatewayAction::class];
yield [FilterAction::class];
}

#[DataProvider('provideActions')]
Expand Down

0 comments on commit 45f54f8

Please sign in to comment.