updated payment service

This commit is contained in:
2025-07-06 17:04:29 +03:00
parent 88afa6b329
commit 9edc6cb6a0
17 changed files with 2871 additions and 1177 deletions

View File

@@ -6,6 +6,7 @@ from Schemas.account.account import (
AccountDetail,
AccountRecordExchanges,
AccountRecords,
AccountDelayInterest,
)
from Schemas.account.iban import (
BuildIbans,
@@ -124,6 +125,7 @@ __all__ = [
"AccountDetail",
"AccountRecordExchanges",
"AccountRecords",
"AccountDelayInterest",
"BuildIbans",
"BuildIbanDescription",
"RelationshipEmployee2PostCode",

View File

@@ -315,6 +315,45 @@ class AccountRecordExchanges(CrudCollection):
)
class AccountDelayInterest(CrudCollection):
__tablename__ = "account_delay_interest"
__exclude__fields__ = []
interest_turn: Mapped[str] = mapped_column(String(10), nullable=False, server_default="akdi")
interest_rate: Mapped[float] = mapped_column(Numeric(10, 2), nullable=False, server_default="0")
delay_day: Mapped[int] = mapped_column(Integer, nullable=False, comment="Delay in days", server_default="0")
daily_rate: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, server_default="0")
interest: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, server_default="0")
bsmv: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, server_default="0")
kkdf: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, server_default="0")
total: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, server_default="0")
account_record_bank_date: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), nullable=True)
book_payment_process_date: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), nullable=True)
debt: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False)
approving_at: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), nullable=True)
approved_record: Mapped[bool] = mapped_column(Boolean, nullable=False, server_default="0")
approving_person_id: Mapped[int] = mapped_column(Integer, nullable=True)
approving_person_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Approving Person UU ID")
bank_resp_company_id: Mapped[int] = mapped_column(Integer, nullable=True)
bank_resp_company_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Bank Response Company UU ID")
account_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=False)
account_records_uu_id: Mapped[str] = mapped_column(String(100), nullable=False)
build_decision_book_payment_id: Mapped[int] = mapped_column(ForeignKey("build_decision_book_payments.id"), nullable=False)
build_decision_book_payment_uu_id: Mapped[str] = mapped_column(String(100), nullable=True)
new_build_decision_book_payment_id: Mapped[int] = mapped_column(Integer, nullable=True)
new_build_decision_book_payment_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="New Build Decision Book Payment UU ID")
__table_args__ = (
Index("_account_delay_interest_ndx_00", account_records_id, build_decision_book_payment_id),
{"comment": "Account Delay Interest Information"},
)
class AccountRecords(CrudCollection):
"""
build_decision_book_id = kaydın sorumlu olduğu karar defteri
@@ -324,48 +363,20 @@ class AccountRecords(CrudCollection):
__tablename__ = "account_records"
__exclude__fields__ = []
__enum_list__ = [
("receive_debit", "DebitTypes", "D"),
("budget_type", "BudgetType", "B"),
]
__enum_list__ = [("receive_debit", "DebitTypes", "D"),("budget_type", "BudgetType", "B")]
iban: Mapped[str] = mapped_column(
String(64), nullable=False, comment="IBAN Number of Bank"
)
bank_date: Mapped[TIMESTAMP] = mapped_column(
TIMESTAMP(timezone=True), nullable=False, comment="Bank Transaction Date"
)
currency_value: Mapped[float] = mapped_column(
Numeric(20, 6), nullable=False, comment="Currency Value"
)
bank_balance: Mapped[float] = mapped_column(
Numeric(20, 6), nullable=False, comment="Bank Balance"
)
currency: Mapped[str] = mapped_column(
String(5), nullable=False, comment="Unit of Currency"
)
additional_balance: Mapped[float] = mapped_column(
Numeric(20, 6), nullable=False, comment="Additional Balance"
)
channel_branch: Mapped[str] = mapped_column(
String(120), nullable=False, comment="Branch Bank"
)
process_name: Mapped[str] = mapped_column(
String, nullable=False, comment="Bank Process Type Name"
)
process_type: Mapped[str] = mapped_column(
String, nullable=False, comment="Bank Process Type"
)
process_comment: Mapped[str] = mapped_column(
String, nullable=False, comment="Transaction Record Comment"
)
process_garbage: Mapped[str] = mapped_column(
String, nullable=True, comment="Transaction Record Garbage"
)
bank_reference_code: Mapped[str] = mapped_column(
String, nullable=False, comment="Bank Reference Code"
)
iban: Mapped[str] = mapped_column(String(64), nullable=False, comment="IBAN Number of Bank")
bank_date: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), nullable=False, comment="Bank Transaction Date")
currency_value: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, comment="Currency Value")
bank_balance: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, comment="Bank Balance")
currency: Mapped[str] = mapped_column(String(5), nullable=False, comment="Unit of Currency")
additional_balance: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, comment="Additional Balance")
channel_branch: Mapped[str] = mapped_column(String(120), nullable=False, comment="Branch Bank")
process_name: Mapped[str] = mapped_column(String, nullable=False, comment="Bank Process Type Name")
process_type: Mapped[str] = mapped_column(String, nullable=False, comment="Bank Process Type")
process_comment: Mapped[str] = mapped_column(String, nullable=False, comment="Transaction Record Comment")
process_garbage: Mapped[str] = mapped_column(String, nullable=True, comment="Transaction Record Garbage")
bank_reference_code: Mapped[str] = mapped_column(String, nullable=False, comment="Bank Reference Code")
add_comment_note: Mapped[str] = mapped_column(String, server_default="")
is_receipt_mail_send: Mapped[bool] = mapped_column(Boolean, server_default="0")
@@ -378,100 +389,45 @@ class AccountRecords(CrudCollection):
bank_date_w: Mapped[int] = mapped_column(SmallInteger)
bank_date_d: Mapped[int] = mapped_column(SmallInteger)
approving_accounting_record: Mapped[bool] = mapped_column(
Boolean, server_default="0"
)
accounting_receipt_date: Mapped[TIMESTAMP] = mapped_column(
TIMESTAMP(timezone=True), server_default="1900-01-01 00:00:00"
)
approving_accounting_record: Mapped[bool] = mapped_column(Boolean, server_default="0")
accounting_receipt_date: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), server_default="1900-01-01 00:00:00")
accounting_receipt_number: Mapped[int] = mapped_column(Integer, server_default="0")
status_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
approved_record: Mapped[bool] = mapped_column(Boolean, server_default="0")
import_file_name: Mapped[str] = mapped_column(
String, nullable=True, comment="XLS Key"
)
receive_debit: Mapped[int] = mapped_column(
ForeignKey("api_enum_dropdown.id"), nullable=True
)
receive_debit_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Debit UU ID"
)
budget_type: Mapped[int] = mapped_column(
ForeignKey("api_enum_dropdown.id"), nullable=True
)
budget_type_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Budget Type UU ID"
)
import_file_name: Mapped[str] = mapped_column(String, nullable=True, comment="XLS Key")
receive_debit: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
receive_debit_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Debit UU ID")
budget_type: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
budget_type_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Budget Type UU ID")
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=True)
company_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Company UU ID"
)
send_company_id: Mapped[int] = mapped_column(
ForeignKey("companies.id"), nullable=True
)
send_company_uu_id = mapped_column(
String, nullable=True, comment="Send Company UU ID"
)
company_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Company UU ID")
send_company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=True)
send_company_uu_id = mapped_column(String, nullable=True, comment="Send Company UU ID")
send_person_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=True)
send_person_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Send Person UU ID"
)
approving_accounting_person: Mapped[int] = mapped_column(
ForeignKey("people.id"), nullable=True
)
approving_accounting_person_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Approving Accounting Person UU ID"
)
living_space_id: Mapped[int] = mapped_column(
ForeignKey("build_living_space.id"), nullable=True
)
living_space_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Living Space UU ID"
)
send_person_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Send Person UU ID")
approving_accounting_person: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=True)
approving_accounting_person_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Approving Accounting Person UU ID")
living_space_id: Mapped[int] = mapped_column(ForeignKey("build_living_space.id"), nullable=True)
living_space_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Living Space UU ID")
customer_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=True)
customer_uu_id = mapped_column(String, nullable=True, comment="Customer UU ID")
build_id: Mapped[int] = mapped_column(ForeignKey("build.id"), nullable=True)
build_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Build UU ID"
)
build_parts_id: Mapped[int] = mapped_column(
ForeignKey("build_parts.id"), nullable=True
)
build_parts_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Build Parts UU ID"
)
build_decision_book_id: Mapped[int] = mapped_column(
ForeignKey("build_decision_book.id"), nullable=True
)
build_decision_book_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Build Decision Book UU ID"
)
# payment_result_type = Mapped[int] = mapped_column(
# ForeignKey("api_enum_dropdown.id"), nullable=True
# )
# payment_result_type_uu_id: Mapped[str] = mapped_column(
# String, nullable=True, comment="Payment Result Type UU ID"
# )
build_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Build UU ID")
build_parts_id: Mapped[int] = mapped_column(ForeignKey("build_parts.id"), nullable=True)
build_parts_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Build Parts UU ID")
build_decision_book_id: Mapped[int] = mapped_column(ForeignKey("build_decision_book.id"), nullable=True)
build_decision_book_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Build Decision Book UU ID")
payment_result_type: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
payment_result_type_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Payment Result Type UU ID")
is_commission_applied: Mapped[bool] = mapped_column(Boolean, server_default="0")
__table_args__ = (
Index("_budget_records_ndx_00", is_receipt_mail_send, bank_date),
Index(
"_budget_records_ndx_01",
iban,
bank_date,
bank_reference_code,
bank_balance,
unique=True,
),
Index("_budget_records_ndx_01", iban, bank_date, bank_reference_code, bank_balance, unique=True),
Index("_budget_records_ndx_02", status_id, bank_date),
{
"comment": "Bank Records that are related to building and financial transactions"
},
{"comment": "Bank Records that are related to building and financial transactions"},
)
# def payment_budget_record_close(self):

View File

@@ -11,6 +11,7 @@ from Schemas.base_imports import (
mapped_column,
Mapped,
)
from sqlalchemy import text
class BuildIbans(CrudCollection):
@@ -44,6 +45,30 @@ class BuildIbans(CrudCollection):
{"comment": "IBANs related to money transactions due to building objects"},
)
class CompanyDelayInterest(CrudCollection):
__tablename__ = "company_delay_interest"
company_id: Mapped[int] = mapped_column(Integer, ForeignKey("companies.id"), nullable=True)
company_uu_id: Mapped[str] = mapped_column(String, nullable=True)
build_id: Mapped[int] = mapped_column(Integer, ForeignKey("build.id"), nullable=True)
build_uu_id: Mapped[str] = mapped_column(String, nullable=True)
daily_interest_type: Mapped[str] = mapped_column(String(24), nullable=True)
daily_interest_rate: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, server_default=text("0"))
bsmv_rate: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, server_default=text("0"))
kkdf_rate: Mapped[float] = mapped_column(Numeric(20, 6), nullable=False, server_default=text("0"))
start_date: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), nullable=False)
stop_date: Mapped[TIMESTAMP] = mapped_column(TIMESTAMP(timezone=True), nullable=False, server_default=text("'2900-01-01 03:00:00+03'::timestamptz"))
__table_args__ = (
Index("_company_delay_interest_ndx_01", "company_id", "build_id", "start_date", unique=True),
Index("ix_company_delay_interest_build_uu_id", "company_id", "build_id"),
{"comment": "Company Delay Interest Information"},
)
class BuildIbanDescription(CrudCollection):
"""

View File

@@ -570,13 +570,14 @@ class BuildDecisionBookPayments(CrudCollection):
build_parts_id: Mapped[int] = mapped_column(ForeignKey("build_parts.id"), nullable=False)
build_parts_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Build Part UUID")
decision_book_project_id: Mapped[int] = mapped_column(
ForeignKey("build_decision_book_projects.id"),
nullable=True,
comment="Decision Book Project ID",
ForeignKey("build_decision_book_projects.id"), nullable=True, comment="Decision Book Project ID",
)
decision_book_project_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Decision Book Project UUID")
account_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=True)
account_records_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Account Record UU ID")
is_closed: Mapped[bool] = mapped_column(Boolean, server_default="0", comment="Is Decision Book Payment Closed")
debt_to_pay: Mapped[float] = mapped_column(Numeric(16, 2), server_default="0", comment="Debt To Pay")
debt_paid: Mapped[float] = mapped_column(Numeric(16, 2), server_default="0", comment="Debt Paid")
# budget_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=True)
# budget_records_uu_id: Mapped[str] = mapped_column(