Callbacky
Post Shopping Cart Checkout Callback
Zde je příklad vytvoření callbacku pro platební bránu pro vytvoření platby. Je třeba splnit podmínky.
$callbackId = $retailysService->postShoppingCartCheckoutCallback($token, [
'position' => 'payment',
'path' => 'create-payment',
'method' => 'POST',
'redirect' => true,
'parameters' => [
[
'name' => 'orderId',
'variable' => '%orderId%',
],
[
'name' => 'channelId',
'variable' => '%channelId%',
],
],
'condition' => '%channelId% == '.$existingChannel->getChannelId().' and %paymentProvider% == 9',
]);
Vykreslení šablony
Zde je příklad, jak vykreslit šablonu, do které jsou vloženy proměnné. Je zde vrácena v JSON.
$snippet = $this->renderView('config/save.html.twig', [
'config' => $config,
'channelsData' => $channelsData,
'configChannels' => $configChannels,
]);
return $this->json(
[
'snippet' => $snippet,
]
);
Snippety
Static Snippet
Post Layout
Vytvořit statický snippet v layoutu eshopu
$snippetId = $retailysService->postLayoutStaticSnippet($token, [
'position' => 'footer',
'raw' => $this->renderView('snippet/variable.html.twig', [
'variable' => $channel->getVariable(),
]),
'condition' => '%channelId% == '.$channel->getChannelId(),
]);
Put Layout
Aktualizovat statický snippet v layoutu eshopu
$snippetResult = $retailysService->putLayoutStaticSnippet($token, [
'id' => $channel->getSnippetId(),
'position' => 'footer',
'raw' => $this->renderView('snippet/variable.html.twig', [
'variable' => $channel->getVariable(),
]),
'condition' => '%channelId% == '.$channel->getChannelId(),
]);
Dynamic Snippet
PostDynamicSnippet
Na děkovnou stránku v košíku eshopu.
$dynamicSnippetId = $retailysService->postShippingCartThankYouDynamicSnippet($token, [
'position' => 'footer',
'type' => 'twig',
'template' => $this->renderView('snippet/example.html.twig', [
'variable' => $channel->getVariable(),
]),
'condition' => '%channelId% == '.$channel->getChannelId(),
]);