Hi Massimo, Everyone,
Merry Christmas!
##Following is the code from google_wallet.py
from gluon import XML
def button(merchant_id="123456783432215",
products=[dict(name="shoes",
quantity=1,
price=23.5,
currency='USD',
description="running shoes black")]):
t = '<input name="item_%(key)s_%(k)s" type="hidden"
value="%(value)s"/>\n'
list_products = ''
for k, product in enumerate(products):
for key in ('name','description','quantity','price','currency'):
list_products += t % dict(k=k + 1, key=key, value=product[key])
button = """<form
action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/%(merchant_id)s"
id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm"
target="_top">\n%(list_products)s<input name="_charset_" type="hidden"
value="utf-8"/>\n<input alt=""
src="https://checkout.google.com/buttons/buy.gif?merchant_id=%(merchant_id)s&w=117&h=48&style=white&variant=text&loc=en_US"
type="image"/>\n</form>""" % dict(merchant_id=merchant_id,
list_products=list_products)
return XML(button)
Some how I did not get this error earlier but now it is giving me this
error. Seems like it is not able to find XML module in gluon.
<type 'exceptions.NameError'> global name 'XML' is not defined
Rahul
On Sunday, December 24, 2017 at 9:57:12 PM UTC+5:30, Massimo Di Pierro
wrote:
>
> That functionality has been implemented so long ago that I would not be
> surprised if it does not work any more. We should probably simply eliminate
> from contrib.
>
> On Wednesday, 20 December 2017 01:02:36 UTC-6, Rahul wrote:
>>
>> Hi All,
>> I am trying to integrate and utilize the basic functionality for
>> "Google Wallet" for my web2py app and following the instructions given in
>> the online book. I've my own merchant ID and I have registered with
>> Google. but the problem is that it does not seem to initialize the widget
>> on the HTML page. It just shows and placeholder and when I click on it, it
>> shows below err -
>>
>> 404. That’s an error.
>> The requested URL /api/checkout/v2/checkoutForm/Merchant/<merchantID> was
>> not found on this server. That’s all we know.
>>
>> *Code in the view *- (Ofcourse merchant_id I used the one google
>> provided me. )
>>
>> {{from gluon.contrib.google_wallet import button}}
>> {{=button(merchant_id="123456789012345",
>> products=[dict(name="shoes",
>> quantity=1,
>> price=23.5,
>> currency='USD',
>> description="running shoes black")])}}
>>
>> I am using web2py version 2.15.3 - Any help/pointers for this would be
>> greatly appreciated. Does the code need to be updated or changed ?
>>
>> Regards, Rahul
>>
>>
--
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/d/optout.