UNPKG

@airwallex/node-sdk

Version:

Airwallex Node.js SDK

79 lines 3.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PaymentAcceptanceRefundsApi = void 0; const apiClient_1 = require("../../client/apiClient"); const dataParser_1 = require("../../utils/dataParser"); const paymentAcceptanceListResponseOfPaymentAcceptanceRefund_1 = require("../../model/paymentAcceptanceListResponseOfPaymentAcceptanceRefund"); const paymentAcceptanceRefund_1 = require("../../model/paymentAcceptanceRefund"); class PaymentAcceptanceRefundsApi { async createRefund(refund_create_request, options = {}) { const localVarPath = '/api/v1/pa/refunds/create'; const { headers, timeout, responseType } = options; let localVarHeaderParams = Object.assign({}, headers ? headers : {}); if (refund_create_request === null || refund_create_request === undefined) { throw new Error('Required parameter refund_create_request was null or undefined when calling createRefund.'); } const data = await apiClient_1.apiClient.post(localVarPath, { headers: localVarHeaderParams, timeout, responseType, }, refund_create_request); const typeName = paymentAcceptanceRefund_1.PaymentAcceptanceRefund.discriminator; return (0, dataParser_1.parseDataToType)(data, typeName); } async listRefunds({ currency, from_created_at, page_num, page_size, payment_attempt_id, payment_intent_id, status, to_created_at }, options = {}) { const localVarPath = '/api/v1/pa/refunds'; const { headers, timeout, responseType } = options; let localVarHeaderParams = Object.assign({}, headers ? headers : {}); let queryParams = {}; if (currency !== undefined) { queryParams['currency'] = currency; } if (from_created_at !== undefined) { queryParams['from_created_at'] = from_created_at; } if (page_num !== undefined) { queryParams['page_num'] = page_num; } if (page_size !== undefined) { queryParams['page_size'] = page_size; } if (payment_attempt_id !== undefined) { queryParams['payment_attempt_id'] = payment_attempt_id; } if (payment_intent_id !== undefined) { queryParams['payment_intent_id'] = payment_intent_id; } if (status !== undefined) { queryParams['status'] = status; } if (to_created_at !== undefined) { queryParams['to_created_at'] = to_created_at; } const data = await apiClient_1.apiClient.get(localVarPath, { headers: localVarHeaderParams, params: queryParams, timeout, responseType, }); const typeName = paymentAcceptanceListResponseOfPaymentAcceptanceRefund_1.PaymentAcceptanceListResponseOfPaymentAcceptanceRefund.discriminator; return (0, dataParser_1.parseDataToType)(data, typeName); } async retrieveRefund(id, options = {}) { if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling retrieveRefund.'); } const localVarPath = '/api/v1/pa/refunds/{id}'.replace('{' + 'id' + '}', encodeURIComponent(String(id))); const { headers, timeout, responseType } = options; let localVarHeaderParams = Object.assign({}, headers ? headers : {}); const data = await apiClient_1.apiClient.get(localVarPath, { headers: localVarHeaderParams, timeout, responseType, }); const typeName = paymentAcceptanceRefund_1.PaymentAcceptanceRefund.discriminator; return (0, dataParser_1.parseDataToType)(data, typeName); } } exports.PaymentAcceptanceRefundsApi = PaymentAcceptanceRefundsApi; //# sourceMappingURL=paymentAcceptanceRefundsApi.js.map