Skip to content

Commit

Permalink
Merge pull request #58 from cashfree/4.1.2
Browse files Browse the repository at this point in the history
4.1.2
  • Loading branch information
suhas-cashfree authored Apr 1, 2024
2 parents f6dde51 + 2cd1472 commit adc354f
Show file tree
Hide file tree
Showing 16 changed files with 277 additions and 163 deletions.
3 changes: 0 additions & 3 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ cashfree_pg/models/upi_details.py
cashfree_pg/models/upi_payment_method.py
cashfree_pg/models/upload_terminal_docs.py
cashfree_pg/models/upload_terminal_docs_entity.py
cashfree_pg/models/upload_vendor_docs_request.py
cashfree_pg/models/upload_vendor_documents_response.py
cashfree_pg/models/vendor_balance.py
cashfree_pg/models/vendor_balance_transfer_charges.py
Expand Down Expand Up @@ -405,7 +404,6 @@ docs/Upi.md
docs/UpiDetails.md
docs/UploadTerminalDocs.md
docs/UploadTerminalDocsEntity.md
docs/UploadVendorDocsRequest.md
docs/UploadVendorDocumentsResponse.md
docs/VendorBalance.md
docs/VendorBalanceTransferCharges.md
Expand Down Expand Up @@ -613,7 +611,6 @@ test/test_upi_details.py
test/test_upi_payment_method.py
test/test_upload_terminal_docs.py
test/test_upload_terminal_docs_entity.py
test/test_upload_vendor_docs_request.py
test/test_upload_vendor_documents_response.py
test/test_vendor_balance.py
test/test_vendor_balance_transfer_charges.py
Expand Down
3 changes: 1 addition & 2 deletions cashfree_pg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
""" # noqa: E501


__version__ = "4.0.10"
__version__ = "4.1.2"

# import apis into sdk package
# import ApiClient
Expand Down Expand Up @@ -208,7 +208,6 @@
from cashfree_pg.models.upi_details import UpiDetails
from cashfree_pg.models.upload_terminal_docs import UploadTerminalDocs
from cashfree_pg.models.upload_terminal_docs_entity import UploadTerminalDocsEntity
from cashfree_pg.models.upload_vendor_docs_request import UploadVendorDocsRequest
from cashfree_pg.models.upload_vendor_documents_response import UploadVendorDocumentsResponse
from cashfree_pg.models.vendor_balance import VendorBalance
from cashfree_pg.models.vendor_balance_transfer_charges import VendorBalanceTransferCharges
Expand Down
268 changes: 217 additions & 51 deletions cashfree_pg/api_client.py

Large diffs are not rendered by default.

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.0.10".\
"SDK Package Version: 4.1.2".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
1 change: 0 additions & 1 deletion cashfree_pg/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@
from cashfree_pg.models.upi_details import UpiDetails
from cashfree_pg.models.upload_terminal_docs import UploadTerminalDocs
from cashfree_pg.models.upload_terminal_docs_entity import UploadTerminalDocsEntity
from cashfree_pg.models.upload_vendor_docs_request import UploadVendorDocsRequest
from cashfree_pg.models.upload_vendor_documents_response import UploadVendorDocumentsResponse
from cashfree_pg.models.vendor_balance import VendorBalance
from cashfree_pg.models.vendor_balance_transfer_charges import VendorBalanceTransferCharges
Expand Down
20 changes: 15 additions & 5 deletions cashfree_pg/models/create_link_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
import json


from typing import Dict, Optional, Union
from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, constr
from typing import Dict, List, Optional, Union
from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist, constr
from cashfree_pg.models.link_customer_details_entity import LinkCustomerDetailsEntity
from cashfree_pg.models.link_meta_response_entity import LinkMetaResponseEntity
from cashfree_pg.models.link_notify_entity import LinkNotifyEntity
from cashfree_pg.models.vendor_split import VendorSplit

class CreateLinkRequest(BaseModel):
"""
Expand All @@ -41,7 +42,8 @@ class CreateLinkRequest(BaseModel):
link_auto_reminders: Optional[StrictBool] = Field(None, description="If \"true\", reminders will be sent to customers for collecting payments.")
link_notes: Optional[Dict[str, StrictStr]] = Field(None, description="Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs")
link_meta: Optional[LinkMetaResponseEntity] = None
__properties = ["link_id", "link_amount", "link_currency", "link_purpose", "customer_details", "link_partial_payments", "link_minimum_partial_amount", "link_expiry_time", "link_notify", "link_auto_reminders", "link_notes", "link_meta"]
order_splits: Optional[conlist(VendorSplit)] = Field(None, description="If you have Easy split enabled in your Cashfree account then you can use this option to split the order amount.")
__properties = ["link_id", "link_amount", "link_currency", "link_purpose", "customer_details", "link_partial_payments", "link_minimum_partial_amount", "link_expiry_time", "link_notify", "link_auto_reminders", "link_notes", "link_meta", "order_splits"]

