From aa9f1913019ba4799dd5b3ddd7a21c42b18ee8a5 Mon Sep 17 00:00:00 2001 From: hieuunguyeen Date: Thu, 7 Dec 2023 17:33:26 +0200 Subject: [PATCH 1/3] Schemas for payment endpoints --- maas-schemas/package.json | 2 +- .../tsp/payments-initiate/request.json | 21 ++++++++++++++++ .../tsp/payments-initiate/response.json | 25 +++++++++++++++++++ .../tsp/payments-retrieve/request.json | 17 +++++++++++++ .../tsp/payments-retrieve/response.json | 25 +++++++++++++++++++ 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 maas-schemas/schemas/tsp/payments-initiate/request.json create mode 100644 maas-schemas/schemas/tsp/payments-initiate/response.json create mode 100644 maas-schemas/schemas/tsp/payments-retrieve/request.json create mode 100644 maas-schemas/schemas/tsp/payments-retrieve/response.json diff --git a/maas-schemas/package.json b/maas-schemas/package.json index 156441af0..a1f892ee3 100644 --- a/maas-schemas/package.json +++ b/maas-schemas/package.json @@ -1,6 +1,6 @@ { "name": "maas-schemas", - "version": "21.0.0", + "version": "21.1.0", "description": "Schemas for MaaS infrastructure", "main": "index.js", "engine": { diff --git a/maas-schemas/schemas/tsp/payments-initiate/request.json b/maas-schemas/schemas/tsp/payments-initiate/request.json new file mode 100644 index 000000000..7102646f3 --- /dev/null +++ b/maas-schemas/schemas/tsp/payments-initiate/request.json @@ -0,0 +1,21 @@ +{ + "$id": "https://schemas.maas.global/tsp/payments-initiate/request.json", + "description": "Request schema for creating payment through TSP api", + "type": "object", + "properties": { + "tspId": { + "$ref": "https://schemas.maas.global/core/booking.json#/definitions/tspId" + }, + "paymentAmount": { + "type": "number" + } + }, + "required": ["tspId", "paymentAmount"], + "additionalProperties": false, + "examples": [ + { + "tspId": "00000000-cafe-cafe-cafe-cafecafecafe", + "paymentAmount": 2405 + } + ] +} diff --git a/maas-schemas/schemas/tsp/payments-initiate/response.json b/maas-schemas/schemas/tsp/payments-initiate/response.json new file mode 100644 index 000000000..944991282 --- /dev/null +++ b/maas-schemas/schemas/tsp/payments-initiate/response.json @@ -0,0 +1,25 @@ +{ + "$id": "https://schemas.maas.global/tsp/payments-initiate/request.json", + "description": "Response schema for creating payment through TSP api", + "type": "object", + "properties": { + "tspId": { + "$ref": "https://schemas.maas.global/core/booking.json#/definitions/tspId" + }, + "amount": { + "type": "number" + }, + "paymentStatus": { + "type": "string" + } + }, + "required": ["tspId", "amount", "paymentStatus"], + "additionalProperties": false, + "examples": [ + { + "tspId": "00000000-cafe-cafe-cafe-cafecafecafe", + "amount": 2405, + "paymentStatus": "CONFIRMED" + } + ] +} diff --git a/maas-schemas/schemas/tsp/payments-retrieve/request.json b/maas-schemas/schemas/tsp/payments-retrieve/request.json new file mode 100644 index 000000000..6203eb62b --- /dev/null +++ b/maas-schemas/schemas/tsp/payments-retrieve/request.json @@ -0,0 +1,17 @@ +{ + "$id": "https://schemas.maas.global/tsp/payments-retrieve/request.json", + "description": "Request schema for retrieving a TSP payment from TSP api", + "type": "object", + "properties": { + "tspId": { + "$ref": "https://schemas.maas.global/core/booking.json#/definitions/tspId" + } + }, + "required": ["tspId"], + "additionalProperties": false, + "examples": [ + { + "tspId": "00000000-cafe-cafe-cafe-cafecafecafe" + } + ] +} diff --git a/maas-schemas/schemas/tsp/payments-retrieve/response.json b/maas-schemas/schemas/tsp/payments-retrieve/response.json new file mode 100644 index 000000000..2a63ac73d --- /dev/null +++ b/maas-schemas/schemas/tsp/payments-retrieve/response.json @@ -0,0 +1,25 @@ +{ + "$id": "https://schemas.maas.global/tsp/payments-retrieve/request.json", + "description": "Response schema for retrieving a TSP payment from TSP api", + "type": "object", + "properties": { + "tspId": { + "$ref": "https://schemas.maas.global/core/booking.json#/definitions/tspId" + }, + "amount": { + "type": "number" + }, + "paymentStatus": { + "type": "string" + } + }, + "required": ["tspId", "amount", "paymentStatus"], + "additionalProperties": false, + "examples": [ + { + "tspId": "00000000-cafe-cafe-cafe-cafecafecafe", + "amount": 2405, + "paymentStatus": "PENDING" + } + ] +} From e6db6dcd9c694bd216d0fe1c843fd520baa6cac0 Mon Sep 17 00:00:00 2001 From: hieuunguyeen Date: Tue, 12 Dec 2023 18:57:14 +0200 Subject: [PATCH 2/3] ts-convert --- maas-schemas/src/ajv/registry.ts | 4 + maas-schemas/src/io-ts/_translation.log | 18 +++ .../_types/tsp/payments-initiate/request.ts | 108 ++++++++++++++++++ .../_types/tsp/payments-retrieve/request.ts | 108 ++++++++++++++++++ .../io-ts/tsp/payments-initiate/request.ts | 3 + .../io-ts/tsp/payments-retrieve/request.ts | 3 + 6 files changed, 244 insertions(+) create mode 100644 maas-schemas/src/io-ts/_types/tsp/payments-initiate/request.ts create mode 100644 maas-schemas/src/io-ts/_types/tsp/payments-retrieve/request.ts create mode 100644 maas-schemas/src/io-ts/tsp/payments-initiate/request.ts create mode 100644 maas-schemas/src/io-ts/tsp/payments-retrieve/request.ts diff --git a/maas-schemas/src/ajv/registry.ts b/maas-schemas/src/ajv/registry.ts index 1d85089ff..e4fd47022 100644 --- a/maas-schemas/src/ajv/registry.ts +++ b/maas-schemas/src/ajv/registry.ts @@ -357,6 +357,10 @@ export const registry: mjsv.Registry = { require('../../schemas/tsp/manage/response.json'), require('../../schemas/tsp/package-create/request.json'), require('../../schemas/tsp/package-create/response.json'), + require('../../schemas/tsp/payments-initiate/request.json'), + require('../../schemas/tsp/payments-initiate/response.json'), + require('../../schemas/tsp/payments-retrieve/request.json'), + require('../../schemas/tsp/payments-retrieve/response.json'), require('../../schemas/tsp/post-kyc-verification-update/request.json'), require('../../schemas/tsp/post-kyc-verification-update/response.json'), require('../../schemas/tsp/stations-list/request.json'), diff --git a/maas-schemas/src/io-ts/_translation.log b/maas-schemas/src/io-ts/_translation.log index cdfd71dc5..301517a62 100644 --- a/maas-schemas/src/io-ts/_translation.log +++ b/maas-schemas/src/io-ts/_translation.log @@ -2612,6 +2612,24 @@ WARNING: missing $schema declaration in schemas/tsp/package-create/request.json WARNING: missing $schema declaration in schemas/tsp/package-create/response.json +WARNING: missing $schema declaration + in schemas/tsp/payments-initiate/request.json +INFO: primitive type "number" used outside top-level definitions + in schemas/tsp/payments-initiate/request.json +WARNING: missing $schema declaration + in schemas/tsp/payments-initiate/response.json +INFO: primitive type "number" used outside top-level definitions + in schemas/tsp/payments-initiate/response.json +INFO: primitive type "string" used outside top-level definitions + in schemas/tsp/payments-initiate/response.json +WARNING: missing $schema declaration + in schemas/tsp/payments-retrieve/request.json +WARNING: missing $schema declaration + in schemas/tsp/payments-retrieve/response.json +INFO: primitive type "number" used outside top-level definitions + in schemas/tsp/payments-retrieve/response.json +INFO: primitive type "string" used outside top-level definitions + in schemas/tsp/payments-retrieve/response.json WARNING: missing $schema declaration in schemas/tsp/post-kyc-verification-update/request.json INFO: primitive type "string" used outside top-level definitions diff --git a/maas-schemas/src/io-ts/_types/tsp/payments-initiate/request.ts b/maas-schemas/src/io-ts/_types/tsp/payments-initiate/request.ts new file mode 100644 index 000000000..43b717b28 --- /dev/null +++ b/maas-schemas/src/io-ts/_types/tsp/payments-initiate/request.ts @@ -0,0 +1,108 @@ +/* + +undefined +Response schema for creating payment through TSP api + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray'; +import * as t from 'io-ts'; +import { nonEmptyArray } from 'io-ts-types/lib/nonEmptyArray'; + +import * as Booking_4353_ from '../../core/booking'; + +export type Defined = {} | null; +export class DefinedType extends t.Type { + readonly _tag: 'DefinedType' = 'DefinedType'; + constructor() { + super( + 'defined', + (u): u is Defined => typeof u !== 'undefined', + (u, c) => (this.is(u) ? t.success(u) : t.failure(u, c)), + t.identity, + ); + } +} +export type DefinedC = {} & DefinedType; +export const Defined: DefinedC = new DefinedType(); + +export const schemaId = 'https://schemas.maas.global/tsp/payments-initiate/request.json'; + +// Response +// The default export. More information at the top. +export type Response = t.Branded< + { + tspId?: Booking_4353_.TspId; + amount?: number; + paymentStatus?: string; + } & { + tspId: Defined; + amount: Defined; + paymentStatus: Defined; + }, + ResponseBrand +>; +export type ResponseC = t.BrandC< + t.IntersectionC< + [ + t.PartialC<{ + tspId: typeof Booking_4353_.TspId; + amount: t.NumberC; + paymentStatus: t.StringC; + }>, + t.TypeC<{ + tspId: typeof Defined; + amount: typeof Defined; + paymentStatus: typeof Defined; + }>, + ] + >, + ResponseBrand +>; +export const Response: ResponseC = t.brand( + t.intersection([ + t.partial({ + tspId: Booking_4353_.TspId, + amount: t.number, + paymentStatus: t.string, + }), + t.type({ + tspId: Defined, + amount: Defined, + paymentStatus: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + tspId?: Booking_4353_.TspId; + amount?: number; + paymentStatus?: string; + } & { + tspId: Defined; + amount: Defined; + paymentStatus: Defined; + }, + ResponseBrand + > => true, + 'Response', +); +export type ResponseBrand = { + readonly Response: unique symbol; +}; +/** require('io-ts-validator').validator(nonEmptyArray(Response)).decodeSync(examplesResponse) // => examplesResponse */ +export const examplesResponse: NonEmptyArray = [ + { + tspId: '00000000-cafe-cafe-cafe-cafecafecafe', + amount: 2405, + paymentStatus: 'CONFIRMED', + }, +] as unknown as NonEmptyArray; + +export default Response; + +// Success diff --git a/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/request.ts b/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/request.ts new file mode 100644 index 000000000..9f39de2cd --- /dev/null +++ b/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/request.ts @@ -0,0 +1,108 @@ +/* + +undefined +Response schema for retrieving a TSP payment from TSP api + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray'; +import * as t from 'io-ts'; +import { nonEmptyArray } from 'io-ts-types/lib/nonEmptyArray'; + +import * as Booking_4353_ from '../../core/booking'; + +export type Defined = {} | null; +export class DefinedType extends t.Type { + readonly _tag: 'DefinedType' = 'DefinedType'; + constructor() { + super( + 'defined', + (u): u is Defined => typeof u !== 'undefined', + (u, c) => (this.is(u) ? t.success(u) : t.failure(u, c)), + t.identity, + ); + } +} +export type DefinedC = {} & DefinedType; +export const Defined: DefinedC = new DefinedType(); + +export const schemaId = 'https://schemas.maas.global/tsp/payments-retrieve/request.json'; + +// Response +// The default export. More information at the top. +export type Response = t.Branded< + { + tspId?: Booking_4353_.TspId; + amount?: number; + paymentStatus?: string; + } & { + tspId: Defined; + amount: Defined; + paymentStatus: Defined; + }, + ResponseBrand +>; +export type ResponseC = t.BrandC< + t.IntersectionC< + [ + t.PartialC<{ + tspId: typeof Booking_4353_.TspId; + amount: t.NumberC; + paymentStatus: t.StringC; + }>, + t.TypeC<{ + tspId: typeof Defined; + amount: typeof Defined; + paymentStatus: typeof Defined; + }>, + ] + >, + ResponseBrand +>; +export const Response: ResponseC = t.brand( + t.intersection([ + t.partial({ + tspId: Booking_4353_.TspId, + amount: t.number, + paymentStatus: t.string, + }), + t.type({ + tspId: Defined, + amount: Defined, + paymentStatus: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + tspId?: Booking_4353_.TspId; + amount?: number; + paymentStatus?: string; + } & { + tspId: Defined; + amount: Defined; + paymentStatus: Defined; + }, + ResponseBrand + > => true, + 'Response', +); +export type ResponseBrand = { + readonly Response: unique symbol; +}; +/** require('io-ts-validator').validator(nonEmptyArray(Response)).decodeSync(examplesResponse) // => examplesResponse */ +export const examplesResponse: NonEmptyArray = [ + { + tspId: '00000000-cafe-cafe-cafe-cafecafecafe', + amount: 2405, + paymentStatus: 'PENDING', + }, +] as unknown as NonEmptyArray; + +export default Response; + +// Success diff --git a/maas-schemas/src/io-ts/tsp/payments-initiate/request.ts b/maas-schemas/src/io-ts/tsp/payments-initiate/request.ts new file mode 100644 index 000000000..6d03b48e6 --- /dev/null +++ b/maas-schemas/src/io-ts/tsp/payments-initiate/request.ts @@ -0,0 +1,3 @@ +// Generated by update-index.ts Do not edit! + +export * from '../../_types/tsp/payments-initiate/request'; diff --git a/maas-schemas/src/io-ts/tsp/payments-retrieve/request.ts b/maas-schemas/src/io-ts/tsp/payments-retrieve/request.ts new file mode 100644 index 000000000..25ffb3a2b --- /dev/null +++ b/maas-schemas/src/io-ts/tsp/payments-retrieve/request.ts @@ -0,0 +1,3 @@ +// Generated by update-index.ts Do not edit! + +export * from '../../_types/tsp/payments-retrieve/request'; From 3657da752a80e2ab749a71db0d59d7193a122149 Mon Sep 17 00:00:00 2001 From: hieuunguyeen Date: Wed, 13 Dec 2023 13:35:54 +0200 Subject: [PATCH 3/3] Fix wrong endpoint response schema id duplication --- .../tsp/payments-initiate/response.json | 2 +- .../tsp/payments-retrieve/response.json | 2 +- .../_types/tsp/payments-initiate/request.ts | 60 ++++------ .../_types/tsp/payments-initiate/response.ts | 108 ++++++++++++++++++ .../_types/tsp/payments-retrieve/request.ts | 52 +++------ .../_types/tsp/payments-retrieve/response.ts | 108 ++++++++++++++++++ .../io-ts/tsp/payments-initiate/response.ts | 3 + .../io-ts/tsp/payments-retrieve/response.ts | 3 + 8 files changed, 264 insertions(+), 74 deletions(-) create mode 100644 maas-schemas/src/io-ts/_types/tsp/payments-initiate/response.ts create mode 100644 maas-schemas/src/io-ts/_types/tsp/payments-retrieve/response.ts create mode 100644 maas-schemas/src/io-ts/tsp/payments-initiate/response.ts create mode 100644 maas-schemas/src/io-ts/tsp/payments-retrieve/response.ts diff --git a/maas-schemas/schemas/tsp/payments-initiate/response.json b/maas-schemas/schemas/tsp/payments-initiate/response.json index 944991282..7ded30724 100644 --- a/maas-schemas/schemas/tsp/payments-initiate/response.json +++ b/maas-schemas/schemas/tsp/payments-initiate/response.json @@ -1,5 +1,5 @@ { - "$id": "https://schemas.maas.global/tsp/payments-initiate/request.json", + "$id": "https://schemas.maas.global/tsp/payments-initiate/response.json", "description": "Response schema for creating payment through TSP api", "type": "object", "properties": { diff --git a/maas-schemas/schemas/tsp/payments-retrieve/response.json b/maas-schemas/schemas/tsp/payments-retrieve/response.json index 2a63ac73d..bb8c2af0a 100644 --- a/maas-schemas/schemas/tsp/payments-retrieve/response.json +++ b/maas-schemas/schemas/tsp/payments-retrieve/response.json @@ -1,5 +1,5 @@ { - "$id": "https://schemas.maas.global/tsp/payments-retrieve/request.json", + "$id": "https://schemas.maas.global/tsp/payments-retrieve/response.json", "description": "Response schema for retrieving a TSP payment from TSP api", "type": "object", "properties": { diff --git a/maas-schemas/src/io-ts/_types/tsp/payments-initiate/request.ts b/maas-schemas/src/io-ts/_types/tsp/payments-initiate/request.ts index 43b717b28..e1b6b16c3 100644 --- a/maas-schemas/src/io-ts/_types/tsp/payments-initiate/request.ts +++ b/maas-schemas/src/io-ts/_types/tsp/payments-initiate/request.ts @@ -1,7 +1,7 @@ /* undefined -Response schema for creating payment through TSP api +Request schema for creating payment through TSP api !!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! See https://www.npmjs.com/package/io-ts-from-json-schema @@ -31,48 +31,42 @@ export const Defined: DefinedC = new DefinedType(); export const schemaId = 'https://schemas.maas.global/tsp/payments-initiate/request.json'; -// Response +// Request // The default export. More information at the top. -export type Response = t.Branded< +export type Request = t.Branded< { tspId?: Booking_4353_.TspId; - amount?: number; - paymentStatus?: string; + paymentAmount?: number; } & { tspId: Defined; - amount: Defined; - paymentStatus: Defined; + paymentAmount: Defined; }, - ResponseBrand + RequestBrand >; -export type ResponseC = t.BrandC< +export type RequestC = t.BrandC< t.IntersectionC< [ t.PartialC<{ tspId: typeof Booking_4353_.TspId; - amount: t.NumberC; - paymentStatus: t.StringC; + paymentAmount: t.NumberC; }>, t.TypeC<{ tspId: typeof Defined; - amount: typeof Defined; - paymentStatus: typeof Defined; + paymentAmount: typeof Defined; }>, ] >, - ResponseBrand + RequestBrand >; -export const Response: ResponseC = t.brand( +export const Request: RequestC = t.brand( t.intersection([ t.partial({ tspId: Booking_4353_.TspId, - amount: t.number, - paymentStatus: t.string, + paymentAmount: t.number, }), t.type({ tspId: Defined, - amount: Defined, - paymentStatus: Defined, + paymentAmount: Defined, }), ]), ( @@ -80,29 +74,23 @@ export const Response: ResponseC = t.brand( ): x is t.Branded< { tspId?: Booking_4353_.TspId; - amount?: number; - paymentStatus?: string; + paymentAmount?: number; } & { tspId: Defined; - amount: Defined; - paymentStatus: Defined; + paymentAmount: Defined; }, - ResponseBrand + RequestBrand > => true, - 'Response', + 'Request', ); -export type ResponseBrand = { - readonly Response: unique symbol; +export type RequestBrand = { + readonly Request: unique symbol; }; -/** require('io-ts-validator').validator(nonEmptyArray(Response)).decodeSync(examplesResponse) // => examplesResponse */ -export const examplesResponse: NonEmptyArray = [ - { - tspId: '00000000-cafe-cafe-cafe-cafecafecafe', - amount: 2405, - paymentStatus: 'CONFIRMED', - }, -] as unknown as NonEmptyArray; +/** require('io-ts-validator').validator(nonEmptyArray(Request)).decodeSync(examplesRequest) // => examplesRequest */ +export const examplesRequest: NonEmptyArray = [ + { tspId: '00000000-cafe-cafe-cafe-cafecafecafe', paymentAmount: 2405 }, +] as unknown as NonEmptyArray; -export default Response; +export default Request; // Success diff --git a/maas-schemas/src/io-ts/_types/tsp/payments-initiate/response.ts b/maas-schemas/src/io-ts/_types/tsp/payments-initiate/response.ts new file mode 100644 index 000000000..d390c9cc5 --- /dev/null +++ b/maas-schemas/src/io-ts/_types/tsp/payments-initiate/response.ts @@ -0,0 +1,108 @@ +/* + +undefined +Response schema for creating payment through TSP api + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray'; +import * as t from 'io-ts'; +import { nonEmptyArray } from 'io-ts-types/lib/nonEmptyArray'; + +import * as Booking_4353_ from '../../core/booking'; + +export type Defined = {} | null; +export class DefinedType extends t.Type { + readonly _tag: 'DefinedType' = 'DefinedType'; + constructor() { + super( + 'defined', + (u): u is Defined => typeof u !== 'undefined', + (u, c) => (this.is(u) ? t.success(u) : t.failure(u, c)), + t.identity, + ); + } +} +export type DefinedC = {} & DefinedType; +export const Defined: DefinedC = new DefinedType(); + +export const schemaId = 'https://schemas.maas.global/tsp/payments-initiate/response.json'; + +// Response +// The default export. More information at the top. +export type Response = t.Branded< + { + tspId?: Booking_4353_.TspId; + amount?: number; + paymentStatus?: string; + } & { + tspId: Defined; + amount: Defined; + paymentStatus: Defined; + }, + ResponseBrand +>; +export type ResponseC = t.BrandC< + t.IntersectionC< + [ + t.PartialC<{ + tspId: typeof Booking_4353_.TspId; + amount: t.NumberC; + paymentStatus: t.StringC; + }>, + t.TypeC<{ + tspId: typeof Defined; + amount: typeof Defined; + paymentStatus: typeof Defined; + }>, + ] + >, + ResponseBrand +>; +export const Response: ResponseC = t.brand( + t.intersection([ + t.partial({ + tspId: Booking_4353_.TspId, + amount: t.number, + paymentStatus: t.string, + }), + t.type({ + tspId: Defined, + amount: Defined, + paymentStatus: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + tspId?: Booking_4353_.TspId; + amount?: number; + paymentStatus?: string; + } & { + tspId: Defined; + amount: Defined; + paymentStatus: Defined; + }, + ResponseBrand + > => true, + 'Response', +); +export type ResponseBrand = { + readonly Response: unique symbol; +}; +/** require('io-ts-validator').validator(nonEmptyArray(Response)).decodeSync(examplesResponse) // => examplesResponse */ +export const examplesResponse: NonEmptyArray = [ + { + tspId: '00000000-cafe-cafe-cafe-cafecafecafe', + amount: 2405, + paymentStatus: 'CONFIRMED', + }, +] as unknown as NonEmptyArray; + +export default Response; + +// Success diff --git a/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/request.ts b/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/request.ts index 9f39de2cd..3ecf364b0 100644 --- a/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/request.ts +++ b/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/request.ts @@ -1,7 +1,7 @@ /* undefined -Response schema for retrieving a TSP payment from TSP api +Request schema for retrieving a TSP payment from TSP api !!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! See https://www.npmjs.com/package/io-ts-from-json-schema @@ -31,48 +31,36 @@ export const Defined: DefinedC = new DefinedType(); export const schemaId = 'https://schemas.maas.global/tsp/payments-retrieve/request.json'; -// Response +// Request // The default export. More information at the top. -export type Response = t.Branded< +export type Request = t.Branded< { tspId?: Booking_4353_.TspId; - amount?: number; - paymentStatus?: string; } & { tspId: Defined; - amount: Defined; - paymentStatus: Defined; }, - ResponseBrand + RequestBrand >; -export type ResponseC = t.BrandC< +export type RequestC = t.BrandC< t.IntersectionC< [ t.PartialC<{ tspId: typeof Booking_4353_.TspId; - amount: t.NumberC; - paymentStatus: t.StringC; }>, t.TypeC<{ tspId: typeof Defined; - amount: typeof Defined; - paymentStatus: typeof Defined; }>, ] >, - ResponseBrand + RequestBrand >; -export const Response: ResponseC = t.brand( +export const Request: RequestC = t.brand( t.intersection([ t.partial({ tspId: Booking_4353_.TspId, - amount: t.number, - paymentStatus: t.string, }), t.type({ tspId: Defined, - amount: Defined, - paymentStatus: Defined, }), ]), ( @@ -80,29 +68,21 @@ export const Response: ResponseC = t.brand( ): x is t.Branded< { tspId?: Booking_4353_.TspId; - amount?: number; - paymentStatus?: string; } & { tspId: Defined; - amount: Defined; - paymentStatus: Defined; }, - ResponseBrand + RequestBrand > => true, - 'Response', + 'Request', ); -export type ResponseBrand = { - readonly Response: unique symbol; +export type RequestBrand = { + readonly Request: unique symbol; }; -/** require('io-ts-validator').validator(nonEmptyArray(Response)).decodeSync(examplesResponse) // => examplesResponse */ -export const examplesResponse: NonEmptyArray = [ - { - tspId: '00000000-cafe-cafe-cafe-cafecafecafe', - amount: 2405, - paymentStatus: 'PENDING', - }, -] as unknown as NonEmptyArray; +/** require('io-ts-validator').validator(nonEmptyArray(Request)).decodeSync(examplesRequest) // => examplesRequest */ +export const examplesRequest: NonEmptyArray = [ + { tspId: '00000000-cafe-cafe-cafe-cafecafecafe' }, +] as unknown as NonEmptyArray; -export default Response; +export default Request; // Success diff --git a/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/response.ts b/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/response.ts new file mode 100644 index 000000000..c5638d4a4 --- /dev/null +++ b/maas-schemas/src/io-ts/_types/tsp/payments-retrieve/response.ts @@ -0,0 +1,108 @@ +/* + +undefined +Response schema for retrieving a TSP payment from TSP api + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray'; +import * as t from 'io-ts'; +import { nonEmptyArray } from 'io-ts-types/lib/nonEmptyArray'; + +import * as Booking_4353_ from '../../core/booking'; + +export type Defined = {} | null; +export class DefinedType extends t.Type { + readonly _tag: 'DefinedType' = 'DefinedType'; + constructor() { + super( + 'defined', + (u): u is Defined => typeof u !== 'undefined', + (u, c) => (this.is(u) ? t.success(u) : t.failure(u, c)), + t.identity, + ); + } +} +export type DefinedC = {} & DefinedType; +export const Defined: DefinedC = new DefinedType(); + +export const schemaId = 'https://schemas.maas.global/tsp/payments-retrieve/response.json'; + +// Response +// The default export. More information at the top. +export type Response = t.Branded< + { + tspId?: Booking_4353_.TspId; + amount?: number; + paymentStatus?: string; + } & { + tspId: Defined; + amount: Defined; + paymentStatus: Defined; + }, + ResponseBrand +>; +export type ResponseC = t.BrandC< + t.IntersectionC< + [ + t.PartialC<{ + tspId: typeof Booking_4353_.TspId; + amount: t.NumberC; + paymentStatus: t.StringC; + }>, + t.TypeC<{ + tspId: typeof Defined; + amount: typeof Defined; + paymentStatus: typeof Defined; + }>, + ] + >, + ResponseBrand +>; +export const Response: ResponseC = t.brand( + t.intersection([ + t.partial({ + tspId: Booking_4353_.TspId, + amount: t.number, + paymentStatus: t.string, + }), + t.type({ + tspId: Defined, + amount: Defined, + paymentStatus: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + tspId?: Booking_4353_.TspId; + amount?: number; + paymentStatus?: string; + } & { + tspId: Defined; + amount: Defined; + paymentStatus: Defined; + }, + ResponseBrand + > => true, + 'Response', +); +export type ResponseBrand = { + readonly Response: unique symbol; +}; +/** require('io-ts-validator').validator(nonEmptyArray(Response)).decodeSync(examplesResponse) // => examplesResponse */ +export const examplesResponse: NonEmptyArray = [ + { + tspId: '00000000-cafe-cafe-cafe-cafecafecafe', + amount: 2405, + paymentStatus: 'PENDING', + }, +] as unknown as NonEmptyArray; + +export default Response; + +// Success diff --git a/maas-schemas/src/io-ts/tsp/payments-initiate/response.ts b/maas-schemas/src/io-ts/tsp/payments-initiate/response.ts new file mode 100644 index 000000000..68cdc898f --- /dev/null +++ b/maas-schemas/src/io-ts/tsp/payments-initiate/response.ts @@ -0,0 +1,3 @@ +// Generated by update-index.ts Do not edit! + +export * from '../../_types/tsp/payments-initiate/response'; diff --git a/maas-schemas/src/io-ts/tsp/payments-retrieve/response.ts b/maas-schemas/src/io-ts/tsp/payments-retrieve/response.ts new file mode 100644 index 000000000..56634c686 --- /dev/null +++ b/maas-schemas/src/io-ts/tsp/payments-retrieve/response.ts @@ -0,0 +1,3 @@ +// Generated by update-index.ts Do not edit! + +export * from '../../_types/tsp/payments-retrieve/response';