X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=scripts%2Fmerchant%2Fmerchant.py;h=9456f10f972a1ce7e7b8b69c3e6c26beb4d822ec;hb=3cbe11a42473af52e7c5e002c36aaaf32646f627;hp=feedf916196477318e51e19f00a69eb2cd2e1540;hpb=6cd4ed486a91e4ffe82cda8227d9f11e2e4aaeb1;p=electrum-nvc.git diff --git a/scripts/merchant/merchant.py b/scripts/merchant/merchant.py index feedf91..9456f10 100644 --- a/scripts/merchant/merchant.py +++ b/scripts/merchant/merchant.py @@ -21,7 +21,7 @@ import time, thread, sys, socket, os import urllib2,json import Queue import sqlite3 -from electrum import Wallet, WalletStorage, SimpleConfig, Network, set_verbosity +from electrum_nvc import Wallet, WalletStorage, SimpleConfig, Network, set_verbosity set_verbosity(False) import ConfigParser @@ -167,7 +167,7 @@ if __name__ == '__main__': wallet = Wallet(storage) if not storage.file_exists: wallet.seed = '' - wallet.create_watching_only_wallet(master_chain,master_public_key) + wallet.create_watching_only_wallet(master_public_key,master_chain) wallet.synchronize = lambda: None # prevent address creation by the wallet wallet.start_threads(network) @@ -218,10 +218,10 @@ if __name__ == '__main__': cur.execute("""UPDATE electrum_payments set paid=0 WHERE expires_at < CURRENT_TIMESTAMP and paid is NULL;""") # do callback for addresses that received payment or expired - cur.execute("""SELECT address, paid from electrum_payments WHERE paid is not NULL and processed is NULL;""") + cur.execute("""SELECT oid, address, paid from electrum_payments WHERE paid is not NULL and processed is NULL;""") data = cur.fetchall() for item in data: - address, paid = item + oid, address, paid = item paid = bool(paid) headers = {'content-type':'application/json'} data_json = { 'address':address, 'password':cb_password, 'paid':paid } @@ -230,7 +230,8 @@ if __name__ == '__main__': req = urllib2.Request(url, data_json, headers) try: response_stream = urllib2.urlopen(req) - cur.execute("UPDATE electrum_payments SET processed=1 WHERE id=%d;"%(id)) + print 'Got Response for %s' % address + cur.execute("UPDATE electrum_payments SET processed=1 WHERE oid=%d;"%(oid)) except urllib2.HTTPError: print "cannot do callback", data_json except ValueError, e: