model.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. from datetime import datetime
  2. from sqlalchemy import Boolean, DateTime, Integer, String, Text
  3. from sqlalchemy.orm import Mapped, mapped_column
  4. from app.core.base_model import PaymentModelMixin, TenantMixin
  5. from .enums import FacetofaceOrderStatus
  6. class FacetofaceOrderModel(PaymentModelMixin, TenantMixin):
  7. """当面付开通申请单"""
  8. __tablename__ = "pay_facetoface_order"
  9. __table_args__ = {"comment": "当面付开通申请单"}
  10. enterprise_id: Mapped[str | None] = mapped_column(
  11. String(64), unique=True, index=True, comment="关联企业ID"
  12. )
  13. batch_no: Mapped[str | None] = mapped_column(
  14. String(64), unique=True, index=True, comment="支付宝事务编号"
  15. )
  16. order_no: Mapped[str | None] = mapped_column(
  17. String(64), index=True, comment="支付宝申请单号"
  18. )
  19. order_status: Mapped[str] = mapped_column(
  20. String(32),
  21. default=FacetofaceOrderStatus.INIT.value,
  22. index=True,
  23. comment="申请单状态",
  24. )
  25. merchant_name: Mapped[str | None] = mapped_column(
  26. String(128), comment="商户名称"
  27. )
  28. shop_name: Mapped[str | None] = mapped_column(
  29. String(128), comment="店铺名称"
  30. )
  31. shop_address: Mapped[str | None] = mapped_column(
  32. String(256), comment="店铺地址"
  33. )
  34. mcc_code: Mapped[str | None] = mapped_column(
  35. String(32), comment="商户类别码"
  36. )
  37. rate: Mapped[str | None] = mapped_column(
  38. String(16), comment="费率"
  39. )
  40. business_license_no: Mapped[str | None] = mapped_column(
  41. String(64), comment="营业执照号"
  42. )
  43. business_license_mobile: Mapped[str | None] = mapped_column(
  44. String(32), comment="联系手机号"
  45. )
  46. sign_and_auth: Mapped[bool] = mapped_column(
  47. Boolean, default=False, comment="是否同时获取授权"
  48. )
  49. confirm_url: Mapped[str | None] = mapped_column(
  50. Text, comment="商家确认链接"
  51. )
  52. app_auth_token: Mapped[str | None] = mapped_column(
  53. String(128), comment="商家授权token"
  54. )
  55. reject_reason: Mapped[str | None] = mapped_column(
  56. Text, comment="驳回原因"
  57. )
  58. remark: Mapped[str | None] = mapped_column(
  59. Text, comment="备注"
  60. )
  61. last_query_time: Mapped[datetime | None] = mapped_column(
  62. DateTime, comment="最后查询时间"
  63. )
  64. next_query_time: Mapped[datetime | None] = mapped_column(
  65. DateTime, index=True, comment="下次查询时间"
  66. )
  67. query_count: Mapped[int] = mapped_column(
  68. Integer, default=0, comment="已查询次数"
  69. )