diff --git a/CHANGELOG.md b/CHANGELOG.md index bfc25e4..ed4cbf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ Given a version number MAJOR.MINOR.PATCH, increment: ## [Unreleased] +### Added +- holder_id query parameter to MerchantPurchase and MerchantSession +- holder_id and soft_descriptor attributes to MerchantSession and MerchantPurchase ## [2.32.1] - 2026-02-24 ### Added diff --git a/starkbank/merchantpurchase/__merchantpurchase.py b/starkbank/merchantpurchase/__merchantpurchase.py index 25965a7..30f15e7 100644 --- a/starkbank/merchantpurchase/__merchantpurchase.py +++ b/starkbank/merchantpurchase/__merchantpurchase.py @@ -9,9 +9,9 @@ class MerchantPurchase(Resource): """ def __init__(self, amount, card_id, funding_type, installment_count, id=None, card_expiration=None, - card_number=None, card_security_code=None,holder_name=None, holder_email=None, holder_phone=None, + card_number=None, card_security_code=None,holder_name=None, holder_email=None, holder_phone=None, holder_id=None, billing_country_code=None, billing_city=None,billing_state_code=None, billing_street_line_1=None, - billing_street_line_2=None, billing_zip_code=None, metadata=None, card_ending=None, + billing_street_line_2=None, billing_zip_code=None, metadata=None, card_ending=None, soft_descriptor=None, challenge_mode=None, challenge_url=None, created=None, currency_code=None, end_to_end_id=None, fee=None, network=None, source=None, status=None, tags=None, updated=None): Resource.__init__(self, id=id) @@ -24,6 +24,7 @@ def __init__(self, amount, card_id, funding_type, installment_count, id=None, ca self.holder_name = holder_name self.holder_email = holder_email self.holder_phone = holder_phone + self.holder_id = holder_id self.funding_type = funding_type self.billing_country_code = billing_country_code self.billing_city = billing_city @@ -34,6 +35,7 @@ def __init__(self, amount, card_id, funding_type, installment_count, id=None, ca self.metadata = metadata self.card_ending = card_ending self.card_id = card_id + self.soft_descriptor = soft_descriptor self.challenge_mode = challenge_mode self.challenge_url = challenge_url self.currency_code = currency_code @@ -58,7 +60,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, tags=None, ids=None, user=None): +def query(limit=None, after=None, before=None, status=None, tags=None, ids=None, holder_id=None, user=None): return rest.get_stream( resource=_resource, limit=limit, @@ -67,11 +69,12 @@ def query(limit=None, after=None, before=None, status=None, tags=None, ids=None, status=status, tags=tags, ids=ids, + holder_id=holder_id, user=user, ) -def page(cursor=None, limit=None, after=None, before=None, status=None, tags=None, ids=None, user=None): +def page(cursor=None, limit=None, after=None, before=None, status=None, tags=None, ids=None, holder_id=None, user=None): return rest.get_page( resource=_resource, cursor=cursor, @@ -81,6 +84,7 @@ def page(cursor=None, limit=None, after=None, before=None, status=None, tags=Non status=status, tags=tags, ids=ids, + holder_id=holder_id, user=user, ) diff --git a/starkbank/merchantsession/__merchantsession.py b/starkbank/merchantsession/__merchantsession.py index 3ed4802..df0b7ba 100644 --- a/starkbank/merchantsession/__merchantsession.py +++ b/starkbank/merchantsession/__merchantsession.py @@ -13,7 +13,7 @@ class MerchantSession(Resource): """ def __init__(self, allowed_funding_types, allowed_installments, expiration, id=None, allowed_ips=None, - challenge_mode=None, created=None, status=None, tags=None, updated=None, uuid=None): + challenge_mode=None, created=None, status=None, tags=None, updated=None, uuid=None, holder_id=None, soft_descriptor=None): Resource.__init__(self, id=id) self.allowed_funding_types = allowed_funding_types @@ -26,7 +26,8 @@ def __init__(self, allowed_funding_types, allowed_installments, expiration, id=N self.created = check_datetime(created) self.updated = check_datetime(updated) self.uuid = uuid - + self.holder_id = holder_id + self.soft_descriptor = soft_descriptor _resource = {"class": MerchantSession, "name": "MerchantSession"} @@ -51,7 +52,7 @@ def get(id, user=None): return rest.get_id(resource=_resource, id=id, user=user) -def query(limit=None, status=None, tags=None, ids=None, after=None, before=None, user=None): +def query(limit=None, status=None, tags=None, ids=None, after=None, before=None, holder_id=None, user=None): return rest.get_stream( resource=_resource, limit=limit, @@ -60,11 +61,12 @@ def query(limit=None, status=None, tags=None, ids=None, after=None, before=None, status=status, tags=tags, ids=ids, + holder_id=holder_id, user=user, ) -def page(cursor=None, limit=None, status=None, tags=None, ids=None, after=None, before=None, user=None): +def page(cursor=None, limit=None, status=None, tags=None, ids=None, after=None, before=None, holder_id=None, user=None): return rest.get_page( resource=_resource, cursor=cursor, @@ -74,6 +76,7 @@ def page(cursor=None, limit=None, status=None, tags=None, ids=None, after=None, status=status, tags=tags, ids=ids, + holder_id=holder_id, user=user, ) diff --git a/starkbank/merchantsession/__purchase.py b/starkbank/merchantsession/__purchase.py index adabd13..c649007 100644 --- a/starkbank/merchantsession/__purchase.py +++ b/starkbank/merchantsession/__purchase.py @@ -8,11 +8,11 @@ class Purchase(Resource): """ def __init__(self, amount, card_expiration, card_number, card_security_code, holder_name, funding_type, id=None, - holder_email=None, holder_phone=None, installment_count=None, billing_country_code=None, + holder_email=None, holder_phone=None, holder_id=None, installment_count=None, billing_country_code=None, billing_city=None, billing_state_code=None, billing_street_line_1=None, billing_street_line_2=None, billing_zip_code=None, metadata=None, card_ending=None, card_id=None, challenge_mode=None, challenge_url=None, created=None, currency_code=None, end_to_end_id=None, fee=None, network=None, - source=None, status=None, tags=None, updated=None): + soft_descriptor=None, source=None, status=None, tags=None, updated=None): Resource.__init__(self, id=id) self.amount = amount @@ -23,6 +23,7 @@ def __init__(self, amount, card_expiration, card_number, card_security_code, hol self.funding_type = funding_type self.holder_email = holder_email self.holder_phone = holder_phone + self.holder_id = holder_id self.installment_count = installment_count self.billing_country_code = billing_country_code self.billing_city = billing_city @@ -39,6 +40,7 @@ def __init__(self, amount, card_expiration, card_number, card_security_code, hol self.end_to_end_id = end_to_end_id self.fee = fee self.network = network + self.soft_descriptor = soft_descriptor self.source = source self.status = status self.tags = tags diff --git a/tests/utils/merchantPurchase.py b/tests/utils/merchantPurchase.py index 341bb70..68e8913 100644 --- a/tests/utils/merchantPurchase.py +++ b/tests/utils/merchantPurchase.py @@ -47,6 +47,7 @@ def json_to_merchant_purchase(json_data): holder_name=json_data.get("holderName"), holder_email=json_data.get("holderEmail"), holder_phone=json_data.get("holderPhone"), + holder_id=json_data.get("holderId"), funding_type=json_data.get("fundingType"), billing_country_code=json_data.get("billingCountryCode"), billing_city=json_data.get("billingCity"), @@ -56,6 +57,7 @@ def json_to_merchant_purchase(json_data): billing_zip_code=json_data.get("billingZipCode"), metadata=json_data.get("metadata"), card_id=json_data.get("cardId"), + soft_descriptor=json_data.get("softDescriptor"), ) @@ -68,6 +70,7 @@ def json_to_merchant_purchase(json_data): "holderName": "Holder Name", "holderEmail": "holdeName@email.com", "holderPhone": "11111111111", + "holderId": "565656555656", "fundingType": "credit", "billingCountryCode": "BRA", "billingCity": "São Paulo", @@ -102,6 +105,8 @@ def generate_example_merchant_purchase_json(card_id): "billingZipCode": "11111-111", "holderEmail": "holdeName@email.com", "holderPhone": "11111111111", + "holderId": "565656555656", + "softDescriptor": "Soft Descriptor", "metadata": { "userAgent": "userAgent", "userIp": "255.255.255.255", diff --git a/tests/utils/merchantSession.py b/tests/utils/merchantSession.py index 2e756aa..0170763 100644 --- a/tests/utils/merchantSession.py +++ b/tests/utils/merchantSession.py @@ -30,6 +30,8 @@ def json_to_merchant_session(json_data): challenge_mode=json_data.get("challengeMode"), expiration=json_data.get("expiration"), tags=json_data.get("tags"), + holder_id=json_data.get("holderId"), + soft_descriptor=json_data.get("softDescriptor"), ) @@ -37,20 +39,22 @@ def generate_example_merchant_session_json(challengeMode): merchant_session_json = { "allowedFundingTypes": ["debit", "credit"], "allowedInstallments": [ - {"totalAmount": 0, "count": 1}, - {"totalAmount": 120, "count": 2}, - {"totalAmount": 180, "count": 12}, + {"totalAmount": 500, "count": 1}, + {"totalAmount": 1000, "count": 2}, + {"totalAmount": 6000, "count": 12}, ], "expiration": 3600, "challengeMode": challengeMode, "tags": ["yourTags"], + "holderId": "5656565665", + "softDescriptor": "softDescriptor", } return deepcopy(json_to_merchant_session(merchant_session_json)) def generate_example_merchant_session_purchase_challenge_mode_disabled_json(): merchant_session_purchase_json = { - "amount": 180, + "amount": 6000, "installmentCount": 12, "cardExpiration": "2035-01", "cardNumber": "5277696455399733", @@ -63,7 +67,7 @@ def generate_example_merchant_session_purchase_challenge_mode_disabled_json(): def generate_example_merchant_session_purchase_challenge_mode_enabled_json(): merchant_session_purchase_json = { - "amount": 180, + "amount": 6000, "installmentCount": 12, "cardExpiration": "2035-01", "cardNumber": "5277696455399733",