- 1 :
- 2 :
(function(root, factory) {
- 3 :
if (typeof define === 'function' && define.amd) {
- 4 :
// AMD. Register as an anonymous module.
- 5 :
define(['ApiClient', 'models/CancelPaymentAuthorizationRequest', 'models/CreatePaymentAuthorizationRequest', 'models/ErrorResponseVo', 'models/PaymentAuthorizationResponse'], factory);
- 6 :
} else if (typeof module === 'object' && module.exports) {
- 7 :
// CommonJS-like environments that support module.exports, like Node.
- 8 :
module.exports = factory(require('../ApiClient'), require('../models/CancelPaymentAuthorizationRequest'), require('../models/CreatePaymentAuthorizationRequest'), require('../models/ErrorResponseVo'), require('../models/PaymentAuthorizationResponse'));
- 9 :
} else {
- 10 :
// Browser globals (root is window)
- 11 :
if (!root.OrbipayPaymentsapiClient) {
- 12 :
root.OrbipayPaymentsapiClient = {};
- 13 :
}
- 14 :
root.OrbipayPaymentsapiClient.PaymentAuthorizationApi = factory(root.OrbipayPaymentsapiClient.ApiClient, root.OrbipayPaymentsapiClient.CancelPaymentAuthorizationRequest, root.OrbipayPaymentsapiClient.CreatePaymentAuthorizationRequest, root.OrbipayPaymentsapiClient.ErrorResponseVo, root.OrbipayPaymentsapiClient.PaymentAuthorizationResponse);
- 15 :
}
- 16 :
}(this, function(ApiClient, CancelPaymentAuthorizationRequest, CreatePaymentAuthorizationRequest, ErrorResponseVo, PaymentAuthorizationResponse) {
- 17 :
'use strict';
- 18 :
- 19 :
/**
- 20 :
* PaymentAuthorization service.
- 21 :
* @module api/PaymentAuthorizationApi
- 22 :
*/
- 23 :
- 24 :
/**
- 25 :
* <h3 style="color:red"> This class subject to change without prior notice, Please dont use this class directly. </h3>
- 26 :
- 27 :
* Constructs a new PaymentAuthorizationApi.
- 28 :
* @alias module:api/PaymentAuthorizationApi
- 29 :
* @class
- 30 :
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
- 31 :
* default to {@link module:ApiClient#instance} if unspecified.
- 32 :
*/
- 33 :
var exports = function(apiClient) {
- 34 :
this.apiClient = apiClient || ApiClient.instance;
- 35 :
- 36 :
- 37 :
/**
- 38 :
* Callback function to receive the result of the cancelPaymentAuthorization operation.
- 39 :
* @callback module:api/PaymentAuthorizationApi~cancelPaymentAuthorizationCallback
- 40 :
* @param {String} error Error message, if any.
- 41 :
* @param data This operation does not return a value.
- 42 :
* @param {String} response The complete HTTP response.
- 43 :
*/
- 44 :
- 45 :
/**
- 46 :
* Cancel Payment Authorization
- 47 :
* The API is used to cancel a payment authorization. Payment Authorizations that are already been processed into Payment cannot be cancelled. It returns 204 http status code with empty body in successful case.
- 48 :
* @param {String} channel The channel through which the API is invoked.
- 49 :
* @param {String} client_key The unique identifier assigned by EBPP to the client.
- 50 :
* @param {module:models/String} product The product identifier corresponding to the API.
- 51 :
* @param {String} timestamp The timestamp for the moment when the API request is created.
- 52 :
* @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
- 53 :
* @param {module:models/String} requestor_type Type of the requestor of the API.
- 54 :
* @param {String} id_customer The unique identifier assigned by EBPP to the customer.
- 55 :
* @param {String} id_authorization The unique identifier assigned by EBPP to the payment authorization.
- 56 :
* @param {module:models/CancelPaymentAuthorizationRequest} cancel_payment_authorization_request Details of payment authorization to be cancelled
- 57 :
* @param {Object} opts Optional parameters
- 58 :
* @param {String} opts.requestor The identifier for the requestor of the API.
- 59 :
* @param {String} opts.x_opay_headers Intended for the future use.
- 60 :
* @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
- 61 :
* @param {module:api/PaymentAuthorizationApi~cancelPaymentAuthorizationCallback} callback The callback function, accepting three arguments: error, data, response
- 62 :
*/
- 63 :
this.cancelPaymentAuthorization = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, id_authorization, cancel_payment_authorization_request, opts, callback) {
- 64 :
opts = opts || {};
- 65 :
var postBody = cancel_payment_authorization_request;
- 66 :
- 67 :
var pathParams = {
- 68 :
'ID_CUSTOMER': id_customer,
- 69 :
'ID_AUTHORIZATION': id_authorization
- 70 :
};
- 71 :
var queryParams = {
- 72 :
};
- 73 :
var headerParams = {
- 74 :
'channel': channel,
- 75 :
'client_key': client_key,
- 76 :
'product': product,
- 77 :
'timestamp': timestamp,
- 78 :
'idempotent_request_key': idempotent_request_key,
- 79 :
'requestor_type': requestor_type,
- 80 :
'requestor': opts['requestor'],
- 81 :
'X-OPAY-Headers': opts['x_opay_headers'],
- 82 :
'trace_id': opts['trace_id']
- 83 :
};
- 84 :
var formParams = {
- 85 :
};
- 86 :
- 87 :
var authNames = [];
- 88 :
var contentTypes = ['application/json'];
- 89 :
var accepts = ['application/json'];
- 90 :
var returnType = null;
- 91 :
- 92 :
return this.apiClient.callApi(
- 93 :
'/customers/{ID_CUSTOMER}/payments/auth/{ID_AUTHORIZATION}/cancel', 'POST',
- 94 :
pathParams, queryParams, headerParams, formParams, postBody,
- 95 :
authNames, contentTypes, accepts, returnType, callback
- 96 :
);
- 97 :
};
- 98 :
- 99 :
/**
- 100 :
* Callback function to receive the result of the createPaymentAuthorization operation.
- 101 :
* @callback module:api/PaymentAuthorizationApi~createPaymentAuthorizationCallback
- 102 :
* @param {String} error Error message, if any.
- 103 :
* @param {module:models/PaymentAuthorizationResponse} data The data returned by the service call.
- 104 :
* @param {String} response The complete HTTP response.
- 105 :
*/
- 106 :
- 107 :
/**
- 108 :
* Create Payment Authorization
- 109 :
* The API is used to create a payment authorization with certain amount on a given card account. Client systems can provide the unique identifier for the payment authorization in their system as payment_auth_reference.
- 110 :
* @param {String} channel The channel through which the API is invoked.
- 111 :
* @param {String} client_key The unique identifier assigned by EBPP to the client.
- 112 :
* @param {module:models/String} product The product identifier corresponding to the API.
- 113 :
* @param {String} timestamp The timestamp for the moment when the API request is created.
- 114 :
* @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
- 115 :
* @param {module:models/String} requestor_type Type of the requestor of the API.
- 116 :
* @param {module:models/CreatePaymentAuthorizationRequest} create_payment_authorization_request JSON containing all the fields required to make a payment.
- 117 :
* @param {Object} opts Optional parameters
- 118 :
* @param {String} opts.requestor The identifier for the requestor of the API.
- 119 :
* @param {String} opts.x_opay_headers Intended for the future use.
- 120 :
* @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
- 121 :
* @param {module:api/PaymentAuthorizationApi~createPaymentAuthorizationCallback} callback The callback function, accepting three arguments: error, data, response
- 122 :
* data is of type: {@link module:models/PaymentAuthorizationResponse}
- 123 :
*/
- 124 :
this.createPaymentAuthorization = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, create_payment_authorization_request, opts, callback) {
- 125 :
opts = opts || {};
- 126 :
var postBody = create_payment_authorization_request;
- 127 :
- 128 :
var pathParams = {
- 129 :
};
- 130 :
var queryParams = {
- 131 :
};
- 132 :
var headerParams = {
- 133 :
'channel': channel,
- 134 :
'client_key': client_key,
- 135 :
'product': product,
- 136 :
'timestamp': timestamp,
- 137 :
'idempotent_request_key': idempotent_request_key,
- 138 :
'requestor_type': requestor_type,
- 139 :
'requestor': opts['requestor'],
- 140 :
'X-OPAY-Headers': opts['x_opay_headers'],
- 141 :
'trace_id': opts['trace_id']
- 142 :
};
- 143 :
var formParams = {
- 144 :
};
- 145 :
- 146 :
var authNames = [];
- 147 :
var contentTypes = ['application/json'];
- 148 :
var accepts = ['application/json'];
- 149 :
var returnType = PaymentAuthorizationResponse;
- 150 :
- 151 :
return this.apiClient.callApi(
- 152 :
'/payments/auth', 'POST',
- 153 :
pathParams, queryParams, headerParams, formParams, postBody,
- 154 :
authNames, contentTypes, accepts, returnType, callback
- 155 :
);
- 156 :
};
- 157 :
};
- 158 :
- 159 :
return exports;
- 160 :
}));