All files / app/payment/paymentMethod getUniquePaymentMethodId.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 1224x   24x 413x     24x 9x   9x    
import { compact } from 'lodash';
 
export default function getUniquePaymentMethodId(methodId: string, gatewayId?: string): string {
    return compact([gatewayId, methodId]).join('-');
}
 
export function parseUniquePaymentMethodId(value: string): { methodId: string; gatewayId?: string } {
    const [gatewayId, methodId] = value.indexOf('-') > -1 ? value.split('-') : [undefined, value];
 
    return { gatewayId, methodId };
}