Good day Guys,
I am currently trying to run the authorize.net credit processing example,
but I am getting some indentation errors with the following lines of code;
if form.accepts(request,session):
if process(form.vars.creditcard,form.vars.expiration,
total,form.vars.cvv,0.0,invoice,testmode=True):
I followed the example to T, but not sure what am I doing wrong. Any help
will be appreciated. Below is the code in its entirety.
def buy():
if not session.cart:
session.flash = 'add something to the shopping cart'
redirect(URL('index'))
import uuid
from gluon.contrib.AuthorizeNet import process
invoice = str(uuid.uuid4())
total = sum(db.product(id).price for id in session.cart.items())
form = SQLFORM.factory(
Field('creditcard', requires=IS_NOT_EMPTY()),
Field('expiration', requires=IS_MATCH('\d{2}/\d{4}')),
Field('cvv', requires=IS_MATCH('\d{3}')),
Field('shipping_address', requires=IS_NOT_EMPTY()),
Field('shipping_city', requires=IS_NOT_EMPTY()),
Field('shipping_state', requires=IS_NOT_EMPTY()),
Field('shipping_zip_code',
requires=IS_MATCH('\d{5}(\-\d{4})?')))
if form.accepts(request,session):
if process(form.vars.creditcard,form.vars.expiration,
total,form.vars.cvv,0.0,invoice,testmode=True):
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.