Skip to content

Commit 40b6ef4

Browse files
feat(api): add service location attributes to auth_rules, fields to merchant
1 parent 1838bd0 commit 40b6ef4

5 files changed

Lines changed: 112 additions & 4 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 189
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-5f3c4878ed085a0e8925abdf14ed250ba25b04d5a128e3edd81f28be5fd79b69.yml
3-
openapi_spec_hash: f2cc51f780daf0454712a4f73b9c8302
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-7fb459122adaf544433c3d5acd17566e642289b3eccb7ee25d7b7ce418967e32.yml
3+
openapi_spec_hash: fe69fbb129fa5b7d7b1e71d4f2a908f1
44
config_hash: 400b9afe0f7f7b7d96177d05950775f9

src/lithic/types/auth_rules/conditional_authorization_action_parameters.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class Condition(BaseModel):
3131
"WALLET_TYPE",
3232
"TRANSACTION_INITIATOR",
3333
"ADDRESS_MATCH",
34+
"SERVICE_LOCATION_STATE",
35+
"SERVICE_LOCATION_POSTAL_CODE",
3436
"CARD_AGE",
3537
"ACCOUNT_AGE",
3638
]
@@ -88,6 +90,14 @@ class Condition(BaseModel):
8890
- `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address
8991
data with the cardholder KYC data if it exists. Valid values are `MATCH`,
9092
`MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`.
93+
- `SERVICE_LOCATION_STATE`: The state/province code (ISO 3166-2) where the
94+
cardholder received the service, e.g. "NY". When a service location is present
95+
in the network data, the service location state is used. Otherwise, falls back
96+
to the card acceptor state.
97+
- `SERVICE_LOCATION_POSTAL_CODE`: The postal code where the cardholder received
98+
the service, e.g. "10001". When a service location is present in the network
99+
data, the service location postal code is used. Otherwise, falls back to the
100+
card acceptor postal code.
91101
- `CARD_AGE`: The age of the card in seconds at the time of the authorization.
92102
- `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time
93103
of the authorization.

src/lithic/types/auth_rules/conditional_authorization_action_parameters_param.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class Condition(TypedDict, total=False):
3434
"WALLET_TYPE",
3535
"TRANSACTION_INITIATOR",
3636
"ADDRESS_MATCH",
37+
"SERVICE_LOCATION_STATE",
38+
"SERVICE_LOCATION_POSTAL_CODE",
3739
"CARD_AGE",
3840
"ACCOUNT_AGE",
3941
]
@@ -92,6 +94,14 @@ class Condition(TypedDict, total=False):
9294
- `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address
9395
data with the cardholder KYC data if it exists. Valid values are `MATCH`,
9496
`MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`.
97+
- `SERVICE_LOCATION_STATE`: The state/province code (ISO 3166-2) where the
98+
cardholder received the service, e.g. "NY". When a service location is present
99+
in the network data, the service location state is used. Otherwise, falls back
100+
to the card acceptor state.
101+
- `SERVICE_LOCATION_POSTAL_CODE`: The postal code where the cardholder received
102+
the service, e.g. "10001". When a service location is present in the network
103+
data, the service location postal code is used. Otherwise, falls back to the
104+
card acceptor postal code.
95105
- `CARD_AGE`: The age of the card in seconds at the time of the authorization.
96106
- `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time
97107
of the authorization.

src/lithic/types/card_authorization_approval_request_webhook_event.py

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from datetime import datetime
55
from typing_extensions import Literal
66

7+
from .shared import merchant
78
from .._models import BaseModel
89
from .token_info import TokenInfo
910
from .shared.currency import Currency
10-
from .shared.merchant import Merchant
1111
from .cardholder_authentication import CardholderAuthentication
1212

