refactor: remove SalesInvoiceItemsService and update sales invoice handling
- Deleted SalesInvoiceItemsService as it was not implemented. - Changed variable declaration from `const` to `let` in SalesInvoicesService for sales invoice creation. - Updated response handling after sending to TSP provider in SalesInvoicesService. - Renamed payload properties in TspProvider DTOs for clarity. - Enhanced error handling in SalesInvoiceTspSwitchService for unsupported providers. - Refactored SalesInvoiceTspService to utilize utility functions for payload building and sending. - Updated PrismaService to increase connection limit and utilize dynamic options. - Added new migration scripts to update database schema for sale_invoice_tsp_attempts. - Introduced utility functions for building payloads and handling responses in sales invoice processing.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import * as CONSUMER from './consumer'
|
||||
import * as LICENSE_ACTIVATION from './licenseActivation'
|
||||
import * as POS from './pos'
|
||||
import * as SALE_INVOICE from './saleInvoice'
|
||||
|
||||
export const QUERY_CONSTANTS = {
|
||||
POS,
|
||||
CONSUMER,
|
||||
LICENSE_ACTIVATION,
|
||||
SALE_INVOICE,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
import { SalesInvoiceSelect } from '@/generated/prisma/models'
|
||||
|
||||
export const summarySelect: SalesInvoiceSelect = {
|
||||
id: true,
|
||||
code: true,
|
||||
invoice_date: true,
|
||||
invoice_number: true,
|
||||
main_id: true,
|
||||
total_amount: true,
|
||||
tax_id: true,
|
||||
type: true,
|
||||
notes: true,
|
||||
tsp_attempts: {
|
||||
select: {
|
||||
status: true,
|
||||
sent_at: true,
|
||||
message: true,
|
||||
},
|
||||
orderBy: {
|
||||
attempt_no: 'desc',
|
||||
},
|
||||
take: 1,
|
||||
},
|
||||
reference_invoice: {
|
||||
select: {
|
||||
id: true,
|
||||
invoice_number: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export const select: SalesInvoiceSelect = {
|
||||
...summarySelect,
|
||||
payments: {
|
||||
select: {
|
||||
amount: true,
|
||||
paid_at: true,
|
||||
payment_method: true,
|
||||
terminal_info: {
|
||||
select: {
|
||||
customer_card_no: true,
|
||||
terminal_id: true,
|
||||
rrn: true,
|
||||
stan: true,
|
||||
transaction_date_time: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
unknown_customer: true,
|
||||
customer: {
|
||||
select: {
|
||||
type: true,
|
||||
legal: true,
|
||||
individual: true,
|
||||
},
|
||||
},
|
||||
items: {
|
||||
select: {
|
||||
quantity: true,
|
||||
unit_price: true,
|
||||
discount: true,
|
||||
total_amount: true,
|
||||
payload: true,
|
||||
measure_unit_code: true,
|
||||
measure_unit_text: true,
|
||||
sku_code: true,
|
||||
sku_vat: true,
|
||||
good_snapshot: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user