Skip to content

Commit 940840e

Browse files
horghclaude
andcommitted
Add payment method field to support transaction payment types
Add PaymentMethod enum with 10 values including bank_debit, card, crypto, digital_wallet, and others. Update Payment class to include method field positioned above processor per requirements. Updated tests and documentation to demonstrate usage. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent e6102b4 commit 940840e

File tree

5 files changed

+49
-1
lines changed

5 files changed

+49
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ CHANGELOG
88
* Added `CreditApplication` and `FundTransfer` to the `EventType` enum.
99
* Added the input `/event/party`. This is the party submitting the
1010
transaction. You may provide this by providing `party` to `Event`.
11+
* Added the input `/payment/method`. This is the payment method associated
12+
with the transaction. You may provide this by providing `method` to
13+
`Payment`.
1114

1215
8.1.0 (2025-05-23)
1316
------------------

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ try {
224224
}),
225225
payment: new minFraud.Payment({
226226
declineCode: 'A',
227+
method: minFraud.Constants.PaymentMethod.Card,
227228
processor: minFraud.Constants.Processor.ConceptPayments,
228229
wasAuthorized: true,
229230
}),

src/constants.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ export enum DeliverySpeed {
2424
Standard = 'standard',
2525
}
2626

27+
export enum PaymentMethod {
28+
BankDebit = 'bank_debit',
29+
BankRedirect = 'bank_redirect',
30+
BankTransfer = 'bank_transfer',
31+
BuyNowPayLater = 'buy_now_pay_later',
32+
Card = 'card',
33+
Crypto = 'crypto',
34+
DigitalWallet = 'digital_wallet',
35+
GiftCard = 'gift_card',
36+
RealTimePayment = 'real_time_payment',
37+
Rewards = 'rewards',
38+
}
39+
2740
export enum Processor {
2841
Adyen = 'adyen',
2942
Affirm = 'affirm',

src/request/payment.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Payment from './payment';
2+
import { PaymentMethod } from '../constants';
23

34
describe('Payment()', () => {
45
it('constructs', () => {
@@ -8,4 +9,28 @@ describe('Payment()', () => {
89
});
910
}).not.toThrow();
1011
});
12+
13+
it('accepts card payment method', () => {
14+
const payment = new Payment({
15+
method: PaymentMethod.Card,
16+
});
17+
18+
expect(payment.method).toEqual(PaymentMethod.Card);
19+
});
20+
21+
it('accepts crypto payment method', () => {
22+
const payment = new Payment({
23+
method: PaymentMethod.Crypto,
24+
});
25+
26+
expect(payment.method).toEqual(PaymentMethod.Crypto);
27+
});
28+
29+
it('accepts digital_wallet payment method', () => {
30+
const payment = new Payment({
31+
method: PaymentMethod.DigitalWallet,
32+
});
33+
34+
expect(payment.method).toEqual(PaymentMethod.DigitalWallet);
35+
});
1136
});

src/request/payment.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { Processor } from '../constants';
1+
import { PaymentMethod, Processor } from '../constants';
22

33
interface PaymentProps {
4+
/**
5+
* The payment method associated with the transaction.
6+
*/
7+
method?: PaymentMethod;
48
/**
59
* The payment processor used for the transaction.
610
*/
@@ -21,6 +25,8 @@ interface PaymentProps {
2125
* The payment information for the transaction being sent to the web service.
2226
*/
2327
export default class Payment implements PaymentProps {
28+
/** @inheritDoc PaymentProps.method */
29+
public method?: PaymentMethod;
2430
/** @inheritDoc PaymentProps.processor */
2531
public processor?: Processor;
2632
/** @inheritDoc PaymentProps.wasAuthorized */

0 commit comments

Comments
 (0)