1313
__all__ = [
@@ -19,6 +19,8 @@
1919
"AmountsSettlement",
2020
"Avs",
2121
"Card",
22+
"Merchant",
23+
"ServiceLocation",
2224
"FleetInfo",
2325
"LatestChallenge",
2426
"NetworkSpecificData",
@@ -141,6 +143,40 @@ class Card(BaseModel):
141143
type: Optional[Literal["SINGLE_USE", "MERCHANT_LOCKED", "UNLOCKED", "PHYSICAL", "DIGITAL_WALLET", "VIRTUAL"]] = None
142144

143145

146+
class Merchant(merchant.Merchant):
147+
"""Merchant information including full location details."""
148+
149+
phone_number: Optional[str] = None
150+
"""Phone number of card acceptor."""
151+
152+
postal_code: Optional[str] = None
153+
"""Postal code of card acceptor."""
154+
155+
street_address: Optional[str] = None
156+
"""Street address of card acceptor."""
157+
158+
159+
class ServiceLocation(BaseModel):
160+
"""
161+
Where the cardholder received the service, when different from the card acceptor location. This is populated from network data elements such as Mastercard DE-122 SE1 SF9-14 and Visa F34 DS02.
162+
"""
163+
164+
city: Optional[str] = None
165+
"""City of service location."""
166+
167+
country: Optional[str] = None
168+
"""Country code of service location, ISO 3166-1 alpha-3."""
169+
170+
postal_code: Optional[str] = None
171+
"""Postal code of service location."""
172+
173+
state: Optional[str] = None
174+
"""State/province code of service location, ISO 3166-2."""
175+
176+
street_address: Optional[str] = None
177+
"""Street address of service location."""
178+
179+
144180
class FleetInfo(BaseModel):
145181
"""
146182
Optional Object containing information if the Card is a part of a Fleet managed program
@@ -412,6 +448,7 @@ class CardAuthorizationApprovalRequestWebhookEvent(BaseModel):
412448
event_type: Literal["card_authorization.approval_request"]
413449

414450
merchant: Merchant
451+
"""Merchant information including full location details."""
415452

416453
merchant_amount: int
417454
"""Deprecated, use `amounts`.
@@ -426,6 +463,13 @@ class CardAuthorizationApprovalRequestWebhookEvent(BaseModel):
426463
merchant_currency: str
427464
"""3-character alphabetic ISO 4217 code for the local currency of the transaction."""
428465

466+
service_location: Optional[ServiceLocation] = None
467+
"""
468+
Where the cardholder received the service, when different from the card acceptor
469+
location. This is populated from network data elements such as Mastercard DE-122
470+
SE1 SF9-14 and Visa F34 DS02.
471+
"""
472+
429473
settled_amount: int
430474
"""Deprecated, use `amounts`.
431475

src/lithic/types/transaction.py

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from datetime import datetime
55
from typing_extensions import Literal
66

7+
from .shared import merchant
78
from .._models import BaseModel
89
from .token_info import TokenInfo
910
from .shared.currency import Currency
10-
from .shared.merchant import Merchant
1111
from .cardholder_authentication import CardholderAuthentication
1212

1313
__all__ = [
@@ -18,9 +18,11 @@
1818
"AmountsMerchant",
1919
"AmountsSettlement",
2020
"Avs",
21+
"Merchant",
2122
"Pos",
2223
"PosEntryMode",
2324
"PosTerminal",
25+
"ServiceLocation",
2426
"Event",
2527
"EventAmounts",
2628
"EventAmountsCardholder",
@@ -98,6 +100,19 @@ class Avs(BaseModel):
98100
"""Cardholder ZIP code"""
99101

100102

103+
class Merchant(merchant.Merchant):
104+
"""Merchant information including full location details."""
105+
106+
phone_number: Optional[str] = None
107+
"""Phone number of card acceptor."""
108+
109+
postal_code: Optional[str] = None
110+
"""Postal code of card acceptor."""
111+
112+
street_address: Optional[str] = None
113+
"""Street address of card acceptor."""
114+
115+
101116
class PosEntryMode(BaseModel):
102117
card: Literal["NOT_PRESENT", "PREAUTHORIZED", "PRESENT", "UNKNOWN"]
103118
"""Card presence indicator"""
@@ -206,6 +221,27 @@ class Pos(BaseModel):
206221
terminal: PosTerminal
207222

208223

224+
class ServiceLocation(BaseModel):
225+
"""
226+
Where the cardholder received the service, when different from the card acceptor location. This is populated from network data elements such as Mastercard DE-122 SE1 SF9-14 and Visa F34 DS02.
227+
"""
228+
229+
city: Optional[str] = None
230+
"""City of service location."""
231+
232+
country: Optional[str] = None
233+
"""Country code of service location, ISO 3166-1 alpha-3."""
234+
235+
postal_code: Optional[str] = None
236+
"""Postal code of service location."""
237+
238+
state: Optional[str] = None
239+
"""State/province code of service location, ISO 3166-2."""
240+
241+
street_address: Optional[str] = None
242+
"""Street address of service location."""
243+
244+
209245
class EventAmountsCardholder(BaseModel):
210246
amount: int
211247
"""Amount of the event in the cardholder billing currency."""
@@ -667,6 +703,7 @@ class Transaction(BaseModel):
667703
financial_account_token: Optional[str] = None
668704

669705
merchant: Merchant
706+
"""Merchant information including full location details."""
670707

671708
merchant_amount: Optional[int] = None
672709
"""Analogous to the 'amount', but in the merchant currency."""
@@ -723,6 +760,13 @@ class Transaction(BaseModel):
723760
"USER_TRANSACTION_LIMIT",
724761
]
725762

763+
service_location: Optional[ServiceLocation] = None
764+
"""
765+
Where the cardholder received the service, when different from the card acceptor
766+
location. This is populated from network data elements such as Mastercard DE-122
767+
SE1 SF9-14 and Visa F34 DS02.
768+
"""
769+
726770
settled_amount: int
727771
"""The settled amount of the transaction in the settlement currency."""
728772

0 commit comments

Comments
 (0)