class Config:
"""Pydantic configuration"""
Expand All @@ -65,7 +67,7 @@ def from_json(cls, json_str: str) -> CreateLinkRequest:
def from_json_for_one_of(cls, json_str: str) -> CreateLinkRequest:
"""Create an instance of CreateLinkRequest from a JSON string"""
temp_dict = json.loads(json_str)
if "link_id, link_amount, link_currency, link_purpose, customer_details, link_partial_payments, link_minimum_partial_amount, link_expiry_time, link_notify, link_auto_reminders, link_notes, link_meta" in temp_dict.keys():
if "link_id, link_amount, link_currency, link_purpose, customer_details, link_partial_payments, link_minimum_partial_amount, link_expiry_time, link_notify, link_auto_reminders, link_notes, link_meta, order_splits" in temp_dict.keys():
return cls.from_dict(json.loads(json_str))
return None

Expand All @@ -84,6 +86,13 @@ def to_dict(self):
# override the default output from pydantic by calling `to_dict()` of link_meta
if self.link_meta:
_dict['link_meta'] = self.link_meta.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in order_splits (list)
_items = []
if self.order_splits:
for _item in self.order_splits:
if _item:
_items.append(_item.to_dict())
_dict['order_splits'] = _items
return _dict

@classmethod
Expand All @@ -107,7 +116,8 @@ def from_dict(cls, obj: dict) -> CreateLinkRequest:
"link_notify": LinkNotifyEntity.from_dict(obj.get("link_notify")) if obj.get("link_notify") is not None else None,
"link_auto_reminders": obj.get("link_auto_reminders"),
"link_notes": obj.get("link_notes"),
"link_meta": LinkMetaResponseEntity.from_dict(obj.get("link_meta")) if obj.get("link_meta") is not None else None
"link_meta": LinkMetaResponseEntity.from_dict(obj.get("link_meta")) if obj.get("link_meta") is not None else None,
"order_splits": [VendorSplit.from_dict(_item) for _item in obj.get("order_splits")] if obj.get("order_splits") is not None else None
})
return _obj

Expand Down
20 changes: 15 additions & 5 deletions cashfree_pg/models/link_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
import json


from typing import Dict, Optional, Union
from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Dict, List, Optional, Union
from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist
from cashfree_pg.models.link_customer_details_entity import LinkCustomerDetailsEntity
from cashfree_pg.models.link_meta_response_entity import LinkMetaResponseEntity
from cashfree_pg.models.link_notify_entity import LinkNotifyEntity
from cashfree_pg.models.vendor_split import VendorSplit

