fix(SPG-697) Pada index booking seharusnya transaksi pos tidak muncul, dan sesuaikan alur booking dengan pembayaran counter
parent
dc6476a66f
commit
c6be42299e
|
@ -0,0 +1,25 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
|
export class UpdateColumnToTransactionTable1722334034920
|
||||||
|
implements MigrationInterface
|
||||||
|
{
|
||||||
|
name = 'UpdateColumnToTransactionTable1722334034920';
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "transaction_items" ADD "qr_image_url" character varying`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "transactions" ADD "payment_code" character varying`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "transactions" DROP COLUMN "payment_code"`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "transaction_items" DROP COLUMN "qr_image_url"`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,10 +19,7 @@ export class BatchConfirmReconciliationManager extends BaseBatchUpdateStatusMana
|
||||||
reconciliation_confirm_date: new Date().getTime(),
|
reconciliation_confirm_date: new Date().getTime(),
|
||||||
status: STATUS.SETTLED,
|
status: STATUS.SETTLED,
|
||||||
reconciliation_status: this.dataStatus,
|
reconciliation_status: this.dataStatus,
|
||||||
payment_code_reference: await generateInvoiceCodeHelper(
|
payment_code: await generateInvoiceCodeHelper(this.dataService, 'PMY'),
|
||||||
this.dataService,
|
|
||||||
'PMY',
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,7 @@ export class ConfirmReconciliationManager extends BaseUpdateStatusManager<Transa
|
||||||
reconciliation_confirm_date: new Date().getTime(),
|
reconciliation_confirm_date: new Date().getTime(),
|
||||||
status: STATUS.SETTLED,
|
status: STATUS.SETTLED,
|
||||||
reconciliation_status: this.dataStatus,
|
reconciliation_status: this.dataStatus,
|
||||||
payment_code_reference: await generateInvoiceCodeHelper(
|
payment_code: await generateInvoiceCodeHelper(this.dataService, 'PMY'),
|
||||||
this.dataService,
|
|
||||||
'PMY',
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -40,6 +40,7 @@ export class DetailReconciliationManager extends BaseDetailManager<TransactionEn
|
||||||
`${this.tableName}.payment_type_method_name`,
|
`${this.tableName}.payment_type_method_name`,
|
||||||
`${this.tableName}.payment_type_method_number`,
|
`${this.tableName}.payment_type_method_number`,
|
||||||
`${this.tableName}.payment_code_reference`,
|
`${this.tableName}.payment_code_reference`,
|
||||||
|
`${this.tableName}.payment_code`,
|
||||||
`${this.tableName}.payment_date`,
|
`${this.tableName}.payment_date`,
|
||||||
|
|
||||||
`${this.tableName}.payment_total`,
|
`${this.tableName}.payment_total`,
|
||||||
|
|
|
@ -53,6 +53,7 @@ export class IndexReconciliationManager extends BaseIndexManager<TransactionEnti
|
||||||
`${this.tableName}.payment_type_method_name`,
|
`${this.tableName}.payment_type_method_name`,
|
||||||
`${this.tableName}.payment_type_method_number`,
|
`${this.tableName}.payment_type_method_number`,
|
||||||
`${this.tableName}.payment_code_reference`,
|
`${this.tableName}.payment_code_reference`,
|
||||||
|
`${this.tableName}.payment_code`,
|
||||||
`${this.tableName}.payment_date`,
|
`${this.tableName}.payment_date`,
|
||||||
|
|
||||||
`${this.tableName}.payment_total`,
|
`${this.tableName}.payment_total`,
|
||||||
|
|
|
@ -14,6 +14,9 @@ export class TransactionItemModel
|
||||||
@Column('varchar', { name: 'item_id', nullable: true })
|
@Column('varchar', { name: 'item_id', nullable: true })
|
||||||
item_id: string;
|
item_id: string;
|
||||||
|
|
||||||
|
@Column('varchar', { name: 'qr_image_url', nullable: true })
|
||||||
|
qr_image_url: string;
|
||||||
|
|
||||||
@Column('varchar', { name: 'item_name', nullable: true })
|
@Column('varchar', { name: 'item_name', nullable: true })
|
||||||
item_name: string;
|
item_name: string;
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,9 @@ export class TransactionModel
|
||||||
})
|
})
|
||||||
payment_type: TransactionPaymentType;
|
payment_type: TransactionPaymentType;
|
||||||
|
|
||||||
|
@Column('varchar', { name: 'payment_code', nullable: true })
|
||||||
|
payment_code: string;
|
||||||
|
|
||||||
@Column('varchar', { name: 'payment_type_method_id', nullable: true })
|
@Column('varchar', { name: 'payment_type_method_id', nullable: true })
|
||||||
payment_type_method_id: string;
|
payment_type_method_id: string;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ export interface TransactionItemEntity extends BaseCoreEntity {
|
||||||
item_category_id: string;
|
item_category_id: string;
|
||||||
item_category_name: string;
|
item_category_name: string;
|
||||||
item_bundlings: string;
|
item_bundlings: string;
|
||||||
|
qr_image_url: string;
|
||||||
|
|
||||||
// item tenant data
|
// item tenant data
|
||||||
item_tenant_id: string;
|
item_tenant_id: string;
|
||||||
|
|
|
@ -47,6 +47,7 @@ export interface TransactionEntity extends BaseStatusEntity {
|
||||||
payment_type_method_qr: string;
|
payment_type_method_qr: string;
|
||||||
payment_card_information: string;
|
payment_card_information: string;
|
||||||
payment_code_reference: string;
|
payment_code_reference: string;
|
||||||
|
payment_code: string;
|
||||||
payment_midtrans_token: string;
|
payment_midtrans_token: string;
|
||||||
payment_midtrans_url: string;
|
payment_midtrans_url: string;
|
||||||
payment_date: Date;
|
payment_date: Date;
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
import { TransactionChangeStatusEvent } from '../../entities/event/transaction-change-status.event';
|
import { TransactionChangeStatusEvent } from '../../entities/event/transaction-change-status.event';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||||
|
import { generateInvoiceCodeHelper } from '../managers/helpers/generate-invoice-code.helper';
|
||||||
|
|
||||||
@EventsHandler(MidtransCallbackEvent)
|
@EventsHandler(MidtransCallbackEvent)
|
||||||
export class MidtransCallbackHandler
|
export class MidtransCallbackHandler
|
||||||
|
@ -36,6 +37,7 @@ export class MidtransCallbackHandler
|
||||||
Object.assign(transaction, {
|
Object.assign(transaction, {
|
||||||
status: STATUS.SETTLED,
|
status: STATUS.SETTLED,
|
||||||
settlement_date: new Date(data.settlement_time),
|
settlement_date: new Date(data.settlement_time),
|
||||||
|
payment_code: await generateInvoiceCodeHelper(this.dataService, 'PMY'),
|
||||||
payment_code_reference: data.approval_code,
|
payment_code_reference: data.approval_code,
|
||||||
});
|
});
|
||||||
} else if (['pending'].includes(data['transaction_status'])) {
|
} else if (['pending'].includes(data['transaction_status'])) {
|
||||||
|
|
|
@ -56,10 +56,7 @@ export class ConfirmTransactionManager extends BaseUpdateStatusManager<Transacti
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(this.data, {
|
Object.assign(this.data, {
|
||||||
invoice_code:
|
invoice_code: await generateInvoiceCodeHelper(this.dataService, 'INV'),
|
||||||
this.data.payment_type == TransactionPaymentType.COUNTER
|
|
||||||
? null
|
|
||||||
: await generateInvoiceCodeHelper(this.dataService, 'INV'),
|
|
||||||
status: freeTransaction ? STATUS.ACTIVE : STATUS.PENDING,
|
status: freeTransaction ? STATUS.ACTIVE : STATUS.PENDING,
|
||||||
invoice_date: new Date(),
|
invoice_date: new Date(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -69,6 +69,7 @@ export class DetailTransactionManager extends BaseDetailManager<TransactionEntit
|
||||||
`${this.tableName}.payment_type_method_number`,
|
`${this.tableName}.payment_type_method_number`,
|
||||||
`${this.tableName}.payment_card_information`,
|
`${this.tableName}.payment_card_information`,
|
||||||
`${this.tableName}.payment_code_reference`,
|
`${this.tableName}.payment_code_reference`,
|
||||||
|
`${this.tableName}.payment_code`,
|
||||||
|
|
||||||
`${this.tableName}.payment_sub_total`,
|
`${this.tableName}.payment_sub_total`,
|
||||||
`${this.tableName}.payment_discount_total`,
|
`${this.tableName}.payment_discount_total`,
|
||||||
|
|
|
@ -14,7 +14,7 @@ export async function generateInvoiceCodeHelper(dataService, code) {
|
||||||
|
|
||||||
if (code == 'PYM') {
|
if (code == 'PYM') {
|
||||||
query = {
|
query = {
|
||||||
payment_code_reference: ILike(`%${month_year}%`),
|
payment_code: ILike(`%${month_year}%`),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ export function mappingTransaction(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,
|
||||||
payment_code: data.payment_code_reference,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
delete data.season_period_id;
|
delete data.season_period_id;
|
||||||
|
@ -82,17 +81,18 @@ export function mappingRevertTransaction(data, type) {
|
||||||
editor_id: data.pos_admin?.id,
|
editor_id: data.pos_admin?.id,
|
||||||
editor_name: data.pos_admin?.name,
|
editor_name: data.pos_admin?.name,
|
||||||
edited_at: new Date(data.created_at),
|
edited_at: new Date(data.created_at),
|
||||||
|
payment_code: data.code,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Object.assign(data, {
|
Object.assign(data, {
|
||||||
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,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(data, {
|
Object.assign(data, {
|
||||||
id: data.booking_id ?? data._id,
|
id: data.booking_id ?? data._id,
|
||||||
invoice_code: data.code,
|
|
||||||
creator_counter_no: Number(data.pos_number),
|
creator_counter_no: Number(data.pos_number),
|
||||||
status: STATUS.SETTLED,
|
status: STATUS.SETTLED,
|
||||||
settlement_date: new Date(data.created_at),
|
settlement_date: new Date(data.created_at),
|
||||||
|
|
|
@ -67,6 +67,8 @@ export class IndexTransactionManager extends BaseIndexManager<TransactionEntity>
|
||||||
`${this.tableName}.editor_id`,
|
`${this.tableName}.editor_id`,
|
||||||
`${this.tableName}.editor_name`,
|
`${this.tableName}.editor_name`,
|
||||||
|
|
||||||
|
`${this.tableName}.payment_code`,
|
||||||
|
`${this.tableName}.payment_card_information`,
|
||||||
`${this.tableName}.payment_type`,
|
`${this.tableName}.payment_type`,
|
||||||
`${this.tableName}.payment_date`,
|
`${this.tableName}.payment_date`,
|
||||||
`${this.tableName}.payment_total_pay`,
|
`${this.tableName}.payment_total_pay`,
|
||||||
|
|
Loading…
Reference in New Issue