From 71008d48787dfafe892ee2c9af6480a977659a4c Mon Sep 17 00:00:00 2001 From: Alonso Date: Thu, 13 Sep 2018 15:24:17 -0500 Subject: [PATCH 1/5] ignore .idea(pycharm) folder --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c88eb10..2f2c56d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ test*.py build/* #Ignore idea -idea/* \ No newline at end of file +*.idea \ No newline at end of file From b6916086225342986bb4838ffa41547be4fb558c Mon Sep 17 00:00:00 2001 From: Alonso Date: Fri, 14 Sep 2018 11:48:54 -0500 Subject: [PATCH 2/5] apply PEP8 to README and fix min errors --- README.rst | 59 ++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/README.rst b/README.rst index 7cb9161..e449f5e 100644 --- a/README.rst +++ b/README.rst @@ -28,13 +28,14 @@ Usage import pyepayco.epayco as epayco - apiKey = "491d6a0b6e992cf924edd8d3d088aff1" - privateKey = "268c8e0162990cf2ce97fa7ade2eff5a" - lenguage = "ES" - test = True - options={"apiKey":apiKey,"privateKey":privateKey,"test":test,"lenguage":lenguage} + options={ + "apiKey": "491d6a0b6e992cf924edd8d3d088aff1", + "privateKey": "268c8e0162990cf2ce97fa7ade2eff5a", + "test": True, + "lenguage": "ES" + } - objepayco=epayco.Epayco(options) + objepayco = epayco.Epayco(options) Create Token #### @@ -46,9 +47,9 @@ Create Token "card[exp_year]": "2017", "card[exp_month]": "07", "card[cvc]": "123" - } + } - token=objepayco.token.create(credit_info) + token = objepayco.token.create(credit_info) Customers #### @@ -63,31 +64,29 @@ Create "email": "joe@payco.co", "phone": "3005234321", "default": true - } + } - customer=objepayco.customer.create(customer_info) + customer = objepayco.customer.create(customer_info) Retrieve ****** .. code-block:: python - customer=objepayco.customer.get("eXj5Wdqgj7xzvC7AR") + customer = objepayco.customer.get("eXj5Wdqgj7xzvC7AR") List ****** .. code-block:: python - customers = testepayco.customer.getlist() + customers = objepayco.customer.getlist() Update ****** .. code-block:: python - update_customer_info = { - "name": "Alex" - } - - customer =test.customer.update("eXj5Wdqgj7xzvC7AR",update_customer_info) + customer = test.customer.update( + "eXj5Wdqgj7xzvC7AR", {"name": "Alex"} + ) Plans #### @@ -137,47 +136,45 @@ Create .. code-block:: python subscription_info = { - "id_plan": "coursereact2", - "customer": "9xRxhaJ2YmLTkT5uz", - "token_card": "eXj5Wdqgj7xzvC7AR", - "doc_type": "CC", - "doc_number": "5234567" + "id_plan": "coursereact2", + "customer": "9xRxhaJ2YmLTkT5uz", + "token_card": "eXj5Wdqgj7xzvC7AR", + "doc_type": "CC", + "doc_number": "5234567" } - sub=objepayco.subscriptions.create(subscription_info) + sub = objepayco.subscriptions.create(subscription_info) Retrieve ****** .. code-block:: python - sub=objepayco.subscriptions.get("efPXtZ5r4nZRoPtjZ") + subscription = objepayco.subscriptions.get("efPXtZ5r4nZRoPtjZ") List ****** .. code-block:: python - sub=objepayco.subscriptions.getlist() + subscriptions = objepayco.subscriptions.getlist() Cancel ****** .. code-block:: python - sub=objepayco.subscriptions.cancel("fayE66HxYbxWydaN8") + subscription = objepayco.subscriptions.cancel("fayE66HxYbxWydaN8") Pay Subscription ****** .. code-block:: python - subscription_info = { + sub = objepayco.subscriptions.charge({ "id_plan": "coursereact", "customer": "A6ZGiJ6rgxK5RB2WT", "token_card": "eXj5Wdqgj7xzvC7AR", "doc_type": "CC", "doc_number": "1000000" - } - - sub = objepayco.subscriptions.charge(subscription_info) + }) PSE #### @@ -287,4 +284,4 @@ Retrieve .. code-block:: python - pay = epayco.charge.get("ref_payco") \ No newline at end of file + pay = epayco.charge.get("ref_payco") From 80295059075ca92400d2cc77b44ced79ea1a4108 Mon Sep 17 00:00:00 2001 From: Alonso Enrique Date: Mon, 22 Oct 2018 12:41:30 -0500 Subject: [PATCH 3/5] fix bug to cancel subscription --- pyepayco/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyepayco/resources.py b/pyepayco/resources.py index 388e1f6..1dc61d3 100644 --- a/pyepayco/resources.py +++ b/pyepayco/resources.py @@ -309,7 +309,7 @@ def getlist(self): """ def cancel(self, uid=None): - options = {uid: uid} + options = {id: uid} return self.request( "POST", From df23ed9d3d644e7223534cf96b42d171c0d2b4ce Mon Sep 17 00:00:00 2001 From: Alonso Enrique Date: Mon, 22 Oct 2018 12:42:23 -0500 Subject: [PATCH 4/5] change name in key --- pyepayco/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyepayco/resources.py b/pyepayco/resources.py index 1dc61d3..8b8e158 100644 --- a/pyepayco/resources.py +++ b/pyepayco/resources.py @@ -309,7 +309,7 @@ def getlist(self): """ def cancel(self, uid=None): - options = {id: uid} + options = {'id': uid} return self.request( "POST", From 7354a31f7cf1e6ddca3ac874dd4c359553301ea6 Mon Sep 17 00:00:00 2001 From: Alonso Enrique Date: Mon, 22 Oct 2018 12:50:26 -0500 Subject: [PATCH 5/5] fix resource that search user for id --- pyepayco/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyepayco/resources.py b/pyepayco/resources.py index 8b8e158..8a4bb2a 100644 --- a/pyepayco/resources.py +++ b/pyepayco/resources.py @@ -71,7 +71,7 @@ def create(self, options=None): def get(self, uid): return self.request( "GET", - "payment/v1/customer/" + uid + "/", + "payment/v1/customer/" + self.epayco.api_key + "/" + uid + "/", self.epayco.api_key, None, self.epayco.private_key,