Skip to content
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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Given a version number MAJOR.MINOR.PATCH, increment:


## [Unreleased]
### Added
- Deprecated create pix infraction

## [0.25.0] - 2026-04-08
### Added
Expand Down
6 changes: 5 additions & 1 deletion starkinfra/pixinfraction/__pixinfraction.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from ..utils import rest
from starkcore.utils.resource import Resource
from starkcore.utils.checks import check_datetime, check_date
from starkcore.error import StarkError


class PixInfraction(Resource):
Expand Down Expand Up @@ -70,6 +71,9 @@ def __init__(self, reference_id, type, method, operator_email, operator_phone,


def create(infractions, user=None):
"""
Deprecated: Function deprecated since v0.26.0
"""
"""# Create PixInfraction objects
Create PixInfractions in the Stark Infra API
## Parameters (required):
Expand All @@ -79,7 +83,7 @@ def create(infractions, user=None):
## Return:
- list of PixInfraction objects with updated attributes
"""
return rest.post_multi(resource=_resource, entities=infractions, user=user)
raise StarkError([{"code": "deprecated", "message": "Function deprecated since v0.26.0"}])


def get(id, user=None):
Expand Down
18 changes: 8 additions & 10 deletions tests/sdk/testPixInfraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
class TestPixInfractionPostAndDelete(TestCase):
def test_success(self):
infraction_reports = generateExamplePixInfractionsJson(n=2)
infraction_reports = starkinfra.pixinfraction.create(infraction_reports)
self.assertEqual(len(infraction_reports), 2)
for infraction_report in infraction_reports:
deleted_infraction_report = starkinfra.pixinfraction.cancel(infraction_report.id)
self.assertEqual(deleted_infraction_report.status, "canceled")
with self.assertRaises(starkinfra.error.StarkError) as context:
starkinfra.pixinfraction.create(infraction_reports)
self.assertEqual(context.exception.args[0][0]["code"], "deprecated")
self.assertEqual(context.exception.args[0][0]["message"], "Function deprecated since v0.26.0")


class TestPixInfractionQuery(TestCase):
Expand Down Expand Up @@ -77,11 +76,10 @@ def test_success_ids(self):
class TestPixInfractionInfoDelete(TestCase):

def test_success(self):
infraction_report = starkinfra.pixinfraction.create(generateExamplePixInfractionsJson())[0]
deleted_infraction_report = starkinfra.pixinfraction.cancel(infraction_report.id)
self.assertIsNotNone(deleted_infraction_report.id)
self.assertEqual(deleted_infraction_report.id, infraction_report.id)
self.assertEqual(deleted_infraction_report.status, "canceled")
with self.assertRaises(starkinfra.error.StarkError) as context:
starkinfra.pixinfraction.create(generateExamplePixInfractionsJson())
self.assertEqual(context.exception.args[0][0]["code"], "deprecated")
self.assertEqual(context.exception.args[0][0]["message"], "Function deprecated since v0.26.0")


class TestPixInfractionInfoPatch(TestCase):
Expand Down