feat: fixed midtrans

pull/69/head
Firman Ramdhani 2024-08-12 19:26:39 +07:00
parent aaf6f97e57
commit b9b1695dc5
1 changed files with 5 additions and 5 deletions

View File

@ -99,7 +99,7 @@ export class ChangeStatusBookingHandler
}); });
mappingTransaction(booking); mappingTransaction(booking);
console.log({ dataID, couchData, booking }); console.log('change status', { dataID, couchData, booking });
if (!couchData) { if (!couchData) {
console.log('save data to couch'); console.log('save data to couch');
@ -134,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(
{ {