Skip to content

Commit

Permalink
carrier: Add status in kr.epost
Browse files Browse the repository at this point in the history
  • Loading branch information
shlee322 committed May 19, 2024
1 parent 850b255 commit 851ef85
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/core/src/carriers/kr.epost/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,18 @@ class KoreaPostTrackScraper {
const location = tds[2].textContent?.replace(/\s+/g, " ")?.trim() ?? null;
const status = tds[3].textContent?.replace(/\s+/g, " ")?.trim() ?? null;

// ๋˜๋„๋ก ์›๋ณธ ํ…์ŠคํŠธ ์œ ์ง€ (์ ‘์ˆ˜๋Š” ์ œ์™ธ)
const statusDescription =
status?.startsWith("์ ‘์ˆ˜ ์†Œํฌ ๋ฌผํ’ˆ ์‚ฌ์ง„") === true
? "์ ‘์ˆ˜"
: status ?? "";

return {
status: this.parseStatus(status),
time: this.parseTime(date, time),
location: this.parseLocation(location),
contact: null,
description: `${status ?? ""} - ${location ?? ""}`,
description: `${statusDescription} - ${location ?? ""}`,
carrierSpecificData: new Map(),
};
}
Expand Down Expand Up @@ -118,7 +124,14 @@ class KoreaPostTrackScraper {
carrierSpecificData: new Map(),
};
}

// NOTE: text๊ฐ€ "์ ‘์ˆ˜ ์†Œํฌ ๋ฌผํ’ˆ ์‚ฌ์ง„ //<![CDATA[" ํ˜•์‹์ด๋ฉด "์ ‘์ˆ˜"๋กœ ๋ณ€๊ฒฝํ•˜๊ธฐ ์œ„ํ•จ
if (status.startsWith("์ ‘์ˆ˜ ์†Œํฌ ๋ฌผํ’ˆ ์‚ฌ์ง„")) {
return {
code: TrackEventStatusCode.InformationReceived,
name: "์ ‘์ˆ˜",
carrierSpecificData: new Map(),
};
}
if (status.includes("๋ฐฐ๋‹ฌ์ค€๋น„")) {
return {
code: TrackEventStatusCode.OutForDelivery,
Expand Down

0 comments on commit 851ef85

Please sign in to comment.