Skip to content

Commit 84cb669

Browse files
ShariqueSharique
authored andcommitted
fix: mtero 2.1.0 issue
1 parent b663590 commit 84cb669

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

mock-service/src/config/mock-config/TRV11/METRO/2.1.0/on_cancel/on_cancel_soft_technical/generator.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ function applyCancellation(quote: Quote, cancellationCharges: number): Quote {
220220
function removeTicketStops(order: any) {
221221
if (!order.fulfillments || !Array.isArray(order.fulfillments)) return order;
222222

223-
order.fulfillments = order.fulfillments
223+
order.fulfillments = order.fulfillments;
224224

225225
return order;
226226
}
@@ -239,7 +239,22 @@ export async function onCancelSoftTechnicalGenerator(
239239

240240
if (sessionData.fulfillments.length > 0) {
241241
existingPayload.message.order.fulfillments = sessionData.fulfillments;
242-
242+
if (sessionData?.flow_id === "TECHNICAL_CANCELLATION_FLOW") {
243+
existingPayload.message.order.fulfillments =
244+
existingPayload.message.order.fulfillments?.map((f: any) => {
245+
if (f.type === "TICKET") {
246+
return {
247+
...f,
248+
state: {
249+
descriptor: {
250+
code: "INACTIVE",
251+
},
252+
},
253+
};
254+
}
255+
return f;
256+
});
257+
}
243258
existingPayload.message.order = removeTicketStops(
244259
existingPayload.message.order,
245260
);
@@ -267,7 +282,7 @@ export async function onCancelSoftTechnicalGenerator(
267282
}
268283
const now = new Date().toISOString();
269284
existingPayload.message.order.created_at = sessionData.created_at;
270-
existingPayload.message.order.tags = sessionData?.tags?.flat()
285+
existingPayload.message.order.tags = sessionData?.tags?.flat();
271286

272287
//______SETTLEMENT_AMOUNT____________
273288
const tags = existingPayload?.message?.order?.tags;
@@ -320,7 +335,7 @@ export async function onCancelSoftTechnicalGenerator(
320335
if (settlementAmountItemBpp) {
321336
settlementAmountItemBpp.value = settlementAmount.toString();
322337
}
323-
338+
324339
existingPayload.message.order.updated_at = now;
325340
return existingPayload;
326341
}

mock-service/src/config/mock-config/TRV11/METRO/2.1.0/on_init/on_init_recharge/default.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ message:
118118
value: 7 INR
119119
- descriptor:
120120
code: SETTLEMENT_TYPE
121-
value: upi
121+
value: NEFT
122122
- descriptor:
123123
code: SETTLEMENT_BANK_CODE
124124
value: XXXXXXXX

mock-service/src/config/mock-config/TRV11/METRO/2.1.0/on_update/on_update_accepted/generator.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,22 @@ export async function onUpdateAcceptedGenerator(
104104

105105
if (sessionData.fulfillments.length > 0) {
106106
existingPayload.message.order.fulfillments = sessionData.fulfillments;
107+
if (sessionData?.flow_id === "DELAYED_CANCELLATION_FLOW_ACCEPTED") {
108+
existingPayload.message.order.fulfillments =
109+
existingPayload.message.order.fulfillments?.map((f: any) => {
110+
if (f.type === "TICKET") {
111+
return {
112+
...f,
113+
state: {
114+
descriptor: {
115+
code: "INACTIVE",
116+
},
117+
},
118+
};
119+
}
120+
return f;
121+
});
122+
}
107123
}
108124

109125
// existingPayload.message.order.fulfillments.forEach((fulfillment: any) => {

0 commit comments

Comments
 (0)