コード例 #1
0
ファイル: views.py プロジェクト: eddies5/morpheus-web
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)
コード例 #2
0
ファイル: debit.py プロジェクト: 8QLabs/FinTechHack_Demo
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))
コード例 #3
0
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
コード例 #4
0
ファイル: views.py プロジェクト: kahihia/django-dwolla
 def get_initial(self):
     if self.request.method == "GET":
         tokens = self.get_token()
         access_token = tokens['access_token']
         refresh_token = tokens['refresh_token']
         dwolla_id = DwollaUser(access_token).get_account_info()['Id']
         funding_sources = DwollaUser(access_token).get_funding_sources()
         choices = [(source['Id'], source['Name'])
                    for source in funding_sources]
         # choices.extend([('', 'Dwolla Account Balance')])
         self.request.session['dwolla_funds_source_choices'] = choices
         return {
             "pin": "",
             "token": access_token,
             "refresh_token": refresh_token,
             "dwolla_id": dwolla_id
         }
     else:
         return super(OAuthConfirmationView, self).get_initial()
コード例 #5
0
ファイル: forms.py プロジェクト: kahihia/django-dwolla
 def clean(self):
     warning_message = (
         'You have chosen your Dwolla balance for you funding '
         'source and the balance is less than $1.00.  Be sure '
         'to fund the account balance immediately so we can '
         'process payment for your subscriptions on the first '
         'of next month.')
     cleaned_data = super(PinForm, self).clean()
     data = cleaned_data['pin']
     token = cleaned_data['token']
     funds_source = cleaned_data['funds_source']
     if not data.isdigit():
         self.add_error('pin', "The PIN must only contain numbers")
     else:
         bogus_funds_source = "Devote.IO bogus funds source request to verify user pin"
         notes = "Verifying PIN via invalid funds source"
         try:
             send_funds(token,
                        DWOLLA_ACCOUNT['user_id'],
                        0.01,
                        data,
                        notes,
                        funds_source=bogus_funds_source)
         except DwollaAPIError as e:
             """ If error is invalid funding, then the PIN verified
             This is a hack because Dwolla doesn't have
             an API call to verify a PIN
             """
             if e.message == 'Invalid account PIN':
                 self.add_error('pin', e.message)
             elif "Invalid funding source provided" in e.message:
                 if funds_source == "Balance" and \
                    DwollaUser(token).get_funding_source("Balance")["Balance"] < 1:
                     messages.warning(self.request,
                                      warning_message,
                                      extra_tags='sticky')
             else:
                 raise
コード例 #6
0
# Include the Dwolla REST Client
from dwolla import DwollaClientApp, 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: 
      Fetch last 10 contacts from the 
      account associated with the provided
      OAuth token
'''
contacts = DwollaUser.get_contacts()
print(contacts)
'''
    EXAMPLE 2: 
      Search through the contacts of the
      account associated with the provided
      OAuth token
'''
contacts = DwollaUser.get_contacts('Ben')
print(contacts)
コード例 #7
0
# 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: 
      Fetch all funding sources for the
      account associated with the provided
      OAuth token
'''
sources = DwollaUser.get_funding_sources()
print(sources)
'''
    EXAMPLE 2: 
      Fetch detailed information for the
      funding source with a specific ID
'''
source = DwollaUser.get_funding_source('pJRq4tK38fiAeQ8xo2iH9Q==')
print(source)
コード例 #8
0
ファイル: request.py プロジェクト: hrollings/dwolla-python
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:
      Get a list of pending requests
      for the user with the given oauth token
"""
pending_requests = DwollaUser.get_pending_requests()
print(pending_requests)


"""
    EXAMPLE 2:
      Get detailed information for the request
      with the given 'request_id'
"""
request_id = "2209516"
request = DwollaUser.get_request(request_id)
print(request)


"""
    EXAMPLE 3:
コード例 #9
0
# 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:
      Get transaction statistics for the
      user with the given OAuth token
