def compute_input_csv(): db = wireup.db(wireup.env()) routes = get_ready_payout_routes_by_network(db, 'paypal') writer = csv.writer(open(INPUT_CSV, 'w+')) print_rule(88) headers = "username", "email", "fee cap", "amount" print("{:<24}{:<32} {:^7} {:^7}".format(*headers)) print_rule(88) total_gross = 0 for route in routes: amount = route.participant.balance if amount < 0.50: # Minimum payout of 50 cents. I think that otherwise PayPal upcharges to a penny. # See https://github.com/gratipay/gratipay.com/issues/1958. continue total_gross += amount print("{:<24}{:<32} {:>7} {:>7}".format( route.participant.username , route.address , route.fee_cap , amount )) row = (route.participant.username, route.address, route.fee_cap, amount) writer.writerow(row) print(" "*64, "-"*7) print("{:>72}".format(total_gross))
def compute_input_csv(): db = wireup.db(wireup.env()) routes = get_ready_payout_routes_by_network(db, 'paypal') writer = csv.writer(open(INPUT_CSV, 'w+')) print_rule(88) headers = "username", "email", "fee cap", "amount" print("{:<24}{:<32} {:^7} {:^7}".format(*headers)) print_rule(88) total_gross = 0 for route in routes: amount = route.participant.balance if amount < 0.50: # Minimum payout of 50 cents. I think that otherwise PayPal upcharges to a penny. # See https://github.com/gratipay/gratipay.com/issues/1958. continue total_gross += amount print("{:<24}{:<32} {:>7} {:>7}".format( route.participant.username , route.address , route.fee_cap , amount )) row = (route.participant.username, route.address, route.fee_cap, amount) writer.writerow(row) print(" "*80, "-"*7) print("{:>88}".format(total_gross))
def test_grprbn_includes_1_0_payouts(self): alice = self.make_participant('alice', balance=24, status_of_1_0_payout='pending-payout', claimed_time='now') ExchangeRoute.insert(alice, 'paypal', '*****@*****.**') routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert [r.participant.username for r in routes] == ['alice']
def test_grprbn_includes_1_0_payouts(self): alice = self.make_participant( 'alice' , balance=24 , status_of_1_0_payout='pending-payout' , claimed_time='now' ) ExchangeRoute.insert(alice, 'paypal', '*****@*****.**') routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert [r.participant.username for r in routes] == ['alice']
def payout(self): """This is the second stage of payday in which we send money out to the bank accounts of participants. """ log("Starting payout loop.") routes = get_ready_payout_routes_by_network(self.db, 'balanced-ba') def credit(route): if route.participant.is_suspicious is None: log("UNREVIEWED: %s" % route.participant.username) return withhold = route.participant.giving error = ach_credit(self.db, route.participant, withhold) if error: self.mark_ach_failed() threaded_map(credit, routes) log("Did payout for %d participants." % len(routes)) self.db.self_check() log("Checked the DB.")
def test_grprbn_excludes_member_with_no_verified_identity(self): self.run_payday_with_member() self.homer.clear_identity(self.homer.list_identity_metadata()[0].country.id) routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert [r.participant.username for r in routes] == ['picard']
def test_grprbn_includes_former_team_members(self): enterprise = self.run_payday_with_member() enterprise.remove_member(self.homer, P('picard')) routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert list(sorted([r.participant.username for r in routes])) == ['homer', 'picard']
def test_grprbn_includes_team_members(self): self.run_payday_with_member() routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert list(sorted([r.participant.username for r in routes])) == ['homer', 'picard']
def test_grprbn_includes_team_owners(self): enterprise = self.make_team(is_approved=True) self.obama.set_payment_instruction(enterprise, 100) self.run_payday() routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert [r.participant.username for r in routes] == ['picard']
def test_grprbn_that_its_empty_to_start_with(self): assert get_ready_payout_routes_by_network(self.db, 'paypal') == []
def test_grprbn_excludes_member_with_no_verified_identity(self): self.run_payday_with_member() self.homer.clear_identity(self.homer.list_identity_metadata()[0].country.id) routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert [r.participant.username for r in routes] == ['picard']
def test_grprbn_includes_former_team_members(self): enterprise = self.run_payday_with_member() enterprise.remove_member(self.homer, P('picard')) routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert list(sorted([r.participant.username for r in routes])) == ['homer', 'picard']
def test_grprbn_includes_team_members(self): self.run_payday_with_member() routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert list(sorted([r.participant.username for r in routes])) == ['homer', 'picard']
def test_grprbn_includes_team_owners(self): enterprise = self.make_team(is_approved=True) self.obama.set_payment_instruction(enterprise, 100) self.run_payday() routes = get_ready_payout_routes_by_network(self.db, 'paypal') assert [r.participant.username for r in routes] == ['picard']
def test_grprbn_that_its_empty_to_start_with(self): assert get_ready_payout_routes_by_network(self.db, 'paypal') == []