Skip to content
This repository was archived by the owner on Jun 26, 2025. It is now read-only.

Commit 1a05390

Browse files
nuhamozainiecleel
authored andcommitted
fixes (#2)
* setup.py, minor fixes to create() and refund() and package security update. * passing only source to source builder instead of the whole payment object
1 parent 159e308 commit 1a05390

5 files changed

Lines changed: 30 additions & 11 deletions

File tree

moyasar/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import base64
2-
31
import requests
42
import json
53
from moyasar.payment import Payment

moyasar/actions/create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class Create(Constructor):
77
def __init__(self, data):
8-
super().__init__(data)
8+
super().__init__(**data)
99

1010
@classmethod
1111
def create_url(cls):

moyasar/payment.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ def __init__(self, **kwargs):
88
super().__init__(**kwargs)
99

1010
@classmethod
11-
def build(cls, payment):
12-
if payment.source['type'] == "creditcard":
13-
payment.source = Source.source_to_creditcard(payment.source)
11+
def build(cls, source):
12+
if source['type'] == "creditcard":
13+
source = Source.source_to_creditcard(source)
1414
else:
15-
payment.source = Source.source_to_sadad(payment.source)
16-
return payment
15+
source = Source.source_to_sadad(source)
16+
return source
1717

1818
@classmethod
1919
def source_to_creditcard(cls, data):
@@ -37,8 +37,9 @@ class Sadad(Source):
3737
class Payment(Resource, Refund):
3838
def __init__(self, data):
3939
super().__init__(data)
40-
Source.build(self)
40+
self.source = Source.build(self.source)
4141

4242
def refund(self, amount=None):
4343
super().refund(amount)
44-
__class__.build(self)
44+
self.source = Source.build(self.source)
45+
return self

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ py==1.8.0
2222
py-bcrypt==0.4
2323
Pygments==2.3.1
2424
pytest==4.3.0
25-
PyYAML==3.13
25+
PyYAML==4.2b1
2626
requests==2.21.0
2727
six==1.12.0
2828
smmap2==2.0.5

setup.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import setuptools
2+
3+
with open("README.rst", "r") as fh:
4+
long_description = fh.read()
5+
setuptools.setup(
6+
name="moyasar-python",
7+
version="0.6",
8+
author="Moyasar",
9+
author_email="developer@moyasar.com",
10+
description="Moyasar Python language wrapper",
11+
long_description=long_description,
12+
long_description_content_type="text/markdown",
13+
url="https://github.com/moyasar/moyasar-python",
14+
packages=setuptools.find_packages(),
15+
classifiers=[
16+
"Programming Language :: Python :: 3",
17+
"License :: MIT License",
18+
"Operating System :: OS Independent",
19+
],
20+
)

0 commit comments

Comments
 (0)