Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  - typia 5.2.2
  - nestia 2.2.2
  • Loading branch information
samchon committed Oct 12, 2023
1 parent 6acf2e2 commit a81ba79
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 362 deletions.
12 changes: 6 additions & 6 deletions 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": "4.0.2",
"version": "0.0.0-dev.20991231",
"description": "Fake iamport server for testing",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -39,7 +39,7 @@
},
"homepage": "https://github.com/samchon/fake-iamport-server",
"devDependencies": {
"@nestia/sdk": "^2.1.5",
"@nestia/sdk": "^2.2.2",
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@types/atob": "^2.1.2",
"@types/btoa": "^1.2.3",
Expand All @@ -50,7 +50,7 @@
"@typescript-eslint/parser": "^5.26.0",
"cli": "^1.0.1",
"copyfiles": "^2.4.1",
"nestia": "^4.5.0",
"nestia": "^5.0.1",
"pm2": "^4.5.6",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
Expand All @@ -60,13 +60,13 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@nestia/core": "^2.1.5",
"@nestia/core": "^2.2.2",
"@nestia/e2e": "^0.3.6",
"@nestia/fetcher": "^2.1.5",
"@nestia/fetcher": "^2.2.2",
"source-map-support": "^0.5.19",
"tstl": "^2.5.13",
"typescript-transform-paths": "^3.4.6",
"typia": "^5.1.5",
"typia": "^5.2.2",
"uuid": "^9.0.0"
},
"keywords": [
Expand Down
10 changes: 5 additions & 5 deletions 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": "4.0.2",
"version": "0.0.0-dev.20991231",
"description": "Fake toss-payments server for testing",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -40,7 +40,7 @@
"homepage": "https://github.com/samchon/fake-toss-payments-server",
"devDependencies": {
"@nestia/e2e": "^0.3.6",
"@nestia/sdk": "^2.1.5",
"@nestia/sdk": "^2.2.2",
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@types/atob": "^2.1.2",
"@types/btoa": "^1.2.3",
Expand All @@ -51,7 +51,7 @@
"@typescript-eslint/parser": "^5.26.0",
"cli": "^1.0.1",
"copyfiles": "^2.4.1",
"nestia": "^4.5.0",
"nestia": "^5.0.1",
"pm2": "^4.5.6",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
Expand All @@ -62,13 +62,13 @@
"typescript-transform-paths": "^3.4.6"
},
"dependencies": {
"@nestia/core": "^2.1.5",
"@nestia/core": "^2.2.2",
"atob": "^2.1.2",
"btoa": "^1.2.1",
"serialize-error": "^4.1.0",
"source-map-support": "^0.5.19",
"tstl": "^2.5.13",
"typia": "^5.1.5",
"typia": "^5.2.2",
"uuid": "^9.0.0"
},
"keywords": [
Expand Down
99 changes: 26 additions & 73 deletions packages/iamport-server-api/README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,38 @@
# Iamport Server API
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/payments/LICENSE)
[![npm version](https://badge.fury.io/js/iamport-server-api.svg)](https://www.npmjs.com/package/iamport-server-api)
[![Downloads](https://img.shields.io/npm/dm/iamport-server-api.svg)](https://www.npmjs.com/package/iamport-server-api)
[![Build Status](https://github.com/samchon/payments/workflows/build/badge.svg)](https://github.com/samchon/payments/actions?query=workflow%3Abuild)
# SDK Library
This is a SDK library generated by [`nestia`](https://nestia.io).

```bash
npm install --save iamport-server-api
```
With this SDK library, you can easily and safely interact with backend server.

`iamport-server-api`[`fake-iamport-server`](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server) 를 기반으로 만들어진 SDK (Software Development Kit) 이다. 그리고 [`fake-iamport-server`](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server) 는 아임포트의 API 명세사항을 따라 만든 목업 서버이기에, 본 `iamport-server-api` 는 진짜 아임포트 서버와의 연동에도 사용할 수 있다.
Just import and call some API functions like gif image below:

고로 아임포트와 연동하는 TypeScript 기반 백엔드 서버를 개발함에 있어, 가짜 아임포트 서버 [`fake-iamport-server`](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server) 는 직접 이용치 않더라도, 실제 아임포트 서버와의 연동을 위하여, 본 SDK 라이브러리만큼은 반드시 설치하기를 권장하는 바이다.
![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)

- **Swagger Editor**: [packages/iamport-server-api/swagger.json](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Fpayments%2Fmaster%2Fpackages%2Fiamport-server-api%2Fswagger.json)
- 자료 구조: [src/api/structures/IIamportPayment.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/src/api/structures/IIamportPayment.ts)
- API 함수: [src/api/functional/payments/index.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/src/api/functional/payments/index.ts)
- 예제 코드
- 본인 인증: [test_fake_certification.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/test/features/test_fake_certification.ts)
- 가상 계좌 결제: [test_fake_vbank_payment.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/test/features/test_fake_vbank_payment.ts)
- 카드 결제: [test_fake_card_payment.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/test/features/test_fake_card_payment.ts)
- 간편 결제 등록
- [test_fake_subscription_payment_again.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/test/features/test_fake_subscription_payment_again.ts)
- [test_fake_subscription_payment_onetime.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/test/features/test_fake_subscription_payment_onetime.ts)
- 전체 환불: [test_fake_card_payment_cancel.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/test/features/test_fake_card_payment_cancel.ts)
- 부분 환불: [test_fake_card_payment_cancel_partial.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/test/features/test_fake_card_payment_cancel_partial.ts)
- 현금 영수증 발행하기: [test_fake_receipt.ts](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server/test/features/test_fake_receipt.ts)
> Left is server code, and right is client code utilizing the SDK
```typescript
import { v4 } from "uuid";

import imp from "iamport-server-api";
import { IIamportCardPayment } from "iamport-server-api/lib/structures/IIamportCardPayment";
import { IIamportPayment } from "iamport-server-api/lib/structures/IIamportPayment";
import { IIamportResponse } from "iamport-server-api/lib/structures/IIamportResponse";

export async function test_fake_card_payment(): Promise<IIamportCardPayment>
{
// 커넥터 정보 구성, 토큰 만료시 자동으로 갱신해 줌
const connector: imp.IamportConnector = new imp.IamportConnector
(
"http://127.0.0.1:10851",
{
imp_key: "test_imp_key",
imp_secret: "test_imp_secret"
}
);

// 카드로 결제하기
const output: IIamportResponse<IIamportCardPayment> =
await imp.functional.subscribe.payments.onetime
(
await connector.get(),
{
card_number: "1111-2222-3333-4444",
expiry: "2028-12",
birth: "880311",
# What [`Nestia`](https://nestia.io) is:
![Nestia Logo](https://nestia.io/logo.png)

merchant_uid: v4(),
amount: 25_000,
name: "Fake 주문"
}
);
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
[![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
[![Downloads](https://img.shields.io/npm/dm/nestia.svg)](https://www.npmjs.com/package/nestia)
[![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
[![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)

// 결제 내역 조회하기
const reloaded: IIamportResponse<IIamportPayment> =
await imp.functional.payments.at
(
await connector.get(),
output.response.imp_uid,
{},
);
[Nestia](https://nestia.io) is a set of helper libraries for NestJS, supporting below features:

// 결제 방식 및 완료 여부 확인
const payment: IIamportPayment = reloaded.response;
if (payment.pay_method !== "card")
throw new Error("Bug on payments.at(): its pay_method must be card.");
else if (!payment.paid_at || payment.status !== "paid")
throw new Error("Bug on payments.at(): its status must be paid.");
- `@nestia/core`: super-fast decorators
- `@nestia/sdk`
- SDK generator for clients
- Swagger generator evolved than ever
- Automatic E2E test functions generator
- `nestia`: just CLI (command line interface) tool

// 첫 번째 if condition 에 의해 자동 다운 캐스팅 된 상태
payment.card_number;
return payment;
}
```
> **Note**
>
> - **Only one line** required, with pure TypeScript type
> - Runtime validator is **20,000x faster** than `class-validator`
> - JSON serialization is **200x faster** than `class-transformer`
> - SDK is similar with [tRPC](https://trpc.io), but much advanced
21 changes: 10 additions & 11 deletions packages/iamport-server-api/package.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
{
"name": "iamport-server-api",
"version": "4.0.2",
"description": "API for Iamport Server",
"name": "@ORGANIZATION/PROJECT-api",
"version": "0.0.0-dev.20991231",
"description": "SDK library generated by Nestia",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"scripts": {
"build": "npm run build:sdk && npm run compile",
"build:sdk": "rimraf ../fake-iamport-server/src/api/functional && cd ../fake-iamport-server && npx nestia sdk && cd ../iamport-server-api",
"compile": "rimraf lib && tsc",
"deploy": "npm run build && npm publish",
"postinstall": "ts-patch install"
"prepare": "ts-patch install"
},
"repository": {
"type": "git",
"url": "https://github.com/samchon/payments"
"url": "https://github.com/samchon/nestia"
},
"author": "Jeongho Nam",
"license": "MIT",
"bugs": {
"url": "https://github.com/samchon/payments/issues"
"url": "https://github.com/samchon/nestia/issues"
},
"homepage": "https://github.com/samchon/payments",
"homepage": "https://nestia.io",
"files": [
"lib",
"package.json",
"swagger.json",
"README.md"
],
"devDependencies": {
"rimraf": "^5.0.1",
"rimraf": "^5.0.5",
"ts-node": "^10.9.1",
"ts-patch": "^3.0.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@nestia/fetcher": "^2.1.5",
"typia": "^5.1.5"
"@nestia/fetcher": "^2.2.2",
"typia": "^5.2.2"
}
}
2 changes: 1 addition & 1 deletion 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": "4.0.2",
"version": "0.0.0-dev.20991231",
"license": {
"name": "MIT"
}
Expand Down
Loading

0 comments on commit a81ba79

Please sign in to comment.