Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cashfree_pg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
""" # noqa: E501


__version__ = "4.5.1"
__version__ = "5.0.1"

# import apis into sdk package
# import ApiClient
Expand Down
1,398 changes: 745 additions & 653 deletions cashfree_pg/api_client.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions cashfree_pg/api_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from typing import Any, Dict, Optional
from pydantic import Field, StrictInt, StrictStr

# Updated imports for Pydantic v2 compatibility

class ApiResponse:
"""
API response object
Expand Down
2 changes: 1 addition & 1 deletion cashfree_pg/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 2023-08-01\n"\
"SDK Package Version: 4.5.1".\
"SDK Package Version: 5.0.1".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
10 changes: 6 additions & 4 deletions cashfree_pg/models/address_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ class AddressDetails(BaseModel):
email: Optional[StrictStr] = Field(None, description="Cutomer Email Address.")
__properties = ["name", "address_line_one", "address_line_two", "country", "country_code", "state", "state_code", "city", "pin_code", "phone", "email"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
10 changes: 6 additions & 4 deletions cashfree_pg/models/adjust_vendor_balance_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ class AdjustVendorBalanceRequest(BaseModel):
tags: Optional[Dict[str, Any]] = Field(None, description="Provide additional data fields using tags.")
__properties = ["transfer_from", "transfer_type", "transfer_amount", "remark", "tags"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
10 changes: 6 additions & 4 deletions cashfree_pg/models/adjust_vendor_balance_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ class AdjustVendorBalanceResponse(BaseModel):
charges: Optional[ChargesDetails] = None
__properties = ["settlement_id", "transfer_details", "balances", "charges"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
12 changes: 7 additions & 5 deletions cashfree_pg/models/api_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ApiError(BaseModel):
type: Optional[StrictStr] = Field(None, description="api_error")
__properties = ["message", "code", "type"]

@validator('type')
@field_validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
Expand All @@ -41,10 +41,12 @@ def type_validate_enum(cls, value):
raise ValueError("must be one of enum values ('api_error')")
return value

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
12 changes: 7 additions & 5 deletions cashfree_pg/models/api_error404.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ApiError404(BaseModel):
type: Optional[StrictStr] = Field(None, description="invalid_request_error")
__properties = ["message", "code", "type"]

@validator('type')
@field_validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
Expand All @@ -41,10 +41,12 @@ def type_validate_enum(cls, value):
raise ValueError("must be one of enum values ('invalid_request_error')")
return value

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
12 changes: 7 additions & 5 deletions cashfree_pg/models/api_error409.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ApiError409(BaseModel):
type: Optional[StrictStr] = Field(None, description="invalid_request_error")
__properties = ["message", "code", "type"]

@validator('type')
@field_validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
Expand All @@ -41,10 +41,12 @@ def type_validate_enum(cls, value):
raise ValueError("must be one of enum values ('invalid_request_error')")
return value

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
12 changes: 7 additions & 5 deletions cashfree_pg/models/api_error502.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ApiError502(BaseModel):
type: Optional[StrictStr] = Field(None, description="api_error")
__properties = ["message", "code", "type"]

@validator('type')
@field_validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
Expand All @@ -41,10 +41,12 @@ def type_validate_enum(cls, value):
raise ValueError("must be one of enum values ('api_error')")
return value

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
12 changes: 7 additions & 5 deletions cashfree_pg/models/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ class App(BaseModel):
phone: StrictStr = Field(..., description="Customer phone number associated with a wallet for payment.")
__properties = ["channel", "provider", "phone"]

@validator('provider')
@field_validator('provider')
def provider_validate_enum(cls, value):
"""Validates the enum"""
if value not in ('gpay', 'phonepe', 'ola', 'paytm', 'amazon', 'airtel', 'freecharge', 'mobikwik', 'jio'):
raise ValueError("must be one of enum values ('gpay', 'phonepe', 'ola', 'paytm', 'amazon', 'airtel', 'freecharge', 'mobikwik', 'jio')")
return value

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
10 changes: 6 additions & 4 deletions cashfree_pg/models/app_payment_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ class AppPaymentMethod(BaseModel):
app: App = Field(...)
__properties = ["app"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
10 changes: 6 additions & 4 deletions cashfree_pg/models/authentication_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ class AuthenticationError(BaseModel):
type: Optional[StrictStr] = Field(None, description="authentication_error")
__properties = ["message", "code", "type"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
10 changes: 6 additions & 4 deletions cashfree_pg/models/authorization_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ class AuthorizationDetails(BaseModel):
payment_method: Optional[StrictStr] = Field(None, description="Payment method used for the authorization.")
__properties = ["authorization_amount", "authorization_amount_refund", "authorization_reference", "authorization_time", "authorization_status", "payment_id", "payment_method"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
14 changes: 8 additions & 6 deletions cashfree_pg/models/authorization_in_payments_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AuthorizationInPaymentsEntity(BaseModel):
action_time: Optional[StrictStr] = Field(None, description="Time of action (CAPTURE or VOID)")
__properties = ["action", "status", "captured_amount", "start_time", "end_time", "approve_by", "action_reference", "action_time"]

@validator('action')
@field_validator('action')
def action_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
Expand All @@ -46,7 +46,7 @@ def action_validate_enum(cls, value):
raise ValueError("must be one of enum values ('CAPTURE', 'VOID')")
return value

@validator('status')
@field_validator('status')
def status_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
Expand All @@ -56,10 +56,12 @@ def status_validate_enum(cls, value):
raise ValueError("must be one of enum values ('SUCCESS', 'PENDING')")
return value

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
12 changes: 7 additions & 5 deletions cashfree_pg/models/authorize_order_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AuthorizeOrderRequest(BaseModel):
amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The amount if you are running a 'CAPTURE'")
__properties = ["action", "amount"]

@validator('action')
@field_validator('action')
def action_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
Expand All @@ -40,10 +40,12 @@ def action_validate_enum(cls, value):
raise ValueError("must be one of enum values ('CAPTURE', 'VOID')")
return value

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
12 changes: 7 additions & 5 deletions cashfree_pg/models/bad_request_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BadRequestError(BaseModel):
type: Optional[StrictStr] = None
__properties = ["message", "code", "type"]

@validator('type')
@field_validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
Expand All @@ -41,10 +41,12 @@ def type_validate_enum(cls, value):
raise ValueError("must be one of enum values ('invalid_request_error')")
return value

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
10 changes: 6 additions & 4 deletions cashfree_pg/models/balance_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ class BalanceDetails(BaseModel):
vendor_unsettled: Optional[Union[StrictFloat, StrictInt]] = None
__properties = ["merchant_id", "vendor_id", "merchant_unsettled", "vendor_unsettled"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
10 changes: 6 additions & 4 deletions cashfree_pg/models/bank_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ class BankDetails(BaseModel):
ifsc: Optional[StrictStr] = None
__properties = ["account_number", "account_holder", "ifsc"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
10 changes: 6 additions & 4 deletions cashfree_pg/models/banktransfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ class Banktransfer(BaseModel):
channel: Optional[StrictStr] = Field(None, description="The channel for cardless EMI is always `link`")
__properties = ["channel"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
# Updated to Pydantic v2
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True
}

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
Expand Down
Loading
Loading