Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the codebase from Python to TypeScript, converting model files from Python classes using Pydantic to TypeScript interfaces. The changes represent a complete language transition for the Cashfree Payment Gateway API SDK.
Changes:
- Converted Python model classes to TypeScript interfaces
- Replaced Python type annotations with TypeScript type annotations
- Added TypeScript-specific enum declarations for constrained string types
- Updated API initialization file to use Python-style imports
Reviewed changes
Copilot reviewed 133 out of 571 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| cashfree_pg/models/instrument_webhook_data_entity.py | Converted from Python Pydantic model to TypeScript interface |
| cashfree_pg/models/instrument_webhook_data.py | Converted from Python Pydantic model to TypeScript interface with incorrect type annotations |
| cashfree_pg/models/instrument_webhook.py | Converted from Python Pydantic model to TypeScript interface |
| cashfree_pg/models/instrument_entity.py | Converted from Python Pydantic model to TypeScript interface with enum definitions |
| cashfree_pg/models/idempotency_error.py | Converted from Python Pydantic model to TypeScript interface with enum definitions |
| Multiple other model files | Similar conversions from Python to TypeScript with type annotation changes |
| cashfree_pg/api/init.py | New Python API initialization file added despite TypeScript migration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @type {str} | ||
| * @memberof InstrumentWebhookData | ||
| */ | ||
| 'event_time'?: str; | ||
| /** | ||
| * | ||
| * @type {str} | ||
| * @memberof InstrumentWebhookData | ||
| */ | ||
| 'type'?: str; |
There was a problem hiding this comment.
Type annotations use Python syntax str instead of TypeScript syntax. In TypeScript, the string type should be string, not str. This applies to all type annotations throughout the converted TypeScript files. Similarly, int should be number, float should be number, bool should be boolean, List[T] should be Array<T> or T[], and object can remain as is or be more specific.
| * @type {str} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'event_time'?: str; | |
| /** | |
| * | |
| * @type {str} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'type'?: str; | |
| * @type {string} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'event_time'?: string; | |
| /** | |
| * | |
| * @type {string} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'type'?: string; |
| * @type {str} | ||
| * @memberof InstrumentWebhookData | ||
| */ | ||
| 'event_time'?: str; | ||
| /** | ||
| * | ||
| * @type {str} | ||
| * @memberof InstrumentWebhookData | ||
| */ | ||
| 'type'?: str; |
There was a problem hiding this comment.
Type annotations use Python syntax str instead of TypeScript syntax. In TypeScript, the string type should be string, not str. This applies to all type annotations throughout the converted TypeScript files. Similarly, int should be number, float should be number, bool should be boolean, List[T] should be Array<T> or T[], and object can remain as is or be more specific.
| * @type {str} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'event_time'?: str; | |
| /** | |
| * | |
| * @type {str} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'type'?: str; | |
| * @type {string} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'event_time'?: string; | |
| /** | |
| * | |
| * @type {string} | |
| * @memberof InstrumentWebhookData | |
| */ | |
| 'type'?: string; |
| # import apis into api package | ||
| from cashfree_pg.api.customers_api import CustomersApi | ||
| from cashfree_pg.api.disputes_api import DisputesApi | ||
| from cashfree_pg.api.easy_split_api import EasySplitApi | ||
| from cashfree_pg.api.eligibility_api import EligibilityApi | ||
| from cashfree_pg.api.offers_api import OffersApi | ||
| from cashfree_pg.api.orders_api import OrdersApi | ||
| from cashfree_pg.api.pg_reconciliation_api import PGReconciliationApi | ||
| from cashfree_pg.api.payment_links_api import PaymentLinksApi | ||
| from cashfree_pg.api.payments_api import PaymentsApi | ||
| from cashfree_pg.api.refunds_api import RefundsApi | ||
| from cashfree_pg.api.settlement_reconciliation_api import SettlementReconciliationApi | ||
| from cashfree_pg.api.settlements_api import SettlementsApi | ||
| from cashfree_pg.api.simulation_api import SimulationApi | ||
| from cashfree_pg.api.subscription_api import SubscriptionApi | ||
| from cashfree_pg.api.token_vault_api import TokenVaultApi | ||
| from cashfree_pg.api.default_api import DefaultApi | ||
| from cashfree_pg.api.soft_pos_api import SoftPOSApi | ||
|
|
There was a problem hiding this comment.
A Python API initialization file has been added despite the PR converting the codebase to TypeScript. This file uses Python import syntax and references .py files, which is inconsistent with the TypeScript migration shown in the model files. Either this file should be converted to TypeScript (e.g., index.ts with ES6 imports/exports) or the entire migration approach needs reconsideration.
| # import apis into api package | |
| from cashfree_pg.api.customers_api import CustomersApi | |
| from cashfree_pg.api.disputes_api import DisputesApi | |
| from cashfree_pg.api.easy_split_api import EasySplitApi | |
| from cashfree_pg.api.eligibility_api import EligibilityApi | |
| from cashfree_pg.api.offers_api import OffersApi | |
| from cashfree_pg.api.orders_api import OrdersApi | |
| from cashfree_pg.api.pg_reconciliation_api import PGReconciliationApi | |
| from cashfree_pg.api.payment_links_api import PaymentLinksApi | |
| from cashfree_pg.api.payments_api import PaymentsApi | |
| from cashfree_pg.api.refunds_api import RefundsApi | |
| from cashfree_pg.api.settlement_reconciliation_api import SettlementReconciliationApi | |
| from cashfree_pg.api.settlements_api import SettlementsApi | |
| from cashfree_pg.api.simulation_api import SimulationApi | |
| from cashfree_pg.api.subscription_api import SubscriptionApi | |
| from cashfree_pg.api.token_vault_api import TokenVaultApi | |
| from cashfree_pg.api.default_api import DefaultApi | |
| from cashfree_pg.api.soft_pos_api import SoftPOSApi | |
| # This package is intentionally left without Python API imports. | |
| # The API surface has been migrated to TypeScript; this stub remains | |
| # only to avoid import errors for legacy references. | |
| __all__: list[str] = [] |
| * @type {List[str]} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'cf_settlement_ids'?: List[str]; | ||
| /** | ||
| * List of settlement UTRs for which you want the settlement reconciliation details. | ||
| * @type {List[str]} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'settlement_utrs'?: List[str]; | ||
| /** | ||
| * Specify the start date from when you want the settlement reconciliation details. | ||
| * @type {str} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'start_date'?: str; | ||
| /** | ||
| * Specify the end date till when you want the settlement reconciliation details. | ||
| * @type {str} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'end_date'?: str; |
There was a problem hiding this comment.
Type annotation uses Python syntax List[str] instead of TypeScript syntax. Should be Array<string> or string[].
| * @type {List[str]} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'cf_settlement_ids'?: List[str]; | |
| /** | |
| * List of settlement UTRs for which you want the settlement reconciliation details. | |
| * @type {List[str]} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'settlement_utrs'?: List[str]; | |
| /** | |
| * Specify the start date from when you want the settlement reconciliation details. | |
| * @type {str} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'start_date'?: str; | |
| /** | |
| * Specify the end date till when you want the settlement reconciliation details. | |
| * @type {str} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'end_date'?: str; | |
| * @type {Array<string>} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'cf_settlement_ids'?: Array<string>; | |
| /** | |
| * List of settlement UTRs for which you want the settlement reconciliation details. | |
| * @type {Array<string>} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'settlement_utrs'?: Array<string>; | |
| /** | |
| * Specify the start date from when you want the settlement reconciliation details. | |
| * @type {string} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'start_date'?: string; | |
| /** | |
| * Specify the end date till when you want the settlement reconciliation details. | |
| * @type {string} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'end_date'?: string; |
| * @type {List[str]} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'cf_settlement_ids'?: List[str]; | ||
| /** | ||
| * List of settlement UTRs for which you want the settlement reconciliation details. | ||
| * @type {List[str]} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'settlement_utrs'?: List[str]; | ||
| /** | ||
| * Specify the start date from when you want the settlement reconciliation details. | ||
| * @type {str} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'start_date'?: str; | ||
| /** | ||
| * Specify the end date till when you want the settlement reconciliation details. | ||
| * @type {str} | ||
| * @memberof FetchSettlementsRequestFilters | ||
| */ | ||
| 'end_date'?: str; |
There was a problem hiding this comment.
Type annotation uses Python syntax List[str] instead of TypeScript syntax. Should be Array<string> or string[].
| * @type {List[str]} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'cf_settlement_ids'?: List[str]; | |
| /** | |
| * List of settlement UTRs for which you want the settlement reconciliation details. | |
| * @type {List[str]} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'settlement_utrs'?: List[str]; | |
| /** | |
| * Specify the start date from when you want the settlement reconciliation details. | |
| * @type {str} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'start_date'?: str; | |
| /** | |
| * Specify the end date till when you want the settlement reconciliation details. | |
| * @type {str} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'end_date'?: str; | |
| * @type {Array<string>} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'cf_settlement_ids'?: Array<string>; | |
| /** | |
| * List of settlement UTRs for which you want the settlement reconciliation details. | |
| * @type {Array<string>} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'settlement_utrs'?: Array<string>; | |
| /** | |
| * Specify the start date from when you want the settlement reconciliation details. | |
| * @type {string} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'start_date'?: string; | |
| /** | |
| * Specify the end date till when you want the settlement reconciliation details. | |
| * @type {string} | |
| * @memberof FetchSettlementsRequestFilters | |
| */ | |
| 'end_date'?: string; |
Raising PR to github