cybersource-rest-client-typescript
Version:
NodeJS client for cybersource-rest-client-typescript
204 lines (174 loc) • 9.7 kB
JavaScript
/**
* 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
*
* Swagger Codegen version: 2.3.0
*
* Do not edit the class manually.
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'model/CreatePaymentRequest', 'model/IncrementAuthRequest', 'model/PtsV2IncrementalAuthorizationPatch201Response', 'model/PtsV2IncrementalAuthorizationPatch400Response', 'model/PtsV2PaymentsPost201Response', 'model/PtsV2PaymentsPost201Response1', 'model/PtsV2PaymentsPost400Response', 'model/PtsV2PaymentsPost502Response', 'model/RefreshPaymentStatusRequest'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('../model/CreatePaymentRequest'), require('../model/IncrementAuthRequest'), require('../model/PtsV2IncrementalAuthorizationPatch201Response'), require('../model/PtsV2IncrementalAuthorizationPatch400Response'), require('../model/PtsV2PaymentsPost201Response'), require('../model/PtsV2PaymentsPost201Response1'), require('../model/PtsV2PaymentsPost400Response'), require('../model/PtsV2PaymentsPost502Response'), require('../model/RefreshPaymentStatusRequest'));
} else {
// Browser globals (root is window)
if (!root.CyberSource) {
root.CyberSource = {};
}
root.CyberSource.PaymentsApi = factory(root.CyberSource.ApiClient, root.CyberSource.CreatePaymentRequest, root.CyberSource.IncrementAuthRequest, root.CyberSource.PtsV2IncrementalAuthorizationPatch201Response, root.CyberSource.PtsV2IncrementalAuthorizationPatch400Response, root.CyberSource.PtsV2PaymentsPost201Response, root.CyberSource.PtsV2PaymentsPost201Response1, root.CyberSource.PtsV2PaymentsPost400Response, root.CyberSource.PtsV2PaymentsPost502Response, root.CyberSource.RefreshPaymentStatusRequest);
}
}(this, function(ApiClient, CreatePaymentRequest, IncrementAuthRequest, PtsV2IncrementalAuthorizationPatch201Response, PtsV2IncrementalAuthorizationPatch400Response, PtsV2PaymentsPost201Response, PtsV2PaymentsPost201Response1, PtsV2PaymentsPost400Response, PtsV2PaymentsPost502Response, RefreshPaymentStatusRequest) {
'use strict';
/**
* Payments service.
* @module api/PaymentsApi
* @version 0.0.1
*/
/**
* Constructs a new PaymentsApi.
* @alias module:api/PaymentsApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
var exports = function(configObject, apiClient) {
this.apiClient = apiClient || ApiClient.instance;
this.apiClient.setConfiguration(configObject);
/**
* Callback function to receive the result of the createPayment operation.
* @callback module:api/PaymentsApi~createPaymentCallback
* @param {String} error Error message, if any.
* @param {module:model/PtsV2PaymentsPost201Response} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Process a Payment
* A payment authorizes the amount for the transaction. There are a number of supported payment feature, such as E-commerce and Card Present - Credit Card/Debit Card, Echeck, e-Wallets, Level II/III Data, etc.. A payment response includes the status of the request. It also includes processor-specific information when the request is successful and errors if unsuccessful. See the [Payments Developer Guides Page](https://developer.cybersource.com/api/developer-guides/dita-payments/GettingStarted.html). Authorization can be requested with Capture, Decision Manager, Payer Authentication(3ds), and Token Creation.
* @param {module:model/CreatePaymentRequest} createPaymentRequest
* @param {module:api/PaymentsApi~createPaymentCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/PtsV2PaymentsPost201Response}
*/
this.createPayment = function(createPaymentRequest, callback) {
var postBody = createPaymentRequest;
// verify the required parameter 'createPaymentRequest' is set
if (createPaymentRequest === undefined || createPaymentRequest === null) {
throw new Error("Missing the required parameter 'createPaymentRequest' when calling createPayment");
}
var pathParams = {
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json;charset=utf-8'];
var accepts = ['application/hal+json;charset=utf-8'];
var returnType = PtsV2PaymentsPost201Response;
return this.apiClient.callApi(
'/pts/v2/payments', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the incrementAuth operation.
* @callback module:api/PaymentsApi~incrementAuthCallback
* @param {String} error Error message, if any.
* @param {module:model/PtsV2IncrementalAuthorizationPatch201Response} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Increment an Authorization
* Use this service to authorize additional charges in a lodging or autorental transaction. Include the ID returned from the original authorization in the PATCH request to add additional charges to that authorization.
* @param {String} id The ID returned from the original authorization request.
* @param {module:model/IncrementAuthRequest} incrementAuthRequest
* @param {module:api/PaymentsApi~incrementAuthCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/PtsV2IncrementalAuthorizationPatch201Response}
*/
this.incrementAuth = function(id, incrementAuthRequest, callback) {
var postBody = incrementAuthRequest;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling incrementAuth");
}
// verify the required parameter 'incrementAuthRequest' is set
if (incrementAuthRequest === undefined || incrementAuthRequest === null) {
throw new Error("Missing the required parameter 'incrementAuthRequest' when calling incrementAuth");
}
var pathParams = {
'id': id
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json;charset=utf-8'];
var accepts = ['application/hal+json;charset=utf-8'];
var returnType = PtsV2IncrementalAuthorizationPatch201Response;
return this.apiClient.callApi(
'/pts/v2/payments/{id}', 'PATCH',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the refreshPaymentStatus operation.
* @callback module:api/PaymentsApi~refreshPaymentStatusCallback
* @param {String} error Error message, if any.
* @param {module:model/PtsV2PaymentsPost201Response1} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Check a Payment Status
* Checks and updates the payment status
* @param {String} id The payment id whose status needs to be checked and updated.
* @param {module:model/RefreshPaymentStatusRequest} refreshPaymentStatusRequest
* @param {module:api/PaymentsApi~refreshPaymentStatusCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/PtsV2PaymentsPost201Response1}
*/
this.refreshPaymentStatus = function(id, refreshPaymentStatusRequest, callback) {
var postBody = refreshPaymentStatusRequest;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling refreshPaymentStatus");
}
// verify the required parameter 'refreshPaymentStatusRequest' is set
if (refreshPaymentStatusRequest === undefined || refreshPaymentStatusRequest === null) {
throw new Error("Missing the required parameter 'refreshPaymentStatusRequest' when calling refreshPaymentStatus");
}
var pathParams = {
'id': id
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json;charset=utf-8'];
var accepts = ['application/hal+json;charset=utf-8'];
var returnType = PtsV2PaymentsPost201Response1;
return this.apiClient.callApi(
'/pts/v2/refresh-payment-status/{id}', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
};
return exports;
}));