prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Move Payment Gateways to own subtab
  On `admin/settings/` add a subtab "Payment Gateways" and move the Paypal and Stripe here.
  
  ![screenshot from 2016-08-12 01 48 01](https://cloud.githubusercontent.com/assets/1583873/17608754/ed81ed04-602e-11e6-9e1a-444a1369aba2.png)
  
  ![screenshot from 2016-08-12 01 47 33](https://cloud.githubusercontent.com/assets/1583873/17608757/f19fce4c-602e-11e6-9bd0-e42e1d9b36b8.png)
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `app/settings/__init__.py`
  Content:
  ```
  1 import stripe
  2 from flask import current_app
  3 from sqlalchemy import desc
  4 from app.models.setting import Setting
  5 from app.models.fees import TicketFees
  6 
  7 
  8 def get_settings():
  9     """
  10     Use this to get latest system settings
  11     """
  12     if 'custom_settings' in current_app.config:
  13         return current_app.config['custom_settings']
  14     s = Setting.query.order_by(desc(Setting.id)).first()
  15     if s is None:
  16         set_settings(secret='super secret key')
  17     else:
  18         current_app.config['custom_settings'] = make_dict(s)
  19     return current_app.config['custom_settings']
  20 
  21 
  22 def set_settings(**kwargs):
  23     """
  24     Update system settings
  25     """
  26 
  27     if 'service_fee' in kwargs:
  28         ticket_service_fees = kwargs.get('service_fee')
  29         ticket_maximum_fees = kwargs.get('maximum_fee')
  30         from app.helpers.data_getter import DataGetter
  31         from app.helpers.data import save_to_db
  32         currencies = DataGetter.get_payment_currencies()
  33         for i, currency in enumerate(currencies):
  34             currency = currency.split(' ')[0]
  35             ticket_fee = TicketFees(currency=currency,
  36                                     service_fee=ticket_service_fees[i],
  37                                     maximum_fee=ticket_maximum_fees[i])
  38             save_to_db(ticket_fee, "Ticket Fees settings saved")
  39     else:
  40         setting = Setting(**kwargs)
  41         from app.helpers.data import save_to_db
  42         save_to_db(setting, 'Setting saved')
  43         current_app.secret_key = setting.secret
  44         stripe.api_key = setting.stripe_secret_key
  45         current_app.config['custom_settings'] = make_dict(setting)
  46 
  47 
  48 def make_dict(s):
  49     arguments = {}
  50     for name, column in s.__mapper__.columns.items():
  51         if not (column.primary_key or column.unique):
  52             arguments[name] = getattr(s, name)
  53     return arguments
  54
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/app/settings/__init__.py b/app/settings/__init__.py
  --- a/app/settings/__init__.py
  +++ b/app/settings/__init__.py
  @@ -30,7 +30,7 @@
           from app.helpers.data_getter import DataGetter
           from app.helpers.data import save_to_db
           currencies = DataGetter.get_payment_currencies()
  -        for i, currency in enumerate(currencies):
  +        for i, (currency, has_paypal, has_stripe) in enumerate(currencies):
               currency = currency.split(' ')[0]
               ticket_fee = TicketFees(currency=currency,
                                       service_fee=ticket_service_fees[i],
  
verification_info: {"golden_diff": "diff --git a/app/settings/__init__.py b/app/settings/__init__.py\n--- a/app/settings/__init__.py\n+++ b/app/settings/__init__.py\n@@ -30,7 +30,7 @@\n         from app.helpers.data_getter import DataGetter\n         from app.helpers.data import save_to_db\n         currencies = DataGetter.get_payment_currencies()\n-        for i, currency in enumerate(currencies):\n+        for i, (currency, has_paypal, has_stripe) in enumerate(currencies):\n             currency = currency.split(' ')[0]\n             ticket_fee = TicketFees(currency=currency,\n                                     service_fee=ticket_service_fees[i],\n", "issue": "Move Payment Gateways to own subtab\nOn `admin/settings/` add a subtab \"Payment Gateways\" and move the Paypal and Stripe here.\n\n![screenshot from 2016-08-12 01 48 01](https://cloud.githubusercontent.com/assets/1583873/17608754/ed81ed04-602e-11e6-9e1a-444a1369aba2.png)\n\n![screenshot from 2016-08-12 01 47 33](https://cloud.githubusercontent.com/assets/1583873/17608757/f19fce4c-602e-11e6-9bd0-e42e1d9b36b8.png)\n\n", "before_files": [{"content": "import stripe\nfrom flask import current_app\nfrom sqlalchemy import desc\nfrom app.models.setting import Setting\nfrom app.models.fees import TicketFees\n\n\ndef get_settings():\n    \"\"\"\n    Use this to get latest system settings\n    \"\"\"\n    if 'custom_settings' in current_app.config:\n        return current_app.config['custom_settings']\n    s = Setting.query.order_by(desc(Setting.id)).first()\n    if s is None:\n        set_settings(secret='super secret key')\n    else:\n        current_app.config['custom_settings'] = make_dict(s)\n    return current_app.config['custom_settings']\n\n\ndef set_settings(**kwargs):\n    \"\"\"\n    Update system settings\n    \"\"\"\n\n    if 'service_fee' in kwargs:\n        ticket_service_fees = kwargs.get('service_fee')\n        ticket_maximum_fees = kwargs.get('maximum_fee')\n        from app.helpers.data_getter import DataGetter\n        from app.helpers.data import save_to_db\n        currencies = DataGetter.get_payment_currencies()\n        for i, currency in enumerate(currencies):\n            currency = currency.split(' ')[0]\n            ticket_fee = TicketFees(currency=currency,\n                                    service_fee=ticket_service_fees[i],\n                                    maximum_fee=ticket_maximum_fees[i])\n            save_to_db(ticket_fee, \"Ticket Fees settings saved\")\n    else:\n        setting = Setting(**kwargs)\n        from app.helpers.data import save_to_db\n        save_to_db(setting, 'Setting saved')\n        current_app.secret_key = setting.secret\n        stripe.api_key = setting.stripe_secret_key\n        current_app.config['custom_settings'] = make_dict(setting)\n\n\ndef make_dict(s):\n    arguments = {}\n    for name, column in s.__mapper__.columns.items():\n        if not (column.primary_key or column.unique):\n            arguments[name] = getattr(s, name)\n    return arguments\n", "path": "app/settings/__init__.py"}], "after_files": [{"content": "import stripe\nfrom flask import current_app\nfrom sqlalchemy import desc\nfrom app.models.setting import Setting\nfrom app.models.fees import TicketFees\n\n\ndef get_settings():\n    \"\"\"\n    Use this to get latest system settings\n    \"\"\"\n    if 'custom_settings' in current_app.config:\n        return current_app.config['custom_settings']\n    s = Setting.query.order_by(desc(Setting.id)).first()\n    if s is None:\n        set_settings(secret='super secret key')\n    else:\n        current_app.config['custom_settings'] = make_dict(s)\n    return current_app.config['custom_settings']\n\n\ndef set_settings(**kwargs):\n    \"\"\"\n    Update system settings\n    \"\"\"\n\n    if 'service_fee' in kwargs:\n        ticket_service_fees = kwargs.get('service_fee')\n        ticket_maximum_fees = kwargs.get('maximum_fee')\n        from app.helpers.data_getter import DataGetter\n        from app.helpers.data import save_to_db\n        currencies = DataGetter.get_payment_currencies()\n        for i, (currency, has_paypal, has_stripe) in enumerate(currencies):\n            currency = currency.split(' ')[0]\n            ticket_fee = TicketFees(currency=currency,\n                                    service_fee=ticket_service_fees[i],\n                                    maximum_fee=ticket_maximum_fees[i])\n            save_to_db(ticket_fee, \"Ticket Fees settings saved\")\n    else:\n        setting = Setting(**kwargs)\n        from app.helpers.data import save_to_db\n        save_to_db(setting, 'Setting saved')\n        current_app.secret_key = setting.secret\n        stripe.api_key = setting.stripe_secret_key\n        current_app.config['custom_settings'] = make_dict(setting)\n\n\ndef make_dict(s):\n    arguments = {}\n    for name, column in s.__mapper__.columns.items():\n        if not (column.primary_key or column.unique):\n            arguments[name] = getattr(s, name)\n    return arguments\n", "path": "app/settings/__init__.py"}]}