@portone/server-sdk
Version:
PortOne JavaScript SDK for server-side usage
176 lines (175 loc) • 7.7 kB
TypeScript
import { CashReceiptError } from "./CashReceiptError.js";
import type { Unrecognized } from "./../../../utils/unrecognized.js";
import { type PortOneClientInit } from "../../../client.js";
import type { CancelCashReceiptResponse } from "../../../generated/payment/cashReceipt/CancelCashReceiptResponse.js";
import type { CashReceipt } from "../../../generated/payment/cashReceipt/CashReceipt.js";
import type { CashReceiptAlreadyIssuedError } from "../../../generated/payment/cashReceipt/CashReceiptAlreadyIssuedError.js";
import type { CashReceiptFilterInput } from "../../../generated/payment/cashReceipt/CashReceiptFilterInput.js";
import type { CashReceiptNotFoundError } from "../../../generated/payment/cashReceipt/CashReceiptNotFoundError.js";
import type { CashReceiptNotIssuedError } from "../../../generated/payment/cashReceipt/CashReceiptNotIssuedError.js";
import type { CashReceiptSortInput } from "../../../generated/payment/cashReceipt/CashReceiptSortInput.js";
import type { CashReceiptType } from "../../../generated/common/CashReceiptType.js";
import type { ChannelNotFoundError } from "../../../generated/common/ChannelNotFoundError.js";
import type { Currency } from "../../../generated/common/Currency.js";
import type { ForbiddenError } from "../../../generated/common/ForbiddenError.js";
import type { GetCashReceiptsResponse } from "../../../generated/payment/cashReceipt/GetCashReceiptsResponse.js";
import type { InvalidRequestError } from "../../../generated/common/InvalidRequestError.js";
import type { IssueCashReceiptCustomerInput } from "../../../generated/payment/cashReceipt/IssueCashReceiptCustomerInput.js";
import type { IssueCashReceiptPaymentMethodType } from "../../../generated/payment/cashReceipt/IssueCashReceiptPaymentMethodType.js";
import type { IssueCashReceiptResponse } from "../../../generated/payment/cashReceipt/IssueCashReceiptResponse.js";
import type { PageInput } from "../../../generated/common/PageInput.js";
import type { PaymentAmountInput } from "../../../generated/common/PaymentAmountInput.js";
import type { PaymentProductType } from "../../../generated/common/PaymentProductType.js";
import type { PgProviderError } from "../../../generated/common/PgProviderError.js";
import type { UnauthorizedError } from "../../../generated/common/UnauthorizedError.js";
/**
* 포트원 API 클라이언트를 생성합니다.
*/
export declare function CashReceiptClient(init: PortOneClientInit): CashReceiptClient;
export type CashReceiptClient = {
/**
* 현금영수증 다건 조회
*
* 주어진 조건에 맞는 현금영수증들을 페이지 기반으로 조회합니다.
*
* @throws {@link GetCashReceiptsError}
*/
getCashReceipts: (options?: {
/**
* 요청할 페이지 정보
*
* 미 입력 시 number: 0, size: 10 으로 기본값이 적용됩니다.
*/
page?: PageInput;
/**
* 정렬 조건
*
* 미 입력 시 sortBy: ISSUED_AT, sortOrder: DESC 으로 기본값이 적용됩니다.
*/
sort?: CashReceiptSortInput;
/** 조회할 현금영수증 조건 필터 */
filter?: CashReceiptFilterInput;
}) => Promise<GetCashReceiptsResponse>;
/**
* 현금 영수증 수동 발급
*
* 현금 영수증 발급을 요청합니다.
*
* @throws {@link IssueCashReceiptError}
*/
issueCashReceipt: (options: {
/**
* 상점 아이디
*
* 접근 권한이 있는 상점 아이디만 입력 가능하며, 미입력시 토큰에 담긴 상점 아이디를 사용합니다.
*/
storeId?: string;
/**
* 결제 건 아이디
*
* 외부 결제 건에 대한 수동 발급의 경우, 아이디를 직접 채번하여 입력합니다.
*/
paymentId: string;
/** 채널 키 */
channelKey: string;
/** 현금 영수증 유형 */
type: CashReceiptType;
/** 주문명 */
orderName: string;
/** 화폐 */
currency: Currency;
/** 금액 세부 입력 정보 */
amount: PaymentAmountInput;
/** 상품 유형 */
productType?: PaymentProductType;
/** 고객 정보 */
customer: IssueCashReceiptCustomerInput;
/**
* 결제 일자
* (RFC 3339 date-time)
*/
paidAt?: string;
/**
* 사업자등록번호
*
* 웰컴페이먼츠의 경우에만 입력합니다.
*/
businessRegistrationNumber?: string;
/**
* 결제 수단
*
* 웰컴페이먼츠의 경우에만 입력합니다.
*/
paymentMethod?: IssueCashReceiptPaymentMethodType;
}) => Promise<IssueCashReceiptResponse>;
/**
* 현금 영수증 취소
*
* 현금 영수증 취소를 요청합니다.
*
* @throws {@link CancelCashReceiptError}
*/
cancelCashReceiptByPaymentId: (options: {
/** 결제 건 아이디 */
paymentId: string;
/**
* 상점 아이디
*
* 접근 권한이 있는 상점 아이디만 입력 가능하며, 미입력시 토큰에 담긴 상점 아이디를 사용합니다.
*/
storeId?: string;
}) => Promise<CancelCashReceiptResponse>;
/**
* 현금 영수증 단건 조회
*
* 주어진 결제 아이디에 대응되는 현금 영수증 내역을 조회합니다.
*
* @throws {@link GetCashReceiptError}
*/
getCashReceiptByPaymentId: (options: {
/** 결제 건 아이디 */
paymentId: string;
/**
* 상점 아이디
*
* 접근 권한이 있는 상점 아이디만 입력 가능하며, 미입력시 토큰에 담긴 상점 아이디를 사용합니다.
*/
storeId?: string;
}) => Promise<CashReceipt>;
};
export declare class GetCashReceiptsError extends CashReceiptError {
readonly data: ForbiddenError | InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: ForbiddenError | InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
});
}
export declare class IssueCashReceiptError extends CashReceiptError {
readonly data: CashReceiptAlreadyIssuedError | ChannelNotFoundError | ForbiddenError | InvalidRequestError | PgProviderError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: CashReceiptAlreadyIssuedError | ChannelNotFoundError | ForbiddenError | InvalidRequestError | PgProviderError | UnauthorizedError | {
readonly type: Unrecognized;
});
}
export declare class CancelCashReceiptError extends CashReceiptError {
readonly data: CashReceiptNotFoundError | CashReceiptNotIssuedError | ForbiddenError | InvalidRequestError | PgProviderError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: CashReceiptNotFoundError | CashReceiptNotIssuedError | ForbiddenError | InvalidRequestError | PgProviderError | UnauthorizedError | {
readonly type: Unrecognized;
});
}
export declare class GetCashReceiptError extends CashReceiptError {
readonly data: CashReceiptNotFoundError | ForbiddenError | InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: CashReceiptNotFoundError | ForbiddenError | InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
});
}