Compare commits
No commits in common. "3678353f346a4779873266f8cb33b97bc088d0bc" and "bd13f50bc090344af08d7ab874b4485f591b8f06" have entirely different histories.
3678353f34
...
bd13f50bc0
|
@ -11,6 +11,7 @@ import { TransactionChangeStatusEvent } from '../../entities/event/transaction-c
|
|||
import * as _ from 'lodash';
|
||||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||
import { generateInvoiceCodeHelper } from '../managers/helpers/generate-invoice-code.helper';
|
||||
import { apm } from 'src/core/apm';
|
||||
|
||||
@EventsHandler(MidtransCallbackEvent)
|
||||
export class MidtransCallbackHandler
|
||||
|
@ -22,6 +23,11 @@ export class MidtransCallbackHandler
|
|||
) {}
|
||||
|
||||
async handle(event: MidtransCallbackEvent) {
|
||||
const apmTransactions = apm.startTransaction(
|
||||
`callback-midtrans`,
|
||||
'handler',
|
||||
);
|
||||
|
||||
const data_id = event.data.id;
|
||||
const data = event.data.data;
|
||||
let old_data = undefined;
|
||||
|
@ -33,6 +39,8 @@ export class MidtransCallbackHandler
|
|||
});
|
||||
old_data = _.cloneDeep(transaction);
|
||||
|
||||
apmTransactions.setLabel('status', data.transaction_status);
|
||||
|
||||
if (['capture', 'settlement'].includes(data.transaction_status)) {
|
||||
Object.assign(transaction, {
|
||||
status: STATUS.SETTLED,
|
||||
|
@ -83,5 +91,7 @@ export class MidtransCallbackHandler
|
|||
op: OPERATION.UPDATE,
|
||||
}),
|
||||
);
|
||||
|
||||
apmTransactions.end();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue