I'm having a problem when I'm redirected to the dibs website.
Our site is in Danish, is defined in the umbraco hostname and culture section, but when I'm redirected to the Dibs website, the language of that site is English. On the other hand, If I choose the paypal payment mehtod, the language of the site is Danish.
We have set the default language as Danish ("da-DK" ), in the .config for Ucommerce.
I tried to force a language parameter in DIBS.config
file but that broke the integration. I have nothing else to go on right
now and cannot explain why it worked when it was in the TEST DIBS
version. At that point I assumed
the problem was with DIBS itself, but I cannot check what is being
posted because it is encrypted.
Can you please tell me the full host name as used in Umbraco?
Unfortunately you can't modify the dibs parameters by editing the dibs.config file.
A way to force the lang parameter is to make a new DibsPageBuilder that inherits the existing DibsPageBuilder and overwrite the AddHiddenField method and force the lang parameter in there, when name equals lang.
In the test solution, the values that were posted to Dibs were:
submitBasket
yes
decorator
default
merchant
merchantId
accepturl
acceptUrl
cancelurl
orderGuid
OrderGuid
currency
DKK
lang
pt
callbackurl
callbackurl
test
1
orderid
Reference-214
amount
125
uniqueoid
yes
md5key
Key
In this case, our test solution domain ends with a ".pt".. I'm writting from Portugal. I've also tried to change the browser language, but it didn't work...
A curious question, did you remember to register your custom dibs page builder? You have to use the same name as uCommerce's default DIBS page builder otherwise uCommerce will continue using the default implementation.
Best regards Martin
Edit:
I just looked up what name your custom page builder should have. If you in custom.config register your page builder with id = DibsPageBuilder you should get the correct values for the form.
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["lang"] = "da";
return test;
}
}
I recommend that you override the GetParameters instead. That way you accidentally don't removes/forgets some of the standard fields required for DIBS.
EDIT:
There was supposed to be a "don't" in that sentence >.<
I'm having some struggle with the "ICallbackUrl", and also the "GetParameters" method.
and also with the: test.Add(new KeyValuePair<string, string>("lang", paymentRequest.PaymentMethod.DynamicProperty().PreAuth)); "DynamicProperty()"
It can't find the assemble.
edit:
The references that I have: using UCommerce.Content; using UCommerce.Infrastructure.Configuration; using UCommerce.Transactions.Payments; using UCommerce.Transactions.Payments.Dibs; using UCommerce.Web;
If you're using version 6.6.0 or newer then Martin's solution is the right way to do it.
However since you're using an older version, the DibsPageBuilder you have doesn't have a GetParameters method and you will there for have to override the AddHiddenField method as you did in a previous post. The way you did it is wrong as you would replace all the fields with the language field, the solution should be something like this:
public class Test : DibsPageBuilder
{
public Test(CommerceConfigurationProvider configProvider, IDomainService domainService,
DibsMd5Computer dibsMd5Computer, IAbsoluteUrlService absoluteUrlService)
: base(configProvider, domainService, dibsMd5Computer, absoluteUrlService)
{
}
protected override void AddHiddenField(StringBuilder page, string name, string value)
{
if (name == "lang") {
base.AddHiddenField(page, name, "da");
return;
}
base.AddHiddenField(page, name, value);
}
}
And then register the component the way Martin said in a previous post.
Language problem on Dibs
Hello guys!
I'm having a problem when I'm redirected to the dibs website.
Our site is in Danish, is defined in the umbraco hostname and culture section, but when I'm redirected to the Dibs website, the language of that site is English.
On the other hand, If I choose the paypal payment mehtod, the language of the site is Danish.
We have set the default language as Danish ("da-DK" ), in the .config for Ucommerce.
I tried to force a language parameter in DIBS.config file but that broke the integration. I have nothing else to go on right now and cannot explain why it worked when it was in the TEST DIBS version. At that point I assumed the problem was with DIBS itself, but I cannot check what is being posted because it is encrypted.
What else can I do?
Hello,
Do you want to have a conf call just to discuss this more in detail, as the company i work offer these services ?
Hey Gonçalo
Can you please tell me the full host name as used in Umbraco?
Unfortunately you can't modify the dibs parameters by editing the dibs.config file.
A way to force the lang parameter is to make a new DibsPageBuilder that inherits the existing DibsPageBuilder and overwrite the AddHiddenField method and force the lang parameter in there, when name equals lang.
A guide on how to register a custom component in uCommerce
Kind regards
Thomas Arvidsen
Well our full domain is :
www.Fonde.dk
I am trying to override the AddHiddenField method:
I am using the following code:
public class customLanguage : DibsPageBuilder
{
public customLanguage(CommerceConfigurationProvider configProvider, IDomainService domainService, DibsMd5Computer dibsMd5Computer, IAbsoluteUrlService absoluteUrlService)
: base(configProvider, domainService, dibsMd5Computer, absoluteUrlService)
{
}
protected override void AddHiddenField(StringBuilder page, string name, string value)
{
base.AddHiddenField(page, "lang", "da");
}
}
In the test solution, the values that were posted to Dibs were:
In this case, our test solution domain ends with a ".pt".. I'm writting from Portugal. I've also tried to change the browser language, but it didn't work...
Hi Goncalo,
A curious question, did you remember to register your custom dibs page builder? You have to use the same name as uCommerce's default DIBS page builder otherwise uCommerce will continue using the default implementation.
Best regards Martin
Edit: I just looked up what name your custom page builder should have. If you in custom.config register your page builder with id = DibsPageBuilder you should get the correct values for the form.
I'v added the dll to the bin folder, and added the following to the Custom.config:
<component id="DibsPageBuilder"
service="UCommerce.Transactions.Payments.Dibs.DibsPageBuilder, UCommerce.Transactions.Payments"
type= "dibsCustomLanguage.customLanguage, dibsCustomLanguage">
</component>
But now it posts "lang da" in all of the fields.
ahh. It's because you have overridden the wrong method. 2 sec and I get you the right one :)
Okay here are some Example code for inspiration:
I recommend that you override the GetParameters instead. That way you accidentally don't removes/forgets some of the standard fields required for DIBS.
EDIT:
There was supposed to be a "don't" in that sentence >.<
EDIT 2: Remove useless line for this example.
Edit 3: This applies / tested with version 6.6.2
Thank you Martin.
I'm having some struggle with the "ICallbackUrl", and also the "GetParameters" method.
and also with the:
test.Add(new KeyValuePair<string, string>("lang", paymentRequest.PaymentMethod.DynamicProperty().PreAuth));
"DynamicProperty()"
It can't find the assemble.
edit:
The references that I have:
using UCommerce.Content;
using UCommerce.Infrastructure.Configuration;
using UCommerce.Transactions.Payments;
using UCommerce.Transactions.Payments.Dibs;
using UCommerce.Web;
Which version of uCommerce do you use?
Edit: I have removed a line from my example which was not needed (copy paste mistake).
I believe I have the Version 3.3.1.4000
Hey Gonçalo
If you're using version 6.6.0 or newer then Martin's solution is the right way to do it.
However since you're using an older version, the DibsPageBuilder you have doesn't have a GetParameters method and you will there for have to override the AddHiddenField method as you did in a previous post. The way you did it is wrong as you would replace all the fields with the language field, the solution should be something like this:
And then register the component the way Martin said in a previous post.
Kind regards
Thomas Arvidsen
I was trying to do exactly that Thomas, but I wasn't including that last line:
So I was only posting ""lang = da".
Now it's in Danish, finally!
Thank you Thomas and Martin for all the help and patience!
Cheers from Portugal
No problem
Would you be so kind and mark the post as solved?
Kind regards
Thomas Arvidsen.
is working on a reply...