Fixes previously introduced bug
[electrum-nvc.git] / lib / paymentrequest.py
index 6cea063..b0daa22 100644 (file)
@@ -49,13 +49,6 @@ import x509
 REQUEST_HEADERS = {'Accept': 'application/bitcoin-paymentrequest', 'User-Agent': 'Electrum'}
 ACK_HEADERS = {'Content-Type':'application/bitcoin-payment','Accept':'application/bitcoin-paymentack','User-Agent':'Electrum'}
 
-# status can be:
-PR_UNPAID  = 0
-PR_EXPIRED = 1
-PR_SENT    = 2     # sent but not propagated
-PR_PAID    = 3     # send and propagated
-PR_ERROR   = 4     # could not parse
-
 
 ca_list = {}
 ca_path = os.path.expanduser("~/.electrum/ca/ca-bundle.crt")
@@ -64,7 +57,6 @@ ca_path = os.path.expanduser("~/.electrum/ca/ca-bundle.crt")
 
 
 def load_certificates():
-
     try:
         ca_f = open(ca_path, 'r')
     except Exception:
@@ -84,7 +76,7 @@ def load_certificates():
             try:
                 x.parse(c)
             except Exception as e:
-                print "cannot parse cert:", e
+                util.print_error("cannot parse cert:", e)
             ca_list[x.getFingerprint()] = x
     ca_f.close()
     util.print_error("%d certificates"%len(ca_list))
@@ -259,15 +251,14 @@ class PaymentRequest:
 
         self.payment_url = self.details.payment_url
 
-        if self.has_expired():
-            self.error = "ERROR: Payment Request has Expired."
-            return False
-
         return True
 
     def has_expired(self):
         return self.details.expires and self.details.expires < int(time.time())
 
+    def get_expiration_date(self):
+        return self.details.expires
+
     def get_amount(self):
         return sum(map(lambda x:x[1], self.outputs))