Merge branch 'development' of ssh://git.eigen.co.id:2222/eigen/pos-be into development
continuous-integration/drone/tag Build is passing
Details
continuous-integration/drone/tag Build is passing
Details
commit
88cc9f4bc3
|
@ -99,7 +99,10 @@ export class ChangeStatusBookingHandler
|
||||||
});
|
});
|
||||||
mappingTransaction(booking);
|
mappingTransaction(booking);
|
||||||
|
|
||||||
|
console.log('change status', { dataID, couchData, booking });
|
||||||
|
|
||||||
if (!couchData) {
|
if (!couchData) {
|
||||||
|
console.log('save data to couch');
|
||||||
await this.couchService.createDoc(
|
await this.couchService.createDoc(
|
||||||
{
|
{
|
||||||
_id: booking.id,
|
_id: booking.id,
|
||||||
|
@ -108,6 +111,7 @@ export class ChangeStatusBookingHandler
|
||||||
'booking',
|
'booking',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
console.log('update data to couch');
|
||||||
await this.couchService.updateDoc(
|
await this.couchService.updateDoc(
|
||||||
{
|
{
|
||||||
_id: booking.id,
|
_id: booking.id,
|
||||||
|
@ -130,18 +134,18 @@ export class BookingUpdateHandler
|
||||||
|
|
||||||
async handle(event: TransactionUpdatedEvent) {
|
async handle(event: TransactionUpdatedEvent) {
|
||||||
const data = event.data.data;
|
const data = event.data.data;
|
||||||
const dataID = data?.id;
|
const dataID = data?.id ?? data?.order_id;
|
||||||
|
|
||||||
const couchData = await this.couchService.getDoc(dataID, 'booking');
|
const couchData = await this.couchService.getDoc(dataID, 'booking');
|
||||||
|
console.log('update', { dataID, couchData });
|
||||||
if (couchData) {
|
if (couchData) {
|
||||||
const booking = await this.bookingService.getOneByOptions({
|
const booking = await this.bookingService.getOneByOptions({
|
||||||
where: {
|
where: {
|
||||||
id: data.id,
|
id: dataID,
|
||||||
},
|
},
|
||||||
relations: ['items'],
|
relations: ['items'],
|
||||||
});
|
});
|
||||||
|
console.log({ booking });
|
||||||
mappingTransaction(booking);
|
mappingTransaction(booking);
|
||||||
await this.couchService.updateDoc(
|
await this.couchService.updateDoc(
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,15 @@ export class MidtransCallbackHandler
|
||||||
.manager.connection.createQueryRunner();
|
.manager.connection.createQueryRunner();
|
||||||
|
|
||||||
await this.dataService.create(queryRunner, TransactionModel, transaction);
|
await this.dataService.create(queryRunner, TransactionModel, transaction);
|
||||||
|
console.log('update change status to tr', {
|
||||||
|
id: data_id,
|
||||||
|
old: old_data,
|
||||||
|
data: { ...data, status: transaction.status },
|
||||||
|
user: BLANK_USER,
|
||||||
|
description: 'Midtrans Callback',
|
||||||
|
module: TABLE_NAME.TRANSACTION,
|
||||||
|
op: OPERATION.UPDATE,
|
||||||
|
});
|
||||||
console.log({ data, old_data });
|
console.log({ data, old_data });
|
||||||
|
|
||||||
this.eventBus.publish(
|
this.eventBus.publish(
|
||||||
|
|
Loading…
Reference in New Issue