Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Cannot read property 'CreditSale' of undefined #19

@arvinkx

Description

@arvinkx

Hi-
I am getting this error intermittently, works fine most of the time. It seems the response is missing the body and the code doesn't handle that well. The charge goes through but the callback throws an error when it returns.

TypeError: Cannot read property 'CreditSale' of undefined
    at /var/task/node_modules/heartland-nodejs/lib/services/secure-submit/hps-credit-service.js:144:63
    at /var/task/node_modules/heartland-nodejs/lib/services/portico-gateway.js:43:37
    at /var/task/node_modules/heartland-nodejs/lib/soap/client.js:106:13
    at /var/task/node_modules/heartland-nodejs/lib/soap/client.js:174:13
    at Request._callback (/var/task/node_modules/heartland-nodejs/lib/soap/http.js:63:13)
    at Request.self.callback (/var/task/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/var/task/node_modules/request/request.js:1171:10)
    at emitOne (events.js:96:13)

This is the code it is referencing:

if (tv4.validate(tx, schema)) {
                gateway.submitTransaction({'CreditSale':{'Block1':tx}}, function (err, result) {
                    if (err) {
                        callback(err, null);
                    } else {
                        var h = result.header, b = result.body.CreditSale;
                        processAuth(h, b, amount, currency, callback);
                    }
                });
            } else {
                callback(tv4.error, null);
            }

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions