Skip to content

Commit 9ec2876

Browse files
Merge pull request #160 from starkbank/feature/holderid-merchant-session
holder_id attribute to MerchantSession
2 parents 162f3b8 + ca7557d commit 9ec2876

6 files changed

Lines changed: 36 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Given a version number MAJOR.MINOR.PATCH, increment:
1313

1414

1515
## [Unreleased]
16+
### Added
17+
- holder_id query parameter to MerchantPurchase and MerchantSession
18+
- holder_id and soft_descriptor attributes to MerchantSession and MerchantPurchase
1619

1720
## [2.32.1] - 2026-02-24
1821
### Added

starkbank/merchantpurchase/__merchantpurchase.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ class MerchantPurchase(Resource):
99
"""
1010

1111
def __init__(self, amount, card_id, funding_type, installment_count, id=None, card_expiration=None,
12-
card_number=None, card_security_code=None,holder_name=None, holder_email=None, holder_phone=None,
12+
card_number=None, card_security_code=None,holder_name=None, holder_email=None, holder_phone=None, holder_id=None,
1313
billing_country_code=None, billing_city=None,billing_state_code=None, billing_street_line_1=None,
14-
billing_street_line_2=None, billing_zip_code=None, metadata=None, card_ending=None,
14+
billing_street_line_2=None, billing_zip_code=None, metadata=None, card_ending=None, soft_descriptor=None,
1515
challenge_mode=None, challenge_url=None, created=None, currency_code=None, end_to_end_id=None,
1616
fee=None, network=None, source=None, status=None, tags=None, updated=None):
1717
Resource.__init__(self, id=id)
@@ -24,6 +24,7 @@ def __init__(self, amount, card_id, funding_type, installment_count, id=None, ca
2424
self.holder_name = holder_name
2525
self.holder_email = holder_email
2626
self.holder_phone = holder_phone
27+
self.holder_id = holder_id
2728
self.funding_type = funding_type
2829
self.billing_country_code = billing_country_code
2930
self.billing_city = billing_city
@@ -34,6 +35,7 @@ def __init__(self, amount, card_id, funding_type, installment_count, id=None, ca
3435
self.metadata = metadata
3536
self.card_ending = card_ending
3637
self.card_id = card_id
38+
self.soft_descriptor = soft_descriptor
3739
self.challenge_mode = challenge_mode
3840
self.challenge_url = challenge_url
3941
self.currency_code = currency_code
@@ -58,7 +60,7 @@ def get(id, user=None):
5860
return rest.get_id(resource=_resource, id=id, user=user)
5961

6062

61-
def query(limit=None, after=None, before=None, status=None, tags=None, ids=None, user=None):
63+
def query(limit=None, after=None, before=None, status=None, tags=None, ids=None, holder_id=None, user=None):
6264
return rest.get_stream(
6365
resource=_resource,
6466
limit=limit,
@@ -67,11 +69,12 @@ def query(limit=None, after=None, before=None, status=None, tags=None, ids=None,
6769
status=status,
6870
tags=tags,
6971
ids=ids,
72+
holder_id=holder_id,
7073
user=user,
7174
)
7275

7376

74-
def page(cursor=None, limit=None, after=None, before=None, status=None, tags=None, ids=None, user=None):
77+
def page(cursor=None, limit=None, after=None, before=None, status=None, tags=None, ids=None, holder_id=None, user=None):
7578
return rest.get_page(
7679
resource=_resource,
7780
cursor=cursor,
@@ -81,6 +84,7 @@ def page(cursor=None, limit=None, after=None, before=None, status=None, tags=Non
8184
status=status,
8285
tags=tags,
8386
ids=ids,
87+
holder_id=holder_id,
8488
user=user,
8589
)
8690

starkbank/merchantsession/__merchantsession.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MerchantSession(Resource):
1313
"""
1414

1515
def __init__(self, allowed_funding_types, allowed_installments, expiration, id=None, allowed_ips=None,
16-
challenge_mode=None, created=None, status=None, tags=None, updated=None, uuid=None):
16+
challenge_mode=None, created=None, status=None, tags=None, updated=None, uuid=None, holder_id=None, soft_descriptor=None):
1717
Resource.__init__(self, id=id)
1818

