danibram / trustly-client

A node client to comunicate with trustly.
https://github.com/danibram/trustly-client
MIT License
6 stars 8 forks source link

Send limit parameter with createNotificationResponse #41

Closed sly4you closed 3 years ago

sly4you commented 3 years ago

There are some cases (deposit with limit) where I need answer back a notification with additional parameter (ex: limit) as data, but it looks like that with createNotificationResponse I can just send back to Trustly the "status"

How can I add additional parameters to data using createNotificationResponse?

Is there another way to do that with Trustly-client library?

danibram commented 3 years ago

Hi! I just updated the version including 2 functions that I think will help you:

console.log('- Notification is comming. √')
tClient
    .verifyAndParseNotification(req.body)
    .then(function (notification) {
        return composeNotificationResponse(notification, {
            status: 'OK',
            ...aditionalData,
        })
    })
    .then(function (data) {
        console.log(util.inspect(data, false, 20, true))
        res.send(data)
    })
    .catch(function (error) {
        console.log('_Error')
        console.log(util.inspect(error, false, 20, true))
    })

I didn't have too much time, but I think this will help you.

Thanks a lot! and let me know @sly4you

sly4you commented 3 years ago

@danibram: Thank you so much to you for this really great job, and of course for your availability in code update! Lovely!