Compare commits

..

No commits in common. "b05e6fab5a925dd66bc6a6de5e2107aa65ffd614" and "d1892e7aa5e76593a69a48f7142bf5d5ff6e461f" have entirely different histories.

45 changed files with 186 additions and 438 deletions

7
env/env.development vendored
View File

@ -24,11 +24,8 @@ CRON_EVERY_HOUR="0 * * * *"
EMAIL_HOST=smtp.gmail.com EMAIL_HOST=smtp.gmail.com
EMAIL_POST=465 EMAIL_POST=465
EMAIL_USER=weplayground.app@gmail.com EMAIL_USER=developer@eigen.co.id
EMAIL_TOKEN=sonvvwiukhsevtmv EMAIL_TOKEN=bitqkbkzjzfywxqx
// nama email yang akan muncul ke user sebagai pengirim
EMAIL_SENDER=no-reply@eigen.co.id
MIDTRANS_URL=https://app.sandbox.midtrans.com MIDTRANS_URL=https://app.sandbox.midtrans.com
MIDTRANS_PRODUCTION=false MIDTRANS_PRODUCTION=false

View File

@ -22,7 +22,6 @@ export interface Param {
data: string[]; data: string[];
additional?: any[]; additional?: any[];
leftJoin?: any[]; leftJoin?: any[];
isStatus?: boolean;
} }
export interface RelationParam { export interface RelationParam {

View File

@ -52,14 +52,10 @@ export abstract class BaseIndexManager<Entity> extends BaseReadManager {
// ? karena jika tidak, ketika dia search "active" maka "inactive" juga ikut // ? karena jika tidak, ketika dia search "active" maka "inactive" juga ikut
return `'${STATUS[statusData.toUpperCase()]}'` ?? `'%${statusData}%'`; return `'${STATUS[statusData.toUpperCase()]}'` ?? `'%${statusData}%'`;
}); });
specificFilter.push({
const exist = specificFilter.find((item) => item.isStatus); cols: `${this.tableName}.status::text`,
if (!exist) { data: data,
specificFilter.push({ });
cols: `${this.tableName}.status::text`,
data: data,
});
}
} }
new SpecificSearchFilter<Entity>( new SpecificSearchFilter<Entity>(

View File

@ -145,6 +145,7 @@ export const PrivilegePOSConstant = [
actions: [ actions: [
PrivilegeAction.VIEW, PrivilegeAction.VIEW,
PrivilegeAction.CREATE, PrivilegeAction.CREATE,
PrivilegeAction.DELETE,
PrivilegeAction.EDIT, PrivilegeAction.EDIT,
PrivilegeAction.CANCEL, PrivilegeAction.CANCEL,
], ],

View File

@ -1,49 +0,0 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class UpdateRelationTableTransaction1722581313837
implements MigrationInterface
{
name = 'UpdateRelationTableTransaction1722581313837';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "refunds" DROP CONSTRAINT "FK_8bb3b7579f49990d2e77684acd4"`,
);
await queryRunner.query(
`ALTER TABLE "refunds" DROP CONSTRAINT "REL_8bb3b7579f49990d2e77684acd"`,
);
await queryRunner.query(
`ALTER TABLE "refund_items" DROP CONSTRAINT "FK_07b481a163c219f5de8fb1c90b3"`,
);
await queryRunner.query(
`ALTER TABLE "refund_items" DROP CONSTRAINT "REL_07b481a163c219f5de8fb1c90b"`,
);
await queryRunner.query(
`ALTER TABLE "refunds" ADD CONSTRAINT "FK_8bb3b7579f49990d2e77684acd4" FOREIGN KEY ("transaction_id") REFERENCES "transactions"("id") ON DELETE CASCADE ON UPDATE CASCADE`,
);
await queryRunner.query(
`ALTER TABLE "refund_items" ADD CONSTRAINT "FK_07b481a163c219f5de8fb1c90b3" FOREIGN KEY ("transaction_item_id") REFERENCES "transaction_items"("id") ON DELETE CASCADE ON UPDATE CASCADE`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "refund_items" DROP CONSTRAINT "FK_07b481a163c219f5de8fb1c90b3"`,
);
await queryRunner.query(
`ALTER TABLE "refunds" DROP CONSTRAINT "FK_8bb3b7579f49990d2e77684acd4"`,
);
await queryRunner.query(
`ALTER TABLE "refund_items" ADD CONSTRAINT "REL_07b481a163c219f5de8fb1c90b" UNIQUE ("transaction_item_id")`,
);
await queryRunner.query(
`ALTER TABLE "refund_items" ADD CONSTRAINT "FK_07b481a163c219f5de8fb1c90b3" FOREIGN KEY ("transaction_item_id") REFERENCES "transaction_items"("id") ON DELETE CASCADE ON UPDATE CASCADE`,
);
await queryRunner.query(
`ALTER TABLE "refunds" ADD CONSTRAINT "REL_8bb3b7579f49990d2e77684acd" UNIQUE ("transaction_id")`,
);
await queryRunner.query(
`ALTER TABLE "refunds" ADD CONSTRAINT "FK_8bb3b7579f49990d2e77684acd4" FOREIGN KEY ("transaction_id") REFERENCES "transactions"("id") ON DELETE CASCADE ON UPDATE CASCADE`,
);
}
}

View File

@ -1,17 +0,0 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class UpdateTypeColumnItemTable1722587128195
implements MigrationInterface
{
name = 'UpdateTypeColumnItemTable1722587128195';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "items" DROP COLUMN "sales_margin"`);
await queryRunner.query(`ALTER TABLE "items" ADD "sales_margin" numeric`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "items" DROP COLUMN "sales_margin"`);
await queryRunner.query(`ALTER TABLE "items" ADD "sales_margin" integer`);
}
}

View File

@ -1,23 +0,0 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class UpdateTableTransaction1722595038215 implements MigrationInterface {
name = 'UpdateTableTransaction1722595038215';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TYPE "public"."transactions_payment_type_counter_enum" AS ENUM('midtrans', 'bank transfer', 'qris', 'counter', 'cash', 'credit card', 'debit', 'e-money')`,
);
await queryRunner.query(
`ALTER TABLE "transactions" ADD "payment_type_counter" "public"."transactions_payment_type_counter_enum"`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "transactions" DROP COLUMN "payment_type_counter"`,
);
await queryRunner.query(
`DROP TYPE "public"."transactions_payment_type_counter_enum"`,
);
}
}

