├── .codeclimate.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .travis.yml ├── CHANGES.rst ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.rst ├── pytest.ini ├── requirements-dev.txt ├── requirements.txt ├── setup.py ├── tests ├── __init__.py ├── conftest.py └── test_api.py └── vindi ├── __init__.py ├── api.py └── resource.py /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | --- 2 | engines: 3 | duplication: 4 | enabled: true 5 | config: 6 | languages: 7 | - python 8 | checks: 9 | Similar code: 10 | enabled: false 11 | fixme: 12 | enabled: true 13 | radon: 14 | enabled: true 15 | ratings: 16 | paths: 17 | - "**.py" 18 | exclude_paths: 19 | - tests/ 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | 85 | # Spyder project settings 86 | .spyderproject 87 | 88 | # Rope project settings 89 | .ropeproject 90 | 91 | .DS_Store -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: local 3 | hooks: 4 | - id: black 5 | name: black 6 | entry: black 7 | language: system 8 | types: [python] 9 | args: ['--diff'] 10 | - id: isort 11 | name: isort 12 | entry: isort 13 | language: system 14 | types: [python] 15 | args: ['--check-only'] 16 | - id: flake8 17 | name: flake8 18 | entry: flake8 19 | language: system 20 | types: [python] 21 | args: ['--ignore=E501,W503'] 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.6" 4 | - "3.7" 5 | # command to install dependencies 6 | install: 7 | - pip install -r requirements-dev.txt 8 | before_script: 9 | - make lint 10 | # command to run tests 11 | script: 12 | pytest 13 | after_success: 14 | coveralls 15 | -------------------------------------------------------------------------------- /CHANGES.rst: -------------------------------------------------------------------------------- 1 | Changelog 2 | --------- 3 | 4 | 1.0.0 5 | ~~~~~ 6 | 7 | * Suporte a python 3.5 removido. 8 | * Versão do simple-rest-client atualizada para >= 1.0.0 9 | 10 | 0.2.0 11 | ~~~~~ 12 | 13 | * Adicionado o parâmetro api_root_url na função get_api_instance. 14 | 15 | 0.1.0 16 | ~~~~~ 17 | 18 | * Release inicial. 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Allisson Azevedo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.rst 3 | include CHANGES.rst 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean-pyc 2 | 3 | default: test 4 | 5 | clean-pyc: 6 | @find . -iname '*.py[co]' -delete 7 | @find . -iname '__pycache__' -delete 8 | @find . -iname '.coverage' -delete 9 | 10 | clean-dist: 11 | @rm -rf dist/ 12 | @rm -rf build/ 13 | @rm -rf *.egg-info 14 | 15 | clean: clean-pyc clean-dist 16 | 17 | test: 18 | py.test -vvv --cov=vindi tests 19 | 20 | dist: clean 21 | python setup.py sdist 22 | python setup.py bdist_wheel 23 | 24 | release: dist 25 | git tag `python setup.py -q version` 26 | git push origin `python setup.py -q version` 27 | twine upload dist/* 28 | 29 | lint: 30 | SKIP=no-commit-to-branch pre-commit run -a -v 31 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Python Vindi 2 | ============ 3 | 4 | |TravisCI Build Status| |Coverage Status| |Requirements Status| 5 | |Scrutinizer Code Quality| |Code Climate| 6 | 7 | ---- 8 | 9 | Integração com API da Vindi (Python 3.5+). 10 | 11 | 12 | Como instalar 13 | ------------- 14 | 15 | .. code:: shell 16 | 17 | pip install vindi 18 | 19 | 20 | Tutorial 21 | -------- 22 | 23 | .. code:: python 24 | 25 | >>> # import inicial 26 | >>> from vindi.api import get_api_instance 27 | >>> # criando uma nova instância da api 28 | >>> api = get_api_instance(token='seu-token-da-vindi') 29 | >>> # listando todos os resources disponíveis 30 | >>> api.get_resource_list() 31 | ['customers', 'plans', 'products', 'payment_methods', 'discounts', 'subscriptions', 'product_items', 'periods', 'bills', 'bill_items', 'charges', 'transactions', 'payment_profiles', 'usages', 'invoices', 'movements', 'messages', 'import_batches', 'merchant', 'issues'] 32 | >>> # listando todas as ações disponíveis para o resource customers 33 | >>> api.customers.actions 34 | {'list': {'method': 'GET', 'url': 'customers'}, 'create': {'method': 'POST', 'url': 'customers'}, 'retrieve': {'method': 'GET', 'url': 'customers/{}'}, 'update': {'method': 'PUT', 'url': 'customers/{}'}, 'destroy': {'method': 'DELETE', 'url': 'customers/{}'}} 35 | >>> # executando ação list com todos os parâmetros possíveis 36 | >>> response = api.customers.list(body=None, params={}, headers={}) 37 | >>> # trabalhando com uma instância response 38 | >>> response.url 39 | 'https://app.vindi.com.br/api/v1/customers' 40 | >>> response.method 41 | 'GET' 42 | >>> response.headers 43 | {'Cache-Control': 'max-age=0, private, must-revalidate', 'Content-Type': 'application/json; charset=UTF-8', 'Date': 'Fri, 21 Apr 2017 15:30:11 GMT', 'ETag': 'W/"0cbcb8ab8eb167a7525bdc61c7b89ba3"', 'Per-Page': '25', 'Rate-Limit-Limit': '120', 'Rate-Limit-Remaining': '119', 'Rate-Limit-Reset': '1492788671', 'Server': 'nginx', 'Total': '2', 'Vindi-Merchant-Id': '5963', 'X-Request-Id': 'd155bf74-df8e-4803-8281-8f1fe0373814', 'X-Runtime': '0.034142', 'Content-Length': '773', 'Connection': 'keep-alive'} 44 | >>> response.body 45 | {'customers': [{'id': 2481112, 'name': 'Jane Doe', 'email': 'jane@doe.com', 'registry_code': None, 'code': None, 'notes': None, 'status': 'archived', 'created_at': '2017-04-19T13:08:51.000-03:00', 'updated_at': '2017-04-19T13:25:57.000-03:00', 'metadata': {}, 'address': {'street': None, 'number': None, 'additional_details': None, 'zipcode': None, 'neighborhood': None, 'city': None, 'state': None, 'country': None}, 'phones': []}, {'id': 2481258, 'name': 'John Doe', 'email': 'john@doe.com', 'registry_code': None, 'code': None, 'notes': None, 'status': 'inactive', 'created_at': '2017-04-19T13:27:35.000-03:00', 'updated_at': '2017-04-19T13:27:35.000-03:00', 'metadata': {}, 'address': {'street': None, 'number': None, 'additional_details': None, 'zipcode': None, 'neighborhood': None, 'city': None, 'state': None, 'country': None}, 'phones': []}]} 46 | >>> response.status_code 47 | 200 48 | >>> # fim \o/ 49 | 50 | 51 | Usando o ambiente sandbox 52 | ------------------------- 53 | 54 | .. code:: python 55 | 56 | >>> # import inicial 57 | >>> from vindi.api import get_api_instance 58 | >>> # criando uma nova instância da api 59 | >>> api = get_api_instance(token='seu-token-da-vindi', api_root_url='https://sandbox-app.vindi.com.br/api/v1/') 60 | 61 | 62 | Verifique a documentação da `API Vindi`_. 63 | 64 | .. _`API Vindi`: https://vindi.github.io/api-docs/dist/ 65 | 66 | .. |TravisCI Build Status| image:: https://travis-ci.org/allisson/python-vindi.svg?branch=master 67 | :target: https://travis-ci.org/allisson/python-vindi 68 | .. |Coverage Status| image:: https://coveralls.io/repos/github/allisson/python-vindi/badge.svg?branch=master 69 | :target: https://coveralls.io/github/allisson/python-vindi?branch=master 70 | .. |Requirements Status| image:: https://requires.io/github/allisson/python-vindi/requirements.svg?branch=master 71 | :target: https://requires.io/github/allisson/python-vindi/requirements/?branch=master 72 | .. |Scrutinizer Code Quality| image:: https://scrutinizer-ci.com/g/allisson/python-vindi/badges/quality-score.png?b=master 73 | :target: https://scrutinizer-ci.com/g/allisson/python-vindi/?branch=master 74 | .. |Code Climate| image:: https://codeclimate.com/github/allisson/python-vindi/badges/gpa.svg 75 | :target: https://codeclimate.com/github/allisson/python-vindi 76 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = -vvv --cov=vindi --cov-report=term-missing -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | -r requirements.txt 2 | Sphinx 3 | black 4 | coveralls 5 | flake8 6 | isort 7 | pre-commit 8 | pytest 9 | pytest-cov 10 | twine 11 | vcrpy 12 | wheel 13 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | simple-rest-client>=0.1.1 -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import codecs 2 | import os 3 | import re 4 | 5 | from setuptools import Command, find_packages, setup 6 | 7 | here = os.path.abspath(os.path.dirname(__file__)) 8 | 9 | version = "0.0.0" 10 | changes = os.path.join(here, "CHANGES.rst") 11 | match = r"^#*\s*(?P[0-9]+\.[0-9]+(\.[0-9]+)?)$" 12 | with codecs.open(changes, encoding="utf-8") as changes: 13 | for line in changes: 14 | res = re.match(match, line) 15 | if res: 16 | version = res.group("version") 17 | break 18 | 19 | # Get the long description 20 | with codecs.open(os.path.join(here, "README.rst"), encoding="utf-8") as f: 21 | long_description = f.read() 22 | 23 | # Get version 24 | with codecs.open(os.path.join(here, "CHANGES.rst"), encoding="utf-8") as f: 25 | changelog = f.read() 26 | 27 | 28 | install_requirements = ["simple-rest-client>=1.0.0"] 29 | tests_requirements = ["pytest", "pytest-cov", "coveralls"] 30 | 31 | 32 | class VersionCommand(Command): 33 | description = "print library version" 34 | user_options = [] 35 | 36 | def initialize_options(self): 37 | pass 38 | 39 | def finalize_options(self): 40 | pass 41 | 42 | def run(self): 43 | print(version) 44 | 45 | 46 | setup( 47 | name="vindi", 48 | version=version, 49 | description="Integração com API da Vindi (Python 3.6+)", 50 | long_description=long_description, 51 | url="https://github.com/allisson/python-vindi", 52 | author="Allisson Azevedo", 53 | author_email="allisson@gmail.com", 54 | classifiers=[ 55 | "Development Status :: 3 - Alpha", 56 | "Intended Audience :: Developers", 57 | "Programming Language :: Python :: 3.6", 58 | "Programming Language :: Python :: 3.7", 59 | "Topic :: Software Development :: Libraries", 60 | ], 61 | keywords="rest client http vindi", 62 | packages=find_packages(exclude=["docs", "tests*"]), 63 | setup_requires=["pytest-runner"], 64 | install_requires=install_requirements, 65 | tests_require=tests_requirements, 66 | cmdclass={"version": VersionCommand}, 67 | ) 68 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allisson/python-vindi/dc37a493ed3a88d085cc86db3f5dafddd6257a6f/tests/__init__.py -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | 5 | from vindi.api import get_api_instance 6 | 7 | 8 | @pytest.fixture 9 | def api(): 10 | return get_api_instance(token=os.getenv("API_TOKEN", "")) 11 | -------------------------------------------------------------------------------- /tests/test_api.py: -------------------------------------------------------------------------------- 1 | from vindi.api import get_api_instance 2 | 3 | 4 | def test_get_api_instance(): 5 | api = get_api_instance(token="") 6 | assert api.api_root_url == "https://app.vindi.com.br/api/v1/" 7 | assert api.headers["Authorization"] == "Basic Og==" 8 | assert api.headers["Content-Type"] == "application/json" 9 | assert api.json_encode_body 10 | 11 | 12 | def test_get_api_instance_with_api_root_url(): 13 | api = get_api_instance( 14 | token="", api_root_url="https://sandbox-app.vindi.com.br/api/v1/" 15 | ) 16 | assert api.api_root_url == "https://sandbox-app.vindi.com.br/api/v1/" 17 | assert api.headers["Authorization"] == "Basic Og==" 18 | assert api.headers["Content-Type"] == "application/json" 19 | assert api.json_encode_body 20 | -------------------------------------------------------------------------------- /vindi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allisson/python-vindi/dc37a493ed3a88d085cc86db3f5dafddd6257a6f/vindi/__init__.py -------------------------------------------------------------------------------- /vindi/api.py: -------------------------------------------------------------------------------- 1 | from requests.auth import _basic_auth_str as basic_http_auth 2 | from simple_rest_client.api import API 3 | 4 | from vindi import resource 5 | 6 | 7 | def get_api_instance(token="", api_root_url=None, timeout=3): 8 | headers = { 9 | "Authorization": basic_http_auth(token, ""), 10 | "Content-Type": "application/json", 11 | } 12 | import_batches_headers = { 13 | "Authorization": basic_http_auth(token, ""), 14 | "Content-Type": "multipart/form-data", 15 | } 16 | api_root_url = api_root_url or "https://app.vindi.com.br/api/v1/" 17 | api = API( 18 | api_root_url=api_root_url, 19 | headers=headers, 20 | json_encode_body=True, 21 | timeout=timeout, 22 | ) 23 | api.add_resource( 24 | resource_name="customers", resource_class=resource.CustomerResource 25 | ) 26 | api.add_resource(resource_name="plans", resource_class=resource.PlanResource) 27 | api.add_resource(resource_name="products", resource_class=resource.ProductResource) 28 | api.add_resource( 29 | resource_name="payment_methods", resource_class=resource.PaymentMethodResource 30 | ) 31 | api.add_resource( 32 | resource_name="discounts", resource_class=resource.DiscountResource 33 | ) 34 | api.add_resource( 35 | resource_name="subscriptions", resource_class=resource.SubscriptionResource 36 | ) 37 | api.add_resource( 38 | resource_name="product_items", resource_class=resource.ProductItemResource 39 | ) 40 | api.add_resource(resource_name="periods", resource_class=resource.PeriodResource) 41 | api.add_resource(resource_name="bills", resource_class=resource.BillResource) 42 | api.add_resource( 43 | resource_name="bill_items", resource_class=resource.BillItemResource 44 | ) 45 | api.add_resource(resource_name="charges", resource_class=resource.ChargeResource) 46 | api.add_resource( 47 | resource_name="transactions", resource_class=resource.TransactionResource 48 | ) 49 | api.add_resource( 50 | resource_name="payment_profiles", resource_class=resource.PaymentProfileResource 51 | ) 52 | api.add_resource(resource_name="usages", resource_class=resource.UsageResource) 53 | api.add_resource(resource_name="invoices", resource_class=resource.InvoiceResource) 54 | api.add_resource( 55 | resource_name="movements", resource_class=resource.MovementResource 56 | ) 57 | api.add_resource(resource_name="messages", resource_class=resource.MessageResource) 58 | api.add_resource( 59 | resource_name="import_batches", 60 | resource_class=resource.ImportBatchResource, 61 | json_encode_body=False, 62 | headers=import_batches_headers, 63 | ) 64 | api.add_resource(resource_name="merchant", resource_class=resource.MerchantResource) 65 | api.add_resource(resource_name="issues", resource_class=resource.IssueResource) 66 | return api 67 | -------------------------------------------------------------------------------- /vindi/resource.py: -------------------------------------------------------------------------------- 1 | from simple_rest_client.resource import Resource 2 | 3 | 4 | class CustomerResource(Resource): 5 | actions = { 6 | "list": {"method": "GET", "url": "customers"}, 7 | "create": {"method": "POST", "url": "customers"}, 8 | "retrieve": {"method": "GET", "url": "customers/{}"}, 9 | "update": {"method": "PUT", "url": "customers/{}"}, 10 | "destroy": {"method": "DELETE", "url": "customers/{}"}, 11 | } 12 | 13 | 14 | class PlanResource(Resource): 15 | actions = { 16 | "list": {"method": "GET", "url": "plans"}, 17 | "create": {"method": "POST", "url": "plans"}, 18 | "retrieve": {"method": "GET", "url": "plans/{}"}, 19 | "update": {"method": "PUT", "url": "plans/{}"}, 20 | } 21 | 22 | 23 | class ProductResource(Resource): 24 | actions = { 25 | "list": {"method": "GET", "url": "products"}, 26 | "create": {"method": "POST", "url": "products"}, 27 | "retrieve": {"method": "GET", "url": "products/{}"}, 28 | "update": {"method": "PUT", "url": "products/{}"}, 29 | } 30 | 31 | 32 | class PaymentMethodResource(Resource): 33 | actions = { 34 | "list": {"method": "GET", "url": "payment_methods"}, 35 | "retrieve": {"method": "GET", "url": "payment_methods/{}"}, 36 | } 37 | 38 | 39 | class DiscountResource(Resource): 40 | actions = { 41 | "create": {"method": "POST", "url": "discounts"}, 42 | "retrieve": {"method": "GET", "url": "discounts/{}"}, 43 | "destroy": {"method": "DELETE", "url": "discounts/{}"}, 44 | } 45 | 46 | 47 | class SubscriptionResource(Resource): 48 | actions = { 49 | "list": {"method": "GET", "url": "subscriptions"}, 50 | "create": {"method": "POST", "url": "subscriptions"}, 51 | "retrieve": {"method": "GET", "url": "subscriptions/{}"}, 52 | "update": {"method": "PUT", "url": "subscriptions/{}"}, 53 | "destroy": {"method": "DELETE", "url": "subscriptions/{}"}, 54 | "renew": {"method": "POST", "url": "subscriptions/{}/renew"}, 55 | "reactivate": {"method": "POST", "url": "subscriptions/{}/reactivate"}, 56 | } 57 | 58 | 59 | class ProductItemResource(Resource): 60 | actions = { 61 | "create": {"method": "POST", "url": "product_items"}, 62 | "retrieve": {"method": "GET", "url": "product_items/{}"}, 63 | "update": {"method": "PUT", "url": "product_items/{}"}, 64 | "destroy": {"method": "DELETE", "url": "product_items/{}"}, 65 | } 66 | 67 | 68 | class PeriodResource(Resource): 69 | actions = { 70 | "list": {"method": "GET", "url": "periods"}, 71 | "retrieve": {"method": "GET", "url": "periods/{}"}, 72 | "update": {"method": "PUT", "url": "periods/{}"}, 73 | "bill": {"method": "POST", "url": "periods/{}/bill"}, 74 | } 75 | 76 | 77 | class BillResource(Resource): 78 | actions = { 79 | "list": {"method": "GET", "url": "bills"}, 80 | "create": {"method": "POST", "url": "bills"}, 81 | "retrieve": {"method": "GET", "url": "bills/{}"}, 82 | "update": {"method": "PUT", "url": "bills/{}"}, 83 | "destroy": {"method": "DELETE", "url": "bills/{}"}, 84 | "approve": {"method": "POST", "url": "bills/{}/approve"}, 85 | "charge": {"method": "POST", "url": "bills/{}/charge"}, 86 | } 87 | 88 | 89 | class BillItemResource(Resource): 90 | actions = {"retrieve": {"method": "GET", "url": "bill_items/{}"}} 91 | 92 | 93 | class ChargeResource(Resource): 94 | actions = { 95 | "list": {"method": "GET", "url": "charges"}, 96 | "retrieve": {"method": "GET", "url": "charges/{}"}, 97 | "update": {"method": "PUT", "url": "charges/{}"}, 98 | "destroy": {"method": "DELETE", "url": "charges/{}"}, 99 | "reissue": {"method": "POST", "url": "charges/{}/reissue"}, 100 | "charge": {"method": "POST", "url": "charges/{}/charge"}, 101 | "refund": {"method": "POST", "url": "charges/{}/refund"}, 102 | "fraud_review": {"method": "POST", "url": "charges/{}/fraud_review"}, 103 | } 104 | 105 | 106 | class TransactionResource(Resource): 107 | actions = { 108 | "list": {"method": "GET", "url": "transactions"}, 109 | "create": {"method": "POST", "url": "transactions"}, 110 | "retrieve": {"method": "GET", "url": "transactions/{}"}, 111 | "update": {"method": "PUT", "url": "transactions/{}"}, 112 | } 113 | 114 | 115 | class PaymentProfileResource(Resource): 116 | actions = { 117 | "list": {"method": "GET", "url": "payment_profiles"}, 118 | "create": {"method": "POST", "url": "payment_profiles"}, 119 | "retrieve": {"method": "GET", "url": "payment_profiles/{}"}, 120 | "destroy": {"method": "DELETE", "url": "payment_profiles/{}"}, 121 | "verify": {"method": "POST", "url": "payment_profiles/{}/verify"}, 122 | } 123 | 124 | 125 | class UsageResource(Resource): 126 | actions = { 127 | "create": {"method": "POST", "url": "usages"}, 128 | "destroy": {"method": "DELETE", "url": "usages/{}"}, 129 | } 130 | 131 | 132 | class InvoiceResource(Resource): 133 | actions = { 134 | "list": {"method": "GET", "url": "invoices"}, 135 | "create": {"method": "POST", "url": "invoices"}, 136 | "retrieve": {"method": "GET", "url": "invoices/{}"}, 137 | "destroy": {"method": "DELETE", "url": "invoices/{}"}, 138 | "retry": {"method": "POST", "url": "invoices/{}/retry"}, 139 | } 140 | 141 | 142 | class MovementResource(Resource): 143 | actions = {"create": {"method": "POST", "url": "movements"}} 144 | 145 | 146 | class MessageResource(Resource): 147 | actions = { 148 | "list": {"method": "GET", "url": "messages"}, 149 | "create": {"method": "POST", "url": "messages"}, 150 | "retrieve": {"method": "GET", "url": "messages/{}"}, 151 | } 152 | 153 | 154 | class ImportBatchResource(Resource): 155 | actions = { 156 | "list": {"method": "GET", "url": "import_batches"}, 157 | "create": {"method": "POST", "url": "import_batches"}, 158 | "retrieve": {"method": "GET", "url": "import_batches/{}"}, 159 | } 160 | 161 | 162 | class MerchantResource(Resource): 163 | actions = {"list": {"method": "GET", "url": "merchant"}} 164 | 165 | 166 | class IssueResource(Resource): 167 | actions = { 168 | "list": {"method": "GET", "url": "issues"}, 169 | "retrieve": {"method": "GET", "url": "issues/{}"}, 170 | "update": {"method": "PUT", "url": "issues/{}"}, 171 | } 172 | --------------------------------------------------------------------------------