import api from '../../../redux-app/apiClient' ; interface Request { method : 'POST' | string ; body : any ; } interface Response { status : ( code : number ) => any | { json : ( vars : any ) => any ; } ; } const genRequestPayload = ( params ) => ( { widget_id : params . widget_id , card_hash : params . card_hash , payment_method : params . payment_method , amount : params . amount , customer : params . customer , subscription : params . subscription , period : params . recurring_period , } ) ; const ActionDonation = async ( req , res ) => { if ( req . method === 'POST' ) { const endpoint = `/mobilizations/${ req . body . mobilization_id }/donations` ; const body = { donation : genRequestPayload ( req . body ) } ; const result = await api . post ( endpoint , body ) ; return res . status ( 200 ) . json ( { data : result . data } ) ; } return res . status ( 200 ) . json ( { message : 'request GET' } ) ; } ; export default ActionDonation ;