Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iamport types module #10

Open
timo-kang opened this issue Mar 9, 2021 · 4 comments
Open

iamport types module #10

timo-kang opened this issue Mar 9, 2021 · 4 comments

Comments

@timo-kang
Copy link

안녕하세요, react에서 아임포트를 사용하고있는 사용자입니다.

저는 typescript + react를 사용중이라 types.ts를 직접 만들어 사용하고 있는데요,
@types/iamport-client 모듈을 만든다면 다른 많은 분들이 사용하기 훨씬 편할 것 같아 제안해봅니다..

짧지만 제가 사용하고 있는 type을 예시로 보여드리겠습니다.


export interface ExtendedIamportWindow extends Window {
  IMP: IMP
}

export interface IMP {
  init: ( imp_uid: string ) => void;
  request_pay: ( params: IamportPaymentRequest, callback: ( res: IamportPaymentResponse ) => void ) => void;
}

export type IamportPaymentResponse = {
  success: true,
  imp_uid: string,
  merchant_uid: string,
  pay_method: string,
  status: string,
  name: string,
  card_name: string,
  card_quota: number,
  buyer_name: string,
  buyer_email: string,
  paid_amount: number,
  paid_at: string
  receipt_url: string,
} | {
  success: false,
  error_code: string
  error_msg: string,
}

export type IamportPaymentRequest = {
  pg: string,
  pay_method: "card" | "vbank",
  merchant_uid: string,
  name: string,
  amount: number,
  buyer_email: string,
  buyer_name: string,
  notice_url?: string,
}
timo-kang added a commit to timo-kang/iamport-react-example that referenced this issue Mar 9, 2021
iamport#10 에서 제안한 내용입니다.
@timo-kang
Copy link
Author

@SoleeChoi

@crowrish
Copy link

https://github.com/junhoyeo/iamport-typings
이 저장소도 도움이 되실까해서 첨부합니다.

@timo-kang
Copy link
Author

@crowrish 해당 모듈에 다양한 payment방식을 지원하면 좋을 것 같네요 감사합니다!

@seiwonpark
Copy link

seiwonpark commented Mar 25, 2022

(수정됨) 저는 2022.03.25 기준, https://docs.iamport.kr/sdk/javascript-sdk 를 참고하여,

https://github.com/SeiwonPark/iamport-react-ts/tree/main/src/interfaces

위와 같이 인터페이스를 만들어두었습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants