Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const request = (data) => {
const commonPayload = parseToPayload(data)
const paymentData = ifElse(
prop('cardId'),
parseCardId,
getPaymentMethodData,
)(data)
const fullPayload = merge(paymentData, commonPayload)
if (propOr(true, 'createTransaction', data) === false) {
if (commonPayload.payment_method === 'credit_card') {
return pagarme.client
.connect({ encryption_key: commonPayload.encryption_key })
.then(client => client.security.encrypt(paymentData))
.then(cardHash => (
assoc(
'card_hash',
cardHash,
omit([
'card_cvv',
'card_expiration_date',
'card_holder_name',
'card_number',
], fullPayload)
)
))
}