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..

Hello, I am working on multi payment. I’ve found some parts of Spryker’s code supporting it, but I h

USZB5JN4W
USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

Hello,
I am working on multi payment. I’ve found some parts of Spryker’s code supporting it, but I have a problem with the OMS. User can select 2 payment methods which require user’s interaction (for example paypal), so I need some kind of generic, parallelized OMS containing all payment methods, . By testing i found, that parallelized OMS throws error during creation of the event timeout in the DB. Do you know if there is any built-in solution for multiple payments in one order? Or do you have tips how to modify OMS to support it?

Comments

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    edited August 2021

    AFAIK Spryker has multi shipment, but not multi payment. At least not yet.

  • vasily.rodin
    vasily.rodin Spryker Solution Partner Posts: 25 ✨ - Novice

    Why do you need parallelized OMS? I think that it should be linear anyway, even if you need to process multiple payments. For example you pay half with Paypal and half with Credit card, then you try to authorize Paypal first, if it failed, then you don’t need to continue with Credit card at all. Or if Credit card was not able to capture the money, you need to refund Paypal, which was charged before. So it’s good to have it linear to handle such corner cases.

  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

    some of the payment methods have to be accepted manually on the payment provider side, so it can take even few days (strange case, but shop sells not standard items). We need multi payment not for 1 product, but more like multi shipment - different payments for the different payment types and the best will be if user can see in the order details page, that for example item1 is already paid using paypal and item2 is still waiting for the acceptance from the payment provider

  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

    and we can’t say, that it will be always paypal + manually accepted payment. It can be even 2 times “manually accepted payment” + 3 paypals

  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

    hmm or is there possibility to run sub state machine in the oms? Because if I’ll have 2 or more prodcuts with the same payment method, i will have to start multiple state machines for the same payment with different products

  • vasily.rodin
    vasily.rodin Spryker Solution Partner Posts: 25 ✨ - Novice

    OMS is already running per item.

    for example item1 is already paid using paypal and item2 is still waiting for the acceptance from the payment provider

    This should be possible OOTB.

    If we can assign different state machines to different items - good question, should be theoretically possible.. But even with one state machine should be possible to skip entire parts of the process using conditions

  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

    is it here something like condition per item?

  • vasily.rodin
    vasily.rodin Spryker Solution Partner Posts: 25 ✨ - Novice

    every condition runs on item level:

    interface ConditionInterface
    {
        /**
         * Run the check for an item and return boolean result.
         *
         * @api
         *
         * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem $orderItem
         *
         * @return bool
         */
        public function check(SpySalesOrderItem $orderItem);
    }
    
  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

    ah ok

  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

    i’ll analyse it more.. thx for the help 🙂

  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet
    edited August 2021

    hmm something wrong is with me or oms don’t supoprt even multiple conditions 😄. I try to add conditions on transition, eg

      <transition happy="true" condition="Oms/IsPayment1">
                    <source>payments prepared</source>
                    <target>payment1 started</target>
                    <event>payment1 start</event>
                </transition>
    
      <transition happy="true" condition="Oms/IsPayment2">
                    <source>payments prepared</source>
                    <target>payment2 started</target>
                    <event>payment2 start</event>
                </transition>
    
  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

    but it trows

    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6-4' for key 'spy_oms_event_timeout-unique-fk_sales_order_item'
    
  • vasily.rodin
    vasily.rodin Spryker Solution Partner Posts: 25 ✨ - Novice

    Not sure about multiple conditions as well. But at least if / else should be possible

  • U013M1LC46A
    U013M1LC46A Posts: 23 🧑🏻‍🚀 - Cadet

    @USZB5JN4W try removing the events from those 2 transitions

  • USZB5JN4W
    USZB5JN4W Posts: 112 🧑🏻‍🚀 - Cadet

    Thanks Namik, it helped ^^