UNPKG

@bootpay/backend-js

Version:

Bootpay Server Side Package for Node.js

66 lines (65 loc) 2.53 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InvoiceModule = void 0; class InvoiceModule { constructor(bootpay) { this.bootpay = bootpay; } /** * 청구서 목록 조회 * @param params 조회 파라미터 */ list(params) { return __awaiter(this, void 0, void 0, function* () { const queryParams = new URLSearchParams(); if (params) { if (params.page !== undefined) queryParams.append('page', params.page.toString()); if (params.limit !== undefined) queryParams.append('limit', params.limit.toString()); if (params.keyword) queryParams.append('keyword', params.keyword); } const query = queryParams.toString(); return this.bootpay.get(`invoices${query ? `?${query}` : ''}`); }); } /** * 청구서 생성 * @param invoice 청구서 정보 */ create(invoice) { return __awaiter(this, void 0, void 0, function* () { return this.bootpay.post('invoices', invoice); }); } /** * 청구서 알림 발송 * @param invoiceId 청구서 ID * @param sendTypes 발송 타입 배열 (예: [1, 2] - SMS, Email 등) */ notify(invoiceId, sendTypes) { return __awaiter(this, void 0, void 0, function* () { return this.bootpay.post(`invoices/${invoiceId}/notify`, { send_types: sendTypes }); }); } /** * 청구서 상세 조회 * @param invoiceId 청구서 ID */ detail(invoiceId) { return __awaiter(this, void 0, void 0, function* () { return this.bootpay.get(`invoices/${invoiceId}`); }); } } exports.InvoiceModule = InvoiceModule;