iugu-python-sdk 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Seu Nome
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy...
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: iugu-python-sdk
3
+ Version: 1.0.0
4
+ Summary: Client de comunicaçao c/ API da IUGU
5
+ Author-email: Filipe Coelho <filipe@fmconsult.com.br>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Seu Nome
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy...
11
+
12
+ Project-URL: Homepage, https://github.com/seuuser/minha-biblioteca
13
+ Project-URL: Bug Tracker, https://github.com/seuuser/minha-biblioteca/issues
14
+ Keywords: sdk,api,iugu,fmconsult
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
File without changes
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "iugu-python-sdk"
7
+ version = "1.0.0"
8
+ description = "Client de comunicaçao c/ API da IUGU"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {file = "LICENSE"}
12
+ authors = [
13
+ {name = "Filipe Coelho", email = "filipe@fmconsult.com.br"},
14
+ ]
15
+ keywords = ["sdk", "api", "iugu", "fmconsult"]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+
22
+ dependencies = []
23
+
24
+ [project.urls]
25
+ "Homepage" = "https://github.com/seuuser/minha-biblioteca"
26
+ "Bug Tracker" = "https://github.com/seuuser/minha-biblioteca/issues"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ import os, base64
2
+ from fmconsult.http.api import ApiBase
3
+
4
+ class IuguApi(ApiBase):
5
+
6
+ def __init__(self):
7
+ try:
8
+ self.api_token = os.environ['iugu.api.token']
9
+ self.api_environment = os.environ['iugu.api.environment']
10
+
11
+ self.base_url = 'https://api.iugu.com'
12
+
13
+ token_bytes = f'{self.api_token}:'.encode('utf-8')
14
+ basic_token = base64.b64encode(token_bytes).decode('utf-8')
15
+
16
+ self.headers = {
17
+ 'Authorization': f'Basic {basic_token}'
18
+ }
19
+ except:
20
+ raise
File without changes
@@ -0,0 +1,42 @@
1
+ import logging, jsonpickle
2
+ from http import HTTPMethod
3
+ from fmconsult.utils.url import UrlUtil
4
+ from iugu.api import IuguApi
5
+ from iugu.dtos.customer import Customer
6
+
7
+ class Customers(IuguApi):
8
+ def __init__(self):
9
+ super().__init__()
10
+ self.endpoint_url = UrlUtil().make_url(self.base_url, ['v1', 'customers'])
11
+
12
+ def create(self, data:Customer):
13
+ try:
14
+ logging.info(f'generating customer...')
15
+ res = self.call_request(HTTPMethod.POST, self.endpoint_url, None, payload=data.__dict__)
16
+ return jsonpickle.decode(res)
17
+ except:
18
+ raise
19
+
20
+ def update(self, id, data:Customer):
21
+ try:
22
+ logging.info(f'updating customer...')
23
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, [id])
24
+ res = self.call_request(HTTPMethod.PUT, endpoint_url, None, payload=data.__dict__)
25
+ return jsonpickle.decode(res)
26
+ except:
27
+ raise
28
+
29
+ def get_by_id(self, id):
30
+ logging.info(f'get customer info by id: {id}...')
31
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, [id])
32
+ response = self.request(HTTPMethod.GET, endpoint_url)
33
+ return jsonpickle.decode(response)
34
+
35
+ def remove(self, id):
36
+ try:
37
+ logging.info(f'delete customer by id: {id}...')
38
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, [id])
39
+ response = self.request(HTTPMethod.DELETE, endpoint_url)
40
+ return jsonpickle.decode(response)
41
+ except:
42
+ raise
@@ -0,0 +1,15 @@
1
+ import logging, jsonpickle
2
+ from http import HTTPMethod
3
+ from fmconsult.utils.url import UrlUtil
4
+ from iugu.api import IuguApi
5
+
6
+ class Invoices:
7
+ def __init__(self):
8
+ self.api = IuguApi()
9
+ self.endpoint_url = UrlUtil().make_url(self.base_url, ['v1', 'invoices'])
10
+
11
+ def get_by_id(self, id):
12
+ logging.info(f'get invoice info by id: {id}...')
13
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, [id])
14
+ response = self.request(HTTPMethod.GET, endpoint_url)
15
+ return jsonpickle.decode(response)
@@ -0,0 +1,48 @@
1
+ import logging, jsonpickle
2
+ from http import HTTPMethod
3
+ from fmconsult.utils.url import UrlUtil
4
+ from iugu.api import IuguApi
5
+ from iugu.dtos.plan import Plan
6
+
7
+ class Plans(IuguApi):
8
+ def __init__(self):
9
+ super().__init__()
10
+ self.endpoint_url = UrlUtil().make_url(self.base_url, ['v1', 'plans'])
11
+
12
+ def create(self, data:Plan):
13
+ try:
14
+ logging.info(f'generating plan...')
15
+ res = self.call_request(HTTPMethod.POST, self.endpoint_url, None, payload=data.__dict__)
16
+ return jsonpickle.decode(res)
17
+ except:
18
+ raise
19
+
20
+ def update(self, id, data:Plan):
21
+ try:
22
+ logging.info(f'updating plan...')
23
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, [id])
24
+ res = self.call_request(HTTPMethod.PUT, endpoint_url, None, payload=data.__dict__)
25
+ return jsonpickle.decode(res)
26
+ except:
27
+ raise
28
+
29
+ def get_by_id(self, id):
30
+ logging.info(f'get plan info by id: {id}...')
31
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, [id])
32
+ response = self.request(HTTPMethod.GET, endpoint_url)
33
+ return jsonpickle.decode(response)
34
+
35
+ def get_by_identifier(self, identifier):
36
+ logging.info(f'get plan info by identifier: {identifier}...')
37
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, ['identifier', identifier])
38
+ response = self.request(HTTPMethod.GET, endpoint_url)
39
+ return jsonpickle.decode(response)
40
+
41
+ def remove(self, id):
42
+ try:
43
+ logging.info(f'delete plan by id: {id}...')
44
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, [id])
45
+ response = self.request(HTTPMethod.DELETE, endpoint_url)
46
+ return jsonpickle.decode(response)
47
+ except:
48
+ raise
@@ -0,0 +1,33 @@
1
+ import logging, jsonpickle
2
+ from http import HTTPMethod
3
+ from fmconsult.utils.url import UrlUtil
4
+ from iugu.api import IuguApi
5
+ from iugu.dtos.subscription import Subscription
6
+
7
+ class Subscriptions(IuguApi):
8
+ def __init__(self):
9
+ super().__init__()
10
+ self.endpoint_url = UrlUtil().make_url(self.base_url, ['v1', 'subscriptions'])
11
+
12
+ def create(self, data:Subscription):
13
+ try:
14
+ logging.info(f'generating subscription...')
15
+ res = self.call_request(HTTPMethod.POST, self.endpoint_url, None, payload=data.__dict__)
16
+ return jsonpickle.decode(res)
17
+ except:
18
+ raise
19
+
20
+ def get_by_id(self, id):
21
+ logging.info(f'get subscription info by id: {id}...')
22
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, [id])
23
+ response = self.request(HTTPMethod.GET, endpoint_url)
24
+ return jsonpickle.decode(response)
25
+
26
+ def remove(self, id):
27
+ try:
28
+ logging.info(f'delete subscription by id: {id}...')
29
+ endpoint_url = UrlUtil().make_url(self.endpoint_url, [id])
30
+ response = self.request(HTTPMethod.DELETE, endpoint_url)
31
+ return jsonpickle.decode(response)
32
+ except:
33
+ raise
File without changes
@@ -0,0 +1,18 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional
3
+ from fmconsult.utils.object import CustomObject
4
+
5
+ @dataclass
6
+ class Customer(CustomObject):
7
+ email: str
8
+ name: str
9
+ phone: Optional[int]
10
+ phone_prefix: Optional[int]
11
+ cpf_cnpj: Optional[str]
12
+ zip_code: Optional[str]
13
+ number: Optional[str]
14
+ street: Optional[str]
15
+ city: Optional[str]
16
+ state: Optional[str]
17
+ district: Optional[str]
18
+ complement: Optional[str]
@@ -0,0 +1,18 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional
3
+ from fmconsult.utils.enum import CustomEnum
4
+ from fmconsult.utils.object import CustomObject
5
+
6
+ class IntervalType(CustomEnum):
7
+ MONTHS = "months"
8
+ WEEKS = "weeks"
9
+
10
+ @dataclass
11
+ class Plan(CustomObject):
12
+ name: str
13
+ identifier: str
14
+ interval: int
15
+ interval_type: str[IntervalType]
16
+ value_cents: float
17
+ payable_with: list[str]
18
+ billing_days: Optional[int]
@@ -0,0 +1,65 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional
3
+ from fmconsult.utils.object import CustomObject
4
+
5
+ @dataclass
6
+ class Split(CustomObject):
7
+ recipient_account_id: str
8
+ cents: int
9
+ percent: float
10
+ permit_aggregated: bool
11
+ bank_slip_cents: int
12
+ bank_slip_percent: float
13
+ credit_card_cents: int
14
+ credit_card_percent: float
15
+ pix_cents: int
16
+ pix_percent: float
17
+ credit_card_1x_cents: int
18
+ credit_card_2x_cents: int
19
+ credit_card_3x_cents: int
20
+ credit_card_4x_cents: int
21
+ credit_card_5x_cents: int
22
+ credit_card_6x_cents: int
23
+ credit_card_7x_cents: int
24
+ credit_card_8x_cents: int
25
+ credit_card_9x_cents: int
26
+ credit_card_10x_cents: int
27
+ credit_card_11x_cents: int
28
+ credit_card_12x_cents: int
29
+ credit_card_1x_percent: float
30
+ credit_card_2x_percent: float
31
+ credit_card_3x_percent: float
32
+ credit_card_4x_percent: float
33
+ credit_card_5x_percent: float
34
+ credit_card_6x_percent: float
35
+ credit_card_7x_percent: float
36
+ credit_card_8x_percent: float
37
+ credit_card_9x_percent: float
38
+ credit_card_10x_percent: float
39
+ credit_card_11x_percent: float
40
+ credit_card_12x_percent: float
41
+
42
+ @dataclass
43
+ class KeyValue(CustomObject):
44
+ name: str
45
+ value: str
46
+
47
+ @dataclass
48
+ class Subscription(CustomObject):
49
+ customer_id: str
50
+ plan_identifier: Optional[str]
51
+ expires_at: Optional[str]
52
+ splits: Optional[list[Split]]
53
+ only_on_charge_success: Optional[bool]
54
+ ignore_due_email: Optional[bool]
55
+ payable_with: Optional[list[str]]
56
+ credits_based: Optional[bool]
57
+ price_cents: Optional[int]
58
+ credits_cycle: Optional[int]
59
+ credits_min: Optional[int]
60
+ custom_variables: Optional[list[KeyValue]]
61
+ two_step: Optional[bool]
62
+ suspend_on_invoice_expired: Optional[bool]
63
+ only_charge_on_due_date: Optional[bool]
64
+ soft_descriptor_light: Optional[str]
65
+ return_url: Optional[str]
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: iugu-python-sdk
3
+ Version: 1.0.0
4
+ Summary: Client de comunicaçao c/ API da IUGU
5
+ Author-email: Filipe Coelho <filipe@fmconsult.com.br>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Seu Nome
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy...
11
+
12
+ Project-URL: Homepage, https://github.com/seuuser/minha-biblioteca
13
+ Project-URL: Bug Tracker, https://github.com/seuuser/minha-biblioteca/issues
14
+ Keywords: sdk,api,iugu,fmconsult
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/__init__.py
5
+ src/iugu/__init__.py
6
+ src/iugu/api.py
7
+ src/iugu/apis/__init__.py
8
+ src/iugu/apis/customers.py
9
+ src/iugu/apis/invoices.py
10
+ src/iugu/apis/plans.py
11
+ src/iugu/apis/subscriptions.py
12
+ src/iugu/dtos/__init__.py
13
+ src/iugu/dtos/customer.py
14
+ src/iugu/dtos/plan.py
15
+ src/iugu/dtos/subscription.py
16
+ src/iugu_python_sdk.egg-info/PKG-INFO
17
+ src/iugu_python_sdk.egg-info/SOURCES.txt
18
+ src/iugu_python_sdk.egg-info/dependency_links.txt
19
+ src/iugu_python_sdk.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ __init__
2
+ iugu