Skip to content

Bug fixes and improvement README #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ test*.py
build/*

#Ignore idea
idea/*
*.idea
61 changes: 29 additions & 32 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
####
Expand All @@ -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
####
Expand All @@ -63,31 +64,29 @@ Create
"email": "[email protected]",
"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
####
Expand Down Expand Up @@ -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
####
Expand Down Expand Up @@ -331,7 +328,6 @@ Retrieve

pay = epayco.charge.get("ref_payco")


Split Payments
*****

Expand All @@ -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)
pay_split = objepayco.charge.create(payment_info)

4 changes: 2 additions & 2 deletions pyepayco/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -309,7 +309,7 @@ def getlist(self):
"""

def cancel(self, uid=None):
options = {uid: uid}
options = {'id': uid}

return self.request(
"POST",
Expand Down