/* tslint:disable */ /* eslint-disable */ /** * Credify external API doc v2 * API documentations for integration version 2. * * The version of the OpenAPI document: 1.0.0-oas3 * Contact: dev@credify.one * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; import { Configuration } from '../configuration'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import { APIErrorV2 } from '../model'; // @ts-ignore import { IntegrationOrder } from '../model'; // @ts-ignore import { OrderRevertingRequest } from '../model'; /** * BNPLConsumerApi - axios parameter creator * @export */ export const BNPLConsumerApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * This requests disbursement of a BNPL order. * @summary Disburse order * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} */ disburseBnplOrder: async (orderId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'orderId' is not null or undefined assertParamExists('disburseBnplOrder', 'orderId', orderId) const localVarPath = `/v2/integration/bnpl-consumer/orders/{order_id}/disburse` .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This retrieves BNPL order\'s information * @summary Order retrieve * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBnplOrder: async (orderId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'orderId' is not null or undefined assertParamExists('getBnplOrder', 'orderId', orderId) const localVarPath = `/v2/integration/bnpl-consumer/orders/{order_id}` .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This reverts a BNPL payment. * @summary Revert order * @param {string} orderId The id of an order * @param {OrderRevertingRequest} orderRevertingRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ revertBnplOrder: async (orderId: string, orderRevertingRequest: OrderRevertingRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'orderId' is not null or undefined assertParamExists('revertBnplOrder', 'orderId', orderId) // verify required parameter 'orderRevertingRequest' is not null or undefined assertParamExists('revertBnplOrder', 'orderRevertingRequest', orderRevertingRequest) const localVarPath = `/v2/integration/bnpl-consumer/orders/{order_id}/revert` .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = orderRevertingRequest return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * BNPLConsumerApi - functional programming interface * @export */ export const BNPLConsumerApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = BNPLConsumerApiAxiosParamCreator(configuration) return { /** * This requests disbursement of a BNPL order. * @summary Disburse order * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} */ async disburseBnplOrder(orderId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.disburseBnplOrder(orderId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This retrieves BNPL order\'s information * @summary Order retrieve * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBnplOrder(orderId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBnplOrder(orderId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This reverts a BNPL payment. * @summary Revert order * @param {string} orderId The id of an order * @param {OrderRevertingRequest} orderRevertingRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async revertBnplOrder(orderId: string, orderRevertingRequest: OrderRevertingRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.revertBnplOrder(orderId, orderRevertingRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * BNPLConsumerApi - factory interface * @export */ export const BNPLConsumerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = BNPLConsumerApiFp(configuration) return { /** * This requests disbursement of a BNPL order. * @summary Disburse order * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} */ disburseBnplOrder(orderId: string, options?: any): AxiosPromise { return localVarFp.disburseBnplOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * This retrieves BNPL order\'s information * @summary Order retrieve * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBnplOrder(orderId: string, options?: any): AxiosPromise { return localVarFp.getBnplOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * This reverts a BNPL payment. * @summary Revert order * @param {string} orderId The id of an order * @param {OrderRevertingRequest} orderRevertingRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ revertBnplOrder(orderId: string, orderRevertingRequest: OrderRevertingRequest, options?: any): AxiosPromise { return localVarFp.revertBnplOrder(orderId, orderRevertingRequest, options).then((request) => request(axios, basePath)); }, }; }; /** * BNPLConsumerApi - interface * @export * @interface BNPLConsumerApi */ export interface BNPLConsumerApiInterface { /** * This requests disbursement of a BNPL order. * @summary Disburse order * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BNPLConsumerApiInterface */ disburseBnplOrder(orderId: string, options?: AxiosRequestConfig): AxiosPromise; /** * This retrieves BNPL order\'s information * @summary Order retrieve * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BNPLConsumerApiInterface */ getBnplOrder(orderId: string, options?: AxiosRequestConfig): AxiosPromise; /** * This reverts a BNPL payment. * @summary Revert order * @param {string} orderId The id of an order * @param {OrderRevertingRequest} orderRevertingRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BNPLConsumerApiInterface */ revertBnplOrder(orderId: string, orderRevertingRequest: OrderRevertingRequest, options?: AxiosRequestConfig): AxiosPromise; } /** * BNPLConsumerApi - object-oriented interface * @export * @class BNPLConsumerApi * @extends {BaseAPI} */ export class BNPLConsumerApi extends BaseAPI implements BNPLConsumerApiInterface { /** * This requests disbursement of a BNPL order. * @summary Disburse order * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BNPLConsumerApi */ public disburseBnplOrder(orderId: string, options?: AxiosRequestConfig) { return BNPLConsumerApiFp(this.configuration).disburseBnplOrder(orderId, options).then((request) => request(this.axios, this.basePath)); } /** * This retrieves BNPL order\'s information * @summary Order retrieve * @param {string} orderId The id of an order * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BNPLConsumerApi */ public getBnplOrder(orderId: string, options?: AxiosRequestConfig) { return BNPLConsumerApiFp(this.configuration).getBnplOrder(orderId, options).then((request) => request(this.axios, this.basePath)); } /** * This reverts a BNPL payment. * @summary Revert order * @param {string} orderId The id of an order * @param {OrderRevertingRequest} orderRevertingRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BNPLConsumerApi */ public revertBnplOrder(orderId: string, orderRevertingRequest: OrderRevertingRequest, options?: AxiosRequestConfig) { return BNPLConsumerApiFp(this.configuration).revertBnplOrder(orderId, orderRevertingRequest, options).then((request) => request(this.axios, this.basePath)); } }