Hello I got this error when trying out the Estore app.
File "/home/maurice/web2py/applications/EStore/controllers/default.py", line 157, in pay
description="Purchase".encode('utf-8')
File "/home/maurice/web2py/gluon/contrib/stripe.py", line 115, in __init__
self.signature = sha1(repr((self.amount,self.description))).hexdigest()
TypeError: Unicode-objects must be encoded before hashing
part of the code in default is:
@auth.requires_login()
def checkout():
if session.checkout_form and not request.post_vars:
for key in session.checkout_form:
db.cart_order[key].default = session.checkout_form[key]
form = SQLFORM(db.cart_order).process(dbio=False)
if form.accepted:
session.checkout_form = form.vars
redirect(URL('pay'))
return locals()
def pay():#Not working, error # description: TypeError: Unicode-objects must be encoded before hashing
from gluon.contrib.stripe import StripeForm
results = price_cart()
stripe_form = StripeForm(
pk=STRIPE_PUBLIC_KEY,
sk=STRIPE_SECRET_KEY,
amount=int(100*results['total_with_shipping']), # (amount is in cents)amount=int(100*results['total_with_shipping']),
currency='eur',
currency_symbol='€',
description="Purchase".encode('utf-8')
)
stripe_form.process()
Help in correcting this error will be appreciated.
Thank you