UNPKG

payments

Version:

Lists various payment methods. Used by Wix Restaurants for payment configuration.

25 lines (20 loc) 745 B
import _ from 'lodash'; import cash from './methods/cash'; import credit from './methods/credit'; import cellarix from './methods/com.cellarix'; import mysodexo from './methods/il.co.mysodexo'; // Methods const methodsList = [ cash, credit, cellarix, mysodexo ]; const methods = _.reduce(methodsList, (methods, method) => {methods[method.id] = method; return methods;}, {}); export const getMethodsForCountry = countryCode => { return _(methods) .filter(method => (_.isUndefined(method.countries) || _.includes(method.countries, countryCode))) .map(method => _.omit(method, 'countries')) .value(); }; export const getMethodDisplayName = (i18nGet, methodId) => i18nGet(`method_${methodId}_title`);