feat(SPG-818): fix condition transaction status change handler
parent
8dd36042eb
commit
b57da1d21a
|
@ -91,36 +91,36 @@ export class ChangeStatusBookingHandler
|
|||
const isFromCounter = data.payment_type == TransactionPaymentType.COUNTER;
|
||||
const dataID = data?.id;
|
||||
|
||||
if (!isFromCounter) {
|
||||
const couchData = await this.couchService.getDoc(dataID, 'booking');
|
||||
// if (!isFromCounter) {
|
||||
const couchData = await this.couchService.getDoc(dataID, 'booking');
|
||||
|
||||
const booking = await this.bookingService.getOneByOptions({
|
||||
where: {
|
||||
id: data.id,
|
||||
const booking = await this.bookingService.getOneByOptions({
|
||||
where: {
|
||||
id: data.id,
|
||||
},
|
||||
relations: ['items'],
|
||||
});
|
||||
mappingTransaction(booking);
|
||||
|
||||
if (!couchData) {
|
||||
await this.couchService.createDoc(
|
||||
{
|
||||
_id: booking.id,
|
||||
...booking,
|
||||
},
|
||||
relations: ['items'],
|
||||
});
|
||||
mappingTransaction(booking);
|
||||
|
||||
if (!couchData) {
|
||||
await this.couchService.createDoc(
|
||||
{
|
||||
_id: booking.id,
|
||||
...booking,
|
||||
},
|
||||
'booking',
|
||||
);
|
||||
} else {
|
||||
await this.couchService.updateDoc(
|
||||
{
|
||||
_id: booking.id,
|
||||
...booking,
|
||||
},
|
||||
'booking',
|
||||
);
|
||||
}
|
||||
'booking',
|
||||
);
|
||||
} else {
|
||||
await this.couchService.updateDoc(
|
||||
{
|
||||
_id: booking.id,
|
||||
...booking,
|
||||
},
|
||||
'booking',
|
||||
);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
@EventsHandler(TransactionUpdatedEvent)
|
||||
|
|
Loading…
Reference in New Issue