hps / heartland-nodejs

Heartland's node.js SDK for connecting to our Portico Payment Gateway.
GNU General Public License v2.0
10 stars 12 forks source link

portico-gateway.js swallowing errors and running callback multiple times #22

Open charlie-s opened 6 years ago

charlie-s commented 6 years ago

In lib/services/portico-gateway.js, PorticoGateway.submitTransaction, we have this block:

try {
    callback(null, {header: h, body: gatewayResult['Ver1.0'][0].Transaction[0]});
} catch (e) {
    callback(null, {header: h});
}

As you can see, any errors thrown in the callback are swallowed and the callback is then run a 2nd time. What does the try/catch accomplish here?

slogsdon commented 6 years ago

@charlie-s Apologies for missing this originally! Agreed that the try/catch block there isn't a good solution for these cases. We're working on a small update to address this.