@portone/server-sdk
Version:
PortOne JavaScript SDK for server-side usage
175 lines (174 loc) • 7.72 kB
TypeScript
import { BillingKeyError } from "./BillingKeyError.js";
import type { Unrecognized } from "./../../../utils/unrecognized.js";
import { type PortOneClientInit } from "../../../client.js";
import type { BillingKeyAlreadyDeletedError } from "../../../generated/common/BillingKeyAlreadyDeletedError.js";
import type { BillingKeyFilterInput } from "../../../generated/payment/billingKey/BillingKeyFilterInput.js";
import type { BillingKeyInfo } from "../../../generated/payment/billingKey/BillingKeyInfo.js";
import type { BillingKeyNotFoundError } from "../../../generated/common/BillingKeyNotFoundError.js";
import type { BillingKeyNotIssuedError } from "../../../generated/payment/billingKey/BillingKeyNotIssuedError.js";
import type { BillingKeySortInput } from "../../../generated/payment/billingKey/BillingKeySortInput.js";
import type { ChannelNotFoundError } from "../../../generated/common/ChannelNotFoundError.js";
import type { ChannelSpecificError } from "../../../generated/payment/billingKey/ChannelSpecificError.js";
import type { CustomerInput } from "../../../generated/common/CustomerInput.js";
import type { DeleteBillingKeyResponse } from "../../../generated/payment/billingKey/DeleteBillingKeyResponse.js";
import type { ForbiddenError } from "../../../generated/common/ForbiddenError.js";
import type { GetBillingKeyInfosResponse } from "../../../generated/payment/billingKey/GetBillingKeyInfosResponse.js";
import type { InstantBillingKeyPaymentMethodInput } from "../../../generated/payment/billingKey/InstantBillingKeyPaymentMethodInput.js";
import type { InvalidRequestError } from "../../../generated/common/InvalidRequestError.js";
import type { IssueBillingKeyResponse } from "../../../generated/payment/billingKey/IssueBillingKeyResponse.js";
import type { PageInput } from "../../../generated/common/PageInput.js";
import type { PaymentScheduleAlreadyExistsError } from "../../../generated/common/PaymentScheduleAlreadyExistsError.js";
import type { PgProviderError } from "../../../generated/common/PgProviderError.js";
import type { UnauthorizedError } from "../../../generated/common/UnauthorizedError.js";
/**
* 포트원 API 클라이언트를 생성합니다.
*/
export declare function BillingKeyClient(init: PortOneClientInit): BillingKeyClient;
export type BillingKeyClient = {
/**
* 빌링키 다건 조회
*
* 주어진 조건에 맞는 빌링키들을 페이지 기반으로 조회합니다.
*
* @throws {@link GetBillingKeyInfosError}
*/
getBillingKeyInfos: (options?: {
/**
* 요청할 페이지 정보
*
* 미 입력 시 number: 0, size: 10 으로 기본값이 적용됩니다.
*/
page?: PageInput;
/**
* 정렬 조건
*
* 미 입력 시 sortBy: TIME_TO_PAY, sortOrder: DESC 으로 기본값이 적용됩니다.
*/
sort?: BillingKeySortInput;
/**
* 조회할 빌링키 조건 필터
*
* V1 빌링키 건의 경우 일부 필드에 대해 필터가 적용되지 않을 수 있습니다.
*/
filter?: BillingKeyFilterInput;
}) => Promise<GetBillingKeyInfosResponse>;
/**
* 빌링키 발급
*
* 빌링키 발급을 요청합니다.
*
* @throws {@link IssueBillingKeyError}
*/
issueBillingKey: (options: {
/**
* 상점 아이디
*
* 접근 권한이 있는 상점 아이디만 입력 가능하며, 미입력시 토큰에 담긴 상점 아이디를 사용합니다.
*/
storeId?: string;
/** 빌링키 결제 수단 정보 */
method: InstantBillingKeyPaymentMethodInput;
/**
* 채널 키
*
* 채널 키 또는 채널 그룹 ID 필수
*/
channelKey?: string;
/**
* 채널 그룹 ID
*
* 채널 키 또는 채널 그룹 ID 필수
*/
channelGroupId?: string;
/** 고객 정보 */
customer?: CustomerInput;
/** 사용자 지정 데이터 */
customData?: string;
/** PG사별 추가 파라미터 ("PG사별 연동 가이드" 참고) */
bypass?: object;
/**
* 웹훅 주소
*
* 빌링키 발급 시 요청을 받을 웹훅 주소입니다.
* 상점에 설정되어 있는 값보다 우선적으로 적용됩니다.
* 입력된 값이 없을 경우에는 빈 배열로 해석됩니다.
*/
noticeUrls?: string[];
}) => Promise<IssueBillingKeyResponse>;
/**
* 빌링키 단건 조회
*
* 주어진 빌링키에 대응되는 빌링키 정보를 조회합니다.
*
* @throws {@link GetBillingKeyInfoError}
*/
getBillingKeyInfo: (options: {
/** 조회할 빌링키 */
billingKey: string;
/**
* 상점 아이디
*
* 접근 권한이 있는 상점 아이디만 입력 가능하며, 미입력시 토큰에 담긴 상점 아이디를 사용합니다.
*/
storeId?: string;
}) => Promise<BillingKeyInfo>;
/**
* 빌링키 삭제
*
* 빌링키를 삭제합니다.
*
* @throws {@link DeleteBillingKeyError}
*/
deleteBillingKey: (options: {
/** 삭제할 빌링키 */
billingKey: string;
/**
* 상점 아이디
*
* 접근 권한이 있는 상점 아이디만 입력 가능하며, 미입력시 토큰에 담긴 상점 아이디를 사용합니다.
*/
storeId?: string;
/**
* 사유
*
* 네이버페이: 자동결제 해지 사유입니다. 명시가 필요합니다.
*/
reason?: string;
}) => Promise<DeleteBillingKeyResponse>;
};
export declare class GetBillingKeyInfosError extends BillingKeyError {
readonly data: ForbiddenError | InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: ForbiddenError | InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
});
}
export declare class IssueBillingKeyError extends BillingKeyError {
readonly data: ChannelNotFoundError | ChannelSpecificError | ForbiddenError | InvalidRequestError | PgProviderError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: ChannelNotFoundError | ChannelSpecificError | ForbiddenError | InvalidRequestError | PgProviderError | UnauthorizedError | {
readonly type: Unrecognized;
});
}
export declare class GetBillingKeyInfoError extends BillingKeyError {
readonly data: BillingKeyNotFoundError | ForbiddenError | InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: BillingKeyNotFoundError | ForbiddenError | InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
});
}
export declare class DeleteBillingKeyError extends BillingKeyError {
readonly data: BillingKeyAlreadyDeletedError | BillingKeyNotFoundError | BillingKeyNotIssuedError | ChannelSpecificError | ForbiddenError | InvalidRequestError | PaymentScheduleAlreadyExistsError | PgProviderError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: BillingKeyAlreadyDeletedError | BillingKeyNotFoundError | BillingKeyNotIssuedError | ChannelSpecificError | ForbiddenError | InvalidRequestError | PaymentScheduleAlreadyExistsError | PgProviderError | UnauthorizedError | {
readonly type: Unrecognized;
});
}