(20250102) Print statement removed.

This commit is contained in:
2025-01-02 10:12:05 +00:00
parent 2f563b2a0e
commit 7f98f1f662
5 changed files with 108 additions and 49 deletions
+2 -26
View File
@@ -44,7 +44,7 @@ from utils_v2.string import regex
from utils_v2.date_time import date_time
# Models:
from models.core.payment import CorePaymentModel
from models.core.payment import CorePaymentModel, PaymentMetadata
# To work with date and time:
import datetime
@@ -108,30 +108,6 @@ class PGPaymentRequestHeaders(BaseModel):
# ---------------------------------------------------------------------------------------------------------------------
class PaymentRequestMetadata(BaseModel):
idClient: str | int = Field(
description = "account master id for the user's customer",
frozen = True
)
inAccount: str | int = Field(
description = "account master id for the user's bank account",
frozen = True
)
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
# ┗┛┗┛┛┗┛┗┗┫
# ┛
class Config:
extra = "allow"
# ---------------------------------------------------------------------------------------------------------------------
class PGPaymentRequestData(BaseModel):
tokenKey: ObjectId = Field(
@@ -183,7 +159,7 @@ class PGPaymentRequestData(BaseModel):
frozen = True
)
metadata: PaymentRequestMetadata = Field(
metadata: PaymentMetadata = Field(
description = "any extra information about this payment",
frozen = True
)
+45
View File
@@ -134,6 +134,51 @@ class CustomerDetails(BaseModel):
# ---------------------------------------------------------------------------------------------------------------------
class PaymentMetadata(BaseModel):
"""
These are things that the UI will send you, and you must use them as-is for adding receipts. Their internal workings
and use-cases are not known and are not of this code's direct concern except that you must ensure that these details
get delivered through the mechanism of adding receipts.
"""
idClient: int = Field(frozen = True)
inAccount: int = Field(frozen = True)
reference: str | None = Field(frozen = True, default = None, validate_default = True)
againstReference: str | None = Field(frozen = True, default = None, validate_default = True)
documentUrl: str | None = Field(frozen = False, default = None, validate_default = True)
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
# ┗┛┗┛┛┗┛┗┗┫
# ┛
class Config:
extra = "allow"
# ┓┏ ┓• ┓ •
# ┃┃┏┓┃┓┏┫┏┓╋┓┏┓┏┓
# ┗┛┗┻┗┗┗┻┗┻┗┗┗┛┛┗
@field_validator("reference")
def validate_reference(cls, value):
if not value: value = "On Account"
return value
@field_validator("againstReference")
def validate_against_reference(cls, value):
if not value: value = None
return value
@field_validator("documentUrl")
def validate_document_url(cls, value):
if not value: value = None
return value
# ---------------------------------------------------------------------------------------------------------------------
class PaymentEvent(BaseModel):
eventTs: AwareDatetime = Field(