@airwallex/node-sdk
Version:
Airwallex Node.js SDK
145 lines • 7.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PaymentAcceptancePaymentDisputesApi = void 0;
const apiClient_1 = require("../../client/apiClient");
const dataParser_1 = require("../../utils/dataParser");
const paymentAcceptancePageResponseDTOOfPaymentAcceptancePaymentDispute_1 = require("../../model/paymentAcceptancePageResponseDTOOfPaymentAcceptancePaymentDispute");
const paymentAcceptancePageResponseDTOOfPaymentAcceptanceRelatedOrder_1 = require("../../model/paymentAcceptancePageResponseDTOOfPaymentAcceptanceRelatedOrder");
const paymentAcceptancePaymentDispute_1 = require("../../model/paymentAcceptancePaymentDispute");
class PaymentAcceptancePaymentDisputesApi {
async acceptDispute(id, request, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling acceptDispute.');
}
const localVarPath = '/api/v1/pa/payment_disputes/{id}/accept'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (request === null || request === undefined) {
throw new Error('Required parameter request was null or undefined when calling acceptDispute.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, request);
const typeName = paymentAcceptancePaymentDispute_1.PaymentAcceptancePaymentDispute.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async challengeDispute(id, request, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling challengeDispute.');
}
const localVarPath = '/api/v1/pa/payment_disputes/{id}/challenge'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (request === null || request === undefined) {
throw new Error('Required parameter request was null or undefined when calling challengeDispute.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, request);
const typeName = paymentAcceptancePaymentDispute_1.PaymentAcceptancePaymentDispute.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getDispute(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getDispute.');
}
const localVarPath = '/api/v1/pa/payment_disputes/{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 = paymentAcceptancePaymentDispute_1.PaymentAcceptancePaymentDispute.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getDisputes({ customer_id, customer_name, from_due_at, from_updated_at, merchant_order_id, page, payment_intent_id, payment_method_type, reason_code, size, stage, status, to_due_at, to_updated_at, transaction_type }, options = {}) {
const localVarPath = '/api/v1/pa/payment_disputes';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
let queryParams = {};
if (customer_id !== undefined) {
queryParams['customer_id'] = customer_id;
}
if (customer_name !== undefined) {
queryParams['customer_name'] = customer_name;
}
if (from_due_at !== undefined) {
queryParams['from_due_at'] = from_due_at;
}
if (from_updated_at !== undefined) {
queryParams['from_updated_at'] = from_updated_at;
}
if (merchant_order_id !== undefined) {
queryParams['merchant_order_id'] = merchant_order_id;
}
if (page !== undefined) {
queryParams['page'] = page;
}
if (payment_intent_id !== undefined) {
queryParams['payment_intent_id'] = payment_intent_id;
}
if (payment_method_type !== undefined) {
queryParams['payment_method_type'] = payment_method_type;
}
if (reason_code !== undefined) {
queryParams['reason_code'] = reason_code;
}
if (size !== undefined) {
queryParams['size'] = size;
}
if (stage !== undefined) {
queryParams['stage'] = stage;
}
if (status !== undefined) {
queryParams['status'] = status;
}
if (to_due_at !== undefined) {
queryParams['to_due_at'] = to_due_at;
}
if (to_updated_at !== undefined) {
queryParams['to_updated_at'] = to_updated_at;
}
if (transaction_type !== undefined) {
queryParams['transaction_type'] = transaction_type;
}
const data = await apiClient_1.apiClient.get(localVarPath, {
headers: localVarHeaderParams,
params: queryParams,
timeout,
responseType,
});
const typeName = paymentAcceptancePageResponseDTOOfPaymentAcceptancePaymentDispute_1.PaymentAcceptancePageResponseDTOOfPaymentAcceptancePaymentDispute.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getRelatedPaymentIntents(id, { page, page_size }, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getRelatedPaymentIntents.');
}
const localVarPath = '/api/v1/pa/payment_disputes/{id}/related_payment_intents'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
let queryParams = {};
if (page !== undefined) {
queryParams['page'] = page;
}
if (page_size !== undefined) {
queryParams['page_size'] = page_size;
}
const data = await apiClient_1.apiClient.get(localVarPath, {
headers: localVarHeaderParams,
params: queryParams,
timeout,
responseType,
});
const typeName = paymentAcceptancePageResponseDTOOfPaymentAcceptanceRelatedOrder_1.PaymentAcceptancePageResponseDTOOfPaymentAcceptanceRelatedOrder.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
}
exports.PaymentAcceptancePaymentDisputesApi = PaymentAcceptancePaymentDisputesApi;
//# sourceMappingURL=paymentAcceptancePaymentDisputesApi.js.map