Пример #1
0
 def order2atlist(self, o):
     if not o.paid:
         return None
     at = AbstractTransaction()
     at.holvi_order = o  # nonstandard field, but ought to be helpful
     at.name = "%s, %s" % (o.buyer.lastname, o.buyer.firstname)
     at.email = str(o.buyer.email)
     at.stamp = o.paid_time  # this is already parsed by holviapi
     at.amount = o.net
     at.reference = "holvi:%s" % o.code
     # DO NOT EVER CHANGE THIS, it must always and forever yield same unique_id for same transaction.
     at.unique_id = hashlib.sha1(str(o.code).encode('utf-8') + at.stamp.isoformat().encode('utf-8')).hexdigest()
     return [at]  # We must return a list since invoice might have multiple payments
Пример #2
0
 def invoice2atlist(self, i):
     if not i.payments:
         return None
     atlist = []
     for pline in i.payments:
         at = AbstractTransaction()
         at.holvi_invoice = i  # nonstandard field, but ought to be helpful
         at.name = str(i.receiver.name)
         at.email = str(i.receiver.email)
         at.amount = Decimal(pline['amount'])
         at.reference = str(i.rf_reference)
         at.stamp = dateutil.parser.parse(pline['time'])
         # DO NOT EVER CHANGE THIS, it must always and forever yield same unique_id for same transaction.
         at.unique_id = hashlib.sha1(str(i.code).encode('utf-8') + at.stamp.isoformat().encode('utf-8')).hexdigest()
         atlist.append(at)
     return atlist
Пример #3
0
 def order2atlist(self, o):
     if not o.paid:
         return None
     at = AbstractTransaction()
     at.holvi_order = o  # nonstandard field, but ought to be helpful
     at.name = "%s, %s" % (o.buyer.lastname, o.buyer.firstname)
     at.email = str(o.buyer.email)
     at.stamp = o.paid_time  # this is already parsed by holviapi
     at.amount = o.net
     at.reference = "holvi:%s" % o.code
     # DO NOT EVER CHANGE THIS, it must always and forever yield same unique_id for same transaction.
     at.unique_id = hashlib.sha1(
         str(o.code).encode('utf-8') +
         at.stamp.isoformat().encode('utf-8')).hexdigest()
     return [
         at
     ]  # We must return a list since invoice might have multiple payments
Пример #4
0
 def invoice2atlist(self, i):
     if not i.payments:
         return None
     atlist = []
     for pline in i.payments:
         at = AbstractTransaction()
         at.holvi_invoice = i  # nonstandard field, but ought to be helpful
         at.name = str(i.receiver.name)
         at.email = str(i.receiver.email)
         at.amount = Decimal(pline['amount'])
         at.reference = str(i.rf_reference)
         at.stamp = dateutil.parser.parse(pline['time'])
         # DO NOT EVER CHANGE THIS, it must always and forever yield same unique_id for same transaction.
         at.unique_id = hashlib.sha1(
             str(i.code).encode('utf-8') +
             at.stamp.isoformat().encode('utf-8')).hexdigest()
         atlist.append(at)
     return atlist