Skip to content

Commit

Permalink
fix(mojaloop/#2585): bulk-api-adapter fails when extensionLists are n…
Browse files Browse the repository at this point in the history
…ot send in post /bulktransfer (#35)

fix for mojaloop/project#2585:
- added some safety checks on chained object "dot" notation references
- aligned .nvmrc to ci-cd builds (i.e. Node v12.16.1)
  • Loading branch information
mdebarros authored Nov 19, 2021
1 parent b590973 commit cd3b7bc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.15.1
12.16.1
2 changes: 1 addition & 1 deletion src/bulkTransfers/schema/individualTransfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const getIndividualTransferSchema = () => {
}))
}
IndividualTransferSchema.pre('save', function () {
if (!this.payload.extensionList.extension.length) {
if (!this.payload.extensionList || !this.payload.extensionList.extension || !this.payload.extensionList.extension.length) {
delete this._doc.payload.extensionList
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/bulkTransfers/schema/individualTransferFulfil.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const getIndividualTransferFulfilSchema = () => {
}))
}
IndividualTransferFulfilSchema.pre('save', function () {
if (!this.payload.extensionList.extension.length) {
if (!this.payload.extensionList || !this.payload.extensionList.extension || !this.payload.extensionList.extension.length) {
delete this._doc.payload.extensionList
}
})
Expand Down

0 comments on commit cd3b7bc

Please sign in to comment.