Skip to content

Commit e115f01

Browse files
committed
Add documentation
1 parent c1ceb35 commit e115f01

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

doc/adjustments.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Adjustments
2+
### 1. Payloads for Customer, Product or Order
3+
To modify data sent for occurences related to one of resources, you can adjust classes responsible for payload building.
4+
These classes are located under `src/Builder/Payload` directory and have meaningful names corresponding to data that will be provided, e.g. `CustomerPayloadBuilder`or `OrderPayloadBuilder`.
5+
6+
### 2. Requests from User.com on designated endpoint.
7+
Requests send on endpoint designed by User.com are handled by `\BitBag\SyliusUserComPlugin\Controller\UserComAgreementsController`.
8+
You can adjust this controller to handle requests in a way that suits your needs.
9+
There is designated validator to check if request payload contains required fields.
10+
If there will be any field added by User.com, you can adjust this validator to check if this field is present in request payload.
11+
Also, in `BitBag\SyliusUserComPlugin\Assigner\AgreementsAssigner` you can adjust existing logic to assign agreements to customer in a way that suits your needs.
12+
13+
```php
14+
public function assign(CustomerInterface $customer, array $agreements): void
15+
{
16+
foreach ($agreements as $key => $value) {
17+
match ($key) {
18+
'email_agreement' => $customer->setSubscribedToNewsletter($value),
19+
default => $this->logger->error(
20+
sprintf(
21+
'Agreement not found. Key = %s, Value = %s, CustomerId = %s',
22+
$key,
23+
$value,
24+
$customer->getId(),
25+
),
26+
),
27+
};
28+
}
29+
}
30+
}
31+
```

doc/installation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
> "type": "vcs",
1111
> "url": "https://github.com/BitBagCommerce/SyliusUserComPlugin.git"
1212
> },
13-
> { }
14-
>
1513
> ],
1614
> ```
1715
2. Add required environment variables to your `.env` file:

0 commit comments

Comments
 (0)