Skip to content

Commit

Permalink
node-fetch 의 조건부 사용.
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Nov 16, 2023
1 parent 2a1cbe4 commit f991291
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion packages/fake-iamport-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fake-iamport-server",
"version": "5.1.1",
"version": "5.1.2",
"description": "Fake iamport server for testing",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { DomainError } from "tstl/exception/DomainError";
import { FakeIamportConfiguration } from "../FakeIamportConfiguration";
import { FakeIamportStorage } from "./FakeIamportStorage";

(global as any).fetch ??= require("node-fetch");

export namespace FakeIamportPaymentProvider {
export function store(payment: IIamportPayment): void {
FakeIamportStorage.payments.set(payment.imp_uid, payment);
Expand Down
2 changes: 1 addition & 1 deletion packages/fake-toss-payments-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fake-toss-payments-server",
"version": "5.1.1",
"version": "5.1.2",
"description": "Fake toss-payments server for testing",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import { ITossPaymentWebhook } from "toss-payments-server-api/lib/structures/ITo
import { FakeTossConfiguration } from "../FakeTossConfiguration";

// POLYFILL FOR NODE
if (
typeof global === "object" &&
typeof global.process === "object" &&
typeof global.process.versions === "object" &&
typeof global.process.versions.node !== undefined
)
(global as any).fetch = require("node-fetch");
(global as any).fetch ??= require("node-fetch");

export namespace FakeTossWebhookProvider {
export async function webhook(input: ITossPaymentWebhook): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion packages/iamport-server-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iamport-server-api",
"version": "5.1.1",
"version": "5.1.2",
"description": "API for Iamport Server",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
16 changes: 8 additions & 8 deletions packages/iamport-server-api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"info": {
"title": "Iamport API",
"description": "Built by [fake-iamport-server](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server) with [nestia](https://github.com/samchon/nestia)",
"version": "5.1.1",
"version": "5.1.2",
"license": {
"name": "MIT"
}
Expand Down Expand Up @@ -529,7 +529,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-iamport-server/src/api/structures/IIamportCertification.ts",
"textSpan": {
"start": 429,
"start": 447,
"length": 16
}
}
Expand Down Expand Up @@ -630,7 +630,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-iamport-server/src/api/structures/IIamportCertification.ts",
"textSpan": {
"start": 429,
"start": 447,
"length": 16
}
}
Expand Down Expand Up @@ -831,7 +831,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-iamport-server/src/api/structures/IIamportCertification.ts",
"textSpan": {
"start": 429,
"start": 447,
"length": 16
}
}
Expand Down Expand Up @@ -1096,7 +1096,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-iamport-server/src/api/structures/IIamportPayment.ts",
"textSpan": {
"start": 2017,
"start": 2101,
"length": 16
}
}
Expand Down Expand Up @@ -1302,7 +1302,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-iamport-server/src/api/structures/IIamportPayment.ts",
"textSpan": {
"start": 2017,
"start": 2101,
"length": 16
}
}
Expand Down Expand Up @@ -1415,7 +1415,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-iamport-server/src/api/structures/IIamportPayment.ts",
"textSpan": {
"start": 2017,
"start": 2101,
"length": 16
}
}
Expand Down Expand Up @@ -1533,7 +1533,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-iamport-server/src/api/structures/IIamportPayment.ts",
"textSpan": {
"start": 2017,
"start": 2101,
"length": 16
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/payment-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@samchon/payment-api",
"version": "5.1.1",
"version": "5.1.2",
"description": "API for Payment Backend",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -35,8 +35,8 @@
},
"dependencies": {
"@nestia/fetcher": "^2.3.9",
"iamport-server-api": "^5.1.1",
"toss-payments-server-api": "^5.1.1",
"iamport-server-api": "^5.1.2",
"toss-payments-server-api": "^5.1.2",
"typia": "^5.2.6"
}
}
2 changes: 1 addition & 1 deletion packages/payment-api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
],
"info": {
"version": "5.1.1",
"version": "5.1.2",
"title": "@samchon/payment-backend",
"description": "Payment Backend Server",
"license": {
Expand Down
10 changes: 5 additions & 5 deletions packages/payment-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@samchon/payment-backend",
"version": "5.1.1",
"version": "5.1.2",
"description": "Payment Backend Server",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -64,12 +64,12 @@
"@typescript-eslint/parser": "^5.26.0",
"cli": "^1.0.1",
"copyfiles": "^2.4.1",
"iamport-server-api": "^5.1.1",
"iamport-server-api": "^5.1.2",
"nestia": "^5.0.3",
"pm2": "^4.5.6",
"rimraf": "^3.0.2",
"sloc": "^0.2.1",
"toss-payments-server-api": "^5.1.1",
"toss-payments-server-api": "^5.1.2",
"ts-loader": "^9.5.0",
"ts-node": "^10.9.1",
"ts-patch": "^3.0.2",
Expand All @@ -88,8 +88,8 @@
"bcryptjs": "^2.4.3",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
"fake-iamport-server": "^5.1.1",
"fake-toss-payments-server": "^5.1.1",
"fake-iamport-server": "^5.1.2",
"fake-toss-payments-server": "^5.1.2",
"fastify": "^4.24.3",
"git-last-commit": "^1.0.0",
"inquirer": "^8.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { TossPaymentService } from "../../services/toss/TossPaymentService";
import { BcryptUtil } from "../../utils/BcryptUtil";
import { PaymentCancelHistoryProvider } from "./PaymentCancelHistoryProvider";

(global as any).fetch ??= require("node-fetch");

export namespace PaymentHistoryProvider {
export namespace json {
export const transform = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { PaymentConfiguration } from "../../PaymentConfiguration";
import { PaymentGlobal } from "../../PaymentGlobal";
import { PaymentHistoryProvider } from "./PaymentHistoryProvider";

(global as any).fetch ??= require("node-fetch");

export namespace PaymentWebhookProvider {
export const process =
(vendor: "iamport" | "toss.payments") =>
Expand Down
2 changes: 1 addition & 1 deletion packages/toss-payments-server-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "toss-payments-server-api",
"version": "5.1.1",
"version": "5.1.2",
"description": "API for Toss Payments Server",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
16 changes: 8 additions & 8 deletions packages/toss-payments-server-api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"info": {
"title": "Toss Payments API",
"description": "Built by [fake-toss-payments-server](https://github.com/samchon/payments/tree/master/packages/toss-payments-server-api) with [nestia](https://github.com/samchon/nestia)",
"version": "5.1.1",
"version": "5.1.2",
"license": {
"name": "MIT"
}
Expand Down Expand Up @@ -178,7 +178,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-toss-payments-server/src/api/structures/ITossBilling.ts",
"textSpan": {
"start": 415,
"start": 437,
"length": 19
}
}
Expand Down Expand Up @@ -310,7 +310,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-toss-payments-server/src/api/structures/ITossBilling.ts",
"textSpan": {
"start": 415,
"start": 437,
"length": 19
}
}
Expand Down Expand Up @@ -528,7 +528,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-toss-payments-server/src/api/structures/ITossCashReceipt.ts",
"textSpan": {
"start": 145,
"start": 156,
"length": 19
}
}
Expand Down Expand Up @@ -704,7 +704,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-toss-payments-server/src/api/structures/ITossPayment.ts",
"textSpan": {
"start": 2071,
"start": 2165,
"length": 19
}
}
Expand Down Expand Up @@ -802,7 +802,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-toss-payments-server/src/api/structures/ITossPayment.ts",
"textSpan": {
"start": 2071,
"start": 2165,
"length": 19
}
}
Expand Down Expand Up @@ -906,7 +906,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-toss-payments-server/src/api/structures/ITossPayment.ts",
"textSpan": {
"start": 2071,
"start": 2165,
"length": 19
}
}
Expand Down Expand Up @@ -1124,7 +1124,7 @@
"target": {
"fileName": "D:/github/samchon/payments/packages/fake-toss-payments-server/src/api/structures/ITossPayment.ts",
"textSpan": {
"start": 2071,
"start": 2165,
"length": 19
}
}
Expand Down

0 comments on commit f991291

Please sign in to comment.