Found the problem. Satchmo by default rounds decimals to 5 precision
points. However, Paypal cannot accept decimals in this form and will
output an error. (For subscription products at least). In order to
truncate the last 3 zeros from the decimal, I made the following
changes to satchmo/payment/modules/paypal/views.py and satcho sends
the correct subscription product information to payapl.
Index: views.py
===================================================================
--- views.py (revision 1553)
+++ views.py (working copy)
@@ -9,6 +9,10 @@
from django.utils.translation import ugettext as _
from sys import exc_info
from traceback import format_exception
+try:
+ from decimal import Decimal
+except:
+ from django.utils._decimal import Decimal
from satchmo.configuration import config_get_group
from satchmo.configuration import config_value
@@ -69,7 +73,7 @@
order_items = order.orderitem_set.all()
for item in order_items:
if item.product.is_subscription:
- recurring = {'product':item.product,
'price':item.product.price_set.all()[0].price,}
+ recurring = {'product':item.product,
'price':item.product.price_set.all()[0].price.quantize(Decimal('.
01')),}
if len(order_items) > 1 or
recurring['product'].subscriptionproduct.get_trial_terms(0) is not
None or recurring['price'] < order.balance:
recurring['trial1'] = {'price': order.balance,}
if
recurring['product'].subscriptionproduct.get_trial_terms(0) is not
None:
On Sep 27, 4:12 pm, Zene <[EMAIL PROTECTED]> wrote:
> Hi all. I am trying to figure out a problem I am having with
> subscription products and Paypal when using Satchmo. Regular products
> work just fine, but as soon as I add a subscription sub-type, I get
> the following error from paypal when attempting to purchase:
>
> You have entered an invalid amount. Please make sure that all
> punctuation marks are in the correct places and that you only include
> the numeric portion of your amount. For example, if the amount is
> $5.00 USD, you would enter 5.00.
>
> I have tried various settings within the admin for Satchmo products
> without any luck. Has anyone been able to get subscription products
> to work with Paypal?
>
> Thanks,
> Zenos
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Satchmo users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/satchmo-users?hl=en
-~----------~----~----~----~------~----~------~--~---