Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Francis Benyah 35 posts 111 karma points
    Jun 15, 2020 @ 13:39
    Francis Benyah
    0

    Pre-Processing of order without calling PaymentForm

    Hey Matt

    Quick one, if for some or other reason (third party providing payment gateway integration) we can't call this form

    @using(Html.BeginPaymentForm(currentOrder)) {
        <button type="submit">Continue to Payment</button>
    }
    

    because we need to call a surface controller to do some stuff first then send off to third party.

    How can we get the necessary things tied up in the surface controller that would have been taken care of by this call.

    enter image description here

    We not able to get order numbers and I am sure it is as a direct result of this.

    Thanks

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jun 15, 2020 @ 13:58
    Matt Brailsford
    1

    Hi Francis,

    I think there are two possibilities here, one is where you need to do something before a payment provider does it's normal thing, in which scenario the payment provider still want to render a payment form.

    In this scenario, I think you might need to introduce a middle page such that on the final checkout screen you post back to your controller to do it's thing, then this renders a view that renders the Payment Form, but instead of rendering a button, you render some JS to auto submit the form (I have an example of this if you need it as this is essentially what we do on the Vendr.net site)

    The second is where you are integrating your own provider that isn't fitting into the payment provider interface and so you are wanting to bypass the rendering of the payment form entirely and redirect straight from your controller.

    In this case, we don't have the right method exposed yet, but there is a workaround. Essentially an order needs it's transaction initializing before being redirected to the gateway. This is normally done by the Payment Form renderer and as such is currently internal. We do have an open issue to expose this method for such occasions but we haven't managed to resolve it just yet. That said, there is a work around on the issue for calling the method via reflection https://github.com/vendrhub/vendr/issues/102

    It's not ideal, but it might at least get you working and we'd love the feedback to see if this does the trick.

    I hope this helps

    Matt

  • Francis Benyah 35 posts 111 karma points
    Jun 15, 2020 @ 14:34
    Francis Benyah
    0

    Thanks Matt

    Mostly dealing with scenario 2, but I applied the javascript option from scenario 1 and that works perfectly with a trigger to the hidden submit button.

    enter image description here

    Much appreciated.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jun 15, 2020 @ 14:43
    Matt Brailsford
    1

    Awesome!

    In case it helps, this is the JS we use for auto submitting our form https://gist.github.com/mattbrailsford/d92e1e1bbfb71e27d55faefb1096da04 (it's worth knowing that some payment providers use javascript and the onsubmit attribute so this checks for such a scenario)

    /Matt

  • Francis Benyah 35 posts 111 karma points
    Jun 15, 2020 @ 17:32
    Francis Benyah
    0

    Thanks Matt

    Much appreciated will keep this I am sure it will come in handy again.

  • Francis Benyah 35 posts 111 karma points
    Jun 23, 2020 @ 10:33
    Francis Benyah
    0

    Hey Matt

    Sorry another one, busy today :)

    So after updating to the latest version of vendr the reflection for initializing an order does not work any more.

    enter image description here

    It comes back as null.

    Has the method name or something changed?

    Thanks

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jun 23, 2020 @ 10:38
    Matt Brailsford
    1

    Hey Francis,

    Yea, check the changelog, it got made public in 1.2.5 :)

    https://vendr.net/docs/core/changelog/

    Matt

  • Francis Benyah 35 posts 111 karma points
    Jun 23, 2020 @ 11:08
    Francis Benyah
    0

    Ah nice should have checked the log :D

    Thanks Matt

Please Sign in or register to post replies

Write your reply to:

Draft