def payments(self): method = self.doc.xpath('//div[@class="creditCard"]/text()')[0] pmt = Payment() pmt.date = self.order_date() pmt.method = cleanup(method) pmt.amount = self.total() yield pmt
def payments(self): # There's no payment information on Ideel, so we'll make one up. p = Payment() p.date = self.order_date() p.method = u'DEFAULT PAYMENT' p.amount = self.total() yield p
def payments(self): for tr in self.doc.xpath( '//tbody[@class="payment-summary"]' '//th[text()="Payment Summary"]/../../../tbody/tr'): method = tr.xpath('td[1]/text()')[0] amnode = tr.xpath('td[2]')[0] amsign = -1 if amnode.xpath('em') else 1 amount = amnode.text_content().strip() pmt = Payment() pmt.date = self.order_date() pmt.method = unicode(method) pmt.amount = amsign * AmTr.decimal_amount(amount) yield pmt
def payments(self): for tr in self.doc.xpath('//tbody[@class="payment-summary"]' '//th[text()="Payment Summary"]/../../../tbody/tr'): method = tr.xpath('td[1]/text()')[0] amnode = tr.xpath('td[2]')[0] amsign = -1 if amnode.xpath('em') else 1 amount = amnode.text_content().strip() pmt = Payment() pmt.date = self.order_date() pmt.method = unicode(method) pmt.amount = amsign * AmTr.decimal_amount(amount) if pmt.method not in [u'Funds to be applied on backorder']: yield pmt
def transactions(self): # TODO : French translation for tr in self.doc.xpath(u'//div[contains(b,"Credit Card transactions")]' u"/following-sibling::table[1]/tr"): label, date = tr.xpath("td[1]/text()")[0].strip().split(u"\xa0") amount = tr.xpath("td[2]/text()")[0].strip() date = datetime.strptime(date, "%B %d, %Y:") method = label.replace(u"ending in ", u"")[:-1].upper() amount = self.decimal_amount(amount) pmt = Payment() pmt.date = date pmt.method = method pmt.amount = amount yield pmt
def transactions(self): for tr in self.doc.xpath( u'//div[contains(b,"Credit Card transactions")]' u'/following-sibling::table[1]/tr'): label, date = tr.xpath('td[1]/text()')[0].strip().split(u'\xa0') amount = tr.xpath('td[2]/text()')[0].strip() date = datetime.strptime(date, '%B %d, %Y:') method = label.replace(u'ending in ', u'')[:-1].upper() amount = AmTr.decimal_amount(amount) pmt = Payment() pmt.date = date pmt.method = method pmt.amount = amount yield pmt
def transactions(self): for row in self.doc.xpath('//span[contains(text(),"Transactions")]' "/../../div/div"): text = row.text_content().strip().replace("\n", " ") if u"Expédition" not in text: continue date, method, amount = re.match( ".* " "([0-9]+ [^ ]+ [0-9]+)" "[ -]+" "([A-z][^:]+)" ": +" "(EUR [^ ]+)", text ).groups() date = datetime.strptime(self.month_to_int(date), "%d %m %Y") method = method.replace(u"finissant par ", u"").upper() amount = self.decimal_amount(amount) pmt = Payment() pmt.date = date pmt.method = method pmt.amount = amount yield pmt
def transactions(self): for row in self.doc.xpath('//span[contains(text(),"Transactions")]' '/../../div/div'): text = row.text_content().strip().replace('\n', ' ') if u'Expédition' not in text: continue date, method, amount = re.match( '.* ' '([0-9]+ [^ ]+ [0-9]+)' '[ -]+' '([A-z][^:]+)' ': +' '(EUR [^ ]+)', text).groups() date = datetime.strptime(self.month_to_int(date), '%d %m %Y') method = method.replace(u'finissant par ', u'').upper() amount = self.decimal_amount(amount) pmt = Payment() pmt.date = date pmt.method = method pmt.amount = amount yield pmt
def transactions(self): for row in self.doc.xpath('//span[contains(text(),"Transactions")]' '/../../div/div'): text = row.text_content().strip().replace('\n', ' ') if u'Items shipped:' not in text: continue date, method, amount = re.match( '.* ' '([A-z]+ [0-9]+, [0-9]+)' '[ -]+' '([A-z][^:]+)' ': +' '([^ ]+)', text).groups() date = datetime.strptime(date, '%B %d, %Y') method = method.replace(u'ending in ', u'').upper() amount = AmTr.decimal_amount(amount) pmt = Payment() pmt.date = date pmt.method = method pmt.amount = amount yield pmt
def payments(self): if self.gift(): pmt = Payment() pmt.date = self.order_date() pmt.method = u'GIFT CARD' pmt.amount = -self.gift() yield pmt transactions = list(self.transactions()) if transactions: yield from transactions else: for method in self.paymethods(): pmt = Payment() pmt.date = self.order_date() pmt.method = method pmt.amount = self.grand_total() yield pmt break
def payments(self): for shmt in self.shipments(): gift = self.gift(shmt) if gift: pmt = Payment() pmt.date = self.order_date() pmt.method = u'CARTE CADEAU' pmt.amount = -gift yield pmt transactions = list(self.transactions()) if transactions: for t in transactions: yield t else: for method in self.paymethods(): pmt = Payment() pmt.date = self.order_date() pmt.method = method pmt.amount = self.grand_total() yield pmt break
def payments(self): if self.gift(): pmt = Payment() pmt.date = self.order_date() pmt.method = u'GIFT CARD' pmt.amount = -self.gift() yield pmt transactions = list(self.transactions()) if transactions: for t in transactions: yield t else: for method in self.paymethods(): pmt = Payment() pmt.date = self.order_date() pmt.method = method pmt.amount = self.grand_total() yield pmt break