fix: cancel data payment
parent
88cc9f4bc3
commit
f4939ffe89
|
@ -88,14 +88,16 @@ export function mappingTransaction(data, refundId?: string) {
|
|||
}
|
||||
|
||||
export function mappingRevertTransaction(data, type) {
|
||||
const { status } = data;
|
||||
const isCancel = status == STATUS.CANCEL;
|
||||
if (type == TransactionType.COUNTER) {
|
||||
if (data.booking_id) {
|
||||
Object.assign(data, {
|
||||
editor_id: data.pos_admin?.id,
|
||||
editor_name: data.pos_admin?.name,
|
||||
edited_at: new Date(data.created_at),
|
||||
payment_code: data.status == STATUS.CANCEL ? null : data.code,
|
||||
status: data.status == STATUS.CANCEL ? STATUS.PENDING : data.status,
|
||||
payment_code: isCancel ? null : data.code,
|
||||
status: isCancel ? STATUS.PENDING : data.status,
|
||||
});
|
||||
} else {
|
||||
Object.assign(data, {
|
||||
|
@ -110,8 +112,7 @@ export function mappingRevertTransaction(data, type) {
|
|||
id: data.booking_id ?? data._id,
|
||||
creator_counter_no: Number(data.pos_number),
|
||||
settlement_date: new Date(data.created_at),
|
||||
payment_date:
|
||||
data.status == STATUS.CANCEL ? null : new Date(data.created_at),
|
||||
payment_date: isCancel ? null : new Date(data.created_at),
|
||||
invoice_date: new Date(data.created_at),
|
||||
payment_type: TransactionPaymentType.COUNTER,
|
||||
payment_type_counter:
|
||||
|
@ -119,8 +120,7 @@ export function mappingRevertTransaction(data, type) {
|
|||
? TransactionPaymentType.CC
|
||||
: data.payment_type,
|
||||
payment_card_information: data.card_information,
|
||||
payment_code_reference:
|
||||
data.status == STATUS.CANCEL ? null : data.payment_code,
|
||||
payment_code_reference: isCancel ? null : data.payment_code,
|
||||
discount_code_id: data.discount_code?.id,
|
||||
discount_code: data.discount_code?.code,
|
||||
discount_percentage: data.discount_code?.discount,
|
||||
|
@ -131,7 +131,7 @@ export function mappingRevertTransaction(data, type) {
|
|||
});
|
||||
}
|
||||
|
||||
if (data.status != STATUS.CANCEL) {
|
||||
if (!isCancel) {
|
||||
Object.assign(data, {
|
||||
payment_type_method_id:
|
||||
data.payment_type_method?.id ?? data.payment_type_bank?.id,
|
||||
|
|
Loading…
Reference in New Issue