@adyen/react-native
Version:
Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native
24 lines (21 loc) • 717 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.find = find;
/**
* Find payment method in JSON response or \paymentMethods API
*/
function find(paymentMethods, typeName) {
return paymentMethods.paymentMethods.find(pm => pm.type === mapCreatedComponentType(typeName));
}
/**
* Map component name to txVariable name from \paymentMethod response
* @param {string} pmType
* @returns {string} matching txVariable name or original name
*/
function mapCreatedComponentType(pmType) {
// Components created as 'card' need to be matched with paymentMethod response objects with type 'scheme'
return pmType === 'card' ? 'scheme' : pmType;
}
//# sourceMappingURL=utils.js.map