electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 9e2db24f5da2b8e5a34b21933fa075a01ae99d5a
parent c3f0f69f1eb642c0ec7806760c2af92c6d49e942
Author: ThomasV <thomasv@gitorious>
Date:   Sat, 10 May 2014 20:35:00 +0200

return error status for payment requests

Diffstat:
Mlib/paymentrequest.py | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/paymentrequest.py b/lib/paymentrequest.py @@ -193,7 +193,7 @@ class PaymentRequest: pay_det = self.payment_details if not pay_det.payment_url: - return + return False, "no url" paymnt = paymentrequest_pb2.Payment() paymnt.merchant_data = pay_det.merchant_data @@ -212,18 +212,20 @@ class PaymentRequest: try: r = requests.post(payurl.geturl(), data=pm, headers=ACK_HEADERS, verify=False) except Exception as e: - print "Payment Message/PaymentACK Failed" print e - return + return False, "Payment Message/PaymentACK Failed" + + if r.status_code >= 500: + return False, r.reason + try: paymntack = paymentrequest_pb2.PaymentACK() paymntack.ParseFromString(r.content) except Exception: - print "PaymentACK could not be processed. Payment was sent; please manually verify that payment was received." - return + return False, "PaymentACK could not be processed. Payment was sent; please manually verify that payment was received." print "PaymentACK message received: %s" % paymntack.memo - return paymntack.memo + return True, paymntack.memo