(20241216) Payment auth bug fix.
This commit is contained in:
+17
-1
@@ -36,7 +36,7 @@ sys.path.append(".")
|
||||
sys.path.append("..")
|
||||
|
||||
# For making data behaviour_models:
|
||||
from pydantic import BaseModel, Field, field_validator, PastDatetime
|
||||
from pydantic import BaseModel, Field, field_validator, PastDatetime, model_validator
|
||||
from typing import Optional, Literal, Union
|
||||
|
||||
# My utils:
|
||||
@@ -183,6 +183,22 @@ class SMSAuthRequestData(BaseModel):
|
||||
class Config:
|
||||
extra = "forbid"
|
||||
|
||||
# ┓┏ ┓• ┓ •
|
||||
# ┃┃┏┓┃┓┏┫┏┓╋┓┏┓┏┓
|
||||
# ┗┛┗┻┗┗┗┻┗┻┗┗┗┛┛┗
|
||||
|
||||
@model_validator(mode = "after")
|
||||
def ensure_harmony(cls, values):
|
||||
client = values.smsClient
|
||||
auth = values.auth
|
||||
harmony_map = {
|
||||
"nimbusSmsIndia": NimbusSMSIndiaAuth,
|
||||
"savvyBulkSmsKenya": SavvyBulkSMSKenyaAuth
|
||||
}
|
||||
if not isinstance(auth, harmony_map[client]):
|
||||
raise ValueError(f"incorrect 'auth' for selected client '{client}'")
|
||||
return values
|
||||
|
||||
|
||||
# *****************************************************************************************************************
|
||||
# ***** ****
|
||||
|
||||
@@ -45,7 +45,7 @@ from utils_v2.date_time import date_time
|
||||
|
||||
# Data models:
|
||||
from models.core.message import CoreMessageModel
|
||||
from utils_v2.sms.models.data.sms_message import SentSMSMessageModel
|
||||
from utils_v2.sms.models.sms_message import SentSMSMessageModel
|
||||
|
||||
# To work with date and time:
|
||||
import datetime
|
||||
|
||||
Reference in New Issue
Block a user