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
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:
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 :)
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
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)
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>
I've been able to get the debug data from the POST, and can confirm that the preauth parameter is not being included
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
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:
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
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?
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
Replace
Best regards Martin
Edit: uCommerce guide to register custom components http://docs.ucommerce.net/ucommerce/v6.6/extending-ucommerce/register-a-component.html
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?
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 :)
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"
});
Hey Walter
Thank you for sharing your solution. #h5yr
Please mark the post as solved.
Kind regards
Thomas Arvidsen
is working on a reply...