feat: add Service api with interface
This commit is contained in:
parent
ab7a02bcca
commit
a440f954ad
35 changed files with 1027 additions and 23 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
import withBundleAnalyzer from "@next/bundle-analyzer"
|
import withBundleAnalyzer from "@next/bundle-analyzer";
|
||||||
import withPlugins from "next-compose-plugins"
|
import withPlugins from "next-compose-plugins";
|
||||||
import { env } from "./env.mjs"
|
import { env } from "./env.mjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import('next').NextConfig}
|
* @type {import('next').NextConfig}
|
||||||
*/
|
*/
|
||||||
const config = withPlugins([[withBundleAnalyzer({ enabled: env.ANALYZE })]], {
|
const nextConfig = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
experimental: { instrumentationHook: false },
|
experimental: { instrumentationHook: false },
|
||||||
env: {
|
env: {
|
||||||
|
|
@ -14,15 +14,23 @@ const config = withPlugins([[withBundleAnalyzer({ enabled: env.ANALYZE })]], {
|
||||||
REACT_APP_API_KEY: process.env.REACT_APP_API_KEY,
|
REACT_APP_API_KEY: process.env.REACT_APP_API_KEY,
|
||||||
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
|
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
|
||||||
},
|
},
|
||||||
|
|
||||||
rewrites() {
|
rewrites() {
|
||||||
return [
|
return [
|
||||||
{ source: "/healthz", destination: "/api/health" },
|
{ source: "/healthz", destination: "/api/health" },
|
||||||
{ source: "/api/healthz", destination: "/api/health" },
|
{ source: "/api/healthz", destination: "/api/health" },
|
||||||
{ source: "/health", destination: "/api/health" },
|
{ source: "/health", destination: "/api/health" },
|
||||||
{ source: "/ping", destination: "/api/health" },
|
{ source: "/ping", destination: "/api/health" },
|
||||||
]
|
];
|
||||||
},
|
},
|
||||||
})
|
};
|
||||||
|
|
||||||
export default config
|
export default withPlugins(
|
||||||
|
[
|
||||||
|
[
|
||||||
|
withBundleAnalyzer({
|
||||||
|
enabled: env.ANALYZE === "true",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
nextConfig
|
||||||
|
);
|
||||||
|
|
|
||||||
14
package.json
14
package.json
|
|
@ -25,10 +25,10 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
"@mui/icons-material": "^6.1.0",
|
"@mui/icons-material": "^6.1.1",
|
||||||
"@mui/material": "^6.1.0",
|
"@mui/material": "^6.1.1",
|
||||||
"@mui/system": "^6.1.0",
|
"@mui/system": "^6.1.0",
|
||||||
"@next/bundle-analyzer": "^14.0.3",
|
"@next/bundle-analyzer": "^14.2.13",
|
||||||
"@opentelemetry/exporter-trace-otlp-http": "^0.53.0",
|
"@opentelemetry/exporter-trace-otlp-http": "^0.53.0",
|
||||||
"@opentelemetry/exporter-trace-otlp-proto": "^0.53.0",
|
"@opentelemetry/exporter-trace-otlp-proto": "^0.53.0",
|
||||||
"@radix-ui/react-accordion": "^1.1.2",
|
"@radix-ui/react-accordion": "^1.1.2",
|
||||||
|
|
@ -59,12 +59,14 @@
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"i18next": "^23.15.1",
|
"i18next": "^23.15.1",
|
||||||
"jaeger-client": "^3.19.0",
|
"jaeger-client": "^3.19.0",
|
||||||
|
"jotai": "^2.10.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"next": "^14.0.3",
|
"next": "^14.0.3",
|
||||||
"next-compose-plugins": "^2.2.1",
|
"next-compose-plugins": "^2.2.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.3.1",
|
||||||
"react-i18next": "^15.0.1",
|
"react-i18next": "^15.0.2",
|
||||||
|
"recharts": "^2.12.7",
|
||||||
"tailwind-merge": "^2.0.0",
|
"tailwind-merge": "^2.0.0",
|
||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
export const BASE_URL_AUTHENTICATION = "/AUTHENTICATION-SERVICE/rhi-bpc/"
|
export const BASE_URL_AUTHENTICATION = "/AUTHENTICATION-SERVICE/rhi-bpc/"
|
||||||
export const BASE_URL_ADMINISTRATION = '/ADMINISTRATION-SERVICE/rhi-bpc/v2/'
|
export const BASE_URL_ADMINISTRATION = '/ADMINISTRATION-SERVICE/rhi-bpc/v2/'
|
||||||
|
export const BASE_URL_CUSTOMER = '/CUSTOMER-SERVICE/rhi-bpc/v2/customer/'
|
||||||
export const BASE_URL_CUSTOMER_VALIDATION = '/CUSTOMER-SERVICE/rhi-bpc/v2/customer-type-validation-method/'
|
export const BASE_URL_CUSTOMER_VALIDATION = '/CUSTOMER-SERVICE/rhi-bpc/v2/customer-type-validation-method/'
|
||||||
export const BASE_URL_CUSTOMER_TYPEDNI = '/CUSTOMER-SERVICE/rhi-bpc/v2/type-customer-dni/'
|
export const BASE_URL_CUSTOMER_TYPEDNI = '/CUSTOMER-SERVICE/rhi-bpc/v2/type-customer-dni/'
|
||||||
|
export const BASE_URL_SALE = '/SALE-SERVICE/rhi-bpc/v2/sale/'
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { LoginResponse } from '@interfaces/ResponseInterfaces/Auth/UserResponseInterface';
|
||||||
import { GetToken } from '@package/config/api/Admin/auth/GetToken/page';
|
import { GetToken } from '@package/config/api/Admin/auth/GetToken/page';
|
||||||
import { BASE_URL_ADMINISTRATION } from '@package/config/ApiPath';
|
import { BASE_URL_ADMINISTRATION } from '@package/config/ApiPath';
|
||||||
import { FetchData } from '@package/config/FetchData';
|
import { FetchData } from '@package/config/FetchData';
|
||||||
|
|
@ -5,12 +6,7 @@ import { ReturnService } from '@package/config/ReturnService';
|
||||||
import i18n from '@package/utils/language/i18n';
|
import i18n from '@package/utils/language/i18n';
|
||||||
import { deleteKeyApi, deleteUser, encrypt, setKeyApi, setUser } from '@package/utils/Utilities';
|
import { deleteKeyApi, deleteUser, encrypt, setKeyApi, setUser } from '@package/utils/Utilities';
|
||||||
|
|
||||||
interface LoginResponse {
|
|
||||||
correct?: boolean;
|
|
||||||
success: boolean;
|
|
||||||
message: string;
|
|
||||||
errorCode?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authenticates a user by their username and password.
|
* Authenticates a user by their username and password.
|
||||||
|
|
@ -26,7 +22,7 @@ async function Login(ae_user: string, ae_password: string): Promise<LoginRespons
|
||||||
const token = await GetToken();
|
const token = await GetToken();
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
return { success: false, message: i18n.t('errorTokenAPI'), errorCode: 102 };
|
return { correct: false, message: i18n.t('errorTokenAPI'), errorCode: 102, object: null};
|
||||||
}
|
}
|
||||||
|
|
||||||
ae_password = encrypt(ae_password);
|
ae_password = encrypt(ae_password);
|
||||||
|
|
@ -55,12 +51,12 @@ async function Login(ae_user: string, ae_password: string): Promise<LoginRespons
|
||||||
} else {
|
} else {
|
||||||
deleteKeyApi();
|
deleteKeyApi();
|
||||||
deleteUser();
|
deleteUser();
|
||||||
return { success: false, message: data.message || i18n.t('msj_Incorrect_credentials'), errorCode: data.errorCode };
|
return { correct: false, message: data.message || i18n.t('msj_Incorrect_credentials'), errorCode: data.errorCode, object: null };
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
deleteKeyApi();
|
deleteKeyApi();
|
||||||
deleteUser();
|
deleteUser();
|
||||||
return { success: false, message: i18n.t('errorUnexpected'), errorCode: 500 };
|
return { correct: false, message: i18n.t('errorUnexpected'), errorCode: 500, object: null };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
53
package/config/api/Customer/Customer/GetCustomer/page.tsx
Normal file
53
package/config/api/Customer/Customer/GetCustomer/page.tsx
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
import { GetCustomerOutputInterface } from "@interfaces/OutputInterfaces/Customer/GetCustomerOutputInterface";
|
||||||
|
import { CustomerResponseInterface } from "@interfaces/ResponseInterfaces/Customer/CustomerResponseInterface";
|
||||||
|
import { BASE_URL_CUSTOMER } from "@package/config/ApiPath";
|
||||||
|
import { FetchData } from "@package/config/FetchData";
|
||||||
|
import { ReturnService } from "@package/config/ReturnService"
|
||||||
|
import { BASE_URL_LANGUAGE } from "@package/utils/Constants";
|
||||||
|
import i18n from "@package/utils/language/i18n"
|
||||||
|
import { getKeyApi } from "@package/utils/Utilities"
|
||||||
|
|
||||||
|
async function GetCustomer(ae_object: GetCustomerOutputInterface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: ae_object.id ?? '',
|
||||||
|
idCompany: ae_object.idCompany ?? '',
|
||||||
|
idSubsidiary: ae_object.idSubsidiary ?? 0,
|
||||||
|
name: ae_object.name ?? '',
|
||||||
|
lastname: ae_object.lastname ?? '',
|
||||||
|
idTypeCustomer: ae_object.idTypeCustomer ?? '',
|
||||||
|
dni: ae_object.dni ?? '',
|
||||||
|
idGender: ae_object.idGender ?? '',
|
||||||
|
idMaritalStatus: ae_object.idMaritalStatus ?? '',
|
||||||
|
address: ae_object.address ?? '',
|
||||||
|
mail: ae_object.mail ?? '',
|
||||||
|
phone: ae_object.phone ?? '',
|
||||||
|
idUser: '',
|
||||||
|
status: ae_object.status ?? null,
|
||||||
|
size: ae_object.size ?? 1000,
|
||||||
|
page: ae_object.page ?? 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const data: CustomerResponseInterface = await FetchData(BASE_URL_CUSTOMER, 'all', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
export { GetCustomer }
|
||||||
52
package/config/api/Customer/Customer/SaveCustomer/page.tsx
Normal file
52
package/config/api/Customer/Customer/SaveCustomer/page.tsx
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
import { SaveCustomerOutputInteface } from "@interfaces/OutputInterfaces/Customer/SaveCustomerOutputInterface";
|
||||||
|
import { BASE_URL_CUSTOMER } from "@package/config/ApiPath";
|
||||||
|
import { FetchData } from "@package/config/FetchData";
|
||||||
|
import { ReturnService } from "@package/config/ReturnService";
|
||||||
|
import { BASE_URL_LANGUAGE } from "@package/utils/Constants";
|
||||||
|
import i18n from "@package/utils/language/i18n";
|
||||||
|
import { getKeyApi } from "@package/utils/Utilities"
|
||||||
|
|
||||||
|
async function SaveCustomer(ae_object: SaveCustomerOutputInteface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: ae_object.id ?? '',
|
||||||
|
idCompany: ae_object.idCompany ?? '',
|
||||||
|
idSubsidiary: ae_object.idSubsidiary ?? '',
|
||||||
|
name: ae_object.name ?? '',
|
||||||
|
secondName: ae_object.secondName ?? '',
|
||||||
|
firstSurname: ae_object.firstSurname ?? '',
|
||||||
|
secondSurname: ae_object.secondSurname ?? '',
|
||||||
|
idTypeCustomer: ae_object.idTypeCustomer ?? '',
|
||||||
|
dni: ae_object.dni ?? '',
|
||||||
|
idGender: ae_object.idGender ?? '',
|
||||||
|
idMaritalStatus: ae_object.idMaritalStatus ?? '',
|
||||||
|
address: ae_object.address ?? '',
|
||||||
|
mail: ae_object.mail ?? '',
|
||||||
|
phone: ae_object.phone ?? '',
|
||||||
|
idUser: ae_object.idUser ?? '',
|
||||||
|
status: ae_object.status ?? null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const data = await FetchData(BASE_URL_CUSTOMER,'save', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
export { SaveCustomer }
|
||||||
|
|
||||||
48
package/config/api/Customer/TypeDNI/GetTypeDNI/page.tsx
Normal file
48
package/config/api/Customer/TypeDNI/GetTypeDNI/page.tsx
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
import { GetTypeDNIOutputInterface } from "@interfaces/OutputInterfaces/Customer/GetTypeDNIOutputInterface";
|
||||||
|
import { BASE_URL_CUSTOMER_TYPEDNI } from "@package/config/ApiPath";
|
||||||
|
import { FetchData } from "@package/config/FetchData";
|
||||||
|
import { ReturnService } from "@package/config/ReturnService"
|
||||||
|
import { BASE_URL_LANGUAGE } from "@package/utils/Constants";
|
||||||
|
import i18n from "@package/utils/language/i18n";
|
||||||
|
import { getKeyApi } from "@package/utils/Utilities"
|
||||||
|
|
||||||
|
|
||||||
|
async function GetTypeDni(ae_object: GetTypeDNIOutputInterface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: ae_object.id ?? '',
|
||||||
|
name: ae_object.name ?? '',
|
||||||
|
alias: ae_object.alias ?? '',
|
||||||
|
longitude: ae_object.longitude ?? '',
|
||||||
|
status: ae_object.status ?? null,
|
||||||
|
idMethodValidation: ae_object.idMethodValidation ?? '',
|
||||||
|
nameMethodValidation: ae_object.nameMethodValidation ?? '',
|
||||||
|
idUser: ae_object.idUser ?? '',
|
||||||
|
dataType: ae_object.dataType ?? '',
|
||||||
|
size: ae_object.size ?? 1000,
|
||||||
|
page: ae_object.page ?? 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await FetchData(BASE_URL_CUSTOMER_TYPEDNI, 'all', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
export { GetTypeDni }
|
||||||
44
package/config/api/Customer/TypeDNI/SaveTypeDNI/page.tsx
Normal file
44
package/config/api/Customer/TypeDNI/SaveTypeDNI/page.tsx
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { SaveTypeDniOutputInterface } from "@interfaces/OutputInterfaces/Customer/SaveTypeDniOutputInterface";
|
||||||
|
import { BASE_URL_CUSTOMER_TYPEDNI } from "@package/config/ApiPath";
|
||||||
|
import { FetchData } from "@package/config/FetchData";
|
||||||
|
import { ReturnService } from "@package/config/ReturnService"
|
||||||
|
import { BASE_URL_LANGUAGE } from "@package/utils/Constants";
|
||||||
|
import i18n from "@package/utils/language/i18n"
|
||||||
|
import { getKeyApi } from "@package/utils/Utilities"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function SaveTypeDni(ae_object: SaveTypeDniOutputInterface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: ae_object.id ?? '',
|
||||||
|
name: ae_object.name ?? '',
|
||||||
|
alias: ae_object.alias ?? '',
|
||||||
|
longitude: ae_object.longitude ?? 0,
|
||||||
|
status: ae_object.status ?? null,
|
||||||
|
idMethodValidation: ae_object.idMethodValidation ?? '',
|
||||||
|
idUser: ae_object.idUser ?? '',
|
||||||
|
dataType: ae_object.dataType ?? '',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const data = await FetchData(BASE_URL_CUSTOMER_TYPEDNI, 'save', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
export { SaveTypeDni }
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
import { GetTypeValidationOutputInrerface } from "@interfaces/OutputInterfaces/Customer/GetTypeValidationOutputInrerface"
|
||||||
|
import { BASE_URL_CUSTOMER_VALIDATION } from "@package/config/ApiPath"
|
||||||
|
import { FetchData } from "@package/config/FetchData"
|
||||||
|
import { ReturnService } from "@package/config/ReturnService"
|
||||||
|
import { BASE_URL_LANGUAGE } from "@package/utils/Constants"
|
||||||
|
import i18n from "@package/utils/language/i18n"
|
||||||
|
import { getKeyApi } from "@package/utils/Utilities"
|
||||||
|
|
||||||
|
|
||||||
|
async function GetTypeValidation(ae_object: GetTypeValidationOutputInrerface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: ae_object.id ?? '',
|
||||||
|
idCountry: ae_object.idCountry ?? '',
|
||||||
|
name: ae_object.name ?? '',
|
||||||
|
alias: ae_object.alias ?? '',
|
||||||
|
status: ae_object.status ?? null,
|
||||||
|
idUser: ae_object.idUser ?? '',
|
||||||
|
page: ae_object.page ?? 0,
|
||||||
|
size: ae_object.size ?? 1000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await FetchData(BASE_URL_CUSTOMER_VALIDATION, 'all', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
export { GetTypeValidation }
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
import { SaveTypeValidationOutputInterface } from "@interfaces/OutputInterfaces/Customer/SaveTypeValidationOutputInterface"
|
||||||
|
import { BASE_URL_CUSTOMER_VALIDATION } from "@package/config/ApiPath"
|
||||||
|
import { FetchData } from "@package/config/FetchData"
|
||||||
|
import { ReturnService } from "@package/config/ReturnService"
|
||||||
|
import { BASE_URL_LANGUAGE } from "@package/utils/Constants"
|
||||||
|
import i18n from "@package/utils/language/i18n"
|
||||||
|
import { getKeyApi } from "@package/utils/Utilities"
|
||||||
|
|
||||||
|
|
||||||
|
async function SaveTypeValidation(ae_object: SaveTypeValidationOutputInterface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: ae_object.id ?? '',
|
||||||
|
idCountry: ae_object.idCountry ?? '',
|
||||||
|
name: ae_object.name ?? '',
|
||||||
|
alias: ae_object.alias ?? '',
|
||||||
|
status: ae_object.status ?? null,
|
||||||
|
idUser: ae_object.idUser ?? ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const data = await FetchData(BASE_URL_CUSTOMER_VALIDATION, 'save', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
export { SaveTypeValidation }
|
||||||
50
package/config/api/Sale/Transaction/AddProducts/page.tsx
Normal file
50
package/config/api/Sale/Transaction/AddProducts/page.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
import { AddProductsOutputInterface } from "@interfaces/OutputInterfaces/Sale/AddProductsOutputInterfae";
|
||||||
|
import { AddProductsResponseInterface } from "@interfaces/ResponseInterfaces/Sale/AddProductsResponseInterface";
|
||||||
|
import { BASE_URL_SALE } from "@package/config/ApiPath";
|
||||||
|
import { FetchData } from "@package/config/FetchData";
|
||||||
|
import { ReturnService } from "@package/config/ReturnService"
|
||||||
|
import { BASE_URL_LANGUAGE } from "@utils/Constants"
|
||||||
|
import i18n from "@utils/language/i18n";
|
||||||
|
import { getKeyApi } from "@utils/Utilities"
|
||||||
|
|
||||||
|
|
||||||
|
async function AddProducts(ae_object: AddProductsOutputInterface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
idTransaction: ae_object.idTransaction ?? '',
|
||||||
|
storeNumber: ae_object.storeNumber ?? '',
|
||||||
|
idSubsidiary: ae_object.idSubsidiary ?? 0,
|
||||||
|
clientNit: ae_object.clientNit ?? '',
|
||||||
|
idUser: ae_object.idUser ?? '',
|
||||||
|
localDate: ae_object.localDate ?? '',
|
||||||
|
pos: ae_object.pos ?? '',
|
||||||
|
products: ae_object.products.map(item => ({
|
||||||
|
sku: item.sku ?? '',
|
||||||
|
value: item.value ?? 0,
|
||||||
|
})),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let data: AddProductsResponseInterface = await FetchData(BASE_URL_SALE, 'addProducts', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default AddProducts
|
||||||
63
package/config/api/Sale/Transaction/EndSale/page.tsx
Normal file
63
package/config/api/Sale/Transaction/EndSale/page.tsx
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
import { EndSaleOutputInterface } from "@interfaces/OutputInterfaces/Sale/EndSaleOutputInterface";
|
||||||
|
import { EndSaleResponseInterface } from "@interfaces/ResponseInterfaces/Sale/EndSaleResponseInterface";
|
||||||
|
import { BASE_URL_SALE } from "@package/config/ApiPath";
|
||||||
|
import { FetchData } from "@package/config/FetchData";
|
||||||
|
import { ReturnService } from "@package/config/ReturnService"
|
||||||
|
import { BASE_URL_LANGUAGE } from "@utils/Constants"
|
||||||
|
import i18n from "@utils/language/i18n";
|
||||||
|
import { getKeyApi } from "@utils/Utilities"
|
||||||
|
|
||||||
|
|
||||||
|
async function EndSale(ae_object: EndSaleOutputInterface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE,
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
idTransaction: ae_object.idTransaction ?? '',
|
||||||
|
storeNumber: ae_object.storeNumber ?? '',
|
||||||
|
idSubsidiary: ae_object.idSubsidiary ?? 0,
|
||||||
|
idUser: ae_object.idUser ?? '',
|
||||||
|
localDate: ae_object.localDate ?? '',
|
||||||
|
pos: ae_object.pos ?? '',
|
||||||
|
comment: ae_object.comment ?? '',
|
||||||
|
payment: ae_object.payment.map((item) => ({
|
||||||
|
type: item.type ?? '',
|
||||||
|
approvalCode: item.approvalCode ?? '',
|
||||||
|
receiptNumber: item.receiptNumber ?? '',
|
||||||
|
value: item.value ?? 0,
|
||||||
|
cardNumber: item.cardNumber ?? '',
|
||||||
|
cardType: item.cardType ?? '',
|
||||||
|
comment: item.comment ?? '',
|
||||||
|
})),
|
||||||
|
infoPos: {
|
||||||
|
addressPos: ae_object.infoPos.addressPos ?? '',
|
||||||
|
codeMunPos: ae_object.infoPos.codeMunPos ?? '',
|
||||||
|
nameMunPos: ae_object.infoPos.nameMunPos ?? '',
|
||||||
|
codeDepPos: ae_object.infoPos.codeDepPos ?? '',
|
||||||
|
nameDepPos: ae_object.infoPos.nameDepPos ?? '',
|
||||||
|
pos: ae_object.infoPos.pos ?? '',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
let data : EndSaleResponseInterface = await FetchData(BASE_URL_SALE, 'endSale', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default EndSale
|
||||||
44
package/config/api/Sale/Transaction/GetSale/page.tsx
Normal file
44
package/config/api/Sale/Transaction/GetSale/page.tsx
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { GetSaleOutputInterface } from "@interfaces/OutputInterfaces/Sale/GetSaleOutputInterface";
|
||||||
|
import { GetSaleResponseInterface } from "@interfaces/ResponseInterfaces/Sale/GetSaleResponseInterface";
|
||||||
|
import { BASE_URL_SALE } from "@package/config/ApiPath";
|
||||||
|
import { FetchData } from "@package/config/FetchData";
|
||||||
|
import { ReturnService } from "@package/config/ReturnService"
|
||||||
|
import { BASE_URL_LANGUAGE } from "@utils/Constants"
|
||||||
|
import i18n from "@utils/language/i18n";
|
||||||
|
import { getKeyApi } from "@utils/Utilities"
|
||||||
|
|
||||||
|
async function GetSale(ae_object: GetSaleOutputInterface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
idTransaction: ae_object.idTransaction ?? '',
|
||||||
|
storeNumber: ae_object.storeNumber ?? 0,
|
||||||
|
idSubsidiary: ae_object.idSubsidiary ?? '',
|
||||||
|
idUser: ae_object.idUser ?? '',
|
||||||
|
pos: ae_object.pos ?? '',
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let data: GetSaleResponseInterface = await FetchData(BASE_URL_SALE, 'addProducts', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default GetSale
|
||||||
55
package/config/api/Sale/Transaction/StartSale/page.tsx
Normal file
55
package/config/api/Sale/Transaction/StartSale/page.tsx
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
import { StartSaleOutputInterface } from "@interfaces/OutputInterfaces/Sale/StartSaleOutputInterface";
|
||||||
|
import { StartSaleResponseInterface } from "@interfaces/ResponseInterfaces/Sale/StartSaleResponseInterface";
|
||||||
|
import { BASE_URL_SALE } from "@package/config/ApiPath";
|
||||||
|
import { FetchData } from "@package/config/FetchData";
|
||||||
|
import { ReturnService } from "@package/config/ReturnService"
|
||||||
|
import { BASE_URL_LANGUAGE } from "@utils/Constants"
|
||||||
|
import i18n from "@utils/language/i18n";
|
||||||
|
import { getKeyApi } from "@utils/Utilities"
|
||||||
|
|
||||||
|
|
||||||
|
async function StartSale(ae_object: StartSaleOutputInterface) {
|
||||||
|
const token = getKeyApi()
|
||||||
|
if (token === '') {
|
||||||
|
return new ReturnService('', false, i18n.t('errorTokenAPI'), 102)
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: RequestInit = {
|
||||||
|
method: 'post',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer ' + token,
|
||||||
|
lng: BASE_URL_LANGUAGE
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
storeNumber: ae_object.storeNumber ?? '',
|
||||||
|
idSubsidiary: ae_object.idSubsidiary ?? 0,
|
||||||
|
idClient: ae_object.idClient ?? '',
|
||||||
|
clientDni: ae_object.clientDni ?? '',
|
||||||
|
idType: ae_object.idType ?? '',
|
||||||
|
idGroup: ae_object.idGroup ?? '',
|
||||||
|
invoiceName: ae_object.invoiceName ?? '',
|
||||||
|
invoiceTypeNit: ae_object.invoiceTypeNit ?? '',
|
||||||
|
invoiceNit: ae_object.invoiceNit ?? '',
|
||||||
|
invoiceDirection: ae_object.invoiceDirection ?? '',
|
||||||
|
invoiceCellPhone: ae_object.invoiceCellPhone ?? '',
|
||||||
|
invoiceEmail: ae_object.invoiceEmail ?? '',
|
||||||
|
idUser: ae_object.idUser ?? '',
|
||||||
|
localDate: ae_object.localDate ?? '',
|
||||||
|
pos: ae_object.pos ?? '',
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let data : StartSaleResponseInterface = await FetchData(BASE_URL_SALE, 'addProducts', options)
|
||||||
|
|
||||||
|
if (data.correct) {
|
||||||
|
return data.object
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default StartSale
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
export interface GetCustomerOutputInterface {
|
||||||
|
id?: string;
|
||||||
|
idCompany?: string;
|
||||||
|
idSubsidiary?: number;
|
||||||
|
name?: string;
|
||||||
|
lastname?: string;
|
||||||
|
idTypeCustomer?: string;
|
||||||
|
dni?: string;
|
||||||
|
idGender?: string;
|
||||||
|
idMaritalStatus?: string;
|
||||||
|
address?: string;
|
||||||
|
mail?: string;
|
||||||
|
phone?: string;
|
||||||
|
idUser?: string;
|
||||||
|
status?: any;
|
||||||
|
validateOnline?: boolean;
|
||||||
|
size?: number;
|
||||||
|
page?: number;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
export interface GetTypeDNIOutputInterface {
|
||||||
|
id?: string;
|
||||||
|
name?: string;
|
||||||
|
alias?: string;
|
||||||
|
longitude?: string;
|
||||||
|
status?: any;
|
||||||
|
idMethodValidation?: string;
|
||||||
|
nameMethodValidation?: string;
|
||||||
|
idUser?: string;
|
||||||
|
dataType?: string;
|
||||||
|
size?: number;
|
||||||
|
page?: number;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
export interface GetTypeValidationOutputInrerface {
|
||||||
|
id?: string;
|
||||||
|
idCountry?: string;
|
||||||
|
name?: string;
|
||||||
|
alias?: string;
|
||||||
|
status?: string | null;
|
||||||
|
idUser?: string;
|
||||||
|
page?: number;
|
||||||
|
size?: number;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
export interface SaveCustomerOutputInteface {
|
||||||
|
id?: string;
|
||||||
|
idCompany?: string;
|
||||||
|
idSubsidiary?: string;
|
||||||
|
name?: string;
|
||||||
|
secondName?: string;
|
||||||
|
firstSurname?: string;
|
||||||
|
secondSurname?: string;
|
||||||
|
idTypeCustomer?: string;
|
||||||
|
dni?: string;
|
||||||
|
idGender?: string;
|
||||||
|
idMaritalStatus?: string;
|
||||||
|
address?: string;
|
||||||
|
mail?: string;
|
||||||
|
phone?: string;
|
||||||
|
idUser?: string;
|
||||||
|
status?: any;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
export interface SaveTypeDniOutputInterface {
|
||||||
|
id?: string;
|
||||||
|
name?: string;
|
||||||
|
alias?: string;
|
||||||
|
longitude?: number;
|
||||||
|
status?: any;
|
||||||
|
idMethodValidation?: string;
|
||||||
|
idUser?: string;
|
||||||
|
dataType?: string;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
export interface SaveTypeValidationOutputInterface {
|
||||||
|
id?: string;
|
||||||
|
idCountry?: string;
|
||||||
|
name?: string;
|
||||||
|
alias?: string;
|
||||||
|
status?: any;
|
||||||
|
idUser?: string;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
interface Product {
|
||||||
|
sku: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AddProductsOutputInterface {
|
||||||
|
idTransaction?: string;
|
||||||
|
storeNumber?: string;
|
||||||
|
idSubsidiary?: number;
|
||||||
|
clientNit?: string;
|
||||||
|
idUser?: string;
|
||||||
|
localDate?: Date;
|
||||||
|
pos?: string;
|
||||||
|
products: Product[];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
export interface Payment {
|
||||||
|
type: string;
|
||||||
|
approvalCode: string;
|
||||||
|
receiptNumber: string;
|
||||||
|
value: number;
|
||||||
|
cardNumber: string;
|
||||||
|
cardType: string;
|
||||||
|
comment: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InfoPos {
|
||||||
|
addressPos: string;
|
||||||
|
codeMunPos: string;
|
||||||
|
nameMunPos: string;
|
||||||
|
codeDepPos: string;
|
||||||
|
nameDepPos: string;
|
||||||
|
pos: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EndSaleOutputInterface {
|
||||||
|
idTransaction: string;
|
||||||
|
storeNumber: string;
|
||||||
|
idSubsidiary: number;
|
||||||
|
idUser: string;
|
||||||
|
localDate: string;
|
||||||
|
pos: string;
|
||||||
|
comment: string;
|
||||||
|
payment: Payment[];
|
||||||
|
infoPos: InfoPos;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
export interface GetSaleOutputInterface {
|
||||||
|
idTransaction?: string;
|
||||||
|
storeNumber?: number;
|
||||||
|
idSubsidiary?: string;
|
||||||
|
idUser?: string;
|
||||||
|
pos?: string;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
export interface Product {
|
||||||
|
sku: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Transaction {
|
||||||
|
idTransaction: string;
|
||||||
|
storeNumber: string;
|
||||||
|
idSubsidiary: number;
|
||||||
|
clientNit: string;
|
||||||
|
idUser: string;
|
||||||
|
localDate: string;
|
||||||
|
pos: string;
|
||||||
|
products: Product[];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
export interface StartSaleOutputInterface {
|
||||||
|
storeNumber?: string;
|
||||||
|
idSubsidiary?: number;
|
||||||
|
idClient?: string;
|
||||||
|
clientDni?: string;
|
||||||
|
idType?: string;
|
||||||
|
idGroup?: string;
|
||||||
|
invoiceName?: string;
|
||||||
|
invoiceTypeNit?: string;
|
||||||
|
invoiceNit?: string;
|
||||||
|
invoiceDirection?: string;
|
||||||
|
invoiceCellPhone?: string;
|
||||||
|
invoiceEmail?: string;
|
||||||
|
idUser?: string;
|
||||||
|
localDate?: string;
|
||||||
|
pos?: string;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
export interface UserResposeInterface {
|
||||||
|
id: string;
|
||||||
|
idSubsidiary: number;
|
||||||
|
subsidiaryName: string;
|
||||||
|
idCompany: string;
|
||||||
|
companyName: string;
|
||||||
|
name: string;
|
||||||
|
lastName: string;
|
||||||
|
email: string;
|
||||||
|
cellphone: string;
|
||||||
|
idTypeUser: string;
|
||||||
|
typeName: string;
|
||||||
|
isActive: boolean;
|
||||||
|
isAdmin: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoginResponse {
|
||||||
|
correct?: boolean;
|
||||||
|
message: string;
|
||||||
|
errorCode?: number;
|
||||||
|
object: UserResposeInterface | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
export interface CustomerResponseInterface {
|
||||||
|
correct: boolean;
|
||||||
|
message: string;
|
||||||
|
errorCode: number;
|
||||||
|
object: CustomerObjectInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomerObjectInterface {
|
||||||
|
page: number;
|
||||||
|
size: number;
|
||||||
|
totalPage: number;
|
||||||
|
list: CustomerInterface[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomerInterface {
|
||||||
|
id?: string;
|
||||||
|
idCompany?: string;
|
||||||
|
companyName?: string;
|
||||||
|
idSubsidiary?: number;
|
||||||
|
nameSubsidiary?: string;
|
||||||
|
externalClientId?: string | null;
|
||||||
|
name?: string;
|
||||||
|
secondName?: string;
|
||||||
|
firstSurname?: string;
|
||||||
|
secondSurname?: string;
|
||||||
|
idTypeCustomer: string;
|
||||||
|
nameTypeCustomer?: string;
|
||||||
|
dni: string;
|
||||||
|
idGender?: string;
|
||||||
|
nameGender?: string;
|
||||||
|
idMaritalStatus?: string | null;
|
||||||
|
nameMaritalStatus?: string | null;
|
||||||
|
address: string;
|
||||||
|
idCity?: string | null;
|
||||||
|
nameCity?: string | null;
|
||||||
|
idCountry?: string | null;
|
||||||
|
nameCountry?: string | null;
|
||||||
|
mail: string;
|
||||||
|
phone: string;
|
||||||
|
idUser?: string;
|
||||||
|
nameUser?: string;
|
||||||
|
status: boolean;
|
||||||
|
birthdate?: string | null;
|
||||||
|
group: any[];
|
||||||
|
NameSurname?: string;
|
||||||
|
SurnameName?: string;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
export interface CustomerDniTypeResponseInterface {
|
||||||
|
correct: boolean;
|
||||||
|
message: string;
|
||||||
|
errorCode: number;
|
||||||
|
object: CustomerDniTypeObjectInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomerDniTypeObjectInterface {
|
||||||
|
page: number;
|
||||||
|
size: number;
|
||||||
|
totalPage: number;
|
||||||
|
list: CustomerDniTypeInterface[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomerDniTypeInterface {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
alias: string;
|
||||||
|
longitude: string;
|
||||||
|
status: boolean;
|
||||||
|
idMethodValidation: string;
|
||||||
|
nameMethodValidation: string;
|
||||||
|
dataType: string | null;
|
||||||
|
idUser: string;
|
||||||
|
nameUser: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
export interface CustomerTypeValidationResponseInterface {
|
||||||
|
correct: boolean;
|
||||||
|
message: string;
|
||||||
|
errorCode: number;
|
||||||
|
object: CustomerTypeValidationObjectInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomerTypeValidationObjectInterface {
|
||||||
|
page: number;
|
||||||
|
size: number;
|
||||||
|
totalPage: number;
|
||||||
|
list: CustomerTypeValidationInterface[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomerTypeValidationInterface {
|
||||||
|
id: string;
|
||||||
|
idCountry: string;
|
||||||
|
nameCountry: string;
|
||||||
|
name: string;
|
||||||
|
alias: string;
|
||||||
|
status: boolean;
|
||||||
|
idUser: string;
|
||||||
|
nameUser: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
export interface Tax {
|
||||||
|
id: string;
|
||||||
|
idSaleDetail: string;
|
||||||
|
idProduct: string;
|
||||||
|
idTax: string;
|
||||||
|
name: string;
|
||||||
|
alias: string;
|
||||||
|
percent: number;
|
||||||
|
totalPriceBeforeTaxes: number;
|
||||||
|
taxValue: number;
|
||||||
|
taxUnitValue: number | null;
|
||||||
|
taxIncluded: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ItemObject {
|
||||||
|
id: string;
|
||||||
|
itemIdentifier: string;
|
||||||
|
regularUnitPrice: number;
|
||||||
|
totalTaxes: number;
|
||||||
|
extendedPrice: number;
|
||||||
|
name: string;
|
||||||
|
idDepartment: string | null;
|
||||||
|
departmentNumber: string | null;
|
||||||
|
description: string;
|
||||||
|
longDescription: string;
|
||||||
|
quantity: number;
|
||||||
|
restrictedAge: number;
|
||||||
|
taxableFlag: boolean;
|
||||||
|
weight: number | null;
|
||||||
|
taxes: Tax[];
|
||||||
|
weighable: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AddProductsResponseInterface {
|
||||||
|
correct: boolean;
|
||||||
|
message: string | null;
|
||||||
|
errorCode: number;
|
||||||
|
object: ItemObject;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
export interface TransactionObject {
|
||||||
|
StatusCV: boolean;
|
||||||
|
QRCode: string;
|
||||||
|
description: string;
|
||||||
|
numFac: string;
|
||||||
|
status: string;
|
||||||
|
cufe: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EndSaleResponseInterface {
|
||||||
|
correct: boolean;
|
||||||
|
message: string;
|
||||||
|
errorCode: number;
|
||||||
|
object: TransactionObject;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
|
||||||
|
export interface Tax {
|
||||||
|
id: string;
|
||||||
|
idSaleDetail: string;
|
||||||
|
idProduct: string;
|
||||||
|
idTax: string;
|
||||||
|
name: string;
|
||||||
|
alias: string;
|
||||||
|
percent: number;
|
||||||
|
totalPriceBeforeTaxes: number;
|
||||||
|
taxValue: number;
|
||||||
|
taxUnitValue: number | null;
|
||||||
|
taxIncluded: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SaleDetail {
|
||||||
|
idDetail: string;
|
||||||
|
idTransaction: string;
|
||||||
|
id: string;
|
||||||
|
itemIdentifier: string;
|
||||||
|
name: string;
|
||||||
|
unitMeasurement: string;
|
||||||
|
idDepartment: string | null;
|
||||||
|
departmentNumber: string | null;
|
||||||
|
description: string;
|
||||||
|
quantity: number;
|
||||||
|
weight: number | null;
|
||||||
|
regularUnitPrice: number;
|
||||||
|
originalUnitPrice: number;
|
||||||
|
discount: number;
|
||||||
|
totalTaxes: number;
|
||||||
|
taxableFlag: boolean;
|
||||||
|
restrictedAge: number;
|
||||||
|
idSaleState: number;
|
||||||
|
idUser: string;
|
||||||
|
creation: string;
|
||||||
|
lastUpdate: string;
|
||||||
|
taxes: Tax[];
|
||||||
|
active: boolean;
|
||||||
|
weighable: boolean;
|
||||||
|
extendedPrice: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomerPromotion {
|
||||||
|
groupId: string;
|
||||||
|
customerId: string;
|
||||||
|
percentageDiscount: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ItemPromotion {
|
||||||
|
index: number;
|
||||||
|
code: string;
|
||||||
|
quantity: number;
|
||||||
|
unitPrice: number;
|
||||||
|
attribute: string | null;
|
||||||
|
promotionTrace: string | null;
|
||||||
|
resultPercentDiscount: number | null;
|
||||||
|
weighable: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Promotions {
|
||||||
|
customer: CustomerPromotion;
|
||||||
|
items: ItemPromotion[];
|
||||||
|
total: number;
|
||||||
|
listPromotion: any[]; // Assuming this is an empty array, can adjust if more data is provided
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SaleTransactionObject {
|
||||||
|
id: string;
|
||||||
|
idCompany: string;
|
||||||
|
idSubsidiary: number;
|
||||||
|
transactionNumber: string;
|
||||||
|
idClient: string;
|
||||||
|
clientName: string;
|
||||||
|
clientDni: string;
|
||||||
|
idType: string;
|
||||||
|
totalSale: number;
|
||||||
|
totalTaxes: number;
|
||||||
|
totalWithPromotion: number;
|
||||||
|
idGroup: string;
|
||||||
|
group: string;
|
||||||
|
invoiceCode: string | null;
|
||||||
|
invoiceName: string;
|
||||||
|
invoiceTypeDni: string;
|
||||||
|
invoiceDni: string;
|
||||||
|
invoiceDirection: string;
|
||||||
|
invoiceCellPhone: string;
|
||||||
|
invoiceEmail: string;
|
||||||
|
idUser: string;
|
||||||
|
idSaleState: number;
|
||||||
|
numberStore: string;
|
||||||
|
pos: string;
|
||||||
|
posLocalTimeStart: string;
|
||||||
|
posLocalTimeEnd: string | null;
|
||||||
|
localDateTime: string | null;
|
||||||
|
creation: string;
|
||||||
|
lastUpdate: string;
|
||||||
|
list: SaleDetail[];
|
||||||
|
promotions: Promotions;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetSaleResponseInterface {
|
||||||
|
correct: boolean;
|
||||||
|
message: string | null;
|
||||||
|
errorCode: number;
|
||||||
|
object: SaleTransactionObject;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
// interfaces/ProductDetails.ts
|
||||||
|
|
||||||
|
export interface Tax {
|
||||||
|
id: string;
|
||||||
|
idSaleDetail: string;
|
||||||
|
idProduct: string;
|
||||||
|
idTax: string;
|
||||||
|
name: string;
|
||||||
|
alias: string;
|
||||||
|
percent: number;
|
||||||
|
totalPriceBeforeTaxes: number;
|
||||||
|
taxValue: number;
|
||||||
|
taxUnitValue: number | null;
|
||||||
|
taxIncluded: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductObject {
|
||||||
|
id: string;
|
||||||
|
itemIdentifier: string;
|
||||||
|
regularUnitPrice: number;
|
||||||
|
totalTaxes: number;
|
||||||
|
extendedPrice: number;
|
||||||
|
name: string;
|
||||||
|
idDepartment: string | null;
|
||||||
|
departmentNumber: string | null;
|
||||||
|
description: string;
|
||||||
|
longDescription: string;
|
||||||
|
quantity: number;
|
||||||
|
restrictedAge: number;
|
||||||
|
taxableFlag: boolean;
|
||||||
|
weight: number | null;
|
||||||
|
taxes: Tax[];
|
||||||
|
weighable: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RemoveProductsResponseInterface {
|
||||||
|
correct: boolean;
|
||||||
|
message: string | null;
|
||||||
|
errorCode: number;
|
||||||
|
object: ProductObject;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
export interface TransactionObject {
|
||||||
|
id: string;
|
||||||
|
transactionNumber: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StartSaleResponseInterface {
|
||||||
|
correct: boolean;
|
||||||
|
message: string;
|
||||||
|
errorCode: number;
|
||||||
|
object: TransactionObject;
|
||||||
|
}
|
||||||
|
|
@ -30,6 +30,9 @@
|
||||||
"@organisms/*": ["./package/components/organisms/*"],
|
"@organisms/*": ["./package/components/organisms/*"],
|
||||||
"@layouts/*": ["./package/components/layouts/*"],
|
"@layouts/*": ["./package/components/layouts/*"],
|
||||||
"@styles/*": ["./package/styles/*"],
|
"@styles/*": ["./package/styles/*"],
|
||||||
|
"@utils/*": ["./package/utils/*"],
|
||||||
|
"@hooks/*": ["./package/hooks/*"],
|
||||||
|
"@interfaces/*": ["./package/interfaces/*"],
|
||||||
"@package/*": ["./package/*"],
|
"@package/*": ["./package/*"],
|
||||||
"@app/*": ["./app/*"],
|
"@app/*": ["./app/*"],
|
||||||
"@public/*": ["./public/*"]
|
"@public/*": ["./public/*"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue