Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 4 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ return [
### Step 3: Configure plugin

```yaml
# config/packages/_sylius.yaml
# config/packages/setono_sylius_partner_ads.yaml
imports:
# ...
- { resource: "@SetonoSyliusPartnerAdsPlugin/Resources/config/app/config.yaml" }
# ...
```

### Step 4: Import routing
Expand All @@ -48,67 +46,20 @@ setono_partner_ads_plugin:
resource: "@SetonoSyliusPartnerAdsPlugin/Resources/config/routing.yaml"
```

### Step 5: HTTP client
If you already use a PSR18 HTTP client you need to inject that service:
```yaml
setono_sylius_partner_ads:
http_client: '@http_client_service_id'
```

If not, you can just do composer the Buzz library and it will automatically register the Buzz client as the HTTP client:

```bash
$ composer require kriswallsmith/buzz
```

### Step 6: Update your database schema
### Step 5: Update your database schema

```bash
$ php bin/console doctrine:migrations:diff
$ php bin/console doctrine:migrations:migrate
```

### Step 7: Setup program
### Step 6: Setup program

Login to your Sylius app admin and go to the Partner Ads page and click "Create" to create a new program. Fill in the program id of your Partner Ads program, make sure "enable" is toggled on, and choose which channel the program should be applied to. Please notice you should only make one program for each channel, or else you will end up with undefined behaviour.

### Step 8 (optional, but recommended): Configure Async HTTP requests
This plugin will make a HTTP request to Partner Ads when a customer completes an order. This will make the 'Thank you' page load slower. To circumvent that you can use RabbitMQ with Symfony Messenger to send this HTTP request asynchronously.

Follow the installation instructions here: [How to Use the Messenger](https://symfony.com/doc/current/messenger.html) and then [configure a transport](https://symfony.com/doc/current/messenger.html#transports).

Basically you should do:
```bash
$ composer req messenger symfony/serializer-pack
```

Then configure the Messenger component:
```yaml
# config/packages/messenger.yaml
framework:
messenger:
transports:
amqp: "%env(MESSENGER_TRANSPORT_DSN)%"
```

```yaml
# .env
###> symfony/messenger ###
MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
###< symfony/messenger ###
```

And finally configure the plugin to use your transport:

```yaml
setono_sylius_partner_ads:
messenger:
transport: amqp
```
### Step 7 (optional, but recommended): Configure Async HTTP requests

After this the Messenger will be automatically enabled in this plugin and subsequently it will send an asynchronous request to Partner Ads instead of a synchronous.

For testing purposes you can sign up for a free RabbitMQ cloud service here: [CloudAMQP](https://www.cloudamqp.com/plans.html).

[ico-version]: https://poser.pugx.org/setono/sylius-partner-ads-plugin/v/stable
[ico-license]: https://poser.pugx.org/setono/sylius-partner-ads-plugin/license
Expand Down
27 changes: 15 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"setono/doctrine-object-manager-trait": "^1.1",
"setono/symfony-main-request-trait": "^1.0",
"sylius/resource-bundle": "^1.6",
"symfony/config": "^4.4 || ^5.4",
"symfony/dependency-injection": "^4.4 || ^5.4",
"symfony/event-dispatcher": "^4.4 || ^5.4",
"symfony/form": "^4.4 || ^5.4",
"symfony/http-foundation": "^4.4 || ^5.4",
"symfony/http-kernel": "^4.4 || ^5.4",
"symfony/messenger": "^4.4 || ^5.4",
"symfony/config": "^4.4 || ^5.4 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0",
"symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0",
"symfony/form": "^4.4 || ^5.4 || ^6.0",
"symfony/http-client": "^4.4 || ^5.4 || ^6.0",
"symfony/http-client-contracts": "^1.1 || ^2.5 || ^3.1",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.0",
"symfony/messenger": "^4.4 || ^5.4 || ^6.0",
"symfony/workflow": "^4.4 || ^5.4 || ^6.0",
"webmozart/assert": "^1.11"
},
"require-dev": {
"api-platform/core": "^2.7",
"friendsofsymfony/oauth-server-bundle": ">2.0.0-alpha.0 ^2.0@dev",
"kriswallsmith/buzz": "^1.2",
"lexik/jwt-authentication-bundle": "^2.16",
"matthiasnoback/symfony-config-test": "^4.3",
"matthiasnoback/symfony-dependency-injection-test": "^4.3",
Expand All @@ -41,11 +44,11 @@
"setono/code-quality-pack": "^2.2",
"sylius/admin-api-bundle": "^1.11",
"sylius/sylius": "~1.10.14",
"symfony/debug-bundle": "^4.4 || ^5.4",
"symfony/dotenv": "^4.4 || ^5.4",
"symfony/intl": "^4.4 || ^5.4",
"symfony/debug-bundle": "^4.4 || ^5.4 || ^6.0",
"symfony/dotenv": "^4.4 || ^5.4 || ^6.0",
"symfony/intl": "^4.4 || ^5.4 || ^6.0",
"symfony/serializer-pack": "^1.0",
"symfony/web-profiler-bundle": "^4.4 || ^5.4",
"symfony/web-profiler-bundle": "^4.4 || ^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.15"
},
"prefer-stable": true,
Expand Down
2 changes: 1 addition & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');
$containerConfigurator->parameters()->set(Option::PATHS, [
'src', 'tests', 'spec'
'src', 'tests'
]);
$containerConfigurator->parameters()->set(Option::SKIP, [
'tests/Application/node_modules/**',
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
</plugins>
<issueHandlers>
<PluginIssue name="QueryBuilderSetParameter" errorLevel="suppress"/>
<UnnecessaryVarAnnotation errorLevel="suppress"/>
</issueHandlers>
</psalm>
45 changes: 0 additions & 45 deletions spec/Calculator/OrderTotalCalculatorSpec.php

This file was deleted.

51 changes: 0 additions & 51 deletions spec/Client/ClientSpec.php

This file was deleted.

Loading