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.

  • Walter Kjell Dahl 6 posts 58 karma points
    Mar 13, 2015 @ 10:14
    Walter Kjell Dahl
    0

    DIBS preauth parameter returning statuscode 5 instead of 13

    Hi!

    Im currently working on a project where we are working on implementing subscriptions by use of DIBS.

    In order to authorize a ticket to use for recurring payments, I have to provide the payment with an additional parameter called "preauth" and the value set to "true".

    What I have tried so far without success:

    1. Adding additionalproperties to the payment request

    PaymentRequest.AdditionalProperties.Add("preauth", "true");

    2. Adding definition field for DIBS called preauth / PreAuth with boolean value of true

    Instead of getting paymentstatus of 13 I get the normal payment status instead which is 5 (successful order created etc)

    Creating a normal payment and collecting the payment is not a problem at all, getting the ticket for recurring transactions however is not working.

    See: http://tech.dibspayment.com/nodeaddpage/toolboxstatuscodes for description of paymentstatus

    Any clues of why I cant get the preauth parameter to return me a ticket, or how to set it up? I have talked with the guys at DIBS and made sure that preauth should be accessible from my DIBS account.

     

    Additional information

    Running this pipeline for checkout, and it works nicely:

    <value>${Checkout.ValidatePaymentsMadeAgainstOrderTotal}</value>

                <value>${Checkout.AssignOrderNumber}</value>

                <value>${Checkout.CreateCustomer}</value>

                <value>${Checkout.CreateMemberForCustomer}</value>

                <value>${Checkout.ConvertBasketToPurchaseOrder}</value>

                <value>${Checkout.AddAuditTrailForCurrentOrderStatus}</value>

                <value>${Checkout.SetVoucherUses}</value>

                <value>${Checkout.ClearBasketInformation}</value>

                <value>${Checkout.SavePurchaseOrder}</value>

                <value>${ToCompletedOrder.AcquirePaymentTask}</value>

     

  • Walter Kjell Dahl 6 posts 58 karma points
    Mar 13, 2015 @ 11:28
    Walter Kjell Dahl
    0

    I've been able to get the debug data from the POST, and can confirm that the preauth parameter is not being included

  • Martin 181 posts 740 karma points
    Mar 13, 2015 @ 20:55
    Martin
    0

    Hi Walter,

    Which version of uCommerce are you using?

    Edit:

    I just tried to setup the latest version of uCommerce and created a DIBS payment provider. According to what I can see you are supposed to go with your number "2" by adding the new definitions.

    Somehow it seems I can't debug the form values sent to DIBS by uCommerce, some time ago you could switch a flag and then see the values posted to a payment provider. I will return when I have some more information :)

    best regards Martin

  • Martin 181 posts 740 karma points
    Mar 14, 2015 @ 12:22
    Martin
    0

    Hi again Walter,

    It seems you still have to extend the page builder for dibs to get your newly created definition added to the DIBS request which I find odd. Perhaps someone from uCommerce can bring some light over it.

    Example code for overriding DibsPageBuilder:

    public class Test : DibsPageBuilder
    {
        public Test(IDomainService domainService, DibsMd5Computer dibsMd5Computer, IAbsoluteUrlService absoluteUrlService, ICallbackUrl callbackUrl) 
            : base(domainService, dibsMd5Computer, absoluteUrlService, callbackUrl)
        {
        }
    
        protected override IDictionary<string, string> GetParameters(PaymentRequest paymentRequest)
        {
            var test = base.GetParameters(paymentRequest);
            test.Add(new KeyValuePair<string, string>("PreAuth", paymentRequest.PaymentMethod.DynamicProperty().PreAuth));
    
            return test;
        }
    }
    

    I have tested the the code with the debug mode of the page builder (can be activated in payments.config) and it seems to do the trick

    Best regards Martin

  • Walter Kjell Dahl 6 posts 58 karma points
    Mar 16, 2015 @ 10:38
    Walter Kjell Dahl
    0

    Thanx for the help Martin! Im using uCommerce 6.6.2.15058 with Umbraco 7.1.4.

    We have tried that code but find it hard to integrate with our current system.

    Lets look at an example where I get the DIBSPaymentprovider

    (DibsPaymentMethodService pms = (DibsPaymentMethodService)method.GetPaymentMethodService();)

    Do you know if it is possible to set the DibsPageBuilder for the DibsPaymentMethodService in a simple and easy way?

  • Martin 181 posts 740 karma points
    Mar 16, 2015 @ 12:31
    Martin
    0

    Hi Walter,

    I should have been more clear in my explaination :-)

    To use a custom PageBuilder you have to register it first in uCommerce. You should register it in the config file called custom.config (found under umbraco -> ucommerce -> configuration)

    Then you add this line

    <component id="DibsPageBuilder" service="UCommerce.Transactions.Payments.Dibs.DibsPageBuilder, UCommerce.Transactions.Payments"  type="<Namespace.Class>, <AssemblyName>" />
    

    Replace

    Best regards Martin

    Edit: uCommerce guide to register custom components http://docs.ucommerce.net/ucommerce/v6.6/extending-ucommerce/register-a-component.html

  • Walter Kjell Dahl 6 posts 58 karma points
    Mar 16, 2015 @ 13:02
    Walter Kjell Dahl
    0

    Hi Martin!`

    Thanx a lot for your help so far!

    We have managed to add the custom component to the payment.config file and got it working.

    The only problem is that we cant get paymentRequest.PaymentMethod.DynamicProperty().PreAuth to compile

    Where do you get the .DynamicProperty() from?

  • Martin 181 posts 740 karma points
    Mar 16, 2015 @ 14:23
    Martin
    0

    Hi Walter,

    I don't have the code right now but I recall it should be in the namespace UCommerce.Extensions. I will take a look when I get home :)

  • Walter Kjell Dahl 6 posts 58 karma points
    Mar 16, 2015 @ 14:36
    Walter Kjell Dahl
    102

    Hi!

    Managed to get it all to work now! What we had to do:

    Added the following class:

    public class AdditionalPropertiesDibsPageBuilder : DibsPageBuilder

    {

    public AdditionalPropertiesDibsPageBuilder(IDomainService domainService, DibsMd5Computer dibsMd5Computer, IAbsoluteUrlService absoluteUrlService, ICallbackUrl callbackUrl)

    : base(domainService, dibsMd5Computer, absoluteUrlService, callbackUrl)

        {

    }

     

    protected override IDictionaryGetParameters(PaymentRequest paymentRequest)

    {

    var test = base.GetParameters(paymentRequest);

    paymentRequest.Payment.PaymentProperties.Where(x => x.Key == "preauth" && x.Value == "true")

    .ToList()

    .ForEach(prop => test.Add(new KeyValuePair("preauth", prop.Value)));

    return test;

    }

    }

     

    Replaced the default DibsPageBuilder in umbraco/ucommerce/configuration/payments.config

    <component id="DibsPageBuilder"

           service="UCommerce.Transactions.Payments.Dibs.DibsPageBuilder, UCommerce.Transactions.Payments"

             type= "MyProject.Extensions.AdditionalPropertiesDibsPageBuilder, MyProject.Web">

          <parameters>

            <debug>true</debug>

          </parameters>

        </component>

    Note for people that is trying to figure it out, notice that "MyProject.Extensions.AdditionalPropertiesDibsPageBuilder" is my namespance + classname

    and "MyProject.Web" refers to the project name which has an assembly that lies normally in the /bin folder as.dll

     

    Added the parameter to my payment function

    DibsPaymentMethodService pms = (DibsPaymentMethodService)method.GetPaymentMethodService();

    var paymentRequest = getPaymentRequest(purchaseOrder, method);

    var payment =  pms.RequestPayment(paymentRequest);

    payment.AddPaymentProperty(new PaymentProperty

                {

                    Key = "preauth",

                    Value = "true"

                });

  • Thomas 30 posts 163 karma points
    Mar 24, 2015 @ 15:56
    Thomas
    0

    Hey Walter

    Thank you for sharing your solution. #h5yr

    Please mark the post as solved.

    Kind regards

    Thomas Arvidsen

Please Sign in or register to post replies

Write your reply to:

Draft