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-beta-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-beta-1".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
11 changes: 7 additions & 4 deletions cashfree_pg/models/address_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing import Optional
from pydantic import BaseModel, Field, StrictStr
from pydantic import field_validator
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'field_validator' is not used.

Suggested change
from pydantic import field_validator

Copilot uses AI. Check for mistakes.

class AddressDetails(BaseModel):
"""
Expand All @@ -39,10 +40,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
11 changes: 7 additions & 4 deletions cashfree_pg/models/adjust_vendor_balance_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing import Any, Dict, Optional, Union
from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr
from pydantic import field_validator

Comment on lines +24 to 25
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'field_validator' is not used.

Suggested change
from pydantic import field_validator

Copilot uses AI. Check for mistakes.
class AdjustVendorBalanceRequest(BaseModel):
"""
Expand All @@ -33,10 +34,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
11 changes: 7 additions & 4 deletions cashfree_pg/models/adjust_vendor_balance_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from cashfree_pg.models.balance_details import BalanceDetails
from cashfree_pg.models.charges_details import ChargesDetails
from cashfree_pg.models.transfer_details import TransferDetails
from pydantic import field_validator
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'field_validator' is not used.

Suggested change
from pydantic import field_validator

Copilot uses AI. Check for mistakes.

class AdjustVendorBalanceResponse(BaseModel):
"""
Expand All @@ -35,10 +36,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
13 changes: 8 additions & 5 deletions cashfree_pg/models/api_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing import Optional
from pydantic import BaseModel, Field, StrictStr, validator
from pydantic import field_validator

class ApiError(BaseModel):
"""
Expand All @@ -31,7 +32,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 +42,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
13 changes: 8 additions & 5 deletions cashfree_pg/models/api_error404.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing import Optional
from pydantic import BaseModel, Field, StrictStr, validator
from pydantic import field_validator

class ApiError404(BaseModel):
"""
Expand All @@ -31,7 +32,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 +42,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
13 changes: 8 additions & 5 deletions cashfree_pg/models/api_error409.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing import Optional
from pydantic import BaseModel, Field, StrictStr, validator
from pydantic import field_validator

class ApiError409(BaseModel):
"""
Expand All @@ -31,7 +32,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 +42,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
13 changes: 8 additions & 5 deletions cashfree_pg/models/api_error502.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing import Optional
from pydantic import BaseModel, Field, StrictStr, validator
from pydantic import field_validator

class ApiError502(BaseModel):
"""
Expand All @@ -31,7 +32,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 +42,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
13 changes: 8 additions & 5 deletions cashfree_pg/models/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


from pydantic import BaseModel, Field, StrictStr, validator
from pydantic import field_validator

class App(BaseModel):
"""
Expand All @@ -31,17 +32,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
11 changes: 7 additions & 4 deletions cashfree_pg/models/app_payment_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from pydantic import BaseModel, Field
from cashfree_pg.models.app import App
from pydantic import field_validator
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'field_validator' is not used.

Suggested change
from pydantic import field_validator

Copilot uses AI. Check for mistakes.

class AppPaymentMethod(BaseModel):
"""
Expand All @@ -30,10 +31,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
11 changes: 7 additions & 4 deletions cashfree_pg/models/authentication_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing import Optional
from pydantic import BaseModel, Field, StrictStr
from pydantic import field_validator
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'field_validator' is not used.

Suggested change
from pydantic import field_validator

Copilot uses AI. Check for mistakes.

class AuthenticationError(BaseModel):
"""
Expand All @@ -31,10 +32,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
11 changes: 7 additions & 4 deletions cashfree_pg/models/authorization_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing import Optional, Union
from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from pydantic import field_validator

Comment on lines +24 to 25
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'field_validator' is not used.

Suggested change
from pydantic import field_validator

Copilot uses AI. Check for mistakes.
class AuthorizationDetails(BaseModel):
"""
Expand All @@ -35,10 +36,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
15 changes: 9 additions & 6 deletions cashfree_pg/models/authorization_in_payments_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from typing import Optional, Union
from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, validator
from pydantic import field_validator

class AuthorizationInPaymentsEntity(BaseModel):
"""
Expand All @@ -36,7 +37,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 +47,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 +57,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
Loading
Loading