Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ export const TRV14ApiSequence = {
INIT: 'init',
ON_INIT: 'on_init',
CONFIRM: 'confirm',
ON_CONFIRM: 'on_confirm',
STATUS: 'status',
ON_STATUS: 'on_status',
ON_CONFIRM: 'on_confirm', STATUS: 'status', ON_STATUS: 'on_status',
SOFT_CANCEL: 'soft_cancel',
SOFT_ON_CANCEL: 'soft_on_cancel',
CANCEL: 'cancel',
Expand Down Expand Up @@ -288,8 +286,14 @@ export const airlinesSequence = {
ON_CONFIRM: 'on_confirm',
CANCEL: 'cancel',
ON_CANCEL: 'on_cancel',
STATUS: 'status',
ON_STATUS: 'on_status'
}
export const intercitySequence = {
SEARCH: 'search',
ON_SEARCH: 'on_search',
SELECT: 'select',
}

export const mobilityFlow: any = {
AIRLINES: 'airlines',
METRO: 'metro',
Expand Down
4 changes: 2 additions & 2 deletions controller/validate/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { validateLogsForFIS13 } from '../../shared/Actions/FIS13Actions'
import { validateLogsForTRV13 } from '../../shared/Actions/TRV13Actions'
import { getFis14Format, validateLogsForFIS14 } from '../../shared/Actions/FIS14Actions'
import { validateLogsForTRV14 } from '../../shared/Actions/TRV14Actions'
import { validateLogsForAirline } from '../../shared/Actions/TRV12Action'
import { validateLogsForTRV12 } from '../../shared/Actions/TRV12Action'

const createSignature = async ({ message }: { message: string }) => {
const privateKey = process.env.SIGN_PRIVATE_KEY as string
Expand Down Expand Up @@ -159,7 +159,7 @@ const validateMobility = async (domain: string, payload: string, version: string
break

case 'ONDC:TRV12':
response = validateLogsForAirline(payload, flow, version)
response = validateLogsForTRV12(payload, flow, version)

if (_.isEmpty(response)) {
success = true
Expand Down
2 changes: 1 addition & 1 deletion controller/validate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const controller = {
{
const { response, success, message } = await helper.validateMobility(domain, payload, version, flow)
result = { response, success, message }

}

break
Expand Down Expand Up @@ -77,7 +78,6 @@ const controller = {
domain,
reportTimestamp: new Date().toISOString(),
}

const { signature, currentDate } = await helper.createSignature({ message: JSON.stringify(httpResponse) })

if (!success)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
98 changes: 96 additions & 2 deletions schema/TRV-12/on_select.ts → schema/TRV-12/Airlines/on_select.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const onSelectSchemaTRV_12 = {
export const onSelectSchemaTRV_12 = {
type: 'object',
required: ['context', 'message'],
properties: {
Expand Down Expand Up @@ -228,9 +228,103 @@ export const onSelectSchemaTRV_12 = {
},
},
},
quote: {
type: 'object',
properties: {
price: {
type: 'object',
required: ['value', 'currency'],
properties: {
value: { type: 'string' },
currency: { type: 'string', enum: ['INR'] },
},
},
breakup: {
type: 'array',
items: {
type: 'object',
required: ['title', 'price'],
properties: {
title: { type: 'string', enum: ['BASE_FARE', 'TAX', 'CONVENIENCE_FEE', 'SEAT_FARE', 'ADD_ONS', 'OTHER_CHARGES'] },
item: {
type: 'object',
properties: {
id: { type: 'string' },
quantity: {
type: 'object',
properties: {
selected: {
type: 'object',
properties: {
count: { type: 'integer' },
},
},
},
},
price: {
type: 'object',
properties: {
currency: { type: 'string', enum: ['INR'] },
value: { type: 'string' },
},
},
add_ons: {
type: 'array',
items: {
type: 'object',
properties: {
id: { type: 'string' },
},
},
},
tags: {
type: 'array',
items: {
type: 'object',
properties: {
descriptor: {
type: 'object',
properties: {
code: { type: 'string', enum: ['TAX', 'OTHER_CHARGES'] },
name: { type: 'string' },
},
},
list: {
type: 'array',
items: {
type: 'object',
properties: {
descriptor: {
type: 'object',
properties: {
name: { type: 'string' },
code: { type: 'string' },
},
},
value: { type: 'string' },
},
},
},
},
},
},
},
},
price: {
type: 'object',
properties: {
currency: { type: 'string', enum: ['INR'] },
value: { type: 'string' },
},
},
},
},
},
},
},
},
},
},
},
},
}
};
File renamed without changes.
206 changes: 206 additions & 0 deletions schema/TRV-12/Airlines/select.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
export const selectSchemaTRV_12 = {
type: 'object',
required: ['context', 'message'],
properties: {
context: {
type: 'object',
required: [
'location',
'domain',
'timestamp',
'bap_id',
'transaction_id',
'message_id',
'version',
'action',
'bap_uri',
'bpp_id',
'bpp_uri',
'ttl',
],
properties: {
location: {
type: 'object',
required: ['country', 'city'],
properties: {
country: {
type: 'object',
required: ['code'],
properties: {
code: { type: 'string', enum: ['IND'] },
},
},
city: {
type: 'object',
required: ['code'],
properties: {
code: { type: 'string', pattern: '^std:\\d{3}$' },
},
},
},
},
domain: { type: 'string', enum: ['ONDC:TRV12'] },
timestamp: { type: 'string', format: 'date-time' },
bap_id: { type: 'string' },
transaction_id: { type: 'string', format: 'uuid' },
message_id: { type: 'string', format: 'uuid' },
version: { type: 'string', pattern: '^\\d+\\.\\d+\\.\\d+$' },
action: { type: 'string', enum: ['select'] },
bap_uri: { type: 'string', format: 'uri' },
bpp_id: { type: 'string' },
bpp_uri: { type: 'string', format: 'uri' },
ttl: { type: 'string', pattern: '^PT\\d+S$' },
},
},
message: {
type: 'object',
required: ['order'],
properties: {
order: {
type: 'object',
required: ['provider', 'items', 'fulfillments'],
properties: {
provider: {
type: 'object',
required: ['id'],
properties: {
id: { type: 'string' },
},
},
items: {
type: 'array',
items: {
type: 'object',
required: ['quantity'],
properties: {
id: { type: 'string' },
parent_item_id: { type: 'string' },
quantity: {
type: 'object',
required: ['selected'],
properties: {
selected: {
type: 'object',
required: ['count'],
properties: {
count: { type: 'integer', minimum: 1 },
},
},
},
},
add_ons: {
type: 'array',
items: {
type: 'object',
required: ['id', 'quantity'],
properties: {
id: { type: 'string' },
quantity: {
type: 'object',
required: ['selected'],
properties: {
selected: {
type: 'object',
required: ['count'],
properties: {
count: { type: 'integer', minimum: 1 },
},
},
},
},
},
},
},
},
},
},
fulfillments: {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"stops": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": ["id"]
}
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": ["INFO", "SEAT_GRID"]
},
"name": {
"type": "string"
}
},
"required": ["code"]
},
"display": {
"type": "boolean"
},
"list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"type": "string"
}
},
"required": ["code"]
},
"value": {
"type": "string"
}
},
"required": ["descriptor"]
}
}
},
"required": ["descriptor"]
}
},
"vehicle": {
"type": "object",
"properties": {
"category": {
"type": "string",
"enum": ["AIRLINE"]
},
"code": {
"type": "string"
}
},
"required": ["category", "code"]
}
},
"required": ["id"]
}
}
,
},
},
},
},
},
};
Loading