class LinkEntity(BaseModel):
"""
Expand All @@ -47,7 +48,8 @@ class LinkEntity(BaseModel):
link_auto_reminders: Optional[StrictBool] = None
link_notify: Optional[LinkNotifyEntity] = None
link_qrcode: Optional[StrictStr] = Field(None, description="Base64 encoded string for payment link. You can scan with camera to open a link in the browser to complete the payment.")
__properties = ["cf_link_id", "link_id", "link_status", "link_currency", "link_amount", "link_amount_paid", "link_partial_payments", "link_minimum_partial_amount", "link_purpose", "link_created_at", "customer_details", "link_meta", "link_url", "link_expiry_time", "link_notes", "link_auto_reminders", "link_notify", "link_qrcode"]
order_splits: Optional[conlist(VendorSplit)] = None
__properties = ["cf_link_id", "link_id", "link_status", "link_currency", "link_amount", "link_amount_paid", "link_partial_payments", "link_minimum_partial_amount", "link_purpose", "link_created_at", "customer_details", "link_meta", "link_url", "link_expiry_time", "link_notes", "link_auto_reminders", "link_notify", "link_qrcode", "order_splits"]

class Config:
"""Pydantic configuration"""
Expand All @@ -71,7 +73,7 @@ def from_json(cls, json_str: str) -> LinkEntity:
def from_json_for_one_of(cls, json_str: str) -> LinkEntity:
"""Create an instance of LinkEntity from a JSON string"""
temp_dict = json.loads(json_str)
if "cf_link_id, link_id, link_status, link_currency, link_amount, link_amount_paid, link_partial_payments, link_minimum_partial_amount, link_purpose, link_created_at, customer_details, link_meta, link_url, link_expiry_time, link_notes, link_auto_reminders, link_notify, link_qrcode" in temp_dict.keys():
if "cf_link_id, link_id, link_status, link_currency, link_amount, link_amount_paid, link_partial_payments, link_minimum_partial_amount, link_purpose, link_created_at, customer_details, link_meta, link_url, link_expiry_time, link_notes, link_auto_reminders, link_notify, link_qrcode, order_splits" in temp_dict.keys():
return cls.from_dict(json.loads(json_str))
return None

Expand All @@ -90,6 +92,13 @@ def to_dict(self):
# override the default output from pydantic by calling `to_dict()` of link_notify
if self.link_notify:
_dict['link_notify'] = self.link_notify.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in order_splits (list)
_items = []
if self.order_splits:
for _item in self.order_splits:
if _item:
_items.append(_item.to_dict())
_dict['order_splits'] = _items
return _dict

@classmethod
Expand Down Expand Up @@ -119,7 +128,8 @@ def from_dict(cls, obj: dict) -> LinkEntity:
"link_notes": obj.get("link_notes"),
"link_auto_reminders": obj.get("link_auto_reminders"),
"link_notify": LinkNotifyEntity.from_dict(obj.get("link_notify")) if obj.get("link_notify") is not None else None,
"link_qrcode": obj.get("link_qrcode")
"link_qrcode": obj.get("link_qrcode"),
"order_splits": [VendorSplit.from_dict(_item) for _item in obj.get("order_splits")] if obj.get("order_splits") is not None else None
})
return _obj

Expand Down
84 changes: 0 additions & 84 deletions cashfree_pg/models/upload_vendor_docs_request.py

This file was deleted.

12 changes: 7 additions & 5 deletions cashfree_pg/models/vendor_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@
import json


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

class VendorSplit(BaseModel):
"""
Use to split order when cashfree's Easy Split is enabled for your account.
"""
vendor_id: Optional[StrictStr] = Field(None, description="Vendor id created in Cashfree system")
vendor_id: StrictStr = Field(..., description="Vendor id created in Cashfree system")
amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Amount which will be associated with this vendor")
percentage: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Percentage of order amount which shall get added to vendor account")
__properties = ["vendor_id", "amount", "percentage"]
tags: Optional[Dict[str, Dict[str, Any]]] = Field(None, description="Custom Tags in thr form of {\"key\":\"value\"} which can be passed for an order. A maximum of 10 tags can be added")
__properties = ["vendor_id", "amount", "percentage", "tags"]

class Config:
"""Pydantic configuration"""
Expand All @@ -53,7 +54,7 @@ def from_json(cls, json_str: str) -> VendorSplit:
def from_json_for_one_of(cls, json_str: str) -> VendorSplit:
"""Create an instance of VendorSplit from a JSON string"""
temp_dict = json.loads(json_str)
if "vendor_id, amount, percentage" in temp_dict.keys():
if "vendor_id, amount, percentage, tags" in temp_dict.keys():
return cls.from_dict(json.loads(json_str))
return None

Expand All @@ -77,7 +78,8 @@ def from_dict(cls, obj: dict) -> VendorSplit:
_obj = VendorSplit.parse_obj({
"vendor_id": obj.get("vendor_id"),
"amount": obj.get("amount"),
"percentage": obj.get("percentage")
"percentage": obj.get("percentage"),
"tags": obj.get("tags")
})
return _obj

Expand Down
2 changes: 1 addition & 1 deletion 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.0.9".\
"SDK Package Version: 4.0.10".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cashfree_pg"
version = "4.0.10"
version = "4.1.2"
description = "Cashfree Payment Gateway APIs"
authors = ["API Support <developers@cashfree.com>"]
license = "Apache 2.0"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
NAME = "cashfree_pg"
VERSION = "4.0.10"
VERSION = "4.1.2"
with open("README.md", "r", encoding="utf-8") as fh:
readme = fh.read()
PYTHON_REQUIRES = ">=3.7"
Expand Down
3 changes: 2 additions & 1 deletion test/test_create_link_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def make_instance(self, include_optional):
link_notify = {"send_sms":false,"send_email":true},
link_auto_reminders = True,
link_notes = {"key_1":"value_1","key_2":"value_2"},
link_meta = {"notify_url":"https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net","upi_intent":false,"return_url":"https://b8af79f41056.eu.ngrok.io"}
link_meta = {"notify_url":"https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net","upi_intent":false,"return_url":"https://b8af79f41056.eu.ngrok.io"},
order_splits = [{"amount":10,"vendor":"john"}]
)
else :
return CreateLinkRequest(
Expand Down
7 changes: 7 additions & 0 deletions test/test_easy_split_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ def test_p_ges_update_vendors(self):
"""
pass

def test_p_ges_upload_vendors_docs(self):
"""Test case for p_ges_upload_vendors_docs
Upload Vendor Docs # noqa: E501
"""
pass


if __name__ == '__main__':
unittest.main()
5 changes: 4 additions & 1 deletion test/test_link_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def make_instance(self, include_optional):
link_notes = {"key_1":"value_1","key_2":"value_2"},
link_auto_reminders = True,
link_notify = {"send_sms":false,"send_email":true},
link_qrcode = ''
link_qrcode = '',
order_splits = [
{"vendor_id":"Vendor01","amount":100.12,"description":"order amount should be more than equal to 100.12"}
]
)
else :
return LinkEntity(
Expand Down
6 changes: 5 additions & 1 deletion test/test_vendor_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ def make_instance(self, include_optional):
return VendorSplit(
vendor_id = '',
amount = 1.337,
percentage = 1.337
percentage = 1.337,
tags = {
'key' : None
}
)
else :
return VendorSplit(
vendor_id = '',
)
"""

Expand Down

0 comments on commit adc354f

Please sign in to comment.