Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreon Paypal amount not correctly formatted...on Paypal amount not correctly formatted...
Previous
 
Next
New Post
9/19/2006 5:10 PM
 
Well, the comma is appearing because of the locale settings, when you put your portal in French mode it uses French customs for monetary depiction (ie. using a comma decimal separator).  When it's in UK format, it uses a decimal and all is well.

I'd call this a defect and report it to the team (if they're not already aware), you won't be able to fix it without changing some source code.
 
New Post
9/19/2006 6:52 PM
 

Hello Athompson,

ok - so I leave it to you to inform the team.

It wouldn't be a problem for me to change the code, but it would take me quite some time to check where to code would have to be changed. If you have any hint, do not hesitate

Regards,
Fabian

 
New Post
9/20/2006 6:00 AM
 

%2c = , (comma)

File: Store\Cart\Providers\GatewayProviders\PayPalProvider\PayPalPayment.ascx.cs
Lines: 166-168

payPalURL += "&amount=" + HTTPPOSTEncode(orderInfo.OrderTotal.ToString("0.00"));
payPalURL +=
"&shipping=" + HTTPPOSTEncode(orderInfo.ShippingCost.ToString("0.00"));
payPalURL +=
"&tax=" + HTTPPOSTEncode(orderInfo.Tax.ToString("0.00"));

I would try it without the encodng first. payPalURL += "&amount=" + orderInfo.OrderTotal.ToString("0.00");

They are all decimal data types but obviously machine regional settings are having an effect on the results. According to the PayPal ASP.NET example they use Single(vb) and float(c#), decimal is just a bigger number.

If you have the store source upzipped into your DNN website in \DesktopModules\Store, simply build the BuildSupport project and you should be able to try it immediately. (BuiildSupport puts the dll in the dnnroot\bin folder for you.)

Here's what happens with a C# console app...

using System;
using System.Threading;
using System.Globalization;
namespace ConsoleApplication1
{
class Program
{
static void dump(float x)
{
Console.WriteLine(x);
Console.WriteLine("{0}", x);
Console.WriteLine(x.ToString("0.00"));
}
static void Main(string[] args)
{
float x = 1.23F;
dump(x);
// Set the culture to French (France)
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
dump(x);
// wait for keypress
Console.ReadKey();
}
}
}

Output:
1.23
1.23
1.23
1,23
1,23
1,23

Later today I'll try it in the sandbox to see if I can figure it out.


Dwayne J. Baldwin
 
New Post
9/20/2006 7:47 AM
 

In file...

Store\Cart\Providers\GatewayProviders\PayPalProvider\PayPalPayment.ascx.cs

...add this method...

// convert to paypal currency (convert commas to decimal point) 
// Note: not tested for all regional settings

static string PayPalUrlAmount(string parm,decimal amount)
{
 return String.Format("&{0}={1:N2}",parm,amount).Replace(",",".");
}

...and change this...

payPalURL += "&amount=" + HTTPPOSTEncode(orderInfo.OrderTotal.ToString("0.00"));
payPalURL += "&shipping=" + HTTPPOSTEncode(orderInfo.ShippingCost.ToString("0.00"));
payPalURL += "&tax=" + HTTPPOSTEncode(orderInfo.Tax.ToString("0.00"));

...to this...

payPalURL += PayPalUrlAmount("amount",orderInfo.OrderTotal);
payPalURL += PayPalUrlAmount("shipping",orderInfo.ShippingCost);
payPalURL += PayPalUrlAmount("tax",orderInfo.Tax);

Note that this fix will be included in version 1.1.


Dwayne J. Baldwin
 
New Post
9/20/2006 5:09 PM
 

Hi djbaldwin,

I am confused  - excuse for asking such a simple question : I do not find the file File: Store\Cart\Providers\GatewayProviders\PayPalProvider\PayPalPayment.ascx.cs !

I downloaded the source version of store 1.0.1 - but no such file is in  there.

Any idea what I am missing?

Thank you for any help!

Regards,
Fabian

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreon Paypal amount not correctly formatted...on Paypal amount not correctly formatted...


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out