View File

@ -38,41 +38,36 @@ export class BookingHandler
const old_data = event.data.old; const old_data = event.data.old;
const data = event.data.data; const data = event.data.data;
if (data.payment_type != TransactionPaymentType.COUNTER) return;
const booking = await this.bookingService.getOneByOptions({
where: {
id: data.id,
},
relations: ['items'],
});
mappingTransaction(booking);
if ( if (
data.payment_type == TransactionPaymentType.COUNTER || old_data?.status != data.status &&
([STATUS.ACTIVE, STATUS.SETTLED].includes(data.status) && [STATUS.PENDING, STATUS.ACTIVE].includes(data.status)
data.payment_type != TransactionPaymentType.COUNTER)
) { ) {
const booking = await this.bookingService.getOneByOptions({ await this.couchService.createDoc(
where: { {
id: data.id, _id: booking.id,
...booking,
}, },
relations: ['items'], 'booking',
}); );
} else {
mappingTransaction(booking); await this.couchService.updateDoc(
{
if ( _id: booking.id,
(old_data?.status != data.status || ...booking,
data.payment_type != TransactionPaymentType.COUNTER) && },
[STATUS.PENDING, STATUS.ACTIVE, STATUS.SETTLED].includes(data.status) 'booking',
) { );
await this.couchService.createDoc(
{
_id: booking.id,
...booking,
},
'booking',
);
} else {
await this.couchService.updateDoc(
{
_id: booking.id,
...booking,
},
'booking',
);
}
} }
} }
} }

View File

