All files / app/payment/storedInstrument isInstrumentCardCodeRequiredSelector.ts

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  40x   40x   40x 129x 129x   129x   126x 24x       24x               40x  
import { CheckoutSelectors, Instrument, PaymentMethod } from '@bigcommerce/checkout-sdk';
import { createSelector } from 'reselect';
 
import isInstrumentCardCodeRequired from './isInstrumentCardCodeRequired';
 
const isInstrumentCardCodeRequiredSelector = createSelector(
    ({ data }: CheckoutSelectors) => {
        const cart = data.getCart();
 
        return cart && cart.lineItems;
    },
    lineItems => (instrument: Instrument, method: PaymentMethod) => {
        Iif (!lineItems) {
            return false;
        }
 
        return isInstrumentCardCodeRequired({
            instrument,
            lineItems,
            paymentMethod: method,
        });
    }
);
 
export default isInstrumentCardCodeRequiredSelector;