diff --git a/moyasar/__init__.py b/moyasar/__init__.py index 5536c27..a0888be 100644 --- a/moyasar/__init__.py +++ b/moyasar/__init__.py @@ -1,5 +1,3 @@ -import base64 - import requests import json from moyasar.payment import Payment diff --git a/moyasar/actions/create.py b/moyasar/actions/create.py index dd79e49..600e080 100644 --- a/moyasar/actions/create.py +++ b/moyasar/actions/create.py @@ -5,7 +5,7 @@ class Create(Constructor): def __init__(self, data): - super().__init__(data) + super().__init__(**data) @classmethod def create_url(cls): diff --git a/moyasar/payment.py b/moyasar/payment.py index 1068502..cbf3002 100644 --- a/moyasar/payment.py +++ b/moyasar/payment.py @@ -8,12 +8,12 @@ def __init__(self, **kwargs): super().__init__(**kwargs) @classmethod - def build(cls, payment): - if payment.source['type'] == "creditcard": - payment.source = Source.source_to_creditcard(payment.source) + def build(cls, source): + if source['type'] == "creditcard": + source = Source.source_to_creditcard(source) else: - payment.source = Source.source_to_sadad(payment.source) - return payment + source = Source.source_to_sadad(source) + return source @classmethod def source_to_creditcard(cls, data): @@ -37,8 +37,9 @@ class Sadad(Source): class Payment(Resource, Refund): def __init__(self, data): super().__init__(data) - Source.build(self) + self.source = Source.build(self.source) def refund(self, amount=None): super().refund(amount) - __class__.build(self) + self.source = Source.build(self.source) + return self diff --git a/requirements.txt b/requirements.txt index 335bdce..f5caaa5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ py==1.8.0 py-bcrypt==0.4 Pygments==2.3.1 pytest==4.3.0 -PyYAML==3.13 +PyYAML==4.2b1 requests==2.21.0 six==1.12.0 smmap2==2.0.5 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b266f7e --- /dev/null +++ b/setup.py @@ -0,0 +1,20 @@ +import setuptools + +with open("README.rst", "r") as fh: + long_description = fh.read() +setuptools.setup( + name="moyasar-python", + version="0.6", + author="Moyasar", + author_email="developer@moyasar.com", + description="Moyasar Python language wrapper", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/moyasar/moyasar-python", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: MIT License", + "Operating System :: OS Independent", + ], +)