def testget(self): transactions.get(another='parameter', alternate_token='AN OAUTH TOKEN', dwollaparse='dwolla') transactions.r._get.assert_any_call( '/transactions', { 'client_secret': 'SOME ID', 'another': 'parameter', 'client_id': 'SOME ID' }, { 'alternate_token': 'AN OAUTH TOKEN', 'dwollaparse': 'dwolla' })
constants.client_id = "zbDwIC0dWCVU7cQtfvGwVwVjvxwQfjaTgkVi+FZOmKqPBzK5JG" constants.client_secret = "ckmgwJz9h/fZ09unyXxpupCyrmAMe0bnUiMHF/0+SDaR9RHe99" constants.access_token = "aK6DdCVlIsR1hKvTbp8VCwnvci8cwaTLlW9edtbHJVmKoopnoe" constants.pin = 1234 # Example 1: Send $5.50 to a Dwolla ID. print transactions.send('812-197-4121', 5.50) # Return: # 113533 (Sender's transaction ID) # Example 2: List transactions for the user # associated with the current OAuth token. print transactions.get() # Return: # [ # { # "Id": 113533, # "Amount": 5.50, # "Date": "2014-12-13T05:07:15Z", # "Type": "money_sent", # "UserType": "Email", # "DestinationId": "812-197-4121", # "DestinationName": "Some Name", # "Destination": { # "Id": "812-197-4121", # "Name": "Some Name", # "Type": "dwolla", # "Image": ""
def testget(self): transactions.get(another='parameter', alternate_token='AN OAUTH TOKEN', dwollaparse='dwolla') transactions.r._get.assert_any_call('/transactions', {'client_secret': 'SOME ID', 'another': 'parameter', 'client_id': 'SOME ID'}, {'alternate_token':'AN OAUTH TOKEN', 'dwollaparse':'dwolla'})
print "reflec2r: Another instance already running; exiting." exit(-1) else: print "reflec2r: Lock obtained, starting application." shitty_mutex.value = '1' shitty_mutex.save() # Retrieve entire database for posterity. Check all new transactions # against them for insurance that we will not pay something # which has already been processed. old_tx_ids = [i for sub in Reflector.select(Reflector.tx).order_by(Reflector.id.desc()).tuples() for i in sub] print "reflec2r: Fetching transactions from Dwolla." # Query Dwolla for transactions txlist = t.get(types='money_received', limit=200) \ + t.get(types='money_received', limit=200, skip=200) \ + t.get(types='money_received', limit=200, skip=400) \ + t.get(types='money_received', limit=200, skip=600) \ + t.get(types='money_received', limit=200, skip=800) \ # Reimburse those that qualify for tx in txlist: if (tx['Id'] not in old_tx_ids) and (tx['Status'] == 'processed') and (tx['Notes'] != "reflec2r/do-not-reimburse"): r = t.send(tx['Source']['Id'], tx['Amount']) Reflector.create(amount=tx['Amount'], date=datetime.datetime.now(), refund=r, tx=tx['Id']).save() print "reflec2r: Successfully sent $" + str(tx['Amount']) + " to " + str(tx['Source']['Id']) else: print "reflec2r: Skipping transaction #" + str(tx['Id']) + ", already reflected or flagged." # Unlock mutex, exit
constants.client_id = "zbDwIC0dWCVU7cQtfvGwVwVjvxwQfjaTgkVi+FZOmKqPBzK5JG" constants.client_secret = "ckmgwJz9h/fZ09unyXxpupCyrmAMe0bnUiMHF/0+SDaR9RHe99" constants.access_token = "aK6DdCVlIsR1hKvTbp8VCwnvci8cwaTLlW9edtbHJVmKoopnoe" constants.pin = 1234 # Example 1: Send $5.50 to a Dwolla ID. print(transactions.send('812-197-4121', 5.50)) # Return: # 113533 (Sender's transaction ID) # Example 2: List transactions for the user # associated with the current OAuth token. print(transactions.get()) # Return: # [ # { # "Id": 113533, # "Amount": 5.50, # "Date": "2014-12-13T05:07:15Z", # "Type": "money_sent", # "UserType": "Email", # "DestinationId": "812-197-4121", # "DestinationName": "Some Name", # "Destination": { # "Id": "812-197-4121", # "Name": "Some Name", # "Type": "dwolla", # "Image": ""
def testget(self): transactions.get({'another': 'parameter'}) transactions.r._get.assert_any_call('/transactions', {'client_secret': 'SOME ID', 'oauth_token': 'AN OAUTH TOKEN', 'another': 'parameter', 'client_id': 'SOME ID'})