@paciolan/cybersource-sdk
Version:
CyberSource REST API Typescript SDK
482 lines • 65.2 kB
JavaScript
"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());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomerPaymentInstrumentApi = exports.CustomerPaymentInstrumentApiFactory = exports.CustomerPaymentInstrumentApiFp = exports.CustomerPaymentInstrumentApiAxiosParamCreator = void 0;
/* tslint:disable */
/* eslint-disable */
/**
* CyberSource Merged Spec
* All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
*
* OpenAPI spec version: 0.0.1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
const axios_1 = __importDefault(require("axios"));
const AuthenticationHeader_1 = require("../authentication/core/AuthenticationHeader");
// Some imports not used depending on template conditions
// @ts-ignore
const base_1 = require("../base");
/**
* CustomerPaymentInstrumentApi - axios parameter creator
* @export
*/
const CustomerPaymentInstrumentApiAxiosParamCreator = function (configuration) {
return {
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Deleting a Customers Payment Instrument**<br>Your system can use this API to delete an existing Payment Instrument for a Customer.<br>Any Instrument Identifiers representing the card number will also be deleted if they are not associated with any other Payment Instruments.<br>If a customer has more than one Payment Instrument then the default Payment Instrument cannot be deleted without first selecting a [new default Payment Instrument](#token-management_customer-payment-instrument_update-a-customer-payment-instrument_samplerequests-dropdown_make-customer-payment-instrument-the-default_liveconsole-tab-request-body).
* @summary Delete a Customer Payment Instrument
* @param {string} customerId The Id of a Customer.
* @param {string} paymentInstrumentId The Id of a payment instrument.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteCustomerPaymentInstrument: (customerId, paymentInstrumentId, profileId, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'customerId' is not null or undefined
if (customerId === null || customerId === undefined) {
throw new base_1.RequiredError('customerId', 'Required parameter customerId was null or undefined when calling deleteCustomerPaymentInstrument.');
}
// verify required parameter 'paymentInstrumentId' is not null or undefined
if (paymentInstrumentId === null || paymentInstrumentId === undefined) {
throw new base_1.RequiredError('paymentInstrumentId', 'Required parameter paymentInstrumentId was null or undefined when calling deleteCustomerPaymentInstrument.');
}
const localVarPath = `/tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}`
.replace(`{${"customerId"}}`, encodeURIComponent(String(customerId)))
.replace(`{${"paymentInstrumentId"}}`, encodeURIComponent(String(paymentInstrumentId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (profileId !== undefined && profileId !== null) {
localVarHeaderParameter['profile-id'] = String(profileId);
}
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
const authHeader = new AuthenticationHeader_1.AuthenticationHeader();
authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options));
localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers);
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
}),
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Retrieving a Customer Payment Instrument**<br>Your system can use this API to retrieve an existing Payment Instrument for a Customer.<br>To perform a payment with a particular Payment Instrument simply specify the [Payment Instrument Id in the payments request](#payments_payments_process-a-payment_samplerequests-dropdown_authorization-using-tokens_authorization-with-customer-payment-instrument-and-shipping-address-token-id_liveconsole-tab-request-body).
* @summary Retrieve a Customer Payment Instrument
* @param {string} customerId The Id of a Customer.
* @param {string} paymentInstrumentId The Id of a payment instrument.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomerPaymentInstrument: (customerId, paymentInstrumentId, profileId, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'customerId' is not null or undefined
if (customerId === null || customerId === undefined) {
throw new base_1.RequiredError('customerId', 'Required parameter customerId was null or undefined when calling getCustomerPaymentInstrument.');
}
// verify required parameter 'paymentInstrumentId' is not null or undefined
if (paymentInstrumentId === null || paymentInstrumentId === undefined) {
throw new base_1.RequiredError('paymentInstrumentId', 'Required parameter paymentInstrumentId was null or undefined when calling getCustomerPaymentInstrument.');
}
const localVarPath = `/tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}`
.replace(`{${"customerId"}}`, encodeURIComponent(String(customerId)))
.replace(`{${"paymentInstrumentId"}}`, encodeURIComponent(String(paymentInstrumentId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (profileId !== undefined && profileId !== null) {
localVarHeaderParameter['profile-id'] = String(profileId);
}
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
const authHeader = new AuthenticationHeader_1.AuthenticationHeader();
authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options));
localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers);
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
}),
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Retrieving all Customer Payment Instruments**<br>Your system can use this API to retrieve all existing Payment Instruments for a Customer.
* @summary List Payment Instruments for a Customer
* @param {string} customerId The Id of a Customer.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {number} [offset] Starting record in zero-based dataset that should be returned as the first object in the array. Default is 0.
* @param {number} [limit] The maximum number that can be returned in the array starting from the offset record in zero-based dataset. Default is 20, maximum is 100.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomerPaymentInstrumentsList: (customerId, profileId, offset, limit, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'customerId' is not null or undefined
if (customerId === null || customerId === undefined) {
throw new base_1.RequiredError('customerId', 'Required parameter customerId was null or undefined when calling getCustomerPaymentInstrumentsList.');
}
const localVarPath = `/tms/v2/customers/{customerId}/payment-instruments`
.replace(`{${"customerId"}}`, encodeURIComponent(String(customerId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (offset !== undefined) {
localVarQueryParameter['offset'] = offset;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (profileId !== undefined && profileId !== null) {
localVarHeaderParameter['profile-id'] = String(profileId);
}
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
const authHeader = new AuthenticationHeader_1.AuthenticationHeader();
authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options));
localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers);
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
}),
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Updating a Customers Payment Instrument**<br>Your system can use this API to update an existing Payment Instrument for a Customer, including selecting a [default Payment Instrument](#token-management_customer-payment-instrument_update-a-customer-payment-instrument_samplerequests-dropdown_make-customer-payment-instrument-the-default_liveconsole-tab-request-body) for use in payments.
* @summary Update a Customer Payment Instrument
* @param {PaymentinstrumentsPaymentInstrumentIdBody} body
* @param {string} customerId The Id of a Customer.
* @param {string} paymentInstrumentId The Id of a payment instrument.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {string} [ifMatch] Contains an ETag value from a GET request to make the request conditional.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
patchCustomersPaymentInstrument: (body, customerId, paymentInstrumentId, profileId, ifMatch, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new base_1.RequiredError('body', 'Required parameter body was null or undefined when calling patchCustomersPaymentInstrument.');
}
// verify required parameter 'customerId' is not null or undefined
if (customerId === null || customerId === undefined) {
throw new base_1.RequiredError('customerId', 'Required parameter customerId was null or undefined when calling patchCustomersPaymentInstrument.');
}
// verify required parameter 'paymentInstrumentId' is not null or undefined
if (paymentInstrumentId === null || paymentInstrumentId === undefined) {
throw new base_1.RequiredError('paymentInstrumentId', 'Required parameter paymentInstrumentId was null or undefined when calling patchCustomersPaymentInstrument.');
}
const localVarPath = `/tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}`
.replace(`{${"customerId"}}`, encodeURIComponent(String(customerId)))
.replace(`{${"paymentInstrumentId"}}`, encodeURIComponent(String(paymentInstrumentId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'PATCH' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (profileId !== undefined && profileId !== null) {
localVarHeaderParameter['profile-id'] = String(profileId);
}
if (ifMatch !== undefined && ifMatch !== null) {
localVarHeaderParameter['if-match'] = String(ifMatch);
}
localVarHeaderParameter['Content-Type'] = 'application/json;charset=utf-8';
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
const authHeader = new AuthenticationHeader_1.AuthenticationHeader();
authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options));
localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers);
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
}),
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br><br>**Creating a Customer Payment Instrument**<br>It is recommended you [create a Customer Payment Instrument via a Payment Authorization](#payments_payments_process-a-payment_samplerequests-dropdown_authorization-with-token-create_authorization-create-default-payment-instrument-shipping-address-for-existing-customer_liveconsole-tab-request-body), this can be for a zero amount.<br>In Europe: You should perform Payer Authentication alongside the Authorization.| |**Payment Network Tokens**<br>Network tokens perform better than regular card numbers and they are not necessarily invalidated when a cardholder loses their card, or it expires.<br>A Payment Network Token will be automatically created and used in future payments if you are enabled for the service.<br>A Payment Network Token can also be [provisioned for an existing Instrument Identifier](#token-management_instrument-identifier_enroll-an-instrument-identifier-for-payment-network-token).<br>For more information about Payment Network Tokens see the Developer Guide.<br><br>**Payments with Customers Payment Instrument**<br>To perform a payment with a particular Payment Instrument or Shipping Address specify the [Payment Instrument in the payment request](#payments_payments_process-a-payment_samplerequests-dropdown_authorization-using-tokens_authorization-with-customer-payment-instrument-and-shipping-address-token-id_liveconsole-tab-request-body).
* @summary Create a Customer Payment Instrument
* @param {CustomerIdPaymentinstrumentsBody} body
* @param {string} customerId The Id of a Customer.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
postCustomerPaymentInstrument: (body, customerId, profileId, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new base_1.RequiredError('body', 'Required parameter body was null or undefined when calling postCustomerPaymentInstrument.');
}
// verify required parameter 'customerId' is not null or undefined
if (customerId === null || customerId === undefined) {
throw new base_1.RequiredError('customerId', 'Required parameter customerId was null or undefined when calling postCustomerPaymentInstrument.');
}
const localVarPath = `/tms/v2/customers/{customerId}/payment-instruments`
.replace(`{${"customerId"}}`, encodeURIComponent(String(customerId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (profileId !== undefined && profileId !== null) {
localVarHeaderParameter['profile-id'] = String(profileId);
}
localVarHeaderParameter['Content-Type'] = 'application/json;charset=utf-8';
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
const authHeader = new AuthenticationHeader_1.AuthenticationHeader();
authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options));
localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers);
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
}),
};
};
exports.CustomerPaymentInstrumentApiAxiosParamCreator = CustomerPaymentInstrumentApiAxiosParamCreator;
/**
* CustomerPaymentInstrumentApi - functional programming interface
* @export
*/
const CustomerPaymentInstrumentApiFp = function (configuration) {
return {
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Deleting a Customers Payment Instrument**<br>Your system can use this API to delete an existing Payment Instrument for a Customer.<br>Any Instrument Identifiers representing the card number will also be deleted if they are not associated with any other Payment Instruments.<br>If a customer has more than one Payment Instrument then the default Payment Instrument cannot be deleted without first selecting a [new default Payment Instrument](#token-management_customer-payment-instrument_update-a-customer-payment-instrument_samplerequests-dropdown_make-customer-payment-instrument-the-default_liveconsole-tab-request-body).
* @summary Delete a Customer Payment Instrument
* @param {string} customerId The Id of a Customer.
* @param {string} paymentInstrumentId The Id of a payment instrument.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteCustomerPaymentInstrument(customerId, paymentInstrumentId, profileId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.CustomerPaymentInstrumentApiAxiosParamCreator)(configuration).deleteCustomerPaymentInstrument(customerId, paymentInstrumentId, profileId, options);
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
return axios.request(axiosRequestArgs);
};
});
},
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Retrieving a Customer Payment Instrument**<br>Your system can use this API to retrieve an existing Payment Instrument for a Customer.<br>To perform a payment with a particular Payment Instrument simply specify the [Payment Instrument Id in the payments request](#payments_payments_process-a-payment_samplerequests-dropdown_authorization-using-tokens_authorization-with-customer-payment-instrument-and-shipping-address-token-id_liveconsole-tab-request-body).
* @summary Retrieve a Customer Payment Instrument
* @param {string} customerId The Id of a Customer.
* @param {string} paymentInstrumentId The Id of a payment instrument.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomerPaymentInstrument(customerId, paymentInstrumentId, profileId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.CustomerPaymentInstrumentApiAxiosParamCreator)(configuration).getCustomerPaymentInstrument(customerId, paymentInstrumentId, profileId, options);
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
return axios.request(axiosRequestArgs);
};
});
},
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Retrieving all Customer Payment Instruments**<br>Your system can use this API to retrieve all existing Payment Instruments for a Customer.
* @summary List Payment Instruments for a Customer
* @param {string} customerId The Id of a Customer.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {number} [offset] Starting record in zero-based dataset that should be returned as the first object in the array. Default is 0.
* @param {number} [limit] The maximum number that can be returned in the array starting from the offset record in zero-based dataset. Default is 20, maximum is 100.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomerPaymentInstrumentsList(customerId, profileId, offset, limit, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.CustomerPaymentInstrumentApiAxiosParamCreator)(configuration).getCustomerPaymentInstrumentsList(customerId, profileId, offset, limit, options);
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
return axios.request(axiosRequestArgs);
};
});
},
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Updating a Customers Payment Instrument**<br>Your system can use this API to update an existing Payment Instrument for a Customer, including selecting a [default Payment Instrument](#token-management_customer-payment-instrument_update-a-customer-payment-instrument_samplerequests-dropdown_make-customer-payment-instrument-the-default_liveconsole-tab-request-body) for use in payments.
* @summary Update a Customer Payment Instrument
* @param {PaymentinstrumentsPaymentInstrumentIdBody} body
* @param {string} customerId The Id of a Customer.
* @param {string} paymentInstrumentId The Id of a payment instrument.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {string} [ifMatch] Contains an ETag value from a GET request to make the request conditional.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
patchCustomersPaymentInstrument(body, customerId, paymentInstrumentId, profileId, ifMatch, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.CustomerPaymentInstrumentApiAxiosParamCreator)(configuration).patchCustomersPaymentInstrument(body, customerId, paymentInstrumentId, profileId, ifMatch, options);
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
return axios.request(axiosRequestArgs);
};
});
},
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br><br>**Creating a Customer Payment Instrument**<br>It is recommended you [create a Customer Payment Instrument via a Payment Authorization](#payments_payments_process-a-payment_samplerequests-dropdown_authorization-with-token-create_authorization-create-default-payment-instrument-shipping-address-for-existing-customer_liveconsole-tab-request-body), this can be for a zero amount.<br>In Europe: You should perform Payer Authentication alongside the Authorization.| |**Payment Network Tokens**<br>Network tokens perform better than regular card numbers and they are not necessarily invalidated when a cardholder loses their card, or it expires.<br>A Payment Network Token will be automatically created and used in future payments if you are enabled for the service.<br>A Payment Network Token can also be [provisioned for an existing Instrument Identifier](#token-management_instrument-identifier_enroll-an-instrument-identifier-for-payment-network-token).<br>For more information about Payment Network Tokens see the Developer Guide.<br><br>**Payments with Customers Payment Instrument**<br>To perform a payment with a particular Payment Instrument or Shipping Address specify the [Payment Instrument in the payment request](#payments_payments_process-a-payment_samplerequests-dropdown_authorization-using-tokens_authorization-with-customer-payment-instrument-and-shipping-address-token-id_liveconsole-tab-request-body).
* @summary Create a Customer Payment Instrument
* @param {CustomerIdPaymentinstrumentsBody} body
* @param {string} customerId The Id of a Customer.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
postCustomerPaymentInstrument(body, customerId, profileId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.CustomerPaymentInstrumentApiAxiosParamCreator)(configuration).postCustomerPaymentInstrument(body, customerId, profileId, options);
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
return axios.request(axiosRequestArgs);
};
});
},
};
};
exports.CustomerPaymentInstrumentApiFp = CustomerPaymentInstrumentApiFp;
/**
* CustomerPaymentInstrumentApi - factory interface
* @export
*/
const CustomerPaymentInstrumentApiFactory = function (configuration, basePath, axios) {
return {
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Deleting a Customers Payment Instrument**<br>Your system can use this API to delete an existing Payment Instrument for a Customer.<br>Any Instrument Identifiers representing the card number will also be deleted if they are not associated with any other Payment Instruments.<br>If a customer has more than one Payment Instrument then the default Payment Instrument cannot be deleted without first selecting a [new default Payment Instrument](#token-management_customer-payment-instrument_update-a-customer-payment-instrument_samplerequests-dropdown_make-customer-payment-instrument-the-default_liveconsole-tab-request-body).
* @summary Delete a Customer Payment Instrument
* @param {string} customerId The Id of a Customer.
* @param {string} paymentInstrumentId The Id of a payment instrument.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteCustomerPaymentInstrument(customerId, paymentInstrumentId, profileId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.CustomerPaymentInstrumentApiFp)(configuration).deleteCustomerPaymentInstrument(customerId, paymentInstrumentId, profileId, options).then((request) => request(axios, basePath));
});
},
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Retrieving a Customer Payment Instrument**<br>Your system can use this API to retrieve an existing Payment Instrument for a Customer.<br>To perform a payment with a particular Payment Instrument simply specify the [Payment Instrument Id in the payments request](#payments_payments_process-a-payment_samplerequests-dropdown_authorization-using-tokens_authorization-with-customer-payment-instrument-and-shipping-address-token-id_liveconsole-tab-request-body).
* @summary Retrieve a Customer Payment Instrument
* @param {string} customerId The Id of a Customer.
* @param {string} paymentInstrumentId The Id of a payment instrument.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomerPaymentInstrument(customerId, paymentInstrumentId, profileId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.CustomerPaymentInstrumentApiFp)(configuration).getCustomerPaymentInstrument(customerId, paymentInstrumentId, profileId, options).then((request) => request(axios, basePath));
});
},
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Retrieving all Customer Payment Instruments**<br>Your system can use this API to retrieve all existing Payment Instruments for a Customer.
* @summary List Payment Instruments for a Customer
* @param {string} customerId The Id of a Customer.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {number} [offset] Starting record in zero-based dataset that should be returned as the first object in the array. Default is 0.
* @param {number} [limit] The maximum number that can be returned in the array starting from the offset record in zero-based dataset. Default is 20, maximum is 100.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomerPaymentInstrumentsList(customerId, profileId, offset, limit, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.CustomerPaymentInstrumentApiFp)(configuration).getCustomerPaymentInstrumentsList(customerId, profileId, offset, limit, options).then((request) => request(axios, basePath));
});
},
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.<br>A [Customer](#token-management_customer_create-a-customer) can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-customer-payment-instrument), with one allocated as the Customers default for use in payments.<br>A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-identifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.<br>| |**Updating a Customers Payment Instrument**<br>Your system can use this API to update an existing Payment Instrument for a Customer, including selecting a [default Payment Instrument](#token-management_customer-payment-instrument_update-a-customer-payment-instrument_samplerequests-dropdown_make-customer-payment-instrument-the-default_liveconsole-tab-request-body) for use in payments.
* @summary Update a Customer Payment Instrument
* @param {PaymentinstrumentsPaymentInstrumentIdBody} body
* @param {string} customerId The Id of a Customer.
* @param {string} paymentInstrumentId The Id of a payment instrument.
* @param {string} [profileId] The Id of a profile containing user specific TMS configuration.
* @param {string} [ifMatch] Contains an ETag value from a GET request to make the request conditional.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
patchCustomersPaymentInstrument(body, customerId, paymentInstrumentId, profileId, ifMatch, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.CustomerPaymentInstrumentApiFp)(configuration).patchCustomersPaymentInstrument(body, customerId, paymentInstrumentId, profileId, ifMatch, options).then((request) => request(axios, basePath));
});
},
/**
* | | | | | --- | --- | --- | |**Customer Payment Instrument**<br>A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing add