-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #772 from hieuunguyeen/tsp-payments-endpoints
Tsp payments endpoints
- Loading branch information
Showing
15 changed files
with
523 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"$id": "https://schemas.maas.global/tsp/payments-initiate/response.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" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"$id": "https://schemas.maas.global/tsp/payments-retrieve/response.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" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
maas-schemas/src/io-ts/_types/tsp/payments-initiate/request.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
undefined | ||
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 | ||
*/ | ||
|
||
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<Defined> { | ||
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'; | ||
|
||
// Request | ||
// The default export. More information at the top. | ||
export type Request = t.Branded< | ||
{ | ||
tspId?: Booking_4353_.TspId; | ||
paymentAmount?: number; | ||
} & { | ||
tspId: Defined; | ||
paymentAmount: Defined; | ||
}, | ||
RequestBrand | ||
>; | ||
export type RequestC = t.BrandC< | ||
t.IntersectionC< | ||
[ | ||
t.PartialC<{ | ||
tspId: typeof Booking_4353_.TspId; | ||
paymentAmount: t.NumberC; | ||
}>, | ||
t.TypeC<{ | ||
tspId: typeof Defined; | ||
paymentAmount: typeof Defined; | ||
}>, | ||
] | ||
>, | ||
RequestBrand | ||
>; | ||
export const Request: RequestC = t.brand( | ||
t.intersection([ | ||
t.partial({ | ||
tspId: Booking_4353_.TspId, | ||
paymentAmount: t.number, | ||
}), | ||
t.type({ | ||
tspId: Defined, | ||
paymentAmount: Defined, | ||
}), | ||
]), | ||
( | ||
x, | ||
): x is t.Branded< | ||
{ | ||
tspId?: Booking_4353_.TspId; | ||
paymentAmount?: number; | ||
} & { | ||
tspId: Defined; | ||
paymentAmount: Defined; | ||
}, | ||
RequestBrand | ||
> => true, | ||
'Request', | ||
); | ||
export type RequestBrand = { | ||
readonly Request: unique symbol; | ||
}; | ||
/** require('io-ts-validator').validator(nonEmptyArray(Request)).decodeSync(examplesRequest) // => examplesRequest */ | ||
export const examplesRequest: NonEmptyArray<Request> = [ | ||
{ tspId: '00000000-cafe-cafe-cafe-cafecafecafe', paymentAmount: 2405 }, | ||
] as unknown as NonEmptyArray<Request>; | ||
|
||
export default Request; | ||
|
||
// Success |
108 changes: 108 additions & 0 deletions
108
maas-schemas/src/io-ts/_types/tsp/payments-initiate/response.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Defined> { | ||
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<Response> = [ | ||
{ | ||
tspId: '00000000-cafe-cafe-cafe-cafecafecafe', | ||
amount: 2405, | ||
paymentStatus: 'CONFIRMED', | ||
}, | ||
] as unknown as NonEmptyArray<Response>; | ||
|
||
export default Response; | ||
|
||
// Success |
Oops, something went wrong.