@ -61,12 +61,8 @@ export async function CreateEventCalendarHelper(
function mappingData(transaction) { function mappingData(transaction) {
return { return {
summary: transaction.customer_name ?? transaction.invoice_code, summary: transaction.invoice_code,
description: `<b>Booking for invoice ${ description: `Booking for invoice ${transaction.invoice_code}`,
transaction.invoice_code
}</b><p>List Items :</p><ul>${transaction.items.map(
(item) => `<li>${item.item_name}</li>`,
)}</ul>`,
start: { start: {
dateTime: new Date(transaction.booking_date).toISOString(), dateTime: new Date(transaction.booking_date).toISOString(),
timeZone: 'Asia/Jakarta', timeZone: 'Asia/Jakarta',

View File

@ -20,9 +20,9 @@ export async function sendEmail(receivers, subject) {
if (receiver.payment_type == TransactionPaymentType.MIDTRANS) if (receiver.payment_type == TransactionPaymentType.MIDTRANS)
templateName = 'payment-confirmation-midtrans'; templateName = 'payment-confirmation-midtrans';
let templatePath = path.join( let templatePath = path.resolve(
__dirname, __dirname,
`../email-template/${templateName}.html`, `../email-template/${ templateName }.html`,
); );
templatePath = templatePath.replace(/dist/g, 'src'); templatePath = templatePath.replace(/dist/g, 'src');
const templateSource = fs.readFileSync(templatePath, 'utf8'); const templateSource = fs.readFileSync(templatePath, 'utf8');
@ -31,7 +31,7 @@ export async function sendEmail(receivers, subject) {
const htmlToSend = template(receiver); const htmlToSend = template(receiver);
const emailContext = { const emailContext = {
from: process.env.EMAIL_SENDER ?? 'no-reply@weplayground.app', from: 'no-reply@eigen.co.id',
to: receiver.email, to: receiver.email,
subject: subject, subject: subject,
html: htmlToSend, html: htmlToSend,
@ -42,13 +42,13 @@ export async function sendEmail(receivers, subject) {
smtpTransport.sendMail(emailContext, function (err, data) { smtpTransport.sendMail(emailContext, function (err, data) {
if (err) { if (err) {
console.log(err, `Error occurs on send to ${receiver.email}`); console.log(err, `Error occurs on send to ${ receiver.email }`);
} else { } else {
console.log(`Email sent to ${receiver.email}`); console.log(`Email sent to ${ receiver.email }`);
} }
}); });
} catch (error) { } catch (error) {
console.log(error, `Error occurs on send to ${receiver.email}`); console.log(error, `Error occurs on send to ${ receiver.email }`)
} }
} }
} }

View File

@ -1,57 +0,0 @@
import { Controller, Get, Injectable } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { Public } from 'src/core/guards';
import * as path from 'path';
import * as fs from 'fs';
@ApiTags(`email templates`)
@Controller('v1/email-templates')
@Public()
@Injectable()
export class MailTemplateController {
constructor() {}
getTemplate(templateName) {
const templatePath = path.join(
__dirname,
'../../../../../',
`src/modules/configuration/mail/domain/email-template/${templateName}.html`,
);
return fs.readFileSync(templatePath, 'utf8');
}
@Get('date-change')
async getDateChange() {
return this.getTemplate('change-date');
}
@Get('invoice')
async getBookingInvoice() {
return this.getTemplate('invoice');
}
@Get('payment-confirmation-bank')
async getPaymentConfirmation() {
return this.getTemplate('payment-confirmation-bank');
}
@Get('payment-confirmation-midtrans')
async getPaymentConfirmationMidtrans() {
return this.getTemplate('payment-confirmation-midtrans');
}
@Get('invoice-expired')
async getInvoiceExpired() {
return this.getTemplate('invoice-expired');
}
@Get('refund-confirmation')
async getRefundConfirmation() {
return this.getTemplate('refund-confirmation');
}
@Get('refund-request')
async getRefundRequest() {
return this.getTemplate('refunr-request');
}
}

View File

@ -8,7 +8,6 @@ import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model'; import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
import { TransactionDataService } from 'src/modules/transaction/transaction/data/services/transaction-data.service'; import { TransactionDataService } from 'src/modules/transaction/transaction/data/services/transaction-data.service';
import { PaymentTransactionHandler } from './domain/handlers/payment-transaction.handler'; import { PaymentTransactionHandler } from './domain/handlers/payment-transaction.handler';
import { MailTemplateController } from './infrastructure/mail.controller';
@Module({ @Module({
imports: [ imports: [
@ -19,7 +18,7 @@ import { MailTemplateController } from './infrastructure/mail.controller';
), ),
CqrsModule, CqrsModule,
], ],
controllers: [MailTemplateController], controllers: [],
providers: [ providers: [
PaymentTransactionHandler, PaymentTransactionHandler,
PaymentMethodDataService, PaymentMethodDataService,

View File

@ -18,20 +18,7 @@ export class MidtransController {
@Get(':id/status') @Get(':id/status')
async getStatus(@Param('id') id: string) { async getStatus(@Param('id') id: string) {
try { return await this.dataService.getStatus(id);
const data = await this.dataService.getStatus(id);
this.eventBus.publishAll([
new MidtransCallbackEvent({
id: id,
data: data,
}),
]);
return 'Berhasil update status transaksi';
} catch (error) {
console.log(error.message);
throw new Error('Gagal update status transaksi');
}
} }
@Post('callback') @Post('callback')

View File

@ -32,10 +32,7 @@ export class SeasonPeriodHolidayHandler
const rate = new ItemRateModel(); const rate = new ItemRateModel();
rate.item_id = event.data.id; rate.item_id = event.data.id;
rate.season_period_id = season.id; rate.season_period_id = season.id;
rate.price = rate.price = event.data.data.total_price ?? event.data.data.base_price;
Number(event.data.data.total_price) != 0
? event.data.data.total_price
: event.data.data.base_price;
rates.push(rate); rates.push(rate);
} }

View File

@ -38,7 +38,7 @@ export class ItemModel
@Column('bigint', { name: 'hpp', nullable: true }) @Column('bigint', { name: 'hpp', nullable: true })
hpp: number; hpp: number;
@Column('decimal', { name: 'sales_margin', nullable: true }) @Column('int', { name: 'sales_margin', nullable: true })
sales_margin: number; sales_margin: number;
@Column('bigint', { name: 'total_price', nullable: true }) @Column('bigint', { name: 'total_price', nullable: true })

View File

@ -36,12 +36,7 @@ export class ActiveItemManager extends BaseUpdateStatusManager<ItemEntity> {
{ {
relation: 'tenant', relation: 'tenant',
singleQuery: ['status', '!=', STATUS.ACTIVE], singleQuery: ['status', '!=', STATUS.ACTIVE],
message: `Gagal! tenant tidak aktif`, message: `Gagal! Belum ada item yang aktif`,
},
{
relation: 'bundling_items',
singleQuery: ['status', '!=', STATUS.ACTIVE],
message: `Gagal! Terdapat item yang belum aktif`,
}, },
]; ];
} }

View File

@ -7,7 +7,11 @@ import {
import { ItemModel } from '../../../data/models/item.model'; import { ItemModel } from '../../../data/models/item.model';
import { ItemChangeStatusEvent } from '../../entities/event/item-change-status.event'; import { ItemChangeStatusEvent } from '../../entities/event/item-change-status.event';
import { BatchResult } from 'src/core/response/domain/ok-response.interface'; import { BatchResult } from 'src/core/response/domain/ok-response.interface';
import { Injectable } from '@nestjs/common'; import {
HttpStatus,
Injectable,
UnprocessableEntityException,
} from '@nestjs/common';
import { STATUS } from 'src/core/strings/constants/base.constants'; import { STATUS } from 'src/core/strings/constants/base.constants';
@Injectable() @Injectable()
@ -29,12 +33,7 @@ export class BatchActiveItemManager extends BaseBatchUpdateStatusManager<ItemEnt
{ {
relation: 'tenant', relation: 'tenant',
singleQuery: ['status', '!=', STATUS.ACTIVE], singleQuery: ['status', '!=', STATUS.ACTIVE],
message: `Gagal! tenant tidak aktif`, message: `Gagal! Belum ada item yang aktif`,
},
{
relation: 'bundling_items',
singleQuery: ['status', '!=', STATUS.ACTIVE],
message: `Gagal! Terdapat item yang belum aktif`,
}, },
]; ];
} }

View File

@ -29,12 +29,7 @@ export class BatchConfirmItemManager extends BaseBatchUpdateStatusManager<ItemEn
{ {
relation: 'tenant', relation: 'tenant',
singleQuery: ['status', '!=', STATUS.ACTIVE], singleQuery: ['status', '!=', STATUS.ACTIVE],
message: `Gagal! tenant tidak aktif`, message: `Gagal! Belum ada item yang aktif`,
},
{
relation: 'bundling_items',
singleQuery: ['status', '!=', STATUS.ACTIVE],
message: `Gagal! Terdapat item yang belum aktif`,
}, },
]; ];
} }

View File

@ -32,12 +32,7 @@ export class ConfirmItemManager extends BaseUpdateStatusManager<ItemEntity> {
{ {
relation: 'tenant', relation: 'tenant',
singleQuery: ['status', '!=', STATUS.ACTIVE], singleQuery: ['status', '!=', STATUS.ACTIVE],
message: `Gagal! tenant tidak aktif`, message: `Gagal! Belum ada item yang aktif`,
},
{
relation: 'bundling_items',
singleQuery: ['status', '!=', STATUS.ACTIVE],
message: `Gagal! Terdapat item yang belum aktif`,
}, },
]; ];
} }

View File

