Skip to content

Commit 7c7fef1

Browse files
committed
parseInformationForNextPaymentHistory 추가
1 parent e12f94f commit 7c7fef1

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/app/naver/parser.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,21 @@ describe("NaverParser", () => {
1717
expect(result).toEqual(expectedPaymentHistoryItems);
1818
});
1919
});
20+
21+
describe("parseInformationForNextPaymentHistory", () => {
22+
it("should parse", () => {
23+
// given
24+
const parser = new NaverParser();
25+
26+
// when
27+
const result = parser.parseInformationForNextPaymentHistory(
28+
searchPaymentHistoryJson
29+
);
30+
31+
// then
32+
expect(result.hasNext).toBe(true);
33+
expect(result.lastHistoryId).toBe("order-2021110243152861");
34+
expect(result.lastHistoryDateTimestamp).toBe(1635853254000);
35+
});
36+
});
2037
});

src/app/naver/parser.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,17 @@ export class NaverParser {
2424
});
2525
return paymentHistories;
2626
}
27+
28+
parseInformationForNextPaymentHistory(jsonString: string): {
29+
hasNext: boolean;
30+
lastHistoryId: string;
31+
lastHistoryDateTimestamp: number;
32+
} {
33+
const data = JSON.parse(jsonString) as PaymentHistoryResponse;
34+
35+
const hasNext = data.result.hasNext;
36+
const lastHistoryId = data.result.lastId;
37+
const lastHistoryDateTimestamp = data.result.lastDate;
38+
return { hasNext, lastHistoryId, lastHistoryDateTimestamp };
39+
}
2740
}

0 commit comments

Comments
 (0)