From ce5af8905ac29a30c1758b10c9aad2b4f060b16e Mon Sep 17 00:00:00 2001 From: Kevin Leyow Date: Thu, 6 Aug 2020 23:22:34 -0500 Subject: [PATCH] fix(thirdparty): rename thirdParty to thirdparty (#192) * fix(thirdparty): rename thirdParty to thirdparty * chore: fix endpoints --- src/InboundServer/api.yaml | 46 +++++++++---------- src/InboundServer/handlers.js | 20 ++++---- src/OutboundServer/api.yaml | 4 +- .../OutboundThirdpartyTransactionModel.js | 2 +- src/test/unit/inboundApi/handlers.test.js | 18 ++++---- 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/InboundServer/api.yaml b/src/InboundServer/api.yaml index 2f38e353a..b561c6e4b 100644 --- a/src/InboundServer/api.yaml +++ b/src/InboundServer/api.yaml @@ -1428,7 +1428,7 @@ paths: /authorizations: post: description: > - The HTTP request `POST /authorizations` is used to request the Payer to enter the + The HTTP request `POST /authorizations` is used to request the Payer to enter the applicable credentials in the PISP system. summary: Perform PISP authorization tags: @@ -1471,7 +1471,7 @@ paths: 501: $ref: '#/components/responses/ErrorResponse501' 503: - $ref: '#/components/responses/ErrorResponse503' + $ref: '#/components/responses/ErrorResponse503' '/authorizations/{ID}': parameters: - $ref: '#/components/parameters/ID' @@ -1544,7 +1544,7 @@ paths: application/json: authenticationInfo: authentication: U2F - authenticationValue: + authenticationValue: pinValue: '233133331' counter: '1' responseType: ENTERED @@ -2553,16 +2553,16 @@ paths: $ref: '#/components/responses/ErrorResponse503' requestBody: $ref: '#/components/requestBodies/ErrorInformationObject' - #thirdPartyRequests - /thirdPartyRequests/transactions/{ID}: + #thirdpartyRequests + /thirdpartyRequests/transactions/{ID}: put: description: > - The callback `PUT /thirdPartyRequests/transactions/{ID}` is used to inform the client of the result of a - previously-requested transaction. The `{ID}` in the URI should contain the `transactionRequestId` that was used for + The callback `PUT /thirdpartyRequests/transactions/{ID}` is used to inform the client of the result of a + previously-requested transaction. The `{ID}` in the URI should contain the `transactionRequestId` that was used for the creation of the transaction request. summary: Update third party transaction requests tags: - - thirdPartyRequests + - thirdpartyRequests operationId: UpdateThirdPartyTransactionRequests parameters: #Path @@ -2576,7 +2576,7 @@ paths: - $ref: '#/components/parameters/FSPIOP-Encryption' - $ref: '#/components/parameters/FSPIOP-Signature' - $ref: '#/components/parameters/FSPIOP-URI' - - $ref: '#/components/parameters/FSPIOP-HTTP-Method' + - $ref: '#/components/parameters/FSPIOP-HTTP-Method' - $ref: '#/components/parameters/Content-Length' requestBody: description: Transaction request result returned. @@ -2604,15 +2604,15 @@ paths: $ref: '#/components/responses/ErrorResponse501' 503: $ref: '#/components/responses/ErrorResponse503' - /thirdPartyRequest/transactions/{ID}/error: + /thirdpartyRequests/transactions/{ID}/error: put: description: > - If the server is unable to find the transaction request, or another processing error occurs, - the error callback `PUT /thirdPartyRequest/transactions/{ID}/error` is used. + If the server is unable to find the transaction request, or another processing error occurs, + the error callback `PUT /thirdpartyRequests/transactions/{ID}/error` is used. The `{ID}` in the URI should contain the `transactionRequestId` that was used for the creation of the transaction request. summary: Return transaction error tags: - - thirdPartyRequests + - thirdpartyRequests operationId: UpdateThirdPartyTransactionRequestsError parameters: #Path @@ -3019,7 +3019,7 @@ components: Below are the allowed values for the enumeration AuthenticationType. - OTP One-time password generated by the Payer FSP. - QRCODE QR code used as One Time Password. - + AuthenticationValue: title: AuthenticationValue anyOf: @@ -3047,16 +3047,16 @@ components: pattern: ^\S{1,64}$ minLength: 1 maxLength: 64 - description: U2F challenge-response, where payer FSP verifies if the response provided by end-user device matches the previously registered key. + description: U2F challenge-response, where payer FSP verifies if the response provided by end-user device matches the previously registered key. Counter: title: Counter $ref: '#/components/schemas/Integer' description: Sequential counter used for cloning detection. Present only for U2F authentication. RetriesLeft: title: RetriesLeft - $ref: '#/components/schemas/Integer' + $ref: '#/components/schemas/Integer' description: RetriesLeft is the number of retries left before the financial transaction is rejected. It must be expressed in the form of the data type Integer. retriesLeft=1 means that this is the last retry before the financial transaction is rejected. - + AuthorizationResponse: title: AuthorizationResponse type: string @@ -3722,10 +3722,10 @@ components: description: This is the transaction amount that will be withdrawn from the Payer’s account. transactionId: $ref: '#/components/schemas/CorrelationId' - description: Common ID (decided by the Payer FSP) between the FSPs for the future transaction object. The actual transaction will be created as part of a successful transfer process. + description: Common ID (decided by the Payer FSP) between the FSPs for the future transaction object. The actual transaction will be created as part of a successful transfer process. transactionRequestId: $ref: '#/components/schemas/CorrelationId' - description: The transactionRequestID, received from the POST /transactionRequests service earlier in the process. + description: The transactionRequestID, received from the POST /transactionRequests service earlier in the process. quote: $ref: '#/components/schemas/QuotesIDPutResponse' description: Quotes object @@ -3735,7 +3735,7 @@ components: - amount - transactionId - transactionRequestId - - quote + - quote AuthorizationsIDPutResponse: title: AuthorizationsIDPutResponse type: object @@ -4652,7 +4652,7 @@ components: ThirdPartyTransactionResponse: title: ThirdPartyTransactionResponse type: object - description: The object sent in the PUT /thirdPartyRequests/transactions/{ID} request. + description: The object sent in the PUT /thirdpartyRequests/transactions/{ID} request. properties: transactionId: $ref: '#/components/schemas/CorrelationId' @@ -4660,7 +4660,7 @@ components: Identifies a related transaction (if a transaction has been created) transactionRequestState: $ref: '#/components/schemas/TransactionRequestState' - description: State of the transaction request` + description: State of the transaction request` AccountId: type: string description: > @@ -4708,4 +4708,4 @@ components: description: Unique routable address which is DFSP specific. pattern: ^([0-9A-Za-z_~\-\.]+[0-9A-Za-z_~\-])$ minLength: 1 - maxLength: 1023 + maxLength: 1023 diff --git a/src/InboundServer/handlers.js b/src/InboundServer/handlers.js index d947f1729..dc72565d9 100644 --- a/src/InboundServer/handlers.js +++ b/src/InboundServer/handlers.js @@ -399,8 +399,8 @@ const putAuthorizationsById = async (ctx) => { } const idValue = ctx.state.path.params.ID; - - const authorizationChannel = ctx.state.conf.enablePISPMode + + const authorizationChannel = ctx.state.conf.enablePISPMode ? AuthorizationsModel.notificationChannel(idValue) : `otp_${ctx.state.path.params.ID}`; @@ -924,8 +924,8 @@ const putBulkTransfersByIdError = async(ctx) => { }; /** - * Handles PUT /thirdPartyRequests/transactions/{ID} request. - * This is response to a POST /thirdPartyRequests/transactions request + * Handles PUT /thirdpartyRequests/transactions/{ID} request. + * This is response to a POST /thirdpartyRequests/transactions request */ const putThirdPartyReqTransactionsById = async (ctx) => { if (ctx.state.conf.enableTestFeatures) { @@ -940,7 +940,7 @@ const putThirdPartyReqTransactionsById = async (ctx) => { // publish an event onto the cache for subscribers to action await ThirdpartyTrxnModelOut.publishNotifications(ctx.state.cache, ctx.state.path.params.ID, { - type: 'thirdPartyTransactionsReqResponse', + type: 'thirdpartyTransactionsReqResponse', data: ctx.request.body, headers: ctx.request.headers }); @@ -949,8 +949,8 @@ const putThirdPartyReqTransactionsById = async (ctx) => { }; /** - * Handles PUT /thirdPartyRequests/transactions/{ID}/error. - * This is error response to POST /thirdPartyRequests/transactions request + * Handles PUT /thirdpartyRequests/transactions/{ID}/error. + * This is error response to POST /thirdpartyRequests/transactions request */ const putThirdPartyReqTransactionsByIdError = async (ctx) => { if (ctx.state.conf.enableTestFeatures) { @@ -965,7 +965,7 @@ const putThirdPartyReqTransactionsByIdError = async (ctx) => { // publish an event onto the cache for subscribers to action await ThirdpartyTrxnModelOut.publishNotifications(ctx.state.cache, ctx.state.path.params.ID, { - type: 'thirdPartyTransactionsReqErrorResponse', + type: 'thirdpartyTransactionsReqErrorResponse', data: ctx.request.body, headers: ctx.request.headers }); @@ -1064,10 +1064,10 @@ module.exports = { '/transactionRequests/{ID}': { put: putTransactionRequestsById }, - '/thirdPartyRequests/transactions/{ID}': { + '/thirdpartyRequests/transactions/{ID}': { put: putThirdPartyReqTransactionsById }, - '/thirdPartyRequests/transactions/{ID}/error': { + '/thirdpartyRequests/transactions/{ID}/error': { put: putThirdPartyReqTransactionsByIdError } }; diff --git a/src/OutboundServer/api.yaml b/src/OutboundServer/api.yaml index 8576e357e..a8d8fe634 100644 --- a/src/OutboundServer/api.yaml +++ b/src/OutboundServer/api.yaml @@ -408,7 +408,7 @@ paths: get: summary: Retrieves information for a specific thirdparty request transaction. description: > - The HTTP request `GET /thirdpartyRequest/transaction/{transactionRequestId}` is used to get information regarding a thirdparty transaction created or requested earlier. + The HTTP request `GET /thirdpartyRequests/transactions/{transactionRequestId}` is used to get information regarding a thirdparty transaction created or requested earlier. The `{transactionRequestId}` in the URI should contain the `ID` that was used for the creation of the thirdparty request transaction. tags: - thirdpartyRequest @@ -2090,7 +2090,7 @@ components: thirdpartyRequestsTransactionResponse: title: thirdpartyTransactionResponse type: object - description: The object sent in the PUT /thirdPartyRequests/transactions/{ID} request. + description: The object sent in the PUT /thirdpartyRequests/transactions/{ID} request. properties: transactionId: $ref: '#/components/schemas/mojaloopCorrelationId' diff --git a/src/lib/model/OutboundThirdpartyTransactionModel.js b/src/lib/model/OutboundThirdpartyTransactionModel.js index 727ca1954..aa2eea6ce 100644 --- a/src/lib/model/OutboundThirdpartyTransactionModel.js +++ b/src/lib/model/OutboundThirdpartyTransactionModel.js @@ -236,7 +236,7 @@ async function onPostThirdPartyTransaction() { const request = { ...data }; - console.log(data); + // Request is routed to switch and then to the payer's fsp. const res = await requests.postThirdpartyRequestsTransactions(request, data.payer.partyIdInfo.fspId); logger.push({ res }).log('Thirdparty transaction request sent to peer'); diff --git a/src/test/unit/inboundApi/handlers.test.js b/src/test/unit/inboundApi/handlers.test.js index 4b524cb98..54d996ef2 100644 --- a/src/test/unit/inboundApi/handlers.test.js +++ b/src/test/unit/inboundApi/handlers.test.js @@ -84,7 +84,7 @@ describe('Inbound API handlers:', () => { }, response: {}, state: { - conf: {}, + conf: {}, logger: mockLogger({ app: 'inbound-handlers-unit-test' }) } }; @@ -126,7 +126,7 @@ describe('Inbound API handlers:', () => { logger: mockLogger({ app: 'inbound-handlers-unit-test' }), cache: { publish: async () => Promise.resolve(true) - } + } } }; }); @@ -174,7 +174,7 @@ describe('Inbound API handlers:', () => { logger: mockLogger({ app: 'inbound-handlers-unit-test' }), cache: { publish: async () => Promise.resolve(true) - } + } } }; }); @@ -283,7 +283,7 @@ describe('Inbound API handlers:', () => { logger: mockLogger({ app: 'inbound-handlers-unit-test' }), cache: { publish: async () => Promise.resolve(true) - } + } } }; }); @@ -331,7 +331,7 @@ describe('Inbound API handlers:', () => { logger: mockLogger({ app: 'inbound-handlers-unit-test' }), cache: { publish: async () => Promise.resolve(true) - } + } } }; }); @@ -584,7 +584,7 @@ describe('Inbound API handlers:', () => { }); }); - describe('PUT /thirdPartyRequests/transactions', () => { + describe('PUT /thirdpartyRequests/transactions', () => { let mockThirdPartyReqContext; beforeEach(() => { mockThirdPartyReqContext = { @@ -612,15 +612,15 @@ describe('Inbound API handlers:', () => { }; }); - test('calls `model.thirdPartyRequests.transactions` with the expected arguments.', async () => { + test('calls `model.thirdpartyRequests.transactions` with the expected arguments.', async () => { const pubNotificatiosnSpy = jest.spyOn(ThirdpartyTrxnModelOut, 'publishNotifications'); - await expect(handlers['/thirdPartyRequests/transactions/{ID}'].put(mockThirdPartyReqContext)).resolves.toBe(undefined); + await expect(handlers['/thirdpartyRequests/transactions/{ID}'].put(mockThirdPartyReqContext)).resolves.toBe(undefined); expect(pubNotificatiosnSpy).toHaveBeenCalledTimes(1); expect(pubNotificatiosnSpy).toHaveBeenCalledWith(mockThirdPartyReqContext.state.cache, mockThirdPartyReqContext.state.path.params.ID, { - type: 'thirdPartyTransactionsReqResponse', + type: 'thirdpartyTransactionsReqResponse', data: mockThirdPartyReqContext.request.body, headers: mockThirdPartyReqContext.request.headers });