prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Allow bank, cheque and onsite for payment_mode in orders schema
  **Describe the bug**
  Currently setting bank, cheque and onsite for payment_mode returns 422 error.
  
  **Expected behavior**
  Payment Mode should allow bank, cheque and onsite as options.
  
  --- 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/api/schema/orders.py`
  Content:
  ```
  1 from flask import request
  2 from marshmallow import post_dump, validates_schema, validate
  3 from marshmallow_jsonapi import fields
  4 from marshmallow_jsonapi.flask import Relationship
  5 
  6 from app import db
  7 from app.api.helpers.utilities import dasherize
  8 from app.api.schema.base import SoftDeletionSchema
  9 from utils.common import use_defaults
  10 
  11 
  12 class OnSiteTicketSchema(SoftDeletionSchema):
  13     class Meta:
  14         type_ = 'on-site-ticket'
  15         inflect = dasherize
  16 
  17     id = fields.Str(load_only=True, required=True)
  18     quantity = fields.Str(load_only=True, required=True)
  19 
  20 
  21 @use_defaults()
  22 class OrderSchema(SoftDeletionSchema):
  23     class Meta:
  24         type_ = 'order'
  25         self_view = 'v1.order_detail'
  26         self_view_kwargs = {'order_identifier': '<identifier>'}
  27         inflect = dasherize
  28 
  29     @post_dump
  30     def generate_payment_url(self, data):
  31         """
  32         generate payment url for an order
  33         :param data:
  34         :return:
  35         """
  36         if 'POST' in request.method or ('GET' in request.method and 'regenerate' in request.args) and 'completed' != \
  37            data["status"]:
  38             if data['payment_mode'] == 'stripe':
  39                 data['payment_url'] = 'stripe://payment'
  40         return data
  41 
  42     @validates_schema
  43     def initial_values(self, data):
  44         if data.get('payment_mode') is None and 'POST' in request.method:
  45             data['payment_mode'] = 'free'
  46         return data
  47 
  48     id = fields.Str(dump_only=True)
  49     identifier = fields.Str(dump_only=True)
  50     amount = fields.Float(validate=lambda n: n > 0, allow_none=True)
  51     address = fields.Str(allow_none=True)
  52     city = fields.Str(allow_none=True)
  53     state = fields.Str(db.String, allow_none=True)
  54     country = fields.Str(allow_none=True)
  55     zipcode = fields.Str(allow_none=True)
  56     completed_at = fields.DateTime(dump_only=True)
  57     created_at = fields.DateTime(dump_only=True)
  58     transaction_id = fields.Str(dump_only=True)
  59     payment_mode = fields.Str(default="free",
  60                               validate=validate.OneOf(choices=["free", "stripe", "paypal"]), allow_none=True)
  61     paid_via = fields.Str(dump_only=True)
  62     brand = fields.Str(dump_only=True)
  63     exp_month = fields.Str(dump_only=True)
  64     exp_year = fields.Str(dump_only=True)
  65     last4 = fields.Str(dump_only=True)
  66     status = fields.Str(validate=validate.OneOf(choices=["pending", "cancelled", "completed", "placed", "expired"]))
  67     discount_code_id = fields.Str(allow_none=True)
  68     payment_url = fields.Str(dump_only=True)
  69     cancel_note = fields.Str(allow_none=True)
  70     order_notes = fields.Str(allow_none=True)
  71     tickets_pdf_url = fields.Url(dump_only=True)
  72 
  73     # only used in the case of an on site attendee.
  74     on_site_tickets = fields.List(cls_or_instance=fields.Nested(OnSiteTicketSchema), load_only=True, allow_none=True)
  75 
  76     attendees = Relationship(attribute='ticket_holders',
  77                              self_view='v1.order_attendee',
  78                              self_view_kwargs={'order_identifier': '<identifier>'},
  79                              related_view='v1.attendee_list',
  80                              related_view_kwargs={'order_identifier': '<identifier>'},
  81                              schema='AttendeeSchemaPublic',
  82                              many=True,
  83                              type_='attendee')
  84 
  85     tickets = Relationship(attribute='tickets',
  86                            self_view='v1.order_ticket',
  87                            self_view_kwargs={'order_identifier': '<identifier>'},
  88                            related_view='v1.ticket_list',
  89                            related_view_kwargs={'order_identifier': '<identifier>'},
  90                            schema='TicketSchemaPublic',
  91                            many=True,
  92                            type_="ticket")
  93 
  94     user = Relationship(attribute='user',
  95                         self_view='v1.order_user',
  96                         self_view_kwargs={'order_identifier': '<identifier>'},
  97                         related_view='v1.user_detail',
  98                         related_view_kwargs={'id': '<user_id>'},
  99                         schema='UserSchemaPublic',
  100                         type_="user")
  101 
  102     event = Relationship(attribute='event',
  103                          self_view='v1.order_event',
  104                          self_view_kwargs={'order_identifier': '<identifier>'},
  105                          related_view='v1.event_detail',
  106                          related_view_kwargs={'id': '<event_id>'},
  107                          schema='EventSchemaPublic',
  108                          type_="event")
  109 
  110     marketer = Relationship(attribute='marketer',
  111                             self_view='v1.order_marketer',
  112                             self_view_kwargs={'order_identifier': '<identifier>'},
  113                             related_view='v1.user_detail',
  114                             related_view_kwargs={'id': '<marketer_id>'},
  115                             schema='UserSchemaPublic',
  116                             type_="user")
  117 
  118     discount_code = Relationship(attribute='discount_code',
  119                                  self_view='v1.order_discount',
  120                                  self_view_kwargs={'order_identifier': '<identifier>'},
  121                                  related_view='v1.discount_code_detail',
  122                                  related_view_kwargs={'id': '<discount_code_id>'},
  123                                  schema='DiscountCodeSchemaPublic',
  124                                  type_="discount-code")
  125
  ```
  --- 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/api/schema/orders.py b/app/api/schema/orders.py
  --- a/app/api/schema/orders.py
  +++ b/app/api/schema/orders.py
  @@ -56,8 +56,10 @@
       completed_at = fields.DateTime(dump_only=True)
       created_at = fields.DateTime(dump_only=True)
       transaction_id = fields.Str(dump_only=True)
  -    payment_mode = fields.Str(default="free",
  -                              validate=validate.OneOf(choices=["free", "stripe", "paypal"]), allow_none=True)
  +    payment_mode = fields.Str(
  +                            default="free",
  +                            validate=validate.OneOf(choices=["free", "stripe", "paypal", "bank", "cheque", "onsite"]),
  +                            allow_none=True)
       paid_via = fields.Str(dump_only=True)
       brand = fields.Str(dump_only=True)
       exp_month = fields.Str(dump_only=True)
  
verification_info: {"golden_diff": "diff --git a/app/api/schema/orders.py b/app/api/schema/orders.py\n--- a/app/api/schema/orders.py\n+++ b/app/api/schema/orders.py\n@@ -56,8 +56,10 @@\n     completed_at = fields.DateTime(dump_only=True)\n     created_at = fields.DateTime(dump_only=True)\n     transaction_id = fields.Str(dump_only=True)\n-    payment_mode = fields.Str(default=\"free\",\n-                              validate=validate.OneOf(choices=[\"free\", \"stripe\", \"paypal\"]), allow_none=True)\n+    payment_mode = fields.Str(\n+                            default=\"free\",\n+                            validate=validate.OneOf(choices=[\"free\", \"stripe\", \"paypal\", \"bank\", \"cheque\", \"onsite\"]),\n+                            allow_none=True)\n     paid_via = fields.Str(dump_only=True)\n     brand = fields.Str(dump_only=True)\n     exp_month = fields.Str(dump_only=True)\n", "issue": "Allow bank, cheque and onsite for payment_mode in orders schema\n**Describe the bug**\r\nCurrently setting bank, cheque and onsite for payment_mode returns 422 error.\r\n\r\n**Expected behavior**\r\nPayment Mode should allow bank, cheque and onsite as options.\n", "before_files": [{"content": "from flask import request\nfrom marshmallow import post_dump, validates_schema, validate\nfrom marshmallow_jsonapi import fields\nfrom marshmallow_jsonapi.flask import Relationship\n\nfrom app import db\nfrom app.api.helpers.utilities import dasherize\nfrom app.api.schema.base import SoftDeletionSchema\nfrom utils.common import use_defaults\n\n\nclass OnSiteTicketSchema(SoftDeletionSchema):\n    class Meta:\n        type_ = 'on-site-ticket'\n        inflect = dasherize\n\n    id = fields.Str(load_only=True, required=True)\n    quantity = fields.Str(load_only=True, required=True)\n\n\n@use_defaults()\nclass OrderSchema(SoftDeletionSchema):\n    class Meta:\n        type_ = 'order'\n        self_view = 'v1.order_detail'\n        self_view_kwargs = {'order_identifier': '<identifier>'}\n        inflect = dasherize\n\n    @post_dump\n    def generate_payment_url(self, data):\n        \"\"\"\n        generate payment url for an order\n        :param data:\n        :return:\n        \"\"\"\n        if 'POST' in request.method or ('GET' in request.method and 'regenerate' in request.args) and 'completed' != \\\n           data[\"status\"]:\n            if data['payment_mode'] == 'stripe':\n                data['payment_url'] = 'stripe://payment'\n        return data\n\n    @validates_schema\n    def initial_values(self, data):\n        if data.get('payment_mode') is None and 'POST' in request.method:\n            data['payment_mode'] = 'free'\n        return data\n\n    id = fields.Str(dump_only=True)\n    identifier = fields.Str(dump_only=True)\n    amount = fields.Float(validate=lambda n: n > 0, allow_none=True)\n    address = fields.Str(allow_none=True)\n    city = fields.Str(allow_none=True)\n    state = fields.Str(db.String, allow_none=True)\n    country = fields.Str(allow_none=True)\n    zipcode = fields.Str(allow_none=True)\n    completed_at = fields.DateTime(dump_only=True)\n    created_at = fields.DateTime(dump_only=True)\n    transaction_id = fields.Str(dump_only=True)\n    payment_mode = fields.Str(default=\"free\",\n                              validate=validate.OneOf(choices=[\"free\", \"stripe\", \"paypal\"]), allow_none=True)\n    paid_via = fields.Str(dump_only=True)\n    brand = fields.Str(dump_only=True)\n    exp_month = fields.Str(dump_only=True)\n    exp_year = fields.Str(dump_only=True)\n    last4 = fields.Str(dump_only=True)\n    status = fields.Str(validate=validate.OneOf(choices=[\"pending\", \"cancelled\", \"completed\", \"placed\", \"expired\"]))\n    discount_code_id = fields.Str(allow_none=True)\n    payment_url = fields.Str(dump_only=True)\n    cancel_note = fields.Str(allow_none=True)\n    order_notes = fields.Str(allow_none=True)\n    tickets_pdf_url = fields.Url(dump_only=True)\n\n    # only used in the case of an on site attendee.\n    on_site_tickets = fields.List(cls_or_instance=fields.Nested(OnSiteTicketSchema), load_only=True, allow_none=True)\n\n    attendees = Relationship(attribute='ticket_holders',\n                             self_view='v1.order_attendee',\n                             self_view_kwargs={'order_identifier': '<identifier>'},\n                             related_view='v1.attendee_list',\n                             related_view_kwargs={'order_identifier': '<identifier>'},\n                             schema='AttendeeSchemaPublic',\n                             many=True,\n                             type_='attendee')\n\n    tickets = Relationship(attribute='tickets',\n                           self_view='v1.order_ticket',\n                           self_view_kwargs={'order_identifier': '<identifier>'},\n                           related_view='v1.ticket_list',\n                           related_view_kwargs={'order_identifier': '<identifier>'},\n                           schema='TicketSchemaPublic',\n                           many=True,\n                           type_=\"ticket\")\n\n    user = Relationship(attribute='user',\n                        self_view='v1.order_user',\n                        self_view_kwargs={'order_identifier': '<identifier>'},\n                        related_view='v1.user_detail',\n                        related_view_kwargs={'id': '<user_id>'},\n                        schema='UserSchemaPublic',\n                        type_=\"user\")\n\n    event = Relationship(attribute='event',\n                         self_view='v1.order_event',\n                         self_view_kwargs={'order_identifier': '<identifier>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'id': '<event_id>'},\n                         schema='EventSchemaPublic',\n                         type_=\"event\")\n\n    marketer = Relationship(attribute='marketer',\n                            self_view='v1.order_marketer',\n                            self_view_kwargs={'order_identifier': '<identifier>'},\n                            related_view='v1.user_detail',\n                            related_view_kwargs={'id': '<marketer_id>'},\n                            schema='UserSchemaPublic',\n                            type_=\"user\")\n\n    discount_code = Relationship(attribute='discount_code',\n                                 self_view='v1.order_discount',\n                                 self_view_kwargs={'order_identifier': '<identifier>'},\n                                 related_view='v1.discount_code_detail',\n                                 related_view_kwargs={'id': '<discount_code_id>'},\n                                 schema='DiscountCodeSchemaPublic',\n                                 type_=\"discount-code\")\n", "path": "app/api/schema/orders.py"}], "after_files": [{"content": "from flask import request\nfrom marshmallow import post_dump, validates_schema, validate\nfrom marshmallow_jsonapi import fields\nfrom marshmallow_jsonapi.flask import Relationship\n\nfrom app import db\nfrom app.api.helpers.utilities import dasherize\nfrom app.api.schema.base import SoftDeletionSchema\nfrom utils.common import use_defaults\n\n\nclass OnSiteTicketSchema(SoftDeletionSchema):\n    class Meta:\n        type_ = 'on-site-ticket'\n        inflect = dasherize\n\n    id = fields.Str(load_only=True, required=True)\n    quantity = fields.Str(load_only=True, required=True)\n\n\n@use_defaults()\nclass OrderSchema(SoftDeletionSchema):\n    class Meta:\n        type_ = 'order'\n        self_view = 'v1.order_detail'\n        self_view_kwargs = {'order_identifier': '<identifier>'}\n        inflect = dasherize\n\n    @post_dump\n    def generate_payment_url(self, data):\n        \"\"\"\n        generate payment url for an order\n        :param data:\n        :return:\n        \"\"\"\n        if 'POST' in request.method or ('GET' in request.method and 'regenerate' in request.args) and 'completed' != \\\n           data[\"status\"]:\n            if data['payment_mode'] == 'stripe':\n                data['payment_url'] = 'stripe://payment'\n        return data\n\n    @validates_schema\n    def initial_values(self, data):\n        if data.get('payment_mode') is None and 'POST' in request.method:\n            data['payment_mode'] = 'free'\n        return data\n\n    id = fields.Str(dump_only=True)\n    identifier = fields.Str(dump_only=True)\n    amount = fields.Float(validate=lambda n: n > 0, allow_none=True)\n    address = fields.Str(allow_none=True)\n    city = fields.Str(allow_none=True)\n    state = fields.Str(db.String, allow_none=True)\n    country = fields.Str(allow_none=True)\n    zipcode = fields.Str(allow_none=True)\n    completed_at = fields.DateTime(dump_only=True)\n    created_at = fields.DateTime(dump_only=True)\n    transaction_id = fields.Str(dump_only=True)\n    payment_mode = fields.Str(\n                            default=\"free\",\n                            validate=validate.OneOf(choices=[\"free\", \"stripe\", \"paypal\", \"bank\", \"cheque\", \"onsite\"]),\n                            allow_none=True)\n    paid_via = fields.Str(dump_only=True)\n    brand = fields.Str(dump_only=True)\n    exp_month = fields.Str(dump_only=True)\n    exp_year = fields.Str(dump_only=True)\n    last4 = fields.Str(dump_only=True)\n    status = fields.Str(validate=validate.OneOf(choices=[\"pending\", \"cancelled\", \"completed\", \"placed\", \"expired\"]))\n    discount_code_id = fields.Str(allow_none=True)\n    payment_url = fields.Str(dump_only=True)\n    cancel_note = fields.Str(allow_none=True)\n    order_notes = fields.Str(allow_none=True)\n    tickets_pdf_url = fields.Url(dump_only=True)\n\n    # only used in the case of an on site attendee.\n    on_site_tickets = fields.List(cls_or_instance=fields.Nested(OnSiteTicketSchema), load_only=True, allow_none=True)\n\n    attendees = Relationship(attribute='ticket_holders',\n                             self_view='v1.order_attendee',\n                             self_view_kwargs={'order_identifier': '<identifier>'},\n                             related_view='v1.attendee_list',\n                             related_view_kwargs={'order_identifier': '<identifier>'},\n                             schema='AttendeeSchemaPublic',\n                             many=True,\n                             type_='attendee')\n\n    tickets = Relationship(attribute='tickets',\n                           self_view='v1.order_ticket',\n                           self_view_kwargs={'order_identifier': '<identifier>'},\n                           related_view='v1.ticket_list',\n                           related_view_kwargs={'order_identifier': '<identifier>'},\n                           schema='TicketSchemaPublic',\n                           many=True,\n                           type_=\"ticket\")\n\n    user = Relationship(attribute='user',\n                        self_view='v1.order_user',\n                        self_view_kwargs={'order_identifier': '<identifier>'},\n                        related_view='v1.user_detail',\n                        related_view_kwargs={'id': '<user_id>'},\n                        schema='UserSchemaPublic',\n                        type_=\"user\")\n\n    event = Relationship(attribute='event',\n                         self_view='v1.order_event',\n                         self_view_kwargs={'order_identifier': '<identifier>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'id': '<event_id>'},\n                         schema='EventSchemaPublic',\n                         type_=\"event\")\n\n    marketer = Relationship(attribute='marketer',\n                            self_view='v1.order_marketer',\n                            self_view_kwargs={'order_identifier': '<identifier>'},\n                            related_view='v1.user_detail',\n                            related_view_kwargs={'id': '<marketer_id>'},\n                            schema='UserSchemaPublic',\n                            type_=\"user\")\n\n    discount_code = Relationship(attribute='discount_code',\n                                 self_view='v1.order_discount',\n                                 self_view_kwargs={'order_identifier': '<identifier>'},\n                                 related_view='v1.discount_code_detail',\n                                 related_view_kwargs={'id': '<discount_code_id>'},\n                                 schema='DiscountCodeSchemaPublic',\n                                 type_=\"discount-code\")\n", "path": "app/api/schema/orders.py"}]}