feat: update activation expiration handling and enhance payload structure in transaction services
This commit is contained in:
@@ -24,9 +24,10 @@ export const summarySelect: BusinessActivitySelect = {
|
||||
select: {
|
||||
activation: {
|
||||
select: {
|
||||
_count: {
|
||||
account_allocations: {
|
||||
select: {
|
||||
account_allocations: true,
|
||||
id: true,
|
||||
account_id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -44,13 +45,18 @@ export const select: BusinessActivitySelect = {
|
||||
export const mappedData = (businessActivity: any) => {
|
||||
const { license_activation, ...rest } = businessActivity
|
||||
const { license, ...license_activation_rest } = license_activation
|
||||
const { _count } = license.activation
|
||||
const { account_allocations } = license.activation
|
||||
|
||||
console.log('license_activation', license_activation)
|
||||
|
||||
return {
|
||||
...rest,
|
||||
license_info: {
|
||||
...license_activation_rest,
|
||||
accounts_limit: _count.account_allocations,
|
||||
accounts_limit: account_allocations.length,
|
||||
allocated_account_count: account_allocations.filter(
|
||||
allocation => allocation.account_id,
|
||||
).length,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -105,7 +105,9 @@ export class PartnerAccountChargeTransactionService {
|
||||
try {
|
||||
createdTransaction = await tx.partnerAccountQuotaChargeTransaction.create({
|
||||
data: {
|
||||
activation_expires_at: data.activated_expires_at,
|
||||
activation_expires_at: data.activated_expires_at
|
||||
? new Date(data.activated_expires_at).toISOString()
|
||||
: new Date().toISOString(),
|
||||
tracking_code: generateTrackingCode('AQC', this.TRACKING_CODE_LENGTH),
|
||||
purchased_count: data.quantity,
|
||||
partner: { connect: { id: partner_id } },
|
||||
|
||||
+3
-1
@@ -121,7 +121,9 @@ export class PartnerLicenseChargeTransactionService {
|
||||
try {
|
||||
createdTransaction = await tx.licenseChargeTransaction.create({
|
||||
data: {
|
||||
activation_expires_at: data.activated_expires_at,
|
||||
activation_expires_at: data.activated_expires_at
|
||||
? new Date(data.activated_expires_at).toISOString()
|
||||
: new Date().toISOString(),
|
||||
tracking_code: generateTrackingCode('LIC', this.TRACKING_CODE_LENGTH),
|
||||
purchased_count: data.quantity,
|
||||
partner: { connect: { id: partner_id } },
|
||||
|
||||
@@ -419,6 +419,9 @@ export async function buildOriginalPayload(
|
||||
select: {
|
||||
stan: true,
|
||||
rrn: true,
|
||||
transaction_date_time: true,
|
||||
customer_card_no: true,
|
||||
terminal_id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -465,7 +468,9 @@ export async function buildOriginalPayload(
|
||||
payment_method: payment.payment_method,
|
||||
paid_at: payment.paid_at,
|
||||
terminal_info: {
|
||||
card_number: payment.terminal_info ? payment.terminal_info.stan : undefined,
|
||||
card_number: payment.terminal_info?.customer_card_no
|
||||
? payment.terminal_info.customer_card_no
|
||||
: undefined,
|
||||
tracking_code: payment.terminal_info ? payment.terminal_info.rrn : undefined,
|
||||
},
|
||||
})),
|
||||
|
||||
Reference in New Issue
Block a user