feat: implement consumer info update and password change functionality with DTOs

This commit is contained in:
2026-05-18 10:53:58 +03:30
parent 12b11cc238
commit 23ae3556de
9 changed files with 165 additions and 17 deletions
@@ -11,13 +11,13 @@ import {
import { SharedCreateSalesInvoiceDto } from './sale-invoice-create.dto'
interface TerminalPaymentInfo {
terminalId: string
terminal_id: string
stan: string
rrn: string
transactionDateTime: string | Date
customerCardNO?: string
transaction_date_time: string | Date
customer_card_no: string
description?: string
amount?: number
amount: number
}
interface NormalizedPayment {
@@ -150,6 +150,12 @@ export class SharedSaleInvoiceCreateService {
const rawPayments = (paymentsData || {}) as Record<string, unknown>
const terminalInfo = rawPayments.terminals as TerminalPaymentInfo | undefined
console.log(
'terminalInfo0',
rawPayments.terminals?.[0]?.customer_card_no,
terminalInfo,
)
const payments: NormalizedPayment[] = Object.entries(rawPayments)
.filter(([key, value]) => key !== 'terminals' && value && Number(value) > 0)
.map(([key, value]) => ({
@@ -508,11 +514,11 @@ export class SharedSaleInvoiceCreateService {
await tx.salesInvoicePaymentTerminalInfo.create({
data: {
payment_id: createdPayment.id,
terminal_id: terminalInfo.terminalId,
terminal_id: terminalInfo.terminal_id,
stan: terminalInfo.stan,
rrn: terminalInfo.rrn,
transaction_date_time: new Date(terminalInfo.transactionDateTime || ''),
customer_card_no: terminalInfo.customerCardNO || null,
transaction_date_time: new Date(terminalInfo.transaction_date_time || ''),
customer_card_no: terminalInfo.customer_card_no || null,
description: terminalInfo.description || null,
},
})
@@ -8,7 +8,7 @@ export default (consumer: any) => {
delete legal?.partner
delete individual?.partner
return {
const returnData = {
...rest,
partner,
type: translateEnumValue('ConsumerType', type),
@@ -18,9 +18,13 @@ export default (consumer: any) => {
? { ...individual, fullname: `${individual?.first_name} ${individual?.last_name}` }
: null,
name: legal ? legal.name : `${individual?.first_name} ${individual?.last_name}`,
business_counts,
// license_info: prepareLicenseInfo(activation),
}
if (business_counts !== undefined) {
returnData['business_counts'] = business_counts
}
return returnData
}
function prepareLicenseInfo(latestLicense: any) {