@ -1,11 +1,8 @@
import { HttpStatus, UnprocessableEntityException } from '@nestjs/common'; import { HttpStatus, UnprocessableEntityException } from '@nestjs/common';
import { STATUS } from 'src/core/strings/constants/base.constants';
import { In } from 'typeorm';
export async function validateRelation(dataService, id) { export async function validateRelation(dataService, id) {
const haveRelation = await dataService.getOneByOptions({ const haveRelation = await dataService.getOneByOptions({
where: { where: {
status: In([STATUS.ACTIVE]),
bundling_items: { bundling_items: {
id: id, id: id,
}, },

View File

@ -36,7 +36,6 @@ export class DetailReconciliationManager extends BaseDetailManager<TransactionEn
`${this.tableName}.reconciliation_mdr`, `${this.tableName}.reconciliation_mdr`,
`${this.tableName}.payment_type`, `${this.tableName}.payment_type`,
`${this.tableName}.payment_type_counter`,
`${this.tableName}.payment_type_method_id`, `${this.tableName}.payment_type_method_id`,
`${this.tableName}.payment_type_method_name`, `${this.tableName}.payment_type_method_name`,
`${this.tableName}.payment_type_method_number`, `${this.tableName}.payment_type_method_number`,

View File

@ -51,7 +51,6 @@ export class IndexReconciliationManager extends BaseIndexManager<TransactionEnti
`${this.tableName}.invoice_code`, `${this.tableName}.invoice_code`,
`${this.tableName}.booking_date`, `${this.tableName}.booking_date`,
`${this.tableName}.payment_type`, `${this.tableName}.payment_type`,
`${this.tableName}.payment_type_counter`,
`${this.tableName}.payment_type_method_id`, `${this.tableName}.payment_type_method_id`,
`${this.tableName}.payment_type_method_name`, `${this.tableName}.payment_type_method_name`,
`${this.tableName}.payment_type_method_number`, `${this.tableName}.payment_type_method_number`,
@ -66,11 +65,6 @@ export class IndexReconciliationManager extends BaseIndexManager<TransactionEnti
get specificFilter(): Param[] { get specificFilter(): Param[] {
return [ return [
{
cols: `${this.tableName}.reconciliation_status::text`,
data: this.filterParam.statuses,
isStatus: true,
},
{ {
cols: `${this.tableName}.customer_name`, cols: `${this.tableName}.customer_name`,
data: this.filterParam.customer_names, data: this.filterParam.customer_names,
@ -121,46 +115,36 @@ export class IndexReconciliationManager extends BaseIndexManager<TransactionEnti
if (this.filterParam.payment_type) { if (this.filterParam.payment_type) {
queryBuilder.andWhere( queryBuilder.andWhere(
`${this.tableName}.payment_type::text In (:...paymentType)`, `${this.tableName}.creator_counter_no In (:...counters)`,
{ {
paymentType: [this.filterParam.payment_type], counters: [this.filterParam.couner_no],
}, },
); );
} }
if (this.filterParam.payment_via) { if (this.filterParam.payment_via) {
queryBuilder.andWhere( queryBuilder.andWhere(`${this.tableName}.payment_type In (:...type)`, {
`${this.tableName}.payment_type::text In (:...type)`, type: [this.filterParam.payment_via],
{ });
type: [`%${this.filterParam.payment_via}%`],
},
);
} }
if (this.filterParam.payment_bank) { if (this.filterParam.payment_bank) {
queryBuilder.andWhere( queryBuilder.andWhere(
`${this.tableName}.payment_type_method_name::text In (:...banks)`, `${this.tableName}.payment_type_method_name In (:...banks)`,
{ {
banks: [`%${this.filterParam.payment_bank}%`], banks: [this.filterParam.payment_bank],
}, },
); );
} }
if (this.filterParam.confirmation_date_from) { if (this.filterParam.confirmation_date_from) {
const confirmationDateFrom = new Date(
this.filterParam?.confirmation_date_from,
).getTime();
const confirmationDateTo = new Date(
`${this.filterParam?.confirmation_date_to?.split(' ')[0]} 23:59:59`,
).getTime();
new BetweenQueryHelper( new BetweenQueryHelper(
queryBuilder, queryBuilder,
this.tableName, this.tableName,
'reconciliation_confirm_date', 'payment_date',
confirmationDateFrom, this.filterParam.confirmation_date_from,
confirmationDateTo, this.filterParam.confirmation_date_to,
'reconciliation_confirm_dated', 'payment_created',
).getQuery(); ).getQuery();
} }

View File

@ -35,24 +35,27 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
const transactions = await this.dataService.getManyByOptions({ const transactions = await this.dataService.getManyByOptions({
where: { where: {
is_recap_transaction: false, is_recap_transaction: false,
paymnet_type: TransactionType.COUNTER, type: TransactionType.COUNTER,
status: STATUS.SETTLED, status: STATUS.SETTLED,
created_at: Between(this.startOfDay, this.endOfDay), created_at: Between(this.startOfDay, this.endOfDay),
}, },
}); });
const payCounserTransactions = await this.dataService.getManyByOptions({
where: {
is_recap_transaction: false,
payment_code: ILike('%SLS%'),
status: STATUS.SETTLED,
created_at: Between(this.startOfDay, this.endOfDay),
},
});
transactions.push(...payCounserTransactions);
for (const transaction of transactions) { for (const transaction of transactions) {
const { const { creator_counter_no, payment_type, payment_type_method_id } =
creator_counter_no, transaction;
payment_type_counter,
payment_type_method_id,
} = transaction;
const group_by = const group_by =
creator_counter_no + creator_counter_no + '-' + payment_type + '-' + payment_type_method_id;
'-' +
payment_type_counter +
'-' +
payment_type_method_id;
if (!this.recapTransactions[group_by]) { if (!this.recapTransactions[group_by]) {
this.recapTransactions[group_by] = []; this.recapTransactions[group_by] = [];
} }
@ -66,26 +69,25 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
const total_recap = Object.keys(this.recapTransactions); const total_recap = Object.keys(this.recapTransactions);
for (const recap of total_recap) { for (const recap of total_recap) {
const first_transaction = this.recapTransactions[recap][0]; const first_transaction = this.recapTransactions[recap][0];
const { const { creator_counter_no, payment_type, payment_type_method_id } =
creator_counter_no, first_transaction;
payment_type_counter,
payment_type_method_id,
} = first_transaction;
let query = { let query = {
is_recap_transaction: true, is_recap_transaction: true,
created_at: Between(this.startOfDay, this.endOfDay), created_at: Between(this.startOfDay, this.endOfDay),
creator_counter_no: creator_counter_no, creator_counter_no: creator_counter_no,
payment_type: payment_type_counter, payment_type: payment_type,
}; };
if (payment_type_counter != 'cash') if (payment_type != 'cash')
query['payment_type_method_id'] = payment_type_method_id ?? EMPTY_UUID; query['payment_type_method_id'] = payment_type_method_id ?? EMPTY_UUID;
const exist = await this.dataService.getOneByOptions({ const exist = await this.dataService.getOneByOptions({
where: query, where: query,
}); });
if (payment_type == 'cash') console.log(exist, 'das', query);
const new_recap = new TransactionModel(); const new_recap = new TransactionModel();
const total = _.sumBy(this.recapTransactions[recap], (recap) => const total = _.sumBy(this.recapTransactions[recap], (recap) =>
parseFloat(recap.payment_total), parseFloat(recap.payment_total),
@ -110,8 +112,7 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
booking_date: new Date(), booking_date: new Date(),
payment_date: new Date(), payment_date: new Date(),
creator_counter_no: first_transaction.creator_counter_no, creator_counter_no: first_transaction.creator_counter_no,
payment_type: first_transaction.payment_type_counter, payment_type: first_transaction.payment_type,
payment_type_counter: first_transaction.payment_type_counter,
payment_type_method_id: first_transaction.payment_type_method_id, payment_type_method_id: first_transaction.payment_type_method_id,
payment_type_method_number: payment_type_method_number:
first_transaction.payment_type_method_number, first_transaction.payment_type_method_number,

View File

@ -29,7 +29,7 @@ export class RefundItemModel
// transaction to transaction item // transaction to transaction item
@Column('varchar', { name: 'transaction_item_id', nullable: true }) @Column('varchar', { name: 'transaction_item_id', nullable: true })
transaction_item_id: string; transaction_item_id: string;
@ManyToOne(() => TransactionItemModel, (model) => model.refunds, { @OneToOne(() => TransactionItemModel, (model) => model.refund, {
onDelete: 'CASCADE', onDelete: 'CASCADE',
onUpdate: 'CASCADE', onUpdate: 'CASCADE',
}) })

View File

@ -1,6 +1,6 @@
import { TABLE_NAME } from 'src/core/strings/constants/table.constants'; import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
import { RefundEntity } from '../../domain/entities/refund.entity'; import { RefundEntity } from '../../domain/entities/refund.entity';
import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from 'typeorm'; import { Column, Entity, JoinColumn, OneToMany, OneToOne } from 'typeorm';
import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model'; import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model';
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model'; import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
import { RefundItemModel } from './refund-item.model'; import { RefundItemModel } from './refund-item.model';
@ -64,7 +64,7 @@ export class RefundModel
// relation to transaction // relation to transaction
@Column('varchar', { name: 'transaction_id', nullable: true }) @Column('varchar', { name: 'transaction_id', nullable: true })
transaction_id: string; transaction_id: string;
@ManyToOne(() => TransactionModel, (model) => model.refunds, { @OneToOne(() => TransactionModel, (model) => model.refund, {
onDelete: 'CASCADE', onDelete: 'CASCADE',
onUpdate: 'CASCADE', onUpdate: 'CASCADE',
}) })

View File

@ -38,6 +38,7 @@ export class BatchConfirmRefundManager extends BaseBatchUpdateStatusManager<Refu
if (this.data.status == STATUS.DRAFT) { if (this.data.status == STATUS.DRAFT) {
Object.assign(this.data, { Object.assign(this.data, {
code: `RF-${data?.['transaction']?.invoice_code.split('-')[1]}`,
request_date: new Date(), request_date: new Date(),
status: STATUS.PENDING, status: STATUS.PENDING,
}); });

View File

@ -53,6 +53,7 @@ export class ConfirmRefundManager extends BaseUpdateStatusManager<RefundEntity>
if (data.status == STATUS.DRAFT) { if (data.status == STATUS.DRAFT) {
Object.assign(this.data, { Object.assign(this.data, {
code: `RF-${data.transaction?.invoice_code?.split('-')[1]}`,
request_date: new Date(), request_date: new Date(),
status: STATUS.PENDING, status: STATUS.PENDING,
}); });

View File

@ -13,8 +13,6 @@ import { RefundModel } from '../../../data/models/refund.model';
import { BaseCreateManager } from 'src/core/modules/domain/usecase/managers/base-create.manager'; import { BaseCreateManager } from 'src/core/modules/domain/usecase/managers/base-create.manager';
import { RefundCreatedEvent } from '../../entities/event/refund-created.event'; import { RefundCreatedEvent } from '../../entities/event/refund-created.event';
import { STATUS } from 'src/core/strings/constants/base.constants'; import { STATUS } from 'src/core/strings/constants/base.constants';
import { In, Not } from 'typeorm';
import { generateInvoiceCodeHelper } from 'src/modules/transaction/transaction/domain/usecases/managers/helpers/generate-invoice-code.helper';
@Injectable() @Injectable()
export class CreateRefundManager extends BaseCreateManager<RefundEntity> { export class CreateRefundManager extends BaseCreateManager<RefundEntity> {
@ -28,10 +26,13 @@ export class CreateRefundManager extends BaseCreateManager<RefundEntity> {
}; };
}); });
Object.assign(this.data, {
refund_items: refund_items,
});
const exist = await this.dataService.getOneByOptions({ const exist = await this.dataService.getOneByOptions({
where: { where: {
transaction_id: this.data.transaction.id, transaction_id: this.data.transaction.id,
status: Not(In([STATUS.CANCEL])),
}, },
}); });
if (exist) { if (exist) {
@ -56,11 +57,6 @@ export class CreateRefundManager extends BaseCreateManager<RefundEntity> {
error: 'Unprocessable Entity', error: 'Unprocessable Entity',
}); });
} }
Object.assign(this.data, {
refund_items: refund_items,
code: await generateInvoiceCodeHelper(this.dataService, 'RF'),
});
return; return;
} }

View File

@ -15,7 +15,7 @@ export class DetailRefundManager extends BaseDetailManager<RefundEntity> {
} }
async afterProcess(): Promise<void> { async afterProcess(): Promise<void> {
mappingTransaction(this.result['transaction'], this.dataId); mappingTransaction(this.result['transaction']);
return; return;
} }
@ -25,12 +25,7 @@ export class DetailRefundManager extends BaseDetailManager<RefundEntity> {
joinRelations: [], joinRelations: [],
// relation join and select (relasi yang ingin ditampilkan), // relation join and select (relasi yang ingin ditampilkan),
selectRelations: [ selectRelations: ['transaction', 'transaction.items', 'items.refund'],
'transaction',
'transaction.items',
'items.refunds item_refunds',
'item_refunds.refund item_refunds_refund',
],
// relation yang hanya ingin dihitung (akan return number) // relation yang hanya ingin dihitung (akan return number)
countRelations: [], countRelations: [],
@ -60,9 +55,7 @@ export class DetailRefundManager extends BaseDetailManager<RefundEntity> {
'transaction', 'transaction',
'items', 'items',
'item_refunds', 'refund',
'item_refunds_refund.id',
'item_refunds_refund.status',
]; ];
} }

View File

@ -12,10 +12,25 @@ import {
columnUniques, columnUniques,
validateRelations, validateRelations,
} from 'src/core/strings/constants/interface.constants'; } from 'src/core/strings/constants/interface.constants';
import { STATUS } from 'src/core/strings/constants/base.constants';
@Injectable() @Injectable()
export class UpdateRefundManager extends BaseUpdateManager<RefundEntity> { export class UpdateRefundManager extends BaseUpdateManager<RefundEntity> {
async validateProcess(): Promise<void> { async validateProcess(): Promise<void> {
const transaction = await this.dataServiceFirstOpt.getOneByOptions({
where: {
id: this.data.transaction.id,
status: STATUS.SETTLED,
},
});
if (!transaction) {
throw new UnprocessableEntityException({
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
message: `Gagal! hanya pemesanan dengan status ${STATUS.SETTLED} yang dapat dikembalikan`,
error: 'Unprocessable Entity',
});
}
return; return;
} }

View File

@ -1,5 +1,5 @@
import { TABLE_NAME } from 'src/core/strings/constants/table.constants'; import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from 'typeorm'; import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from 'typeorm';
import { BaseCoreModel } from 'src/core/modules/data/model/base-core.model'; import { BaseCoreModel } from 'src/core/modules/data/model/base-core.model';
import { TransactionItemEntity } from '../../domain/entities/transaction-item.entity'; import { TransactionItemEntity } from '../../domain/entities/transaction-item.entity';
import { TransactionModel } from './transaction.model'; import { TransactionModel } from './transaction.model';
@ -80,10 +80,10 @@ export class TransactionItemModel
transaction: TransactionModel; transaction: TransactionModel;
// relations to refund // relations to refund
@OneToMany(() => RefundItemModel, (model) => model.transaction_item, { @OneToOne(() => RefundItemModel, (model) => model.transaction_item, {
cascade: true, cascade: true,
onDelete: 'CASCADE', onDelete: 'CASCADE',
onUpdate: 'CASCADE', onUpdate: 'CASCADE',
}) })
refunds: RefundItemModel[]; refund: RefundItemModel;
} }

View File

@ -1,6 +1,6 @@
import { TABLE_NAME } from 'src/core/strings/constants/table.constants'; import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
import { TransactionEntity } from '../../domain/entities/transaction.entity'; import { TransactionEntity } from '../../domain/entities/transaction.entity';
import { Column, Entity, OneToMany } from 'typeorm'; import { Column, Entity, OneToMany, OneToOne } from 'typeorm';
import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model'; import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model';
import { import {
TransactionType, TransactionType,
@ -107,13 +107,6 @@ export class TransactionModel
}) })
payment_type: TransactionPaymentType; payment_type: TransactionPaymentType;
@Column('enum', {
name: 'payment_type_counter',
enum: TransactionPaymentType,
nullable: true,
})
payment_type_counter: TransactionPaymentType;
@Column('varchar', { name: 'payment_code', nullable: true }) @Column('varchar', { name: 'payment_code', nullable: true })
payment_code: string; payment_code: string;
@ -240,10 +233,10 @@ export class TransactionModel
taxes: TransactionTaxModel[]; taxes: TransactionTaxModel[];
// relations to refund // relations to refund
@OneToMany(() => RefundModel, (model) => model.transaction, { @OneToOne(() => RefundModel, (model) => model.transaction, {
cascade: true, cascade: true,
onDelete: 'CASCADE', onDelete: 'CASCADE',
onUpdate: 'CASCADE', onUpdate: 'CASCADE',
}) })
refunds: RefundModel[]; refund: RefundModel;
} }

View File

@ -41,7 +41,6 @@ export interface TransactionEntity extends BaseStatusEntity {
// payment data // payment data
payment_type: TransactionPaymentType; payment_type: TransactionPaymentType;
payment_type_counter: TransactionPaymentType;
payment_type_method_id: string; payment_type_method_id: string;
payment_type_method_name: string; payment_type_method_name: string;
payment_type_method_number: string; payment_type_method_number: string;

View File

@ -37,59 +37,57 @@ export class SettledTransactionHandler
relations: ['items'], relations: ['items'],
}); });
if (settled || oldSettled) { if (!settled || !oldSettled) return;
const queryRunner = this.dataService
.getRepository()
.manager.connection.createQueryRunner();
if (settled) { const queryRunner = this.dataService
const profit_formula = await this.formulaService.getOneByOptions({ .getRepository()
where: { .manager.connection.createQueryRunner();
type: FormulaType.PROFIT_SHARE,
},
});
const sales_price = await this.formulaService.getOneByOptions({ if (settled) {
where: { const profit_formula = await this.formulaService.getOneByOptions({
type: FormulaType.SALES_PRICE, where: {
}, type: FormulaType.PROFIT_SHARE,
}); },
});
const taxes = await this.taxService.getManyByOptions({ const sales_price = await this.formulaService.getOneByOptions({
where: { where: {
status: STATUS.ACTIVE, type: FormulaType.SALES_PRICE,
}, },
}); });
// const profit_share_value = this.calculateFormula(profit_formula.formula_string, taxes, data.payment_total_net_profit ?? 0); const taxes = await this.taxService.getManyByOptions({
const { dpp_value, tax_datas } = calculateSalesFormula( where: {
sales_price.formula_string, status: STATUS.ACTIVE,
taxes, },
data.payment_total_net_profit ?? 0, });
);
console.log(data, 'dsa'); // const profit_share_value = this.calculateFormula(profit_formula.formula_string, taxes, data.payment_total_net_profit ?? 0);
const google_calendar = await CreateEventCalendarHelper(data); const { dpp_value, tax_datas } = calculateSalesFormula(
sales_price.formula_string,
taxes,
data.payment_total_net_profit ?? 0,
);
Object.assign(data, { const google_calendar = await CreateEventCalendarHelper(data);
payment_total_dpp: dpp_value,
profit_share_formula: profit_formula.formula_string,
sales_price_formula: sales_price.formula_string,
taxes: tax_datas,
calendar_id: google_calendar?.id,
calendar_link: google_calendar?.htmlLink,
});
} else if (oldSettled) {
console.log(data, 'data oldSettled');
const google_calendar = await CreateEventCalendarHelper(data);
Object.assign(data, { Object.assign(data, {
calendar_id: null, payment_total_dpp: dpp_value,
calendar_link: null, profit_share_formula: profit_formula.formula_string,
}); sales_price_formula: sales_price.formula_string,
} taxes: tax_datas,
calendar_id: google_calendar?.id,
calendar_link: google_calendar?.htmlLink,
});
} else if (oldSettled) {
const google_calendar = await CreateEventCalendarHelper(data);
await this.dataService.create(queryRunner, TransactionModel, data); Object.assign(data, {
calendar_id: null,
calendar_link: null,
});
} }
await this.dataService.create(queryRunner, TransactionModel, data);
} }
} }

