Skip to content

Commit

Permalink
fix(thirdparty): rename thirdParty to thirdparty (#192)
Browse files Browse the repository at this point in the history
* fix(thirdparty): rename thirdParty to thirdparty

* chore: fix endpoints
  • Loading branch information
kleyow authored Aug 7, 2020
1 parent 68e8de5 commit ce5af89
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 45 deletions.
46 changes: 23 additions & 23 deletions src/InboundServer/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -1544,7 +1544,7 @@ paths:
application/json:
authenticationInfo:
authentication: U2F
authenticationValue:
authenticationValue:
pinValue: '233133331'
counter: '1'
responseType: ENTERED
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -3735,7 +3735,7 @@ components:
- amount
- transactionId
- transactionRequestId
- quote
- quote
AuthorizationsIDPutResponse:
title: AuthorizationsIDPutResponse
type: object
Expand Down Expand Up @@ -4652,15 +4652,15 @@ 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'
description: >
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: >
Expand Down Expand Up @@ -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
20 changes: 10 additions & 10 deletions src/InboundServer/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;

Expand Down Expand Up @@ -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) {
Expand All @@ -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
});
Expand All @@ -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) {
Expand All @@ -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
});
Expand Down Expand Up @@ -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
}
};
4 changes: 2 additions & 2 deletions src/OutboundServer/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/model/OutboundThirdpartyTransactionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
18 changes: 9 additions & 9 deletions src/test/unit/inboundApi/handlers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('Inbound API handlers:', () => {
},
response: {},
state: {
conf: {},
conf: {},
logger: mockLogger({ app: 'inbound-handlers-unit-test' })
}
};
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('Inbound API handlers:', () => {
logger: mockLogger({ app: 'inbound-handlers-unit-test' }),
cache: {
publish: async () => Promise.resolve(true)
}
}
}
};
});
Expand Down Expand Up @@ -174,7 +174,7 @@ describe('Inbound API handlers:', () => {
logger: mockLogger({ app: 'inbound-handlers-unit-test' }),
cache: {
publish: async () => Promise.resolve(true)
}
}
}
};
});
Expand Down Expand Up @@ -283,7 +283,7 @@ describe('Inbound API handlers:', () => {
logger: mockLogger({ app: 'inbound-handlers-unit-test' }),
cache: {
publish: async () => Promise.resolve(true)
}
}
}
};
});
Expand Down Expand Up @@ -331,7 +331,7 @@ describe('Inbound API handlers:', () => {
logger: mockLogger({ app: 'inbound-handlers-unit-test' }),
cache: {
publish: async () => Promise.resolve(true)
}
}
}
};
});
Expand Down Expand Up @@ -584,7 +584,7 @@ describe('Inbound API handlers:', () => {
});
});

describe('PUT /thirdPartyRequests/transactions', () => {
describe('PUT /thirdpartyRequests/transactions', () => {
let mockThirdPartyReqContext;
beforeEach(() => {
mockThirdPartyReqContext = {
Expand Down Expand Up @@ -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
});
Expand Down

0 comments on commit ce5af89

Please sign in to comment.