manage fee api started

This commit is contained in:
Kallesh B S 2025-03-04 16:41:02 +05:30
parent 4d205d450a
commit c4247b9322
5 changed files with 636 additions and 16 deletions

View File

@ -189,8 +189,8 @@ POST http://localhost:3000/oracle/CreateTableRecord
Content-Type: application/json
{
"P_USERID": 6,
"P_TABLEFULLDESC": "TypeA desc",
"P_USERID": "6",
"P_TABLEFULLDESC": "TypeA desc"
}
###
@ -264,7 +264,3 @@ Content-Type: application/json

106
manageFee.http Normal file
View File

@ -0,0 +1,106 @@
// CreateBasicFee
POST http://localhost:3000/oracle/CreateBasicFee
Content-Type: application/json
{
"P_SPID": 1,
"P_STARTCARNETVALUE": 1000,
"P_ENDCARNETVALUE": 2000,
"P_EFFDATE": "2023-10-01",
"P_FEES": 150.75,
"P_USERID": "user123"
}
###
// CreateBondRate
POST http://localhost:3000/oracle/CreateBondRate
Content-Type: application/json
{
"P_SPID": 1,
"P_HOLDERTYPE": "Individual",
"P_USCIBMEMBERFLAG": "Yes",
"P_SPCLCOMMODITY": "Electronics",
"P_SPCLCOUNTRY": "USA",
"P_EFFDATE": "2023-10-01",
"P_RATE": 0.05,
"P_USERID": "user123"
}
###
// CreateCargoRate
POST http://localhost:3000/oracle/CreateCargoRate
Content-Type: application/json
{
"P_SPID": 1,
"P_CARNETTYPE": "Type A",
"P_STARTSETS": 10,
"P_ENDSETS": 20,
"P_EFFDATE": "2023-10-01",
"P_RATE": 0.10,
"P_USERID": "user123"
}
###
// CreateCfFee
POST http://localhost:3000/oracle/CreateCfFee
Content-Type: application/json
{
"P_SPID": 1,
"P_STARTSETS": 10,
"P_ENDSETS": 20,
"P_EFFDATE": "2023-10-01",
"P_CUSTOMERTYPE": "Regular",
"P_CARNETTYPE": "Standard",
"P_RATE": 100.5,
"P_USERID": "user123"
}
###
// CreateCsFee
POST http://localhost:3000/oracle/CreateCsFee
Content-Type: application/json
{
"P_SPID": 1,
"P_CUSTOMERTYPE": "Regular",
"P_CARNETTYPE": "Standard",
"P_EFFDATE": "2023-10-01",
"P_RATE": 100.5,
"P_USERID": "user123",
"P_CURSOR": null
}
###
// CreateEeFee
POST http://localhost:3000/oracle/CreateEeFee
Content-Type: application/json
{
"P_SPID": 1,
"P_CUSTOMERTYPE": "Regular",
"P_DELIVERYTYPE": "Express",
"P_STARTTIME": 8,
"P_ENDTIME": 17,
"P_TIMEZONE": "UTC",
"P_EFFDATE": "2023-10-01",
"P_FEES": 50.0,
"P_USERID": "user123"
}
###

View File

