@tosspayments/sdk-types
Advanced tools
Comparing version 1.1.4 to 1.1.5-beta.1
{ | ||
"name": "@tosspayments/sdk-types", | ||
"description": "tosspayments.js TypeScript 타이핑", | ||
"version": "1.1.4", | ||
"version": "1.1.5-beta.1", | ||
"types": "types/tosspayments.d.ts", | ||
@@ -6,0 +6,0 @@ "author": "Toss Payments", |
import { RequestPaymentParams } from './connectpay/requestPayment'; | ||
import addPaymentMethod from './connectpay/addPaymentMethod'; | ||
export interface ConnectPayOptions { | ||
showNavigationBar?: boolean; | ||
redirectUrl?: string; | ||
theme?: Theme; | ||
labels?: { | ||
oneTouchPay?: string; | ||
}; | ||
} | ||
export declare type Theme = 'musinsa' | 'simsale' | 'golfzon'; | ||
declare function ConnectPay(clientKey: string, customerKey: string, options?: ConnectPayOptions): { | ||
authenticate(): Promise<void>; | ||
addPaymentMethod(methodType?: Parameters<typeof addPaymentMethod>[2]['type']): Promise<import("./connectpay/addPaymentMethod").AddPaymentMethodResult>; | ||
requestPayment(params: RequestPaymentParams): Promise<never>; | ||
openSettings(): Promise<never>; | ||
setupPassword(): Promise<void>; | ||
setupOneTouchPay(): Promise<never>; | ||
getPaymentMethods(): Promise<{ | ||
import { PaymentMethodType } from './connectpay/addPaymentMethod'; | ||
import { ConnectpayOptions } from '@connectpay/types'; | ||
declare function ConnectPay(clientKey: string, customerKey: string, options?: ConnectpayOptions): { | ||
authenticate: () => Promise<void>; | ||
addPaymentMethod: (methodType?: PaymentMethodType) => Promise<import("./connectpay/addPaymentMethod").AddPaymentMethodResult>; | ||
requestPayment: (params: RequestPaymentParams) => Promise<never>; | ||
openSettings: () => Promise<never>; | ||
setupPassword: () => Promise<void>; | ||
setupOneTouchPay: () => Promise<never>; | ||
getPaymentMethods: () => Promise<{ | ||
cards: import("./connectpay/PaymentMethod").CardMethod[]; | ||
accounts: import("./connectpay/PaymentMethod").AccountMethod[]; | ||
}>; | ||
requestAgreement(term: '빌링'): Promise<void>; | ||
requestAgreement: (term: '빌링') => Promise<void>; | ||
}; | ||
@@ -25,0 +17,0 @@ declare namespace ConnectPay { |
import { AccountMethod, CardMethod } from './PaymentMethod'; | ||
import { OpenIframeOptions } from './openIframe'; | ||
import { ConnectPayOptions } from '../connectpay'; | ||
export interface AddPaymentMethodOptions extends ConnectPayOptions, OpenIframeOptions { | ||
type?: '카드' | '계좌' | '미선택'; | ||
} | ||
export declare type PaymentMethodType = '카드' | '계좌' | '미선택'; | ||
export interface AddPaymentMethodResult { | ||
@@ -11,2 +8,2 @@ cards: CardMethod[]; | ||
} | ||
export default function addPaymentMethod(clientKey: string, customerToken: string, { container, type: methodType, ...options }: AddPaymentMethodOptions): Promise<AddPaymentMethodResult>; | ||
export declare function addPaymentMethod(customerToken: string, { container }: OpenIframeOptions): Promise<AddPaymentMethodResult>; |
@@ -1,4 +0,4 @@ | ||
import { ConnectPayOptions } from '../connectpay'; | ||
export default function authenticate(clientKey: string, customerKey: string, { container, ...options }?: ConnectPayOptions & { | ||
import { ConnectpayOptions } from '@connectpay/types'; | ||
export default function authenticate(clientKey: string, customerKey: string, { container, ...options }?: ConnectpayOptions & { | ||
container?: HTMLElement; | ||
}): Promise<string>; |
@@ -1,6 +0,3 @@ | ||
import { Theme } from '../connectpay'; | ||
export declare function getDimmer({ styles, theme, }?: { | ||
styles?: Partial<CSSStyleDeclaration>; | ||
theme?: Theme; | ||
}): HTMLDivElement; | ||
import { ConnectpayOptions } from '@connectpay/types'; | ||
export declare function getDimmer(options?: ConnectpayOptions): HTMLDivElement; | ||
export declare function removeDimmer(): void; |
@@ -1,7 +0,2 @@ | ||
declare type MessageResolver = (message: CommonMessageBody) => unknown; | ||
interface CommonMessageBody { | ||
type: string; | ||
eventId: string; | ||
params?: unknown; | ||
} | ||
declare type ReceiveMessageType = 'COMMON_PARAMS' | 'METHOD_TYPE' | 'PAYMENT_PARAMS' | 'SAFE_AREA' | 'VIEWPORT' | 'REPLACE_IFRAME' | 'PAYMENT_RESULT' | 'AUTHENTICATE' | 'COMPLETE' | 'CANCEL'; | ||
/** | ||
@@ -15,11 +10,21 @@ * @description | ||
* @description | ||
* 커넥트페이의 요청을 받아줄 수 있도록 메시지 리스너를 등록합니다. | ||
* 이후 커넥트페이에서 Initialize 메시지를 전송하면 양자간 포트가 초기화되어 쌍방향 통신이 가능한 상태가 됩니다. | ||
* @param onMessageReceive {MessageResolver} | ||
* 열린 포트로 메시지가 전송될 때마다 메시지의 Data Body와 함께 이 함수가 호출됩니다. (ConnectPay -> SDK) | ||
* 이 함수가 리턴하는 값은 다시 커넥트페이로 전송됩니다. (ConnectPay <- SDK) | ||
* 커넥트페이 UI의 요청이 도착하면 실행될 이벤트 리스너를 등록합니다. | ||
* @param type | ||
* 등록할 콜백에 해당하는 메시지 타입입니다. | ||
* @param callback | ||
* 첫번째 파라미터로 넘긴 타입의 메시지가 커넥트페이 UI에서 SDK로 전송될 때마다 콜백이 실행됩니다. (ConnectPay -> SDK) | ||
* 이 콜백이 리턴하는 값은 다시 커넥트페이 UI로 전송됩니다. (ConnectPay <- SDK) | ||
*/ | ||
listen(onMessageReceive: MessageResolver): void; | ||
on<T>(type: ReceiveMessageType, callback: (params: T) => unknown): void; | ||
/** | ||
* @description | ||
* `on`으로 등록했던 이벤트 리스너를 제거합니다. | ||
* @param type | ||
* 등록했던 콜백에 해당되는 메시지 타입입니다. | ||
* @param callback | ||
* 등록했던 콜백의 레퍼런스입니다. 레퍼런스가 같을때만 제대로 제거됩니다. | ||
*/ | ||
off<T_1>(type: ReceiveMessageType, callback: (params: T_1) => unknown): void; | ||
/** | ||
* @description | ||
* 포트를 닫고 커넥트페이로부터 더 이상 메시지를 수신하지 않도록 합니다. | ||
@@ -26,0 +31,0 @@ */ |
@@ -1,6 +0,6 @@ | ||
import { Theme } from '../connectpay'; | ||
import { ConnectpayOptions, Theme } from '@connectpay/types'; | ||
declare type LoaderColor = Record<Theme, string>; | ||
export declare const loaderColor: LoaderColor; | ||
export declare function createLoader(theme?: Theme): HTMLDivElement; | ||
export declare function createLoader(options: ConnectpayOptions): HTMLDivElement; | ||
export declare function removeLoader(): void; | ||
export {}; |
import { OpenIframeOptions } from './openIframe'; | ||
import { ConnectPayOptions } from '../connectpay'; | ||
export default function openSettings(clientKey: string, customerToken: string, { container, ...options }: ConnectPayOptions & OpenIframeOptions): Promise<never>; | ||
export default function openSettings(customerToken: string, { container }: OpenIframeOptions): Promise<never>; |
@@ -1,3 +0,2 @@ | ||
import { ConnectPayOptions } from '../connectpay'; | ||
import { OpenIframeOptions } from './openIframe'; | ||
export declare function requestAgreement(clientKey: string, customerKey: string, { container, ...options }: ConnectPayOptions & OpenIframeOptions): Promise<void>; | ||
export declare function requestAgreement({ container }: OpenIframeOptions): Promise<void>; |
import { OpenIframeOptions } from './openIframe'; | ||
import { ConnectPayOptions } from '../connectpay'; | ||
export interface RequestPaymentParams { | ||
amount: number; | ||
orderId: string; | ||
orderName: string; | ||
successUrl: string; | ||
failUrl: string; | ||
orderId: string; | ||
orderName: string; | ||
amount: number; | ||
methodId?: string; | ||
customerEmail?: string; | ||
shippingAddress?: string; | ||
taxFreeAmount?: number; | ||
cardInstallmentPlan?: number; | ||
useCardPoint?: boolean; | ||
discountCode?: string; | ||
cashReceipt?: { | ||
type: '소득공제' | '지출증빙'; | ||
registrationNumber: string; | ||
}; | ||
} | ||
export default function requestPayment(clientKey: string, customerToken: string, params: RequestPaymentParams, { container, ...options }: ConnectPayOptions & OpenIframeOptions): Promise<never>; | ||
export declare function requestPayment(customerToken: string, { successUrl, failUrl }: Pick<RequestPaymentParams, 'successUrl' | 'failUrl'>, { container }: OpenIframeOptions): Promise<never>; |
@@ -1,3 +0,2 @@ | ||
import { ConnectPayOptions } from '../connectpay'; | ||
import { OpenIframeOptions } from './openIframe'; | ||
export declare function setupOneTouchPay(clientKey: string, customerToken: string, { container, ...options }: ConnectPayOptions & OpenIframeOptions): Promise<never>; | ||
export declare function setupOneTouchPay(customerToken: string, { container }: OpenIframeOptions): Promise<never>; |
@@ -1,3 +0,2 @@ | ||
import { ConnectPayOptions } from '../connectpay'; | ||
import { OpenIframeOptions } from './openIframe'; | ||
export default function setupPassword(clientKey: string, customerToken: string, { container, ...options }: ConnectPayOptions & OpenIframeOptions): Promise<void>; | ||
export declare function setupPassword(customerToken: string, { container }: OpenIframeOptions): Promise<void>; |
@@ -19,2 +19,3 @@ import CardCompany from '../models/CardCompany'; | ||
taxFreeAmount?: number; | ||
cultureExpense?: boolean; | ||
} | ||
@@ -21,0 +22,0 @@ export interface CommonPaymentRequest extends BasePaymentRequest { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
19856
494
3