Skip to content

Commit e37fafc

Browse files
horghclaude
andcommitted
Add /payment/method field
Add new /payment/method enum field to specify the payment method associated with the transaction. Valid values are bank_debit, bank_redirect, bank_transfer, buy_now_pay_later, card, crypto, digital_wallet, gift_card, real_time_payment, and rewards. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2aa733b commit e37fafc

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ History
1313
validation.
1414
* Added the input ``/event/party``. This is the party submitting the
1515
transaction.
16+
* Added the input ``/payment/method``. This is the payment method associated
17+
with the transaction.
1618

1719
3.1.0 (2025-05-23)
1820
++++++++++++++++++

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ Score, Insights and Factors Example
210210
>>> 'payment': {
211211
>>> 'decline_code': 'invalid number',
212212
>>> 'was_authorized': False,
213+
>>> 'method': 'card',
213214
>>> 'processor': 'stripe'
214215
>>> },
215216
>>> 'shopping_cart': [{

src/minfraud/validation.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ def _hostname(hostname: str) -> str:
9898

9999
_shipping_address["delivery_speed"] = _delivery_speed
100100

101+
_payment_method = In(
102+
[
103+
"bank_debit",
104+
"bank_redirect",
105+
"bank_transfer",
106+
"buy_now_pay_later",
107+
"card",
108+
"crypto",
109+
"digital_wallet",
110+
"gift_card",
111+
"real_time_payment",
112+
"rewards",
113+
],
114+
)
115+
101116
_payment_processor = In(
102117
[
103118
"adyen",
@@ -320,6 +335,7 @@ def _uri(s: str) -> str:
320335
},
321336
"billing": _address,
322337
"payment": {
338+
"method": _payment_method,
323339
"processor": _payment_processor,
324340
"was_authorized": bool,
325341
"decline_code": str,

tests/data/full-transaction-request.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"delivery_speed": "same_day"
4343
},
4444
"payment": {
45+
"method": "card",
4546
"processor": "stripe",
4647
"was_authorized": false,
4748
"decline_code": "invalid number"

tests/test_validation.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,23 @@ def test_referrer_uri(self) -> None:
378378

379379

380380
class TestPayment(ValidationBase, unittest.TestCase):
381+
def test_method(self) -> None:
382+
for good in (
383+
"bank_debit",
384+
"bank_redirect",
385+
"bank_transfer",
386+
"buy_now_pay_later",
387+
"card",
388+
"crypto",
389+
"digital_wallet",
390+
"gift_card",
391+
"real_time_payment",
392+
"rewards",
393+
):
394+
self.check_transaction({"payment": {"method": good}})
395+
for bad in ("bad", 1, ""):
396+
self.check_invalid_transaction({"payment": {"method": bad}})
397+
381398
def test_processor(self) -> None:
382399
for good in ("adyen", "stripe"):
383400
self.check_transaction({"payment": {"processor": good}})

0 commit comments

Comments
 (0)