From fc8677b22ade74c3949ee7d809086149cfd9599c Mon Sep 17 00:00:00 2001 From: Vijay Date: Tue, 12 Nov 2024 20:43:45 +0530 Subject: [PATCH] fix: subid in query param --- src/interface/api-template.yaml | 12 + src/interface/api.yaml | 304 +++++++++--------- .../handlers/participants/{Type}/{ID}.ts | 3 +- 3 files changed, 171 insertions(+), 148 deletions(-) diff --git a/src/interface/api-template.yaml b/src/interface/api-template.yaml index 38bdc6a..9769c0e 100644 --- a/src/interface/api-template.yaml +++ b/src/interface/api-template.yaml @@ -134,6 +134,7 @@ paths: parameters: #Headers - $ref: '../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Accept.yaml' + - $ref: '#/components/parameters/partySubIdOrType' responses: 200: description: OK @@ -475,6 +476,17 @@ tags: servers: - url: / components: + parameters: + partySubIdOrType: + name: partySubIdOrType + in: query + required: false + schema: + type: string + description: >- + A sub-identifier of the party identifier, or a sub-type of the party + identifier's type. For example, `PASSPORT`, `DRIVING_LICENSE`. + schemas: ParticipantsTypeIDPutRequest: title: ParticipantsTypeIDPutRequest diff --git a/src/interface/api.yaml b/src/interface/api.yaml index 54afc73..6797cdf 100644 --- a/src/interface/api.yaml +++ b/src/interface/api.yaml @@ -145,6 +145,7 @@ paths: operationId: ParticipantsByTypeAndIDGet parameters: - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/partySubIdOrType' responses: '200': description: OK @@ -518,6 +519,162 @@ tags: servers: - url: / components: + parameters: + partySubIdOrType: + name: partySubIdOrType + in: query + required: false + schema: + type: string + description: >- + A sub-identifier of the party identifier, or a sub-type of the party + identifier's type. For example, `PASSPORT`, `DRIVING_LICENSE`. + Type: + name: Type + in: path + required: true + schema: + type: string + description: The type of the party identifier. For example, `MSISDN`, `PERSONAL_ID`. + ID: + name: ID + in: path + required: true + schema: + type: string + description: The identifier value. + Content-Type: + name: Content-Type + in: header + schema: + type: string + required: true + description: >- + The `Content-Type` header indicates the specific version of the API used + to send the payload body. + Date: + name: Date + in: header + schema: + type: string + required: true + description: The `Date` header field indicates the date when the request was sent. + X-Forwarded-For: + name: X-Forwarded-For + in: header + schema: + type: string + required: false + description: >- + The `X-Forwarded-For` header field is an unofficially accepted standard + used for informational purposes of the originating client IP address, as + a request might pass multiple proxies, firewalls, and so on. Multiple + `X-Forwarded-For` values should be expected and supported by + implementers of the API. + + + **Note:** An alternative to `X-Forwarded-For` is defined in [RFC + 7239](https://tools.ietf.org/html/rfc7239). However, to this point RFC + 7239 is less-used and supported than `X-Forwarded-For`. + FSPIOP-Source: + name: FSPIOP-Source + in: header + schema: + type: string + required: true + description: >- + The `FSPIOP-Source` header field is a non-HTTP standard field used by + the API for identifying the sender of the HTTP request. The field should + be set by the original sender of the request. Required for routing and + signature verification (see header field `FSPIOP-Signature`). + FSPIOP-Destination: + name: FSPIOP-Destination + in: header + schema: + type: string + required: false + description: >- + The `FSPIOP-Destination` header field is a non-HTTP standard field used + by the API for HTTP header based routing of requests and responses to + the destination. The field must be set by the original sender of the + request if the destination is known (valid for all services except GET + /parties) so that any entities between the client and the server do not + need to parse the payload for routing purposes. If the destination is + not known (valid for service GET /parties), the field should be left + empty. + FSPIOP-Encryption: + name: FSPIOP-Encryption + in: header + schema: + type: string + required: false + description: >- + The `FSPIOP-Encryption` header field is a non-HTTP standard field used + by the API for applying end-to-end encryption of the request. + FSPIOP-Signature: + name: FSPIOP-Signature + in: header + schema: + type: string + required: false + description: >- + The `FSPIOP-Signature` header field is a non-HTTP standard field used by + the API for applying an end-to-end request signature. + FSPIOP-URI: + name: FSPIOP-URI + in: header + schema: + type: string + required: false + description: >- + The `FSPIOP-URI` header field is a non-HTTP standard field used by the + API for signature verification, should contain the service URI. Required + if signature verification is used, for more information, see [the API + Signature + document](https://github.com/mojaloop/docs/tree/main/Specification%20Document%20Set). + FSPIOP-HTTP-Method: + name: FSPIOP-HTTP-Method + in: header + schema: + type: string + required: false + description: >- + The `FSPIOP-HTTP-Method` header field is a non-HTTP standard field used + by the API for signature verification, should contain the service HTTP + method. Required if signature verification is used, for more + information, see [the API Signature + document](https://github.com/mojaloop/docs/tree/main/Specification%20Document%20Set). + Accept: + name: Accept + in: header + required: true + schema: + type: string + description: >- + The `Accept` header field indicates the version of the API the client + would like the server to use. + Content-Length: + name: Content-Length + in: header + required: false + schema: + type: integer + description: >- + The `Content-Length` header field indicates the anticipated size of the + payload body. Only sent if there is a body. + + + **Note:** The API supports a maximum size of 5242880 bytes (5 + Megabytes). + SubId: + name: SubId + in: path + required: true + schema: + type: string + description: >- + A sub-identifier of the party identifier, or a sub-type of the party + identifier's type. For example, `PASSPORT`, `DRIVING_LICENSE`. schemas: ParticipantsTypeIDPutRequest: title: ParticipantsTypeIDPutRequest @@ -1142,150 +1299,3 @@ components: description: >- The `Content-Type` header indicates the specific version of the API used to send the payload body. - parameters: - Type: - name: Type - in: path - required: true - schema: - type: string - description: The type of the party identifier. For example, `MSISDN`, `PERSONAL_ID`. - ID: - name: ID - in: path - required: true - schema: - type: string - description: The identifier value. - Content-Type: - name: Content-Type - in: header - schema: - type: string - required: true - description: >- - The `Content-Type` header indicates the specific version of the API used - to send the payload body. - Date: - name: Date - in: header - schema: - type: string - required: true - description: The `Date` header field indicates the date when the request was sent. - X-Forwarded-For: - name: X-Forwarded-For - in: header - schema: - type: string - required: false - description: >- - The `X-Forwarded-For` header field is an unofficially accepted standard - used for informational purposes of the originating client IP address, as - a request might pass multiple proxies, firewalls, and so on. Multiple - `X-Forwarded-For` values should be expected and supported by - implementers of the API. - - - **Note:** An alternative to `X-Forwarded-For` is defined in [RFC - 7239](https://tools.ietf.org/html/rfc7239). However, to this point RFC - 7239 is less-used and supported than `X-Forwarded-For`. - FSPIOP-Source: - name: FSPIOP-Source - in: header - schema: - type: string - required: true - description: >- - The `FSPIOP-Source` header field is a non-HTTP standard field used by - the API for identifying the sender of the HTTP request. The field should - be set by the original sender of the request. Required for routing and - signature verification (see header field `FSPIOP-Signature`). - FSPIOP-Destination: - name: FSPIOP-Destination - in: header - schema: - type: string - required: false - description: >- - The `FSPIOP-Destination` header field is a non-HTTP standard field used - by the API for HTTP header based routing of requests and responses to - the destination. The field must be set by the original sender of the - request if the destination is known (valid for all services except GET - /parties) so that any entities between the client and the server do not - need to parse the payload for routing purposes. If the destination is - not known (valid for service GET /parties), the field should be left - empty. - FSPIOP-Encryption: - name: FSPIOP-Encryption - in: header - schema: - type: string - required: false - description: >- - The `FSPIOP-Encryption` header field is a non-HTTP standard field used - by the API for applying end-to-end encryption of the request. - FSPIOP-Signature: - name: FSPIOP-Signature - in: header - schema: - type: string - required: false - description: >- - The `FSPIOP-Signature` header field is a non-HTTP standard field used by - the API for applying an end-to-end request signature. - FSPIOP-URI: - name: FSPIOP-URI - in: header - schema: - type: string - required: false - description: >- - The `FSPIOP-URI` header field is a non-HTTP standard field used by the - API for signature verification, should contain the service URI. Required - if signature verification is used, for more information, see [the API - Signature - document](https://github.com/mojaloop/docs/tree/main/Specification%20Document%20Set). - FSPIOP-HTTP-Method: - name: FSPIOP-HTTP-Method - in: header - schema: - type: string - required: false - description: >- - The `FSPIOP-HTTP-Method` header field is a non-HTTP standard field used - by the API for signature verification, should contain the service HTTP - method. Required if signature verification is used, for more - information, see [the API Signature - document](https://github.com/mojaloop/docs/tree/main/Specification%20Document%20Set). - Accept: - name: Accept - in: header - required: true - schema: - type: string - description: >- - The `Accept` header field indicates the version of the API the client - would like the server to use. - Content-Length: - name: Content-Length - in: header - required: false - schema: - type: integer - description: >- - The `Content-Length` header field indicates the anticipated size of the - payload body. Only sent if there is a body. - - - **Note:** The API supports a maximum size of 5242880 bytes (5 - Megabytes). - SubId: - name: SubId - in: path - required: true - schema: - type: string - description: >- - A sub-identifier of the party identifier, or a sub-type of the party - identifier's type. For example, `PASSPORT`, `DRIVING_LICENSE`. diff --git a/src/server/handlers/participants/{Type}/{ID}.ts b/src/server/handlers/participants/{Type}/{ID}.ts index 999562f..c70ef05 100644 --- a/src/server/handlers/participants/{Type}/{ID}.ts +++ b/src/server/handlers/participants/{Type}/{ID}.ts @@ -13,7 +13,8 @@ export async function get(_context: Context, request: Request, h: ResponseToolki } const partyId = request.params.ID - const partyMapItem = await retrievePartyMapItem(partyId) + const subId = request.query?.partySubIdOrType + const partyMapItem = await retrievePartyMapItem(partyId, subId) return h.response({ partyList: [partyMapItem] }).code(200) }