19 lines
642 B
TypeScript
19 lines
642 B
TypeScript
import type { Company } from '@/types'
|
|
|
|
/** همتراز با slug شرکت دریافتکننده پرداخت در سرور */
|
|
export const PAYMENT_RECIPIENT_COMPANY_SLUG = 'nademitex'
|
|
|
|
export function productCompanyIdForForm(
|
|
companyId: string | undefined,
|
|
companyList: Company[],
|
|
): string {
|
|
const row = companyList.find((c) => c.id === companyId)
|
|
if (!row || row.slug === PAYMENT_RECIPIENT_COMPANY_SLUG) return ''
|
|
return companyId ?? ''
|
|
}
|
|
|
|
export function resolveProductCompanyPayload(formCompanyId: string): string | undefined {
|
|
const trimmed = formCompanyId.trim()
|
|
return trimmed.length > 0 ? trimmed : undefined
|
|
}
|