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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
.env
Logs
.env.dev
5 changes: 3 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ const express = require("express");
const app = express();
const cors = require("cors");
require("dotenv").config();
const logger = require("./utils/logger");
const { configLoader } = require("./configs/index");

configLoader
.init()
.then((data) => {
console.log("Config loaded successfully.");
logger.info("Config loaded successfully.");

app.use(cors());

Expand All @@ -19,7 +20,7 @@ configLoader
app.use(router);

app.listen(PORT, () => {
console.log("server listening at port " + PORT);
logger.info("server listening at port " + PORT);
});
})
.catch((e) => {
Expand Down
2 changes: 1 addition & 1 deletion configs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require("fs");
const yaml = require("yaml");
const path = require("path");
const $RefParser = require("@apidevtools/json-schema-ref-parser");
const logger = require("../utils/logger");

class ConfigLoader {
constructor() {
Expand All @@ -18,7 +19,6 @@ class ConfigLoader {

this.config = schema;

console.log("schema", schema);
return schema;
} catch (e) {
throw new Error(e);
Expand Down
15 changes: 1 addition & 14 deletions configs/index.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
server:
port: 80
variables:
dev:
callbackUrl: "https://2273-59-145-217-117.ngrok-free.app"
stagingGatewayurl: "https://staging.gateway.proteantech.in/"
signingPrivateKey: "Un205TSOdDXTq8E+N/sJOLJ8xalnzZ1EUP1Wcv23sKx70fOfFd4Q2bzfpzPQ+6XZhZv65SH7Pr6YMk8SuFHpxQ=="
bapId: "mobility-staging.ondc.org"
uniqueKeyId: "UK-MOBILITY"
prod:
callbackUrl: "https://2273-59-145-217-117.ngrok-free.app"
stagingGatewayurl: "https://staging.gateway.proteantech.in/"
signingPrivateKey: "Un205TSOdDXTq8E+N/sJOLJ8xalnzZ1EUP1Wcv23sKx70fOfFd4Q2bzfpzPQ+6XZhZv65SH7Pr6YMk8SuFHpxQ=="
bapId: "mobility-staging.ondc.org"
uniqueKeyId: "UK-MOBILITY"
flows:
- summary: Metro - Station Code Based Flow
id: metro-flow-1
Expand Down Expand Up @@ -55,7 +42,7 @@ flows:
$ref: ./configs/metro-flow-2/protocolMapping.yaml
calls:
$ref: ./configs/metro-flow-2/protocolCalls.yaml
- summary: on demand complete flow
- summary: On-Demand - Assign driver on on-confirm
domain: ONDC:TRV10
id: ondemand-flow-1
input:
Expand Down
42 changes: 42 additions & 0 deletions configs/ondemand-flow-1/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ search:
key: "startCoordinates"
type: "text"
errorText: "Start Coordinates is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "End Coordinates"
key: "endCoordinates"
type: "text"
errorText: "End Coordinates is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Payment Tags"
key: "paymentTagsSearch"
type: "multiline"
Expand All @@ -18,38 +22,54 @@ search:
DELAY_INTEREST: 2.5
STATIC_TERMS: "https://bap.credit.becknprotocol.io/personal-banking/loans/personal-loan"
errorText: "Payment tags is required"
required: true
summary: Vehicle category for which ticket needs to be booked

select:
- name: "BPP URI"
key: "bpp_uri"
type: "text"
error: "BPP URI is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "BPP ID"
key: "bpp_id"
type: "text"
error: "BPP ID is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Item id"
key: "itemId"
type: "text"
errorText: "Item id is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Provider Id"
key: "providerId"
type: "text"
errorText: "Provider Id is required"
required: true
summary: Vehicle category for which ticket needs to be booked

init:
- name: "Name"
key: "name"
type: "text"
errorText: "Name is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Phone"
key: "phone"
type: "text"
errorText: "Phone is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Collected By"
key: "collectedBy"
type: "text"
errorText: "Collected By is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Payment Status"
key: "paymentStatus"
type: "select"
Expand All @@ -59,6 +79,8 @@ init:
- key: "NOT-PAID"
value: "NOT-PAID"
errorText: "Please select a field"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Payment Type"
key: "paymentType"
type: "select"
Expand All @@ -74,18 +96,26 @@ init:
- key: "ON-ORDER"
value: "ON-ORDER"
errorText: "Please select a field"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Bank Code"
key: "bankCode"
type: "text"
errorText: "Bank Code is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Bank Account Number"
key: "bankAccountNumber"
type: "text"
errorText: "Bank Account Number is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Virtual Payment Address"
key: "virtualPaymentAddress"
type: "text"
errorText: "Virtual Payment Address is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Payment Tags"
key: "paymentTagsInit"
type: "multiline"
Expand All @@ -97,20 +127,28 @@ init:
DELAY_INTEREST: 2.5
STATIC_TERMS: "https://bap.credit.becknprotocol.io/personal-banking/loans/personal-loan"
errorText: "Payment Tags is required"
required: true
summary: Vehicle category for which ticket needs to be booked

confirm:
- name: "Payment Id"
key: "paymentId"
type: "text"
errorText: "Payment Id is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Payment Status"
key: "paymentStatusConfirm"
type: "text"
errorText: "Payment Status is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Payment Type"
key: "paymentTypeConfirm"
type: "text"
errorText: "Payment Type is required"
required: true
summary: Vehicle category for which ticket needs to be booked
- name: "Payment Tags"
key: "paymentTagsConfirm"
type: "multiline"
Expand All @@ -122,9 +160,13 @@ confirm:
DELAY_INTEREST: 2.5
STATIC_TERMS: "https://bap.credit.becknprotocol.io/personal-banking/loans/personal-loan"
errorText: "Payment Tags is required"
required: true
summary: Vehicle category for which ticket needs to be booked

status:
- name: "Order Id"
key: "orderId"
type: "text"
errorText: "Order Id is required"
required: true
summary: Vehicle category for which ticket needs to be booked
22 changes: 22 additions & 0 deletions configs/ondemand-flow-1/protocolCalls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ search:
nextRequest: "on_search"
preRequest: null
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

on_search:
type: "on_search"
Expand All @@ -15,6 +17,8 @@ on_search:
nextRequest: "select"
preRequest: "search"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

select:
type: "select"
Expand All @@ -24,6 +28,8 @@ select:
nextRequest: "on_select"
preRequest: "on_search"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

on_select:
type: "on_select"
Expand All @@ -33,6 +39,8 @@ on_select:
nextRequest: "init"
preRequest: "select"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

init:
type: "init"
Expand All @@ -42,6 +50,8 @@ init:
nextRequest: "on_init"
preRequest: "on_select"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

on_init:
type: "on_init"
Expand All @@ -51,6 +61,8 @@ on_init:
nextRequest: "confirm"
preRequest: "init"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

confirm:
type: "confirm"
Expand All @@ -60,6 +72,8 @@ confirm:
nextRequest: "on_confirm"
preRequest: "on_init"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

on_confirm:
type: "on_confirm"
Expand All @@ -69,6 +83,8 @@ on_confirm:
nextRequest: "on_update"
preRequest: "confirm"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

on_update:
type: "on_update"
Expand All @@ -78,6 +94,8 @@ on_update:
nextRequest: "status"
preRequest: "on_confirm"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

status:
type: "status"
Expand All @@ -87,6 +105,8 @@ status:
nextRequest: "on_status"
preRequest: "on_update"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status

on_status:
type: "on_status"
Expand All @@ -96,3 +116,5 @@ on_status:
nextRequest: null
preRequest: "status"
isCollapsed: false
protocol:
$ref: ./protocolMapping.yaml#/protocol/status
Loading