Files
psp_api/src/common/utils/mappers/consumer_mappers.util.ts
T
ahasani 58a7c359d8 feat: add DTOs and services for tax switch integration
- Created SendBulkSaleInvoicesDto for handling bulk sale invoice requests.
- Implemented TaxSwitchSendPayloadDto and related DTOs for tax switch item payloads and results.
- Developed SalesInvoiceTaxSwitchService to manage tax switch operations, including sending and retrieving tax information.
- Added SalesInvoiceTaxService for handling sales invoice tax logic, including bulk sending and persistence of results.
- Introduced NamaTaxSwitchAdapter to interact with the tax switch service, simulating external API responses.
- Created SendBulkSalesInvoicesDto for POS module to handle bulk sales invoice requests.
2026-04-27 22:11:05 +03:30

30 lines
827 B
TypeScript

export default (consumer: any) => {
const { legal, individual, activation, _count, ...rest } = consumer
const { business_activities: business_counts } = _count || { business_activities: 0 }
const partner = legal?.partner || individual?.partner
delete legal?.partner
delete individual?.partner
return {
...rest,
partner,
legal: legal ? { ...legal } : null,
individual: individual
? { ...individual, fullname: `${rest?.first_name} ${rest?.last_name}` }
: null,
name: legal ? legal.name : `${individual?.first_name} ${individual?.last_name}`,
business_counts,
// license_info: prepareLicenseInfo(activation),
}
}
function prepareLicenseInfo(latestLicense: any) {
if (!latestLicense) return null
const { license, ...rest } = latestLicense
return {
...rest,
}
}