def send_money(phone_number): try: dw = DwollaUser('CQOdqAEDtrRgUqPXdMmT4UL2BiCH6QPYX59mKelw6tKaN90uOH') transactionId = dw.send_funds(0.01, phone_number, '4810', dest_type='Phone') print 'Sending file' print transactionId except Exception as e: print 'Failed to send money --> ' + str(e)
def transfer_funds(amount, src_token, dest_id, src_pin): amount = 0.02 user = DwollaUser(src_token) print "About to make transfer... Balance: %.2f" % user.get_balance() transaction_id = user.send_funds(amount, dest_id, src_pin) print "Transfer complete... Balance: %.2f" % user.get_balance() mongo = MongoClient() db = mongo.credit_exchange transactions = db.transactions transactions.save(user.get_transaction(transaction_id))
def send_funds(token, dwolla_account, amount, pin, notes=None, funds_source=None, metadata={}): dwolla_user = DwollaUser(token) tid = dwolla_user.send_funds(amount, dwolla_account, pin, notes=notes, funds_source=funds_source, metadata=metadata) return tid
# Include the Dwolla REST Client from dwolla import DwollaUser # Include any required keys import _keys # Instantiate a new Dwolla User client # And, Sseed a previously generated access token DwollaUser = DwollaUser(_keys.token) ''' EXAMPLE 1: Send money ($1.00) to a Dwolla ID ''' transaction = DwollaUser.send_funds(1.00, '812-626-8794', _keys.pin) print(transaction) ''' EXAMPLE 2: Send money ($1.00) to an email address, with a note ''' transaction = DwollaUser.send_funds(1.00, '*****@*****.**', _keys.pin, 'Everyone loves getting money', dest_type="Email") print(transaction)
email = '*****@*****.**' # Include the Dwolla REST Client from dwolla import DwollaUser # Instantiate a new Dwolla User client # And, Seed a previously generated access token Dwolla = DwollaUser('OAUTH_TOKEN') transaction = Dwolla.send_funds(0.01, email, 'PIN', dest_type='Email') print('Transaction ID: %s' % transaction)
''' Dwolla makes it easy to send money to anyone who's connected to the internet. In this example know Dwolla by sending money to your email address. ''' email = '*****@*****.**' # Your email ID # Dwolla REST Client from dwolla import DwollaUser Dwolla = DwollaUser('OAUTH_TOKEN') transaction = Dwolla.send_funds(0.01, email, 'PIN', dest_type='Email') print('Transaction ID: %s' % transaction)
# Include the Dwolla REST Client from dwolla import DwollaUser # Include any required keys import _keys # Instantiate a new Dwolla User client # And, Seed a previously generated access token DwollaUser = DwollaUser(_keys.token) """ EXAMPLE 1: Send money ($1.00) to a Dwolla ID """ transaction = DwollaUser.send_funds(0.01, "812-626-8794", _keys.pin) print(transaction) """ EXAMPLE 2: Send money ($1.00) to an email address, with a note """ transaction = DwollaUser.send_funds( 1.00, "*****@*****.**", _keys.pin, "Everyone loves getting money", dest_type="Email" ) print(transaction)
def found_item(): item = str(request.values.get('Body', None)) number = format(request.values.get('From', None)) message = "" if internet: db = mongo.db number_obj = db.numbers.find_one({'Number': number}) active_hunt = None if number_obj != None: active_hunt = number_obj['activehunt'] #User starts a hunt if active_hunt == None: #Checks whether 'item' (a hunt name) is a valid huntname active_hunt = db.hunts.find_one({'huntname':item}) if active_hunt == None: #hunt is not valid message = message + "Hunt ("+item+") not found." resp = twilio.twiml.Response() resp.message(message) return str(resp) else: if internet: #hunt is valid, so add a number to numbers database db.numbers.insert({"Number": number, "activehunt": active_hunt, "cluenumber": 0}) clues = json.loads(active_hunt['clues']) message = message + "You have registed for " + active_hunt['huntname'] + ". Clue:" + clues[0] resp = twilio.twiml.Response() #update participants participants = active_hunt['participants'] db.hunts.update({'_id':active_hunt['_id']},{'$set':{'participants':participants+1}},upsert=False, multi=False) resp.message(message) return str(resp) else: return "no internet" #number is registered with a hunt user = db.numbers.find_one({'Number':number}) keys = json.loads(active_hunt['keys']) clues = json.loads(active_hunt['clues']) index = user['cluenumber'] if item == keys[index]: #Correct answer index = index + 1 message = "Congrats! You found " + item + ". " #update cluenumber db.numbers.update({'_id':user['_id']},{'$set':{'cluenumber':index}},upsert=False, multi=False) if index >= len(keys): #You're done. Remove number from database active_hunt = db.hunts.find_one({'huntname':user['activehunt']['huntname']}) left = active_hunt['prize'] reward = active_hunt['reward'] if left>=reward: db.numbers.update({'_id':active_hunt['_id']},{'$set':{'prize':left-reward}},upsert=False, multi=False) person = db.users.find_one({'Email':active_hunt['Email']}) DU = DwollaUser(person['token']) DU.send_funds(active_hunt['reward'], user['Number'][2:], person['pin'], dest_type="Phone") message = message + "Congratulations! You have won $("+str(active_hunt['reward'])+")!" resp = twilio.twiml.Response() resp.message(message) return str(resp) else: message = message + "Congratulations! You have won. However, all the rewards have already been plundered. :'(" resp = twilio.twiml.Response() resp.message(message) return str(resp) if internet: db.numbers.remove({'Number':number}) else: message = message + "Clue:" + clues[index] resp = twilio.twiml.Response() resp.message(message) else: message = "Sorry (" + item+") is not the right answer." resp = twilio.twiml.Response() resp.message(message) return str(resp)
# Include the Dwolla REST Client from dwolla import DwollaUser # Include any required keys import _keys # Instantiate a new Dwolla User client # And, Seed a previously generated access token DwollaUser = DwollaUser(_keys.token) ''' EXAMPLE 1: Send money ($1.00) to a Dwolla ID ''' transaction = DwollaUser.send_funds(0.01, '812-626-8794', _keys.pin) print(transaction) ''' EXAMPLE 2: Send money ($1.00) to an email address, with a note ''' transaction = DwollaUser.send_funds(1.00, '*****@*****.**', _keys.pin, 'Everyone loves getting money', dest_type="Email") print(transaction)
######Copyright 2013 by Akshay Ratan <*****@*****.**> from dwolla import DwollaUser Dwolla = DwollaUser('OAUTH_TOKEN') Dwolla.send_funds(1.00,'*****@*****.**', '812-734-7288',dest_type='Email')