What are the Slack Archives?

Itโ€™s a history of our time together in the Slack Community! Thereโ€™s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you wonโ€™t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

And besides this, we wanted to know how to call a business model from Facade (for Zed), is there any

U01HX2U4NLQ
U01HX2U4NLQ Posts: 67 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet
edited February 2021 in Help

And besides this, we wanted to know how to call a business model from Facade (for Zed), is there any resource where I can refer to?

Comments

  • that does not sound right. ๐Ÿค”

  • can you elaborate on what you intend to do?

  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ Lรถffelhardt Spryker Solution Partner Posts: 871 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    I think that something architectural is not correct..

  • U01HX2U4NLQ
    U01HX2U4NLQ Posts: 67 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet
    edited February 2021

    @UJN2JRU4F @UL65CH0MC thank you for the comments.

    I have intended to inject the custom transaction comments in the order history page like in payment section for both Zed & Yves.

    Zed:
    /vendor/spryker/payment/src/Spryker/Zed/Payment/Communication/Controller/SalesController.php

    $testPaymentClient = new TestPaymentClient();
    $orderTransfer = $testPaymentClient->getTransactionDetails($orderTransfer);

    Yves:
    /vendor/spryker-shopcustomer-page/src/SprykerShop/Yves/CustomerPage/Controller/OrderController.php

    For that, I have injected the custom comments object in $orderTransfer and used the same in twig files. It's working fine, but maybe it's not right to create objects directly in the mentioned classes?

    Target: I want to display the custom comments for the transaction in the order history of backend and frontend.

    So, could you please share your feedback to handle this scenario in the right way?

  • U01HX2U4NLQ
    U01HX2U4NLQ Posts: 67 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @UJN2JRU4F @UL65CH0MC May I politely ask for the feedback on this topic?

  • i will try to mentally entagle after my next meeting in about 1h ๐Ÿ‘

  • Sorry, took a bit longer. I think I got it. And the approach does not sound wrong. However, you add the comments to the order when you read it from Zed. I need to have a look how the order hydration works exactly, but I'm fairly certain that there is a plug-in stack for that

  • did you find what i am talking about, @U01HX2U4NLQ?

  • U01HX2U4NLQ
    U01HX2U4NLQ Posts: 67 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @UJN2JRU4F

    Thank you for the valuable details. In the meanwhile, we started to work on the development to achieve the mentioned requirement. We managed to pull off a solution based on the below-mentioned code, please let me know if this is fine too.

    /**
    * @method \Spryker\Zed\Payment\Persistence\PaymentQueryContainerInterface getQueryContainer()
    * @method \Spryker\Zed\Payment\Business\PaymentFacadeInterface getFacade()
    * @method \Spryker\Zed\Payment\Persistence\PaymentRepositoryInterface getRepository()
    . . .
    * @method \Spryker\Zed\Payment\Communication\PaymentCommunicationFactory getFactory()
    . . .
    */

    public function listAction(Request $request)
    {
    /** @var \Generated\Shared\Transfer\OrderTransfer $orderTransfer */
    $orderTransfer = $request->request->get('orderTransfer');
    . . .
    // Set test payment transaction details in orderTransfer
    $orderTransfer = $this->getFactory()
    ->getTestPaymentFacade()
    ->getTransactionDetails($orderTransfer);
    . . .
    return [
    'payments' => $orderTransfer->getPayments(),
    'order' => $orderTransfer,
    ];
    }

  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ Lรถffelhardt Spryker Solution Partner Posts: 871 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @U01HX2U4NLQ About me so is not correct...
    U have to write a hydrator plugin in your TestPayment Bundle... this hydrator plugin hydrate the transaction details in order transfer.. this plugin should be registered in SalesDependencyProvider.. \Pyz\Zed\Sales\SalesDependencyProvider::getOrderHydrationPlugins

    then u have overall u get an orderTransfer always the transaction details filled, if the order of course has this payment as payment type related..

  • โ˜๐Ÿ˜‰

  • What he said

  • Do you want us to elaborate?

  • U01HX2U4NLQ
    U01HX2U4NLQ Posts: 67 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @UJN2JRU4F @UL65CH0MC Thank you both for the details, it is clear now and I'm checking the module for the update related to this.