@ -1,6 +1,6 @@
import { Injectable } from "@nestjs/common";
import { OracleDBService } from "src/db/db.service";
import { CreateBasicFeeDTO } from "./oracle.dto";
import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO } from "./oracle.dto";
import * as oracledb from 'oracledb';
@Injectable()
@ -8,7 +8,7 @@ export class ManageFeeService {
constructor(private readonly oracleDBService: OracleDBService) { }
async CREATEBASICFEE(body:CreateBasicFeeDTO) {
async CREATEBASICFEE(body: CreateBasicFeeDTO) {
let connection;
try {
@ -75,11 +75,368 @@ export class ManageFeeService {
} finally { }
}
async CREATEBONDRATE() { }
async CREATECARGORATE() { }
async CREATECFFEE() { }
async CREATECSFEE() { }
async CREATEEFFEE() { }
async CREATEBONDRATE(body: CreateBondRateDTO) {
let connection;
try {
// Connect to the Oracle database using oracledb
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
MANAGEFEE_SETUP_PKG.CREATEBONDRATE(
:P_SPID,
:P_HOLDERTYPE,
:P_USCIBMEMBERFLAG,
:P_SPCLCOMMODITY,
:P_SPCLCOUNTRY,
:P_EFFDATE,
:P_RATE,
:P_USERID,
:P_CURSOR);
END;`,
{
P_SPID: {
val: body.P_SPID,
type: oracledb.DB_TYPE_NUMBER
},
P_HOLDERTYPE: {
val: body.P_HOLDERTYPE,
type: oracledb.DB_TYPE_VARCHAR
},
P_USCIBMEMBERFLAG: {
val: body.P_USCIBMEMBERFLAG,
type: oracledb.DB_TYPE_VARCHAR
},
P_SPCLCOMMODITY: {
val: body.P_SPCLCOMMODITY,
type: oracledb.DB_TYPE_VARCHAR
},
P_SPCLCOUNTRY: {
val: body.P_SPCLCOUNTRY,
type: oracledb.DB_TYPE_VARCHAR
},
P_EFFDATE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_RATE: {
val: body.P_RATE,
type: oracledb.DB_TYPE_NUMBER
},
P_USERID: {
val: body.P_USERID,
type: oracledb.DB_TYPE_VARCHAR
},
P_CURSOR: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
console.error('Error fetching users: ', err);
throw new Error('Error fetching users');
} finally { }
}
async CREATECARGORATE(body: CreateCargoRateDTO) {
let connection;
try {
// Connect to the Oracle database using oracledb
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
MANAGEFEE_SETUP_PKG.CREATECARGORATE(
:P_SPID,
:P_CARNETTYPE,
:P_STARTSETS,
:P_ENDSETS,
:P_EFFDATE,
:P_RATE,
:P_USERID,
:P_CURSOR);
END;`,
{
P_SPID: {
val: body.P_SPID,
type: oracledb.DB_TYPE_NUMBER
},
P_CARNETTYPE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_STARTSETS: {
val: body.P_SPID,
type: oracledb.DB_TYPE_NUMBER
},
P_ENDSETS: {
val: body.P_SPID,
type: oracledb.DB_TYPE_NUMBER
},
P_EFFDATE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_RATE: {
val: body.P_RATE,
type: oracledb.DB_TYPE_NUMBER
},
P_USERID: {
val: body.P_USERID,
type: oracledb.DB_TYPE_VARCHAR
},
P_CURSOR: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
console.error('Error fetching users: ', err);
throw new Error('Error fetching users');
} finally { }
}
async CREATECFFEE(body: CreateCfFeeDTO) {
let connection;
try {
// Connect to the Oracle database using oracledb
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
MANAGEFEE_SETUP_PKG.CREATECFFEE(
:P_SPID,
:P_STARTSETS,
:P_ENDSETS,
:P_EFFDATE,
:P_CUSTOMERTYPE,
:P_CARNETTYPE,
:P_RATE,
:P_USERID,
:P_CURSOR);
END;`,
{
P_SPID: {
val: body.P_SPID,
type: oracledb.DB_TYPE_NUMBER
},
P_STARTSETS: {
val: body.P_SPID,
type: oracledb.DB_TYPE_NUMBER
},
P_ENDSETS: {
val: body.P_SPID,
type: oracledb.DB_TYPE_NUMBER
},
P_EFFDATE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_CUSTOMERTYPE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_CARNETTYPE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_RATE: {
val: body.P_RATE,
type: oracledb.DB_TYPE_NUMBER
},
P_USERID: {
val: body.P_USERID,
type: oracledb.DB_TYPE_VARCHAR
},
P_CURSOR: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
console.error('Error fetching users: ', err);
throw new Error('Error fetching users');
} finally { }
}
async CREATECSFEE(body: CreateCsFeeDTO) {
let connection;
try {
// Connect to the Oracle database using oracledb
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
MANAGEFEE_SETUP_PKG.CREATECSFEE(
:P_SPID,
:P_CUSTOMERTYPE,
:P_CARNETTYPE,
:P_EFFDATE,
:P_RATE,
:P_USERID,
:P_CURSOR);
END;`,
{
P_SPID: {
val: body.P_SPID,
type: oracledb.DB_TYPE_NUMBER
},
P_CUSTOMERTYPE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_CARNETTYPE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_EFFDATE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_RATE: {
val: body.P_RATE,
type: oracledb.DB_TYPE_NUMBER
},
P_USERID: {
val: body.P_USERID,
type: oracledb.DB_TYPE_VARCHAR
},
P_CURSOR: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
console.error('Error fetching users: ', err);
throw new Error('Error fetching users');
} finally { }
}
async CREATEEFFEE(body: CreateEfFeeDTO) {
let connection;
try {
// Connect to the Oracle database using oracledb
connection = await this.oracleDBService.getConnection()
if (!connection) {
throw new Error('No DB Connected')
}
const result = await connection.execute(
`BEGIN
MANAGEFEE_SETUP_PKG.CREATEEFFEE(
:P_SPID,
:P_CUSTOMERTYPE,
:P_DELIVERYTYPE,
:P_STARTTIME,
:P_ENDTIME,
:P_TIMEZONE,
:P_EFFDATE,
:P_FEES,
:P_USERID,
:P_CURSOR);
END;`,
{
P_SPID: {
val: body.P_SPID,
type: oracledb.DB_TYPE_NUMBER
},
P_CUSTOMERTYPE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_DELIVERYTYPE: {
val: body.P_DELIVERYTYPE,
type: oracledb.DB_TYPE_VARCHAR
},
P_STARTTIME: {
val: body.P_STARTTIME,
type: oracledb.DB_TYPE_NUMBER
},
P_ENDTIME: {
val: body.P_ENDTIME,
type: oracledb.DB_TYPE_NUMBER
},
P_TIMEZONE: {
val: body.P_TIMEZONE,
type: oracledb.DB_TYPE_VARCHAR
},
P_EFFDATE: {
val: body.P_EFFDATE,
type: oracledb.DB_TYPE_VARCHAR
},
P_FEES: {
val: body.P_FEES,
type: oracledb.DB_TYPE_NUMBER
},
P_USERID: {
val: body.P_USERID,
type: oracledb.DB_TYPE_VARCHAR
},
P_CURSOR: {
type: oracledb.CURSOR,
dir: oracledb.BIND_OUT
}
}, {
outFormat: oracledb.OUT_FORMAT_OBJECT
}
);
await connection.commit();
let fres = await result.outBinds.p_cursor.getRows();
return fres
} catch (err) {
console.error('Error fetching users: ', err);
throw new Error('Error fetching users');
} finally { }
}
async CREATEFEECOMM() { }
async GETBASICFEERATES() { }
async GETBONDRATES() { }

View File

@ -1,13 +1,15 @@
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, Query, UsePipes } from '@nestjs/common';
import { OracleService } from './oracle.service';
import { CreateCarnetSequenceDTO, CreateParamRecordDTO, CreateTableRecordDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, UpdateParamRecordDTO, UpdateRegionDto, UpdateServiceProviderDTO, UpdateSPContactsDTO } from './oracle.dto';
import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCarnetSequenceDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateParamRecordDTO, CreateTableRecordDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, UpdateParamRecordDTO, UpdateRegionDto, UpdateServiceProviderDTO, UpdateSPContactsDTO } from './oracle.dto';
import { ParamTableService } from './paramTable.service';
import { ManageFeeService } from './manageFee.service';
@Controller('oracle')
export class OracleController {
constructor(
private readonly oarcleService: OracleService,
private readonly paramTableService: ParamTableService) { }
private readonly paramTableService: ParamTableService,
private readonly manageFeeService: ManageFeeService) { }
// Regions
@ -198,4 +200,38 @@ export class OracleController {
reActivateParamRecord(@Query('pid') pid,@Query('uid') uid) {
return this.paramTableService.REACTIVATEPARAMRECORD(pid?Number(pid):pid,uid)
}
// ManageFee
@Post('/CreateBasicFee')
CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
return this.manageFeeService.CREATEBASICFEE(body)
}
@Post('/CreateBondRate')
CreateBondRate(@Body() body: CreateBondRateDTO) {
return this.manageFeeService.CREATEBONDRATE(body)
}
@Post('/CreateCargoRate')
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
return this.manageFeeService.CREATECARGORATE(body)
}
@Post('/CreateCfFee')
CreateCfFee(@Body() body: CreateCfFeeDTO) {
return this.manageFeeService.CREATECFFEE(body)
}
@Post('/CreateCsFee')
CreateCsFee(@Body() body: CreateCsFeeDTO) {
return this.manageFeeService.CREATECSFEE(body)
}
@Post('/CreateEfFee')
CreateEeFee(@Body() body: CreateEfFeeDTO) {
return this.manageFeeService.CREATEEFFEE(body)
}
}

View File

@ -298,4 +298,129 @@ export class CreateBasicFeeDTO {
@IsString()
P_USERID: string;
}
}
export class CreateBondRateDTO {
@IsNumber()
P_SPID: number;
@IsString()
P_HOLDERTYPE: string;
@IsString()
P_USCIBMEMBERFLAG: string;
@IsString()
P_SPCLCOMMODITY: string;
@IsString()
P_SPCLCOUNTRY: string;
@IsString()
P_EFFDATE: string;
@IsNumber()
P_RATE: number;
@IsString()
P_USERID: string;
}
export class CreateCargoRateDTO {
@IsNumber()
P_SPID: number;
@IsString()
P_CARNETTYPE: string;
@IsNumber()
P_STARTSETS: number;
@IsNumber()
P_ENDSETS: number;
@IsString()
P_EFFDATE: string;
@IsNumber()
P_RATE: number;
@IsString()
P_USERID: string;
}
export class CreateCfFeeDTO {
@IsNumber()
P_SPID: number;
@IsNumber()
P_STARTSETS: number;
@IsNumber()
P_ENDSETS: number;
@IsString()
P_EFFDATE: string;
@IsString()
P_CUSTOMERTYPE: string;
@IsString()
P_CARNETTYPE: string;
@IsNumber()
P_RATE: number;
@IsString()
P_USERID: string;
}
export class CreateCsFeeDTO {
@IsNumber()
P_SPID: number;
@IsString()
P_CUSTOMERTYPE: string;
@IsString()
P_CARNETTYPE: string;
@IsString()
P_EFFDATE: string;
@IsNumber()
P_RATE: number;
@IsString()
P_USERID: string;
}
export class CreateEfFeeDTO {
@IsNumber()
P_SPID: number;
@IsString()
P_CUSTOMERTYPE: string;
@IsString()
P_DELIVERYTYPE: string;
@IsNumber()
P_STARTTIME: number;
@IsNumber()
P_ENDTIME: number;
@IsString()
P_TIMEZONE: string;
@IsString()
P_EFFDATE: string;
@IsNumber()
P_FEES: number;
@IsString()
P_USERID: string;
}