OCI Response Generator
The OciConnectorResponseGenerator produces an OciFormData structure from the cart. This is rendered as an HTML form in the storefront template and submitted to the procurement system's hook URL on transfer.
buildForm()
public function buildForm(
Cart $cart,
OciSystemEntity $system,
ConnectorSession $session,
SalesChannelContext $context
): OciFormData
Process:
- For each cart line item → find the matching
LineItemContextResolver - For each OCI field with target
LINE_ITEM: resolve value via fallback chain + apply filters - Optionally: append a shipping line item (when
attachShippingis enabled and deliveries exist) - Fire
OciResponseGenerationEvent→OciFormDatacan be modified before return
OciFormData structure
OciFormData
├── hookUrl (string) – return URL of the procurement system
└── lineItems[] (list)
└── OciLineItemData
└── fields[]
└── OciFieldData
├── name (string) – e.g. "NEW_ITEM-DESCRIPTION[1]"
├── value (string) – resolved value
└── type (OciFieldType: standard|long)
Field name convention
OCI field names follow this pattern:
Standard fields:
NEW_ITEM-{FIELDNAME_UPPERCASE}[{INDEX}]
Long-text fields (OciFieldType::LONG):
NEW_ITEM-{FIELDNAME_UPPERCASE}[{INDEX}]:132[]
The :132[] suffix is the OCI 5.0 long text marker for fields that exceed the standard character limit.
Examples:
NEW_ITEM-DESCRIPTION[1](standard)NEW_ITEM-MATNR[1](standard)NEW_ITEM-LONGTEXT[1]:132[](long text)
The index ([1], [2], …) corresponds to the position of the line item in the cart.
Field targets
Each OCI field has a configured target:
| Target | Enum | Description |
|---|---|---|
line_item | OciFieldTarget::LINE_ITEM | Field belongs to a cart line item |
shipping_item | OciFieldTarget::SHIPPING_ITEM | Field for the shipping position (only when attachShipping is enabled) |
The shipping position is appended as a standalone OCI item at the end of the line items.
Value filters
After fallback resolution, optional filters can be applied to the value:
| Filter | Config keys | Description |
|---|---|---|
| Substring | substr.start, substr.end | Trims the string to the defined range |
| Number format | number_format, decimals | Formats the value as a decimal number with the defined decimal places (dot as separator, no thousands separator) |
| Divide | divine.value | Divides the numeric value by the given divisor |
OciResponseGenerationEvent
Just before returning the OciFormData, the generator fires:
| Event | Event name | What can be changed? |
|---|---|---|
OciResponseGenerationEvent | agiqon_connector.oci.response.generation | Complete OciFormData (add, modify, or remove line items) |
Example:
use AgiqonConnector\Connector\System\OCI\Event\OciResponseGenerationEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
#[AsEventListener(event: OciResponseGenerationEvent::EVENT_NAME)]
final class MyOciResponseListener
{
public function __invoke(OciResponseGenerationEvent $event): void
{
$formData = $event->getFormData();
// Custom logic: e.g. modify line items
// $event->setFormData($modifiedFormData);
}
}