Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Girish Khadse 52 posts 132 karma points
    Jun 11, 2013 @ 11:03
    Girish Khadse
    0

    How to customize DIBS.config to redirect to localized url

    Hi..

    I finally integrated the DIBS as a payment API. In DIBS.config we have to set acceptUrl and cancelUrl to handle the success and error resp. So I am redirecting user to payment confirmation page and error page in resp scenarions. But now I am not getting how to set accept url and cancel url as per my selected localization. How should I set such localized urls in DIBS.config?

    Regards,

    Girish

  • Girish Khadse 52 posts 132 karma points
    Jun 11, 2013 @ 11:05
    Girish Khadse
    0

    Found a post with similer issue : http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/37606-Different-DIBS-configuration-for-multiple-sites. ; Soren saying that we can set relative urls for accept urls and cancel urls. Can someone elaborate more on it? Example would be a better idea.

  • Jesper Nielsen 141 posts 498 karma points
    Jun 17, 2013 @ 14:27
    Jesper Nielsen
    1

    Hi Girish,

    The relative urls works by simply checking if the configured urls starts with "http://" or "https://". If not, the Scheme and Host from the current context is simply prepended to the url.

    The code inside looks something like this:

    return string.Format("{0}://{1}{2}", Scheme, Host, url);

    Kind regards,

    Jesper

  • Martin 181 posts 740 karma points
    Jun 18, 2013 @ 22:12
    Martin
    100

    Hi Girish,

    You can use the relative url for your accepturl but that restrict that your confirmation page should have same name on all language versions of your site. So as an example if you have 3 localized sites (German, Danish, Enligsh)

    Then all 3 sites should have their confirmation page at same location. etc. ...dk/confirmation, ...com/confirmation and ....de/confirmation. If you want this then your accept url should be "/confirmation" in dibs.config

    This might seem odd to users that the confirmation page url is not localized. You can solve this being creating a custom version of DibsPageBuilder (as I recall it) and then create your accept url dynamicly which is also suitable.

    Best Regards Martin

  • Girish Khadse 52 posts 132 karma points
    Jun 19, 2013 @ 06:36
    Girish Khadse
    1

    Hi Martin..

    I have a single site differentiating language versions by url only. So "Relative url" trick did not work out.
    As you say - "You can solve this by creating a custom version of DibsPageBuilder (as I recall it) and then create your accept url dynamicly which is also suitable." .. Exactly what I did and solved the issue. Here is the code snippet of it :

      public class LunaDibsPageBuilder : DibsPageBuilder
        {
            public LunaDibsPageBuilder(CommerceConfigurationProvider configProvider, IDomainService domainService, DibsMd5Computer dibsMd5Computer)
                : base(configProvider, domainService, dibsMd5Computer)
            {
            }
            protected override void BuildBody(System.Text.StringBuilder page, PaymentRequest paymentRequest)
            {
                base.BuildBody(page, paymentRequest);
                HtmlDocument htmlDocument = new HtmlDocument();
                htmlDocument.LoadHtml(page.ToString());
                //Replace Url acceptance
                var inputs = htmlDocument.DocumentNode.Descendants("input")
                .Where(n => n.Attributes["name"] != null && n.Attributes["name"].Value == "accepturl");
                foreach (HtmlNode node in inputs)
                {
                    HtmlAttribute valueAttribute = node.Attributes["value"];
                    //Replace Url acceptance
                    if (valueAttribute != null)
                    {
                        valueAttribute.Value = System.Web.HttpContext.Current.Request.UrlReferrer.AbsoluteUri.Substring(0, System.Web.HttpContext.Current.Request.UrlReferrer.AbsoluteUri.LastIndexOf('/') + 1) + valueAttribute.Value.Substring(valueAttribute.Value.LastIndexOf('/') + 1);
                    }
                 
                }
                //Replace Cancel url
                inputs = htmlDocument.DocumentNode.Descendants("input")
                .Where(n => n.Attributes["name"] != null && n.Attributes["name"].Value == "cancelurl");
                foreach (HtmlNode node in inputs)
                {
                    HtmlAttribute valueAttribute = node.Attributes["value"];
                    //Replace Url acceptance
                    if (valueAttribute != null)
                    {
                        valueAttribute.Value = System.Web.HttpContext.Current.Request.UrlReferrer.AbsoluteUri.Substring(0, System.Web.HttpContext.Current.Request.UrlReferrer.AbsoluteUri.LastIndexOf('/') + 1) + valueAttribute.Value.Substring(valueAttribute.Value.LastIndexOf('/') + 1);
                    }
                }
                page.Clear();
                page.Append(htmlDocument.DocumentNode.OuterHtml);
            }
        }
     

     

  • Martin 181 posts 740 karma points
    Jun 19, 2013 @ 19:34
    Martin
    0

    Hi Girish,

    Glad you found a usefull solution. H5YR for posting your solution.

    Best regards Martin

Please Sign in or register to post replies

Write your reply to:

Draft