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 diff --git a/README.rst b/README.rst index 530a479..0b141e1 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]": "2019", "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 #### @@ -331,7 +328,6 @@ Retrieve pay = epayco.charge.get("ref_payco") - Split Payments ***** @@ -350,4 +346,5 @@ Previous requirements https://docs.epayco.co/tools/split-payment "split_primary_receiver_fee":"10" } - pay_split = objepayco.charge.create(payment_info) \ No newline at end of file + pay_split = objepayco.charge.create(payment_info) + diff --git a/pyepayco/resources.py b/pyepayco/resources.py index 388e1f6..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, @@ -309,7 +309,7 @@ def getlist(self): """ def cancel(self, uid=None): - options = {uid: uid} + options = {'id': uid} return self.request( "POST",