File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,16 +6,23 @@ import {
66 ChargebeeCardDefaults ,
77} from '../type' ;
88
9+ /** Default fallback values for card details when config is not provided */
10+ const DEFAULT_EXPIRY_MONTH = 12 ;
11+ const DEFAULT_FUNDING_TYPE = 'credit' ;
12+ const DEFAULT_CARD_BRAND = 'unknown' ;
13+
914export class ChargebeePaymentIntentAdapter {
1015 private readonly cardDefaults : Required < ChargebeeCardDefaults > ;
1116
1217 constructor ( cardDefaults ?: ChargebeeCardDefaults ) {
1318 const currentYear = new Date ( ) . getFullYear ( ) ;
1419 this . cardDefaults = {
15- defaultExpiryMonth : cardDefaults ?. defaultExpiryMonth ?? 12 ,
20+ defaultExpiryMonth :
21+ cardDefaults ?. defaultExpiryMonth ?? DEFAULT_EXPIRY_MONTH ,
1622 defaultExpiryYear : cardDefaults ?. defaultExpiryYear ?? currentYear ,
17- defaultFundingType : cardDefaults ?. defaultFundingType ?? 'credit' ,
18- defaultCardBrand : cardDefaults ?. defaultCardBrand ?? 'unknown' ,
23+ defaultFundingType :
24+ cardDefaults ?. defaultFundingType ?? DEFAULT_FUNDING_TYPE ,
25+ defaultCardBrand : cardDefaults ?. defaultCardBrand ?? DEFAULT_CARD_BRAND ,
1926 } ;
2027 }
2128
Original file line number Diff line number Diff line change @@ -7,16 +7,23 @@ import {
77 StripeCardDefaults ,
88} from '../type' ;
99
10+ /** Default fallback values for card details when config is not provided */
11+ const DEFAULT_EXPIRY_MONTH = 12 ;
12+ const DEFAULT_FUNDING_TYPE = 'credit' ;
13+ const DEFAULT_CARD_BRAND = 'unknown' ;
14+
1015export class StripePaymentAdapter implements IAdapter < IStripePaymentSource > {
1116 private readonly cardDefaults : Required < StripeCardDefaults > ;
1217
1318 constructor ( cardDefaults ?: StripeCardDefaults ) {
1419 const currentYear = new Date ( ) . getFullYear ( ) ;
1520 this . cardDefaults = {
16- defaultExpiryMonth : cardDefaults ?. defaultExpiryMonth ?? 12 ,
21+ defaultExpiryMonth :
22+ cardDefaults ?. defaultExpiryMonth ?? DEFAULT_EXPIRY_MONTH ,
1723 defaultExpiryYear : cardDefaults ?. defaultExpiryYear ?? currentYear ,
18- defaultFundingType : cardDefaults ?. defaultFundingType ?? 'credit' ,
19- defaultCardBrand : cardDefaults ?. defaultCardBrand ?? 'unknown' ,
24+ defaultFundingType :
25+ cardDefaults ?. defaultFundingType ?? DEFAULT_FUNDING_TYPE ,
26+ defaultCardBrand : cardDefaults ?. defaultCardBrand ?? DEFAULT_CARD_BRAND ,
2027 } ;
2128 }
2229
You can’t perform that action at this time.
0 commit comments