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