diff --git a/docs/dfspInboundApi.yaml b/docs/dfspInboundApi.yaml index f7d3a4b..cfea0d6 100644 --- a/docs/dfspInboundApi.yaml +++ b/docs/dfspInboundApi.yaml @@ -832,6 +832,17 @@ components: homeTransactionId: type: string description: Transaction ID from the DFSP backend, used to reconcile transactions between the Switch and DFSP backend systems. + fulfilment: + $ref: '#/components/schemas/IlpFulfilment' + description: Fulfilment from the DFSP backend, used for testing purposes to inject an invalid fulfilment via a rule. + transferState: + $ref: '#/components/schemas/transferState' + description: Transfer state from the DFSP backend, used for testing purposes to inject an desired transfer state via a rule. + example: ABORTED + completedTimestamp: + $ref: '#/components/schemas/timestamp' + description: Completed timestamp from the DFSP backend, used for testing purposes to inject a given completed timestamp via a rule. + example: "2020-05-19T08:38:08.699-04:00" transferDetailsResponse: type: object diff --git a/src/lib/model/InboundTransfersModel.js b/src/lib/model/InboundTransfersModel.js index 3024b24..2ad3c84 100644 --- a/src/lib/model/InboundTransfersModel.js +++ b/src/lib/model/InboundTransfersModel.js @@ -349,9 +349,9 @@ class InboundTransfersModel { // create a mojaloop transfer fulfil response const mojaloopResponse = { - completedTimestamp: new Date(), - transferState: this._reserveNotification ? 'RESERVED' : 'COMMITTED', - fulfilment: fulfilment, + completedTimestamp: response.completedTimestamp || new Date(), + transferState: response.transferState || (this._reserveNotification ? TransferStateEnum.RESERVED : TransferStateEnum.COMPLETED), + fulfilment: response.fulfilment || fulfilment, ...response.extensionList && { extensionList: { extension: response.extensionList, @@ -366,7 +366,7 @@ class InboundTransfersModel { headers: res.originalRequest.headers, body: res.originalRequest.body, }; - this.data.currentState = this._reserveNotification ? TransferStateEnum.RESERVED : TransferStateEnum.COMPLETED; + this.data.currentState = response.transferState || (this._reserveNotification ? TransferStateEnum.RESERVED : TransferStateEnum.COMPLETED); await this._save(); return res; } diff --git a/src/package.json b/src/package.json index b932ce2..a0d631e 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "@pm4ml/mojaloop-connector", - "version": "14.1.11", + "version": "14.1.12", "description": "An adapter for connecting to Mojaloop API enabled switches.", "main": "index.js", "scripts": {