1919
self.allowed_funding_types = allowed_funding_types
@@ -26,7 +26,8 @@ def __init__(self, allowed_funding_types, allowed_installments, expiration, id=N
2626
self.created = check_datetime(created)
2727
self.updated = check_datetime(updated)
2828
self.uuid = uuid
29-
29+
self.holder_id = holder_id
30+
self.soft_descriptor = soft_descriptor
3031

3132
_resource = {"class": MerchantSession, "name": "MerchantSession"}
3233

@@ -51,7 +52,7 @@ def get(id, user=None):
5152
return rest.get_id(resource=_resource, id=id, user=user)
5253

5354

54-
def query(limit=None, status=None, tags=None, ids=None, after=None, before=None, user=None):
55+
def query(limit=None, status=None, tags=None, ids=None, after=None, before=None, holder_id=None, user=None):
5556
return rest.get_stream(
5657
resource=_resource,
5758
limit=limit,
@@ -60,11 +61,12 @@ def query(limit=None, status=None, tags=None, ids=None, after=None, before=None,
6061
status=status,
6162
tags=tags,
6263
ids=ids,
64+
holder_id=holder_id,
6365
user=user,
6466
)
6567

6668

67-
def page(cursor=None, limit=None, status=None, tags=None, ids=None, after=None, before=None, user=None):
69+
def page(cursor=None, limit=None, status=None, tags=None, ids=None, after=None, before=None, holder_id=None, user=None):
6870
return rest.get_page(
6971
resource=_resource,
7072
cursor=cursor,
@@ -74,6 +76,7 @@ def page(cursor=None, limit=None, status=None, tags=None, ids=None, after=None,
7476
status=status,
7577
tags=tags,
7678
ids=ids,
79+
holder_id=holder_id,
7780
user=user,
7881
)
7982

starkbank/merchantsession/__purchase.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ class Purchase(Resource):
88
"""
99

1010
def __init__(self, amount, card_expiration, card_number, card_security_code, holder_name, funding_type, id=None,
11-
holder_email=None, holder_phone=None, installment_count=None, billing_country_code=None,
11+
holder_email=None, holder_phone=None, holder_id=None, installment_count=None, billing_country_code=None,
1212
billing_city=None, billing_state_code=None, billing_street_line_1=None, billing_street_line_2=None,
1313
billing_zip_code=None, metadata=None, card_ending=None, card_id=None, challenge_mode=None,
1414
challenge_url=None, created=None, currency_code=None, end_to_end_id=None, fee=None, network=None,
15-
source=None, status=None, tags=None, updated=None):
15+
soft_descriptor=None, source=None, status=None, tags=None, updated=None):
1616
Resource.__init__(self, id=id)
1717

1818
self.amount = amount
@@ -23,6 +23,7 @@ def __init__(self, amount, card_expiration, card_number, card_security_code, hol
2323
self.funding_type = funding_type
2424
self.holder_email = holder_email
2525
self.holder_phone = holder_phone
26+
self.holder_id = holder_id
2627
self.installment_count = installment_count
2728
self.billing_country_code = billing_country_code
2829
self.billing_city = billing_city
@@ -39,6 +40,7 @@ def __init__(self, amount, card_expiration, card_number, card_security_code, hol
3940
self.end_to_end_id = end_to_end_id
4041
self.fee = fee
4142
self.network = network
43+
self.soft_descriptor = soft_descriptor
4244
self.source = source
4345
self.status = status
4446
self.tags = tags

tests/utils/merchantPurchase.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def json_to_merchant_purchase(json_data):
4747
holder_name=json_data.get("holderName"),
4848
holder_email=json_data.get("holderEmail"),
4949
holder_phone=json_data.get("holderPhone"),
50+
holder_id=json_data.get("holderId"),
5051
funding_type=json_data.get("fundingType"),
5152
billing_country_code=json_data.get("billingCountryCode"),
5253
billing_city=json_data.get("billingCity"),
@@ -56,6 +57,7 @@ def json_to_merchant_purchase(json_data):
5657
billing_zip_code=json_data.get("billingZipCode"),
5758
metadata=json_data.get("metadata"),
5859
card_id=json_data.get("cardId"),
60+
soft_descriptor=json_data.get("softDescriptor"),
5961
)
6062

6163

@@ -68,6 +70,7 @@ def json_to_merchant_purchase(json_data):
6870
"holderName": "Holder Name",
6971
"holderEmail": "holdeName@email.com",
7072
"holderPhone": "11111111111",
73+
"holderId": "565656555656",
7174
"fundingType": "credit",
7275
"billingCountryCode": "BRA",
7376
"billingCity": "São Paulo",
@@ -102,6 +105,8 @@ def generate_example_merchant_purchase_json(card_id):
102105
"billingZipCode": "11111-111",
103106
"holderEmail": "holdeName@email.com",
104107
"holderPhone": "11111111111",
108+
"holderId": "565656555656",
109+
"softDescriptor": "Soft Descriptor",
105110
"metadata": {
106111
"userAgent": "userAgent",
107112
"userIp": "255.255.255.255",

tests/utils/merchantSession.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,31 @@ def json_to_merchant_session(json_data):
3030
challenge_mode=json_data.get("challengeMode"),
3131
expiration=json_data.get("expiration"),
3232
tags=json_data.get("tags"),
33+
holder_id=json_data.get("holderId"),
34+
soft_descriptor=json_data.get("softDescriptor"),
3335
)
3436

3537

3638
def generate_example_merchant_session_json(challengeMode):
3739
merchant_session_json = {
3840
"allowedFundingTypes": ["debit", "credit"],
3941
"allowedInstallments": [
40-
{"totalAmount": 0, "count": 1},
41-
{"totalAmount": 120, "count": 2},
42-
{"totalAmount": 180, "count": 12},
42+
{"totalAmount": 500, "count": 1},
43+
{"totalAmount": 1000, "count": 2},
44+
{"totalAmount": 6000, "count": 12},
4345
],
4446
"expiration": 3600,
4547
"challengeMode": challengeMode,
4648
"tags": ["yourTags"],
49+
"holderId": "5656565665",
50+
"softDescriptor": "softDescriptor",
4751
}
4852
return deepcopy(json_to_merchant_session(merchant_session_json))
4953

5054

5155
def generate_example_merchant_session_purchase_challenge_mode_disabled_json():
5256
merchant_session_purchase_json = {
53-
"amount": 180,
57+
"amount": 6000,
5458
"installmentCount": 12,
5559
"cardExpiration": "2035-01",
5660
"cardNumber": "5277696455399733",
@@ -63,7 +67,7 @@ def generate_example_merchant_session_purchase_challenge_mode_disabled_json():
6367

6468
def generate_example_merchant_session_purchase_challenge_mode_enabled_json():
6569
merchant_session_purchase_json = {
66-
"amount": 180,
70+
"amount": 6000,
6771
"installmentCount": 12,
6872
"cardExpiration": "2035-01",
6973
"cardNumber": "5277696455399733",

0 commit comments

Comments
 (0)