View File

@ -11,7 +11,7 @@ import { TransactionChangeStatusEvent } from '../../entities/event/transaction-c
@Injectable() @Injectable()
export class ActiveTransactionManager extends BaseUpdateStatusManager<TransactionEntity> { export class ActiveTransactionManager extends BaseUpdateStatusManager<TransactionEntity> {
getResult(): string { getResult(): string {
return `Success ${this.dataStatus} data ${this.result.invoice_code}`; return `Success active data ${this.result.invoice_code}`;
} }
async validateProcess(): Promise<void> { async validateProcess(): Promise<void> {

View File

@ -16,11 +16,11 @@ import { STATUS } from 'src/core/strings/constants/base.constants';
@Injectable() @Injectable()
export class CancelTransactionManager extends BaseUpdateStatusManager<TransactionEntity> { export class CancelTransactionManager extends BaseUpdateStatusManager<TransactionEntity> {
getResult(): string { getResult(): string {
return `Success ${this.dataStatus} data ${this.result.invoice_code}`; return `Success active data ${this.result.invoice_code}`;
} }
async validateProcess(): Promise<void> { async validateProcess(): Promise<void> {
if (![STATUS.EXPIRED, STATUS.PENDING].includes(this.oldData.status)) { if (![STATUS.EXPIRED, STATUS.PENDING].includes(this.data.status)) {
throw new UnprocessableEntityException({ throw new UnprocessableEntityException({
statusCode: HttpStatus.UNPROCESSABLE_ENTITY, statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
message: `Gagal! hanya tranksaksi dengan status ${STATUS.PENDING} dan ${STATUS.EXPIRED} yang dapat di${this.dataStatus}`, message: `Gagal! hanya tranksaksi dengan status ${STATUS.PENDING} dan ${STATUS.EXPIRED} yang dapat di${this.dataStatus}`,

View File

@ -25,12 +25,7 @@ export class DetailTransactionManager extends BaseDetailManager<TransactionEntit
joinRelations: [], joinRelations: [],
// relation join and select (relasi yang ingin ditampilkan), // relation join and select (relasi yang ingin ditampilkan),
selectRelations: [ selectRelations: ['items', 'items.refund item_refund', 'refund'],
'items',
'items.refunds item_refunds',
'item_refunds.refund item_refunds_refund',
'refunds',
],
// relation yang hanya ingin dihitung (akan return number) // relation yang hanya ingin dihitung (akan return number)
countRelations: [], countRelations: [],
@ -67,7 +62,6 @@ export class DetailTransactionManager extends BaseDetailManager<TransactionEntit
`${this.tableName}.discount_value`, `${this.tableName}.discount_value`,
`${this.tableName}.payment_type`, `${this.tableName}.payment_type`,
`${this.tableName}.payment_type_counter`,
`${this.tableName}.payment_date`, `${this.tableName}.payment_date`,
`${this.tableName}.payment_total_pay`, `${this.tableName}.payment_total_pay`,
`${this.tableName}.payment_type_method_id`, `${this.tableName}.payment_type_method_id`,
@ -82,11 +76,8 @@ export class DetailTransactionManager extends BaseDetailManager<TransactionEntit
`${this.tableName}.payment_total`, `${this.tableName}.payment_total`,
'items', 'items',
'item_refunds', 'item_refund',
'item_refunds_refund.id', 'refund',
'item_refunds_refund.status',
'refunds',
]; ];
} }

View File

@ -12,12 +12,6 @@ export async function generateInvoiceCodeHelper(dataService, code) {
invoice_code: ILike(`%${month_year}%`), invoice_code: ILike(`%${month_year}%`),
}; };
if (code == 'RF') {
query = {
code: ILike(`%${month_year}%`),
};
}
if (code == 'PYM') { if (code == 'PYM') {
query = { query = {
payment_code: ILike(`%${month_year}%`), payment_code: ILike(`%${month_year}%`),

View File

@ -4,7 +4,7 @@ import {
TransactionType, TransactionType,
} from 'src/modules/transaction/transaction/constants'; } from 'src/modules/transaction/transaction/constants';
export function mappingTransaction(data, refundId?: string) { export function mappingTransaction(data) {
let payment_type_bank: any = null; let payment_type_bank: any = null;
const season_period = { const season_period = {
id: data.season_period_id, id: data.season_period_id,
@ -26,9 +26,6 @@ export function mappingTransaction(data, refundId?: string) {
const items = data?.['items']?.map((itemData) => { const items = data?.['items']?.map((itemData) => {
let tenant; let tenant;
let refund = itemData.refunds?.find(
(item) => ![STATUS.CANCEL].includes(item.refund.status),
);
if (itemData.item_tenant_id) { if (itemData.item_tenant_id) {
tenant = { tenant = {
@ -38,9 +35,6 @@ export function mappingTransaction(data, refundId?: string) {
}; };
} }
if (refundId)
refund = itemData.refunds?.find((item) => item.refund.id == refundId);
return { return {
item: { item: {
id: itemData.item_id, id: itemData.item_id,
@ -55,27 +49,20 @@ export function mappingTransaction(data, refundId?: string) {
}, },
}, },
id: itemData.id, id: itemData.id,
refund: refund, refund: itemData.refund,
qty: itemData.qty, qty: itemData.qty,
qty_remaining: itemData.qty_remaining, qty_remaining: itemData.qty_remaining,
total_price_refund: refund?.refund_total ?? 0, total_price_refund: itemData.refund?.refund_total ?? 0,
total_price: itemData.total_price, total_price: itemData.total_price,
}; };
}); });
const refund = data.refunds?.find(
(refund) => ![STATUS.CANCEL].includes(refund.status),
);
Object.assign(data, { Object.assign(data, {
season_period: season_period, season_period: season_period,
items: items, items: items,
payment_type_bank: payment_type_bank, payment_type_bank: payment_type_bank,
refund: refund,
}); });
delete data.refunds;
delete data.season_period_id; delete data.season_period_id;
delete data.season_period_name; delete data.season_period_name;
delete data.season_period_type_id; delete data.season_period_type_id;
@ -98,7 +85,6 @@ export function mappingRevertTransaction(data, type) {
}); });
} else { } else {
Object.assign(data, { Object.assign(data, {
type: type,
creator_id: data.pos_admin?.id, creator_id: data.pos_admin?.id,
creator_name: data.pos_admin?.name, creator_name: data.pos_admin?.name,
invoice_code: data.code, invoice_code: data.code,
@ -108,11 +94,11 @@ export function mappingRevertTransaction(data, type) {
Object.assign(data, { Object.assign(data, {
id: data.booking_id ?? data._id, id: data.booking_id ?? data._id,
creator_counter_no: Number(data.pos_number), creator_counter_no: Number(data.pos_number),
status: STATUS.SETTLED,
settlement_date: new Date(data.created_at), settlement_date: new Date(data.created_at),
payment_date: new Date(data.created_at), payment_date: new Date(data.created_at),
invoice_date: new Date(data.created_at), invoice_date: new Date(data.created_at),
payment_type: TransactionPaymentType.COUNTER, payment_type:
payment_type_counter:
data.payment_type == 'cc' data.payment_type == 'cc'
? TransactionPaymentType.CC ? TransactionPaymentType.CC
: data.payment_type, : data.payment_type,
@ -123,12 +109,13 @@ export function mappingRevertTransaction(data, type) {
discount_percentage: data.discount_code?.discount, discount_percentage: data.discount_code?.discount,
}); });
} else { } else {
Object.assign(data, { // Object.assign(data, {
type: type, // payment_type:
}); // })
} }
Object.assign(data, { Object.assign(data, {
type: type,
payment_total_net_profit: data.payment_total, payment_total_net_profit: data.payment_total,
customer_category_id: data.customer_category?.id ?? null, customer_category_id: data.customer_category?.id ?? null,
customer_category_name: data.customer_category?.name ?? null, customer_category_name: data.customer_category?.name ?? null,

View File

@ -7,7 +7,6 @@ import {
RelationParam, RelationParam,
} from 'src/core/modules/domain/entities/base-filter.entity'; } from 'src/core/modules/domain/entities/base-filter.entity';
import { BetweenQueryHelper } from 'src/core/helpers/query/between-query.helper'; import { BetweenQueryHelper } from 'src/core/helpers/query/between-query.helper';
import { STATUS } from 'src/core/strings/constants/base.constants';
@Injectable() @Injectable()
export class IndexTransactionManager extends BaseIndexManager<TransactionEntity> { export class IndexTransactionManager extends BaseIndexManager<TransactionEntity> {
@ -21,16 +20,12 @@ export class IndexTransactionManager extends BaseIndexManager<TransactionEntity>
async afterProcess(): Promise<void> { async afterProcess(): Promise<void> {
this.result?.data?.map((item) => { this.result?.data?.map((item) => {
const activeRefund = item['refunds'].find(
(refund) => ![STATUS.CANCEL].includes(refund.status),
);
Object.assign(item, { Object.assign(item, {
refund_code: activeRefund?.code ?? null, refund_code: item['refund']?.code ?? null,
refund_date: activeRefund?.refund_date ?? null, refund_date: item['refund']?.refund_date ?? null,
}); });
delete item['refunds']; delete item['refund'];
}); });
return; return;
} }
@ -41,7 +36,7 @@ export class IndexTransactionManager extends BaseIndexManager<TransactionEntity>
joinRelations: [], joinRelations: [],
// relation join and select (relasi yang ingin ditampilkan), // relation join and select (relasi yang ingin ditampilkan),
selectRelations: ['items', 'refunds'], selectRelations: ['items', 'refund'],
// relation yang hanya ingin dihitung (akan return number) // relation yang hanya ingin dihitung (akan return number)
countRelations: [], countRelations: [],
@ -75,17 +70,16 @@ export class IndexTransactionManager extends BaseIndexManager<TransactionEntity>
`${this.tableName}.payment_code`, `${this.tableName}.payment_code`,
`${this.tableName}.payment_card_information`, `${this.tableName}.payment_card_information`,
`${this.tableName}.payment_type`, `${this.tableName}.payment_type`,
`${this.tableName}.payment_type_counter`,
`${this.tableName}.payment_date`, `${this.tableName}.payment_date`,
`${this.tableName}.payment_total_pay`, `${this.tableName}.payment_total_pay`,
`${this.tableName}.payment_type_method_id`, `${this.tableName}.payment_type_method_id`,
`${this.tableName}.payment_type_method_name`, `${this.tableName}.payment_type_method_name`,
`${this.tableName}.payment_type_method_number`, `${this.tableName}.payment_type_method_number`,
`refunds.id`, `refund.id`,
`refunds.code`, `refund.code`,
`refunds.refund_date`, `refund.refund_date`,
`refunds.request_date`, `refund.request_date`,
]; ];
} }