[amazon] Support for a new payment layout and priceless items. Fixes #1764
This commit is contained in:
parent
1569eb00ee
commit
ce65d35081
1 changed files with 10 additions and 6 deletions
|
|
@ -131,11 +131,15 @@ class OrderNewPage(OrderPage):
|
||||||
break
|
break
|
||||||
|
|
||||||
def paymethods(self):
|
def paymethods(self):
|
||||||
for root in self.doc.xpath('//h5[contains(text(),"Payment Method")]'):
|
for root in self.doc.xpath(u'//h5[contains(text(),"Payment Method")]'):
|
||||||
alt = root.xpath('../div/img/@alt')[0]
|
div = u''.join(root.xpath('../div/text()')).strip()
|
||||||
span = root.xpath('../div/span/text()')[0]
|
if div:
|
||||||
digits = re.match(r'[^0-9]*([0-9]+)[^0-9]*', span).group(1)
|
yield div
|
||||||
yield u'%s %s' % (alt, digits)
|
else:
|
||||||
|
alt = root.xpath('../div/img/@alt')[0]
|
||||||
|
span = root.xpath('../div/span/text()')[0]
|
||||||
|
digits = re.match(r'[^0-9]*([0-9]+)[^0-9]*', span).group(1)
|
||||||
|
yield u'%s %s' % (alt, digits)
|
||||||
|
|
||||||
def grand_total(self):
|
def grand_total(self):
|
||||||
return AmTr.decimal_amount(self.doc.xpath(
|
return AmTr.decimal_amount(self.doc.xpath(
|
||||||
|
|
@ -205,7 +209,7 @@ class OrderNewPage(OrderPage):
|
||||||
if url:
|
if url:
|
||||||
url = unicode(self.browser.BASEURL) + \
|
url = unicode(self.browser.BASEURL) + \
|
||||||
re.match(u'(/gp/product/.*)/ref=.*', url).group(1)
|
re.match(u'(/gp/product/.*)/ref=.*', url).group(1)
|
||||||
if label and price:
|
if label:
|
||||||
itm = Item()
|
itm = Item()
|
||||||
itm.label = label
|
itm.label = label
|
||||||
itm.url = url
|
itm.url = url
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue