feat: implement consumer info update and password change functionality with DTOs
This commit is contained in:
@@ -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,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user