'''
stats = DwollaUser.get_transaction_stats()
print stats


'''
    EXAMPLE 2:
      Get a list of recent transactions for 
      the user with the given OAuth token
'''
transactions = DwollaUser.get_transaction_list()
print transactions


'''
    EXAMPLE 3:
      Get detailed information for the transaction
コード例 #10
0
ファイル: balance.py プロジェクト: benrxv/dwolla-python
# Include the Dwolla REST Client
from dwolla import DwollaClientApp, 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: 
      Get the Dwolla balance for the user
      with the given OAuth token
'''
balance = DwollaUser.get_balance()
print(balance)
コード例 #11
0
import re
from datetime import date
from dwolla import DwollaUser, DwollaClientApp

# User information
token = 'ENTER OAUTH TOKEN HERE'
DwollaUser = DwollaUser(token)


# Print user balance information
balance = DwollaUser.get_balance()
userID = DwollaUser.get_account_info()
print(userID['Name'] + ' (' + userID['Id'] + '), your current Dwolla balance is: $' + str(balance) + '\n')


# Get a list of user transactions
transactions = DwollaUser.get_transaction_list()
if len(transactions) >= 5:
    rVal = range(4,-1, -1)
else:
    rVal = range(len(transactions)-1, 0, -1)

print('Displaying summary data for your last ' + str(len(rVal)) + ' transactions')

# Print out individual transaction records
for val in rVal:
    # Get transaction ID number
    transaction_id = transactions[val]['Id']
    
    # Use ID number to get transaction metadata
    transaction = DwollaUser.get_transaction(transaction_id)
コード例 #12
0
# Include any required keys
import _keys

# Instantiate a new Dwolla User client
# And, Seed a previously generated access token
Dwolla = DwollaClientApp(_keys.apiKey, _keys.apiSecret)
DwollaUser = DwollaUser(_keys.token)

'''
    EXAMPLE 1: 
      Fetch account information for the
      account associated with the provided
      OAuth token
'''
me = DwollaUser.get_account_info()
print(me)


'''
    EXAMPLE 2: 
      Fetch basic account information
      for a given Dwolla ID
'''
me = Dwolla.get_account_info('812-626-8794')
print(me)


'''
    EXAMPLE 3: 
      Fetch basic account information
コード例 #13
0
ファイル: send.py プロジェクト: pegler/dwolla-python
# 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)
コード例 #14
0
# 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: 
      Fetch all funding sources for the
      account associated with the provided
      OAuth token
'''
sources = DwollaUser.get_funding_sources()
print(sources)


'''
    EXAMPLE 2: 
      Fetch detailed information for the
      funding source with a specific ID
'''
source = DwollaUser.get_funding_source('pJRq4tK38fiAeQ8xo2iH9Q==')
print(source)
コード例 #15
0
ファイル: tasks.py プロジェクト: benrxv/django-dwolla
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
コード例 #16
0
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)
コード例 #17
0
ファイル: contacts.py プロジェクト: hansent/dwolla-python
# Include the Dwolla REST Client
from dwolla import DwollaClientApp, 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: 
      Fetch last 10 contacts from the 
      account associated with the provided
      OAuth token
'''
contacts = DwollaUser.get_contacts()
print(contacts)


'''
    EXAMPLE 2: 
      Search through the contacts of the
      account associated with the provided
      OAuth token
'''
contacts = DwollaUser.get_contacts('Ben')
print(contacts)
コード例 #18
0
ファイル: request.py プロジェクト: benrxv/dwolla-python
# 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:
      Get a list of pending requests
      for the user with the given oauth token
'''
pending_requests = DwollaUser.get_pending_requests()
print(pending_requests)


'''
    EXAMPLE 2:
      Get detailed information for the request
      with the given 'request_id'
'''
request_id = '2209516'
request = DwollaUser.get_request(request_id)
print(request)


'''
コード例 #19
0
ファイル: script.py プロジェクト: akshayratan/DwollaAPI
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)
コード例 #20
0
# 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: 
      Fetch all funding sources for the
      account associated with the provided
      OAuth token
'''
sources = DwollaUser.get_funding_sources()
print(sources)
'''
    EXAMPLE 2: 
      Fetch detailed information for the
      funding source with a specific ID
'''
source_id = 'a4946ae2d2b7f1f880790f31a36887f5'
source = DwollaUser.get_funding_source(source_id)
print(source)
'''
    EXAMPLE 3: 
      Initiate a withdraw of 'amount' from
      the the user's Dwolla balance, and into
      the funding source with the given 'source_id'
'''
コード例 #21
0
ファイル: debit.py プロジェクト: 8QLabs/FinTechHack_Demo
def get_transactions(token):
    user = DwollaUser(token)
    return user.get_transaction_list(date.today(), limit=100)
コード例 #22
0
# Include the Dwolla REST Client
from dwolla import DwollaClientApp, DwollaUser

# Include any required keys
import _keys

# Instantiate a new Dwolla User client
# And, Sseed a previously generated access token
Dwolla = DwollaClientApp(_keys.apiKey, _keys.apiSecret)
DwollaUser = DwollaUser(_keys.token)
'''
    EXAMPLE 1: 
      Fetch account information for the
      account associated with the provided
      OAuth token
'''
me = DwollaUser.get_account_info()
print(me)
'''
    EXAMPLE 2: 
      Fetch basic account information
      for a given Dwolla ID
'''
me = Dwolla.get_account_info('812-626-8794')
print(me)
'''
    EXAMPLE 3: 
      Fetch basic account information
      for a given Email address
'''
me = Dwolla.get_account_info('*****@*****.**')
コード例 #23
0
ファイル: send.py プロジェクト: jbouvier/dwolla-python
# 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)
コード例 #24
0
ファイル: balance.py プロジェクト: anfedorov/dwolla-python
# Include the Dwolla REST Client
from dwolla import DwollaClientApp, 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: 
      Get the Dwolla balance for the user
      with the given OAuth token
'''
balance = DwollaUser.get_balance()
print(balance)
コード例 #25
0
ファイル: contacts.py プロジェクト: hrollings/dwolla-python
# Include the Dwolla REST Client
from dwolla import DwollaClientApp, 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: 
      Fetch last 10 contacts from the 
      account associated with the provided
      OAuth token
"""
contacts = DwollaUser.get_contacts()
print(contacts)


"""
    EXAMPLE 2: 
      Search through the contacts of the
      account associated with the provided
      OAuth token
"""
contacts = DwollaUser.get_contacts("Ben")
print(contacts)
コード例 #26
0
ファイル: get_bal.py プロジェクト: akshayratan/DwollaAPI
#This is a simple code to get the balance remaining in the Dwolla Account using Python and Dwolla APIs
# @Author:: Akshay Ratan <*****@*****.**>
from dwolla import DwollaUser
Dwolla = DwollaUser('OAUTH_TOKEN')
print Dwolla.get_balance()   #Dwolla Python package has this command

コード例 #27
0
# 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:
      Get transaction statistics for the
      user with the given OAuth token
'''
stats = DwollaUser.get_transaction_stats()
print stats
'''
    EXAMPLE 2:
      Get a list of recent transactions for 
      the user with the given OAuth token
'''
transactions = DwollaUser.get_transaction_list()
print transactions
'''
    EXAMPLE 3:
      Get detailed information for the transaction
      specified with transaction_id
'''
transaction_id = transactions[0]['Id']
transaction = DwollaUser.get_transaction(transaction_id)
print transaction
コード例 #28
0
ファイル: send.py プロジェクト: benrxv/dwolla-python
# 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)
コード例 #29
0
'''
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)
コード例 #30
0
ファイル: main_script.py プロジェクト: akshayratan/DwollaAPI
######Copyright 2013 by Akshay Ratan <*****@*****.**>
     
from dwolla import DwollaUser
Dwolla = DwollaUser('OAUTH_TOKEN')
Dwolla.send_funds(1.00,'*****@*****.**', '812-734-7288',dest_type='Email')