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


## [Unreleased]
### Added
- reason parameter and attribute to PixRequest resource
- before parameter to PixBalance get method
- chunk_count attribute to PixStatement resource
- tax_id filter to PixKey query and page methods
- Statistics sub-resource to PixUser resource
- reference_ids filter to PixChargeback query and page methods
- bacen_id and reference_ids filters to PixDispute query and page methods
- ids filter to PixDispute log query and page methods
- type parameter and attribute to StaticBrcode resource
- expired, data and jws attributes to BrcodePreview resource
- additional method options to PixRequest and type options to DynamicBrcode and PixInfraction

## [0.26.0] - 2026-06-15
### Added
Expand Down
14 changes: 11 additions & 3 deletions starkinfra/brcodepreview/__brcodepreview.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from starkcore.utils.resource import Resource
from starkcore.utils.api import from_api_json
from ..subscription.__subscription import Subscription
from starkcore.utils.checks import check_datetime_or_date
from starkcore.utils.checks import check_datetime, check_datetime_or_date
from ..subscription.__subscription import _resource as _subscription_resource


Expand All @@ -27,10 +27,13 @@ class BrcodePreview(Resource):
- cash_amount [integer]: Amount to be withdrawn from the cashier in cents. ex: 1000 (= R$ 10.00)
- cashier_bank_code [string]: Cashier's bank code. ex: "20018183"
- cashier_type [string]: Cashier's type. Options: "merchant", "participant" and "other"
- data [list of dictionaries]: additional data of the dynamic QR code, in key/value pairs. ex: [{"key": "additional-info", "value": "order #12345"}]
- discount_amount [integer]: Discount value calculated over nominal_amount. ex: 3000
- due [datetime.datetime]: BR Code due date. ex: datetime(2020, 3, 10)
- expired [datetime.datetime]: date and time after which the dynamic QR code is considered expired. ex: datetime(2022, 2, 1)
- fine_amount [integer]: Fine value calculated over nominal_amount. ex: 20000
- interest_amount [integer]: Interest value calculated over nominal_amount. ex: 10000
- jws [string]: JWS of the dynamic QR code. Returned only when "jws" is passed in the expand query parameter. ex: "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9..."
- key_id [string]: Receiver's PixKey id. ex: "+5511989898989"
- name [string]: Payment receiver name. ex: "Tony Stark"
- nominal_amount [integer]: Brcode emission amount, without fines, fees and discounts. ex: 1234 (= R$ 12.34)
Expand All @@ -43,8 +46,8 @@ class BrcodePreview(Resource):
"""

def __init__(self, id, payer_id, account_number=None, account_type=None, amount=None, amount_type=None, bank_code=None,
branch_code=None, cash_amount=None, cashier_bank_code=None, cashier_type=None, discount_amount=None, due=None,
fine_amount=None, interest_amount=None, key_id=None, name=None, nominal_amount=None, end_to_end_id=None,
branch_code=None, cash_amount=None, cashier_bank_code=None, cashier_type=None, data=None, discount_amount=None, due=None,
expired=None, fine_amount=None, interest_amount=None, jws=None, key_id=None, name=None, nominal_amount=None, end_to_end_id=None,
reconciliation_id=None, reduction_amount=None, scheduled=None, subscription=None, status=None, tax_id=None, description=None):
Resource.__init__(self, id=id)

Expand All @@ -59,12 +62,17 @@ def __init__(self, id, payer_id, account_number=None, account_type=None, amount=
self.cash_amount = cash_amount
self.cashier_bank_code = cashier_bank_code
self.cashier_type = cashier_type
self.data = data
self.discount_amount = discount_amount
if(due == ""):
due = None
self.due = check_datetime_or_date(due)
if(expired == ""):
expired = None
self.expired = check_datetime(expired)
self.fine_amount = fine_amount
self.interest_amount = interest_amount
self.jws = jws
self.key_id = key_id
self.name = name
self.nominal_amount = nominal_amount
Expand Down
2 changes: 1 addition & 1 deletion starkinfra/dynamicbrcode/__dynamicbrcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DynamicBrcode(Resource):
- city [string]: receiver's city name. ex: "Rio de Janeiro"
- external_id [string]: string that must be unique among all your DynamicBrcodes. Duplicated external ids will cause failures. ex: "my-internal-id-123456"
## Parameters (optional):
- type [string, default "instant"]: type of the DynamicBrcode. Options: "instant", "due"
- type [string, default "instant"]: type of the DynamicBrcode. Options: "instant", "due", "subscription", "subscriptionAndInstant", "dueAndOrSubscription"
- tags [list of strings, default []]: list of strings for tagging. ex: ["travel", "food"]
## Attributes (return-only):
- id [string]: id returned on creation, this is the BR code. ex: "00020126360014br.gov.bcb.pix0114+552840092118152040000530398654040.095802BR5915Jamie Lannister6009Sao Paulo620705038566304FC6C"
Expand Down
7 changes: 4 additions & 3 deletions starkinfra/pixbalance/__pixbalance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ..utils import rest
from starkcore.utils.resource import Resource
from starkcore.utils.checks import check_datetime
from starkcore.utils.checks import check_datetime, check_date


class PixBalance(Resource):
Expand All @@ -27,12 +27,13 @@ def __init__(self, id=None, amount=None, currency=None, updated=None):
_resource = {"class": PixBalance, "name": "PixBalance"}


def get(user=None):
def get(before=None, user=None):
"""# Retrieve the PixBalance object
Receive the PixBalance object linked to your Workspace in the Stark Infra API
## Parameters (optional):
- before [datetime.date or string, default None]: date filter to retrieve the balance as of the end of the informed day. ex: datetime.date(2022, 1, 31)
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkinfra.user was set before function call.
## Return:
- PixBalance object with updated attributes
"""
return next(rest.get_stream(resource=_resource, user=user))
return next(rest.get_stream(resource=_resource, before=check_date(before), user=user))
8 changes: 6 additions & 2 deletions starkinfra/pixchargeback/__pixchargeback.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def get(id, user=None):
return rest.get_id(id=id, resource=_resource, user=user)


def query(limit=None, after=None, before=None, status=None, ids=None, bacen_id=None, flow=None, tags=None, user=None):
def query(limit=None, after=None, before=None, status=None, ids=None, bacen_id=None, reference_ids=None, flow=None, tags=None, user=None):
"""# Retrieve PixChargebacks
Receive a generator of PixChargeback objects previously created in the Stark Infra API
## Parameters (optional):
Expand All @@ -113,6 +113,7 @@ def query(limit=None, after=None, before=None, status=None, ids=None, bacen_id=N
- status [list of strings, default None]: filter for status of retrieved objects. ex: ["created", "failed", "delivered", "closed", "canceled"]
- ids [list of strings, default None]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
- bacen_id [string, default None]: unique transaction id returned from Central Bank. ex: "ccf9bd9c-e99d-999e-bab9-b999ca999f99"
- reference_ids [list of strings, default None]: list of end_to_end_ids or return_ids of the reversed transactions to filter retrieved objects. Max = 30. ex: ["E20018183202201201450u34sDjD7334"]
- flow [string, default None]: direction of the Pix Chargeback. Options: "in" for received chargebacks, "out" for chargebacks you requested
- tags [list of strings, default None]: filter for tags of retrieved objects. ex: ["travel", "food"]
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkinfra.user was set before function call.
Expand All @@ -128,13 +129,14 @@ def query(limit=None, after=None, before=None, status=None, ids=None, bacen_id=N
status=status,
ids=ids,
bacen_id=bacen_id,
reference_ids=reference_ids,
flow=flow,
tags=tags,
user=user,
)


def page(cursor=None, limit=None, after=None, before=None, status=None, ids=None, bacen_id=None, flow=None, tags=None, user=None):
def page(cursor=None, limit=None, after=None, before=None, status=None, ids=None, bacen_id=None, reference_ids=None, flow=None, tags=None, user=None):
"""# Retrieve PixChargebacks
Receive a list of up to 100 PixChargeback objects previously created in the Stark Infra API and the cursor to the next page.
Use this function instead of query if you want to manually page your requests.
Expand All @@ -146,6 +148,7 @@ def page(cursor=None, limit=None, after=None, before=None, status=None, ids=None
- status [list of strings, default None]: filter for status of retrieved objects. ex: ["created", "failed", "delivered", "closed", "canceled"]
- ids [list of strings, default None]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
- bacen_id [string, default None]: unique transaction id returned from Central Bank. ex: "ccf9bd9c-e99d-999e-bab9-b999ca999f99"
- reference_ids [list of strings, default None]: list of end_to_end_ids or return_ids of the reversed transactions to filter retrieved objects. Max = 30. ex: ["E20018183202201201450u34sDjD7334"]
- flow [string, default None]: direction of the Pix Chargeback. Options: "in" for received chargebacks, "out" for chargebacks you requested
- tags [list of strings, default None]: filter for tags of retrieved objects. ex: ["travel", "food"]
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkinfra.user was set before function call.
Expand All @@ -162,6 +165,7 @@ def page(cursor=None, limit=None, after=None, before=None, status=None, ids=None
status=status,
ids=ids,
bacen_id=bacen_id,
reference_ids=reference_ids,
flow=flow,
tags=tags,
user=user,
Expand Down
12 changes: 10 additions & 2 deletions starkinfra/pixdispute/__pixdispute.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get(id, user=None):
return rest.get_id(resource=_resource, id=id, user=user)


def query(limit=None, after=None, before=None, status=None, ids=None, tags=None, user=None):
def query(limit=None, after=None, before=None, status=None, ids=None, bacen_id=None, reference_ids=None, tags=None, user=None):
"""# Retrieve PixDisputes
Receive a generator of PixDispute objects previously created in the Stark Infra API
## Parameters (optional):
Expand All @@ -97,6 +97,8 @@ def query(limit=None, after=None, before=None, status=None, ids=None, tags=None,
- before [datetime.date or string, default None]: date filter for objects created before a specified date. ex: datetime.date(2020, 3, 10)
- status [list of strings, default None]: filter for status of retrieved objects. ex: ["created", "processing", "success", "failed"]
- ids [list of strings, default None]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
- bacen_id [string, default None]: Central Bank's unique dispute id to filter retrieved objects. ex: "817fc523-9e9d-40ab-9e53-dacb71454a05"
- reference_ids [list of strings, default None]: list of end_to_end_ids of the reported transactions to filter retrieved objects. ex: ["E20018183202201201450u34sDjD7334"]
- tags [list of strings, default None]: tags to filter retrieved objects. ex: ["tony", "stark"]
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkinfra.user was set before function call.
## Return:
Expand All @@ -109,12 +111,14 @@ def query(limit=None, after=None, before=None, status=None, ids=None, tags=None,
before=check_date(before),
status=status,
ids=ids,
bacen_id=bacen_id,
reference_ids=reference_ids,
tags=tags,
user=user,
)


def page(cursor=None, limit=None, after=None, before=None, status=None, ids=None, tags=None, user=None):
def page(cursor=None, limit=None, after=None, before=None, status=None, ids=None, bacen_id=None, reference_ids=None, tags=None, user=None):
"""# Retrieve paged PixDisputes
Receive a list of up to 100 PixDispute objects previously created in the Stark Infra API and the cursor to the next page.
Use this function instead of query if you want to manually page your requests.
Expand All @@ -125,6 +129,8 @@ def page(cursor=None, limit=None, after=None, before=None, status=None, ids=None
- before [datetime.date or string, default None]: date filter for objects created before a specified date. ex: datetime.date(2020, 3, 10)
- status [list of strings, default None]: filter for status of retrieved objects. ex: ["created", "processing", "success", "failed"]
- ids [list of strings, default None]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
- bacen_id [string, default None]: Central Bank's unique dispute id to filter retrieved objects. ex: "817fc523-9e9d-40ab-9e53-dacb71454a05"
- reference_ids [list of strings, default None]: list of end_to_end_ids of the reported transactions to filter retrieved objects. ex: ["E20018183202201201450u34sDjD7334"]
- tags [list of strings, default None]: tags to filter retrieved objects. ex: ["tony", "stark"]
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkinfra.user was set before function call.
## Return:
Expand All @@ -139,6 +145,8 @@ def page(cursor=None, limit=None, after=None, before=None, status=None, ids=None
before=check_date(before),
status=status,
ids=ids,
bacen_id=bacen_id,
reference_ids=reference_ids,
tags=tags,
user=user,
)
Expand Down
8 changes: 6 additions & 2 deletions starkinfra/pixdispute/log/__log.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ def get(id, user=None):
return rest.get_id(resource=_resource, id=id, user=user)


def query(limit=None, after=None, before=None, types=None, dispute_ids=None, user=None):
def query(limit=None, after=None, before=None, types=None, ids=None, dispute_ids=None, user=None):
"""# Retrieve PixDispute.Logs
Receive a generator of PixDispute.Log objects previously created in the Stark Infra API
## Parameters (optional):
- limit [integer, default None]: maximum number of objects to be retrieved. Unlimited if None. ex: 35
- after [datetime.date or string, default None]: date filter for objects created after a specified date. ex: datetime.date(2020, 3, 10)
- before [datetime.date or string, default None]: date filter for objects created before a specified date. ex: datetime.date(2020, 3, 10)
- types [list of strings, default None]: filter retrieved objects by types. Options: ["sent", "denied", "failed", "created", "success", "approved", "credited", "refunded", "processing"]
- ids [list of strings, default None]: list of PixDispute.Log ids to filter retrieved objects. ex: ["6767676767676767", "4545454545454545"]
- dispute_ids [list of strings, default None]: list of PixDispute ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkinfra.user was set before function call.
## Return:
Expand All @@ -60,12 +61,13 @@ def query(limit=None, after=None, before=None, types=None, dispute_ids=None, use
after=check_date(after),
before=check_date(before),
types=types,
ids=ids,
dispute_ids=dispute_ids,
user=user,
)


def page(cursor=None, limit=None, after=None, before=None, types=None, dispute_ids=None, user=None):
def page(cursor=None, limit=None, after=None, before=None, types=None, ids=None, dispute_ids=None, user=None):
"""# Retrieve paged PixDispute.Logs
Receive a list of up to 100 PixDispute.Log objects previously created in the Stark Infra API and the cursor to the next page.
Use this function instead of query if you want to manually page your requests.
Expand All @@ -75,6 +77,7 @@ def page(cursor=None, limit=None, after=None, before=None, types=None, dispute_i
- after [datetime.date or string, default None]: date filter for objects created after a specified date. ex: datetime.date(2020, 3, 10)
- before [datetime.date or string, default None]: date filter for objects created before a specified date. ex: datetime.date(2020, 3, 10)
- types [list of strings, default None]: filter retrieved objects by types. Options: ["sent", "denied", "failed", "created", "success", "approved", "credited", "refunded", "processing"]
- ids [list of strings, default None]: list of PixDispute.Log ids to filter retrieved objects. ex: ["6767676767676767", "4545454545454545"]
- dispute_ids [list of strings, default None]: list of PixDispute IDs to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
- user [Organization/Project object, default None]: Organization or Project object. Not necessary if starkinfra.user was set before function call.
## Return:
Expand All @@ -88,6 +91,7 @@ def page(cursor=None, limit=None, after=None, before=None, types=None, dispute_i
after=check_date(after),
before=check_date(before),
types=types,
ids=ids,
dispute_ids=dispute_ids,
user=user,
)
2 changes: 1 addition & 1 deletion starkinfra/pixinfraction/__pixinfraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PixInfraction(Resource):
to the Stark Infra API and returns the created object.
## Parameters (required):
- reference_id [string]: end_to_end_id or return_id of the transaction being reported. ex: "E20018183202201201450u34sDGd19lz"
- type [string]: type of infraction report. Options: "reversal", "reversalChargeback"
- type [string]: type of infraction report. Options: "fraud", "reversal", "reversalChargeback"
- method [string]: method of Pix Infraction. Options: "scam", "unauthorized", "coercion", "invasion", "other", "unknown"
- operator_email [string]: contact email of the operator responsible for the PixInfraction.
- operator_phone [string]: contact phone number of the operator responsible for the PixInfraction.
Expand Down
Loading