From 94cc421d87a72babe633cf4e983e93054af88608 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Fri, 23 Dec 2016 09:10:17 -0500 Subject: [PATCH 1/3] Implement a check for whether we posted masspay --- bin/masspay.py | 5 ++++ tests/py/test_dashboard.py | 47 +++++++++++++++++++++++++++++++++++++ www/dashboard/nmasspays.spt | 16 +++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 tests/py/test_dashboard.py create mode 100644 www/dashboard/nmasspays.spt diff --git a/bin/masspay.py b/bin/masspay.py index b7ea3bd856..7713636a68 100755 --- a/bin/masspay.py +++ b/bin/masspay.py @@ -193,6 +193,11 @@ def post_back_to_gratipay(): except KeyError: gratipay_base_url = 'https://gratipay.com' + nmasspays = int(requests.get(gratipay_base_url + '/dashboard/nmasspays').text()) + if nmasspays < 10: + print("It looks like we didn't run MassPay last week! Bailing ...") + return + statuses = load_statuses() nposts = 0 diff --git a/tests/py/test_dashboard.py b/tests/py/test_dashboard.py new file mode 100644 index 0000000000..92bb0cce1b --- /dev/null +++ b/tests/py/test_dashboard.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function, unicode_literals + +from gratipay.testing.billing import BillingHarness + + +class TestNMassPays(BillingHarness): + + # nmp - nmasspays + + def setUp(self): + BillingHarness.setUp(self) + self.make_participant('admin', claimed_time='now', is_admin=True).username + + def post_masspay(self, username, route, amount): + self.client.PxST( '/~{}/history/record-an-exchange'.format(username) + , { 'amount': unicode(amount) + , 'fee': '0' + , 'note': 'Exchange!' + , 'status': 'succeeded' + , 'route_id': unicode(route.id) + } + , auth_as='admin' + ) # responds with 302 + + + def test_nmp_returns_zero_for_no_paydays(self): + self.client.GET('/dashboard/nmasspays').body == '0' + + def test_nmp_returns_zero_for_no_masspays(self): + self.run_payday() + self.client.GET('/dashboard/nmasspays').body == '0' + + def test_nmp_returns_one_for_one_payday_with_one_masspay(self): + team = self.make_team(owner=self.homer, is_approved=True) + self.obama.set_payment_instruction(team, '20.00') + self.run_payday() + self.post_masspay('homer', self.homer_route, 20) + self.client.GET('/dashboard/nmasspays').body == '1' + + def test_nmp_returns_one_for_many_paydays_with_one_masspay(self): + team = self.make_team(owner=self.homer, is_approved=True) + self.obama.set_payment_instruction(team, '20.00') + for i in range(10): + self.run_payday() + self.post_masspay('homer', self.homer_route, 20) + self.client.GET('/dashboard/nmasspays').body == '1' diff --git a/www/dashboard/nmasspays.spt b/www/dashboard/nmasspays.spt new file mode 100644 index 0000000000..7bf67dbcad --- /dev/null +++ b/www/dashboard/nmasspays.spt @@ -0,0 +1,16 @@ +[--------] +nmasspays = website.db.one(""" + + WITH payday AS (SELECT ts_start FROM paydays ORDER BY ts_start DESC LIMIT 1) + + SELECT count(*) + FROM exchanges e + JOIN exchange_routes er + ON e.route = er.id + WHERE er.network = 'paypal' + AND e.amount < 0 + AND timestamp > (SELECT ts_start FROM payday) + +""") +[--------] text/plain +{{ nmasspays }} From 916188404e94ed9113ae4e8c98b4611962579f5e Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Fri, 23 Dec 2016 09:13:30 -0500 Subject: [PATCH 2/3] Test fixture --- tests/py/fixtures/TestNMassPays.yml | 279 ++++++++++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 tests/py/fixtures/TestNMassPays.yml diff --git a/tests/py/fixtures/TestNMassPays.yml b/tests/py/fixtures/TestNMassPays.yml new file mode 100644 index 0000000000..15b7762c13 --- /dev/null +++ b/tests/py/fixtures/TestNMassPays.yml @@ -0,0 +1,279 @@ +interactions: +- request: + body: !!python/unicode bkhpqm20.9111443524salefalse2 + headers: {} + method: POST + uri: https://api.sandbox.braintreegateway.com:443/merchants/j9gwdfjdkxymhdgr/transactions + response: + body: + string: !!binary | + H4sIADkvXVgAA9xYTY/bNhC951csfOfKsrUbb6BVUKBo0UN7SdJDLwFFjS3GEsmQlNfOr+9QlGRp + Re1uDwWK3qyZxyFnOB+PTj+e6+rmBNpwKR5X8e16dQOCyYKLw+Pq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ZB+D/a6taFAUu8cf0iWg/+01JdDKlnhiZMLiKOST + SKORzIMKyLm96v1np2o0Xhxm4aGpHPEboZ5rhhniGC2OySt0JOvb4EXLaoToBV34jGmwi+IUFMcr + ZiKddmW5J05LBYPMbTeX9nGSRcPaRnvd+irzoEbw7w10lYRijDzHVqyzZMt2SbwvGNuy7f7+fnt/ + t4e7eL1lsIOcYY4vLvWWTyBqSUxxXKi0Qd+NgWmldc8hUnJMS32ZUI1hTLcIQEPdBbryRDqPilq9 + keIP+MHCi++wFrH0lPIBNRgBLUtuFW2qI5ZsKxnON2JFRmI7g4wqjueYy72X0XM3B0kXGt8YKxpm + WU1umOZqkYWN9EMbaykmUTj1ZUGQ6BAXxEDhP0PisbQNYvHIz/Zx04HgIAhQyIKbNqeDOvBWZJ9k + Cy1p6f2DTWR+tqlRpGfuAY1+LeTtoPcDAl+zAuZW8c5PbqLtAZZmkdtWPhF/mzMthiFvtPEMuQCL + T8CeV01V4bsZ0evw9lPM7D+DN8Lh7AKA7VmHj+GeGpipSO1CBhvGAuwZb2TBd+e5aiyEUqObK4QL + 5GqNf664Wer7ylfXV9JoCTRlOyNHp6RoTHgWQa/bainSa7YGHmVLnKAEy8vlHeDR93IasUnzyN79 + DQAA//8DABMdB3+UEgAA + headers: + cache-control: ['max-age=0, private, must-revalidate'] + content-encoding: [gzip] + content-type: [application/xml; charset=utf-8] + etag: [W/"6a6cdff3ec2645c2292b016b70572cf3"] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 201, message: Created} +- request: + body: 20.91 + headers: {} + method: PUT + uri: https://api.sandbox.braintreegateway.com:443/merchants/j9gwdfjdkxymhdgr/transactions/k0tqp8ks/submit_for_settlement + response: + body: + string: !!binary | + H4sIADovXVgAA9xYS2/jNhC+768IfGdk2XLWWShaFCha9NBe9nHoJaCokcW1RGpJyrH313coSrIU + UUmAosCiN2vm45AznMdHxx/PVXlzAqW5FA+r8Ha9ugHBZ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/b+txeEjiBNXUljAg6YiS+UZ2cdgv2srCmqK3eMvaRPQ/Xaa + AmhpCjwxMmFxFPJJxMFI5kAZpNxc9e6zUzUKLw6z8NCUlviNUM81wwyxjBbH5BU6kvVt8KJkOUL0 + gi58WjfYRXEKiuMVM5FOu7LMidVSwSCx282lfZxk1rC20V63vsocqBH8ewNdJaEYI8+xFask2rJ9 + FOYZY1u2ze/utne7HHbhestgDynDHF9c6iyfQFSS6Oy4UGmDvhsD00rrHkek4JiW6jKhGsOYbhGA + hroLtOWJdB4VVf3GJ8KAHyx0j64rkxm/w1rE0lPKBVRjBJQsuKlpUx6xZFvJcL4RK9IS2xkktOZ4 + jrnceRnM3fz3nu9e8vwt79GfIA6DpEsRNyBK6mebTaqZ4vUiGx3ph3beUm1SI/uRGUHCR2xIPQ3w + GRKPpYwXi0d+to+dkgQHoodKZ1y3te3VgbMi+2JbaM1L70BspvOzTY0iTbV/JKBfC/U76N2gxFe9 + gLlVvPOTnew5wNJMttvKJ+Juc6bFMKSN0u6lkIHBp3DPL6cq/92Mnhn+7aeY2X8nb4TD2QYAx5Ty + H8M+uTBTkeL6DDaMeV4ReCMLvlvP68aALzW6+Uq4QM7auGeb5RSuvz7a/hoHS6Ap6xs5OiWHY+K3 + CHrdVksVX7M18ElTIJMgWF427wCPnstpxCbNI3n3DwAAAP//AwBQRxgwqhMAAA== + headers: + cache-control: ['max-age=0, private, must-revalidate'] + content-encoding: [gzip] + content-type: [application/xml; charset=utf-8] + etag: [W/"6de595490b11e91ae9ad8979463bc89c"] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: !!python/unicode bkhpqm20.9111443524salefalse2 + headers: {} + method: POST + uri: https://api.sandbox.braintreegateway.com:443/merchants/j9gwdfjdkxymhdgr/transactions + response: + body: + string: !!binary | + H4sIADsvXVgAA9xYS2/jNhC+51cEvjOy/EicQFFQYFGgBdrLbrZoLwFFjS3GEq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BQDV2d32VKMqFLZwm46+w5WILONmm + /1QAZmv6lMudDA7o/1Updg8gDlxJYQH3moo0kUdkH539pq0oKCl2j9+lTUD322kyoLnJ8MTIhMVe + yBcRBT2ZA6WQcHPWu89GVSm8OMzCXZVb4tdDvdV0M8QyWhyTZ2hP1rbBk5J5D9EKmvBpXWEXxSko + 9mfMQDrsynJLrJYKBrHdbixt4yTTitWN9rz1WeZAleA/KmgqCcUYeY6tWMWrJduswm3K2JItt9fX + y+v1FtbhfMlgAwnDHJ9c6iwfQBSS6HQ/UWmdvhkDw0prnkMk45iW6jSgGt2YrhGAhpoLtOWJdB4V + RflJit/hOwvvvsNqxNRTygVUYwSUzLgpaZXvsWRrSXe+HivSEtsZxLTkeI6x3HkZvHWzkzShcY0x + p36WVSWaKV5OsrCevmtjNcUkJU59mRIkOsQG0VP4b5B4LGW8WDzym33sdCA4CDwUMuW6zmmvDpwV + 2SbZREuaev9gExmfbWgU6Zl9QKNfE3nb6d2AwNesgLFVvPODnWhbgKlZZLeVL8Td5kiLYUgqpR1D + TsHgE7DlVUOV/2569Nq//RAz+s/gk3A42gBge1b+Y9inBmYqUjufwYoxD3vGG5nw3XpeVgZ8qdHM + FcIFcrXKPVfsLHV95cn2lSiYAg3ZTs/RISnqE55J0Me2aor0ka2OR5kMJyjB8rJ5B3j0rRxGbNA8 + 4ou/AQAA//8DAPhmT7GUEgAA + headers: + cache-control: ['max-age=0, private, must-revalidate'] + content-encoding: [gzip] + content-type: [application/xml; charset=utf-8] + etag: [W/"09c18617c846ba40272404c7fb27d7d6"] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 201, message: Created} +- request: + body: 20.91 + headers: {} + method: PUT + uri: https://api.sandbox.braintreegateway.com:443/merchants/j9gwdfjdkxymhdgr/transactions/e733859z/submit_for_settlement + response: + body: + string: !!binary | + H4sIADwvXVgAA9xYS2/jNhC+768IfGdk+ZE4gaJFgUWBFmgvu9uivQQUN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6IJt7/z8JLugdSqiHNjKn0fBFRjd9fXiaJc + 2MJpM/4aWy62gLNt+o8lYLamj4Xcy+CI/l9XYv8RxJErKSzgQVORJvKE7KO337YVBRXF7vG7tAno + fjtNDrQwOZ4YmbA4CPkkomAgc6AUEm4uevfZqmqFF4dZuK8LS/wGqJeafoZYRotj8gIdyLo2eFay + GCA6QRs+rWvsojgFxeGCGUnHXVlmxGqpYBDb7abSLk4yrVnTaC9bX2QOVAv+vYa2klCMkefYilW8 + WbPdJsxSxtZsnd3crG+2GWzD5ZrBDhKGOT671Fk+gigl0elhptJ6fTsGxpXWPo5IzjEt1XlENfox + 3SAADbUXaMsT6TwqyuqdT4Qe31toH10XJjN8hzWIuaeUC6jGCCiZc1PRujhgyTaS/nwDVqQltjOI + acXxHFO58zKYuvnvPd+95vl73qM/QBx6SZsibkAU1M8260QzxatZNjrQ9+28odqkQvYjU4KEj9iQ + ehrgCyQeSxkvFo/8Yh87JQkORA+VTrluaturA2dFdsU205rn3oHYTKdnGxtFmmr/SEC/Zuq317tB + ia96AVOreOdHO9kzgLmZbLeVT8Td5kSLYUhqpd1LIQWDT+GOX45V/rsZPDP8248xk/9O3gmHkw0A + jinlP4Z9cmGmIsX1GawZ87wi8EZmfLeeV7UBX2q085VwgZy1ds82yylcf320/TUK5kBj1jdwdEwO + h8RvFvS2rYYqvmWr55MmRyZBsLxs3gEePZPjiI2aR/zhHwAAAP//AwDaL1lVqhMAAA== + headers: + cache-control: ['max-age=0, private, must-revalidate'] + content-encoding: [gzip] + content-type: [application/xml; charset=utf-8] + etag: [W/"7e3ba8dddc17ffb08a4384f145096708"] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: !!python/unicode bkhpqm20.9111443524salefalse2 + headers: {} + method: POST + uri: https://api.sandbox.braintreegateway.com:443/merchants/j9gwdfjdkxymhdgr/transactions + response: + body: + string: !!binary | + H4sIAD4vXVgAA9xYS2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cpJdTFrJsw+3vPLyieyCNKpPCmFo/BAHV2N31TaooF7Zwuoy/wZaLLeBs + m/73CjBbs++l3MvgiP7f1GL/EcSRKyks4FFTkaXyhOxjsN+1FQU1xe7xp7QJ6H47TQG0NAWeGJmw + OAj5LOJgJHOgDFJuLnr32akahReHWbhvSkv8RqiXmmGGWEaLY/ICHcn6NnhWshwhekEXPq0b7KI4 + BcXhgplIp11Z5sRqqWCQ2O3m0j5OMmtY22gvW19kDtQI/qOBrpJQjJHn2IpVEm3ZLgrzjLEt2+Z3 + d9u72xxuw/WWwQ5Shjm+uNRZPoKoJNHZYaHSBn03BqaV1j2HSMExLdV5QjWGMd0iAA11F2jLE+k8 + Kqr6nRR/wA8WXn2HtYilp5QLqMYIKFlwU9OmPGDJtpLhfCNWpCW2M0hozfEcc7nzMnjp5iDpQuMa + Y0n9LKtJNVO8XmRhI/3QxlqKSWqc+jIjSHSIDaKn8F8g8VjKeLF45Bf72OlAcBB4KGTGdZvTXh04 + K7JPsoWWtPT+wSYyP9vUKNIz+4BGvxbydtC7AYGvWQFzq3jnRzvRcoClWWS3lc/E3eZMi2FIG6Ud + Q87A4BOw51VTlf9uRvTav/0UM/vP4J1wONkAYHtW/mPYpwZmKlI7n8GGMQ97xhtZ8N16XjcGfKnR + zRXCBXK1xj1X7Cx1feW77StxsASasp2Ro1NSNCY8i6C3bbUU6S1bA48yBU5QguVl8w7w6LmcRmzS + PJKrfwAAAP//AwBGk0qIlBIAAA== + headers: + cache-control: ['max-age=0, private, must-revalidate'] + content-encoding: [gzip] + content-type: [application/xml; charset=utf-8] + etag: [W/"8fcf3b5aa3b03c6d47e6f3e931b05b80"] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 201, message: Created} +- request: + body: 20.91 + headers: {} + method: PUT + uri: https://api.sandbox.braintreegateway.com:443/merchants/j9gwdfjdkxymhdgr/transactions/1dygf0mg/submit_for_settlement + response: + body: + string: !!binary | + H4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ykMEUSYgXNhDPs + GahCPrNZT8CttNu3m/fE9qiWoH75dGEBF+nllIUs23D7Ow+v6B5Io8qkMKbW90FANXZ3fZ0qyoUt + nC7jr7HlYgs426b/WAFma/ZYyr0Mjuj/dS32H0AcuZLCAh40FVkqT8g+BvtdW1FQU+wef0ubgO63 + 0xRAS1PgiZEJi4OQTyIORjIHyiDl5qJ3n52qUXhxmIX7prTEb4R6rhlmiGW0OCYv0JGsb4NnJcsR + ohd04dO6wS6KU1AcLpiJdNqVZU6slgoGid1uLu3jJLOGtY32svVF5kCN4N8b6CoJxRh5jq1YJdGW + 7aIwzxjbsm1+e7u9vcnhJlxvGewgZZjji0ud5SOIShKdHRYqbdB3Y2Baad3jiBQc01KdJ1RjGNMt + AtBQd4G2PJHOo6Kq30jxB/xgoXt0XZjM+B3WIpaeUi6gGiOgZMFNTZvygCXbSobzjViRltjOIKE1 + x3PM5c7LYO7mT/b8Le/RXyAOg6RLETcgSupnm02qmeL1Ihsd6Yd23lJtUiP7kRlBwkdsSD0N8BkS + j6WMF4tHfraPnZIEB6KHSmdct7Xt1YGzIvtiW2jNS+9AbKbzs02NIk21fySgXwv1O+jdoMRXvYC5 + Vbzzo53sOcDSTLbbyifibnOmxTCkjdLupZCBwadwzy+nKv/djJ4Z/u2nmNl/J2+Ew8kGAMeU8h/D + PrkwU5Hi+gw2jHleEXgjC75bz+vGgC81uvlKuEDO2rhnm+UUrr8+2v4aB0ugKesbOTolh2Pitwh6 + 3VZLFV+zNfBJUyCTIFheNu8Aj57LacQmzSN59x8AAAD//wMAmFUoKKoTAAA= + headers: + cache-control: ['max-age=0, private, must-revalidate'] + content-encoding: [gzip] + content-type: [application/xml; charset=utf-8] + etag: [W/"7faa7f2e11efd502303f944c5a904c0f"] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: !!python/unicode authorized + headers: {} + method: POST + uri: https://api.sandbox.braintreegateway.com:443/merchants/j9gwdfjdkxymhdgr/transactions/advanced_search_ids + response: + body: + string: !!binary | + H4sIAEAvXVgAA7IpTk0sSs7QLUotLs0pKbbjUlCwKUhMT9UtzqxKVSipLEi1VcrMK0lNTy1SsjM1 + sNGHS4KVZqYUQxUlFhUlViqBBfWBonZcNvroRgMAAAD//wMA9crnoGwAAAA= + headers: + cache-control: ['max-age=0, private, must-revalidate'] + content-encoding: [gzip] + content-type: [application/xml; charset=utf-8] + etag: [W/"459758d784c7eb2495f7587b8055fbaf"] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +version: 1 From e5fd92b4d705f7c2cf4f92c8be8f08c0b5f03e67 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Thu, 9 Feb 2017 07:38:46 -0500 Subject: [PATCH 3/3] Add switch to force MassPay postback --- bin/masspay.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/masspay.py b/bin/masspay.py index 7713636a68..3b7b403a2c 100755 --- a/bin/masspay.py +++ b/bin/masspay.py @@ -181,7 +181,7 @@ def load_statuses(): return statuses -def post_back_to_gratipay(): +def post_back_to_gratipay(force=False): try: gratipay_api_key = os.environ['GRATIPAY_API_KEY'] @@ -194,8 +194,9 @@ def post_back_to_gratipay(): gratipay_base_url = 'https://gratipay.com' nmasspays = int(requests.get(gratipay_base_url + '/dashboard/nmasspays').text()) - if nmasspays < 10: - print("It looks like we didn't run MassPay last week! Bailing ...") + if nmasspays < 10 and not force: + print("It looks like we didn't run MassPay last week! If you are absolutely sure that we " + "did, then rerun with -f.") return statuses = load_statuses() @@ -271,7 +272,7 @@ def main(): elif '-o' in sys.argv: compute_output_csvs() elif '-p' in sys.argv: - post_back_to_gratipay() + post_back_to_gratipay('-f' in sys.argv) if __name__ == '__main__':