@phonepe-pg/pg-sdk-node 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +221 -0
  3. package/dist/src/Env.d.ts +4 -0
  4. package/dist/src/Env.js +23 -0
  5. package/dist/src/EnvConfig.d.ts +11 -0
  6. package/dist/src/EnvConfig.js +42 -0
  7. package/dist/src/common/BaseClient.d.ts +33 -0
  8. package/dist/src/common/BaseClient.js +103 -0
  9. package/dist/src/common/CommonUtils.d.ts +9 -0
  10. package/dist/src/common/CommonUtils.js +45 -0
  11. package/dist/src/common/configs/CredentialConfig.d.ts +25 -0
  12. package/dist/src/common/configs/CredentialConfig.js +64 -0
  13. package/dist/src/common/configs/index.d.ts +1 -0
  14. package/dist/src/common/configs/index.js +32 -0
  15. package/dist/src/common/constants/BaseUrl.d.ts +12 -0
  16. package/dist/src/common/constants/BaseUrl.js +30 -0
  17. package/dist/src/common/constants/Headers.d.ts +16 -0
  18. package/dist/src/common/constants/Headers.js +36 -0
  19. package/dist/src/common/events/Constants.d.ts +10 -0
  20. package/dist/src/common/events/Constants.js +29 -0
  21. package/dist/src/common/events/EventQueueHandler.d.ts +11 -0
  22. package/dist/src/common/events/EventQueueHandler.js +57 -0
  23. package/dist/src/common/events/builders/BaseEventBuilder.d.ts +17 -0
  24. package/dist/src/common/events/builders/BaseEventBuilder.js +46 -0
  25. package/dist/src/common/events/builders/EventBuillder.d.ts +16 -0
  26. package/dist/src/common/events/builders/EventBuillder.js +195 -0
  27. package/dist/src/common/events/builders/EventDataBuilder.d.ts +55 -0
  28. package/dist/src/common/events/builders/EventDataBuilder.js +115 -0
  29. package/dist/src/common/events/models/BaseEvent.d.ts +11 -0
  30. package/dist/src/common/events/models/BaseEvent.js +31 -0
  31. package/dist/src/common/events/models/BulkEvent.d.ts +18 -0
  32. package/dist/src/common/events/models/BulkEvent.js +56 -0
  33. package/dist/src/common/events/models/EventData.d.ts +32 -0
  34. package/dist/src/common/events/models/EventData.js +53 -0
  35. package/dist/src/common/events/models/enums/EventState.d.ts +5 -0
  36. package/dist/src/common/events/models/enums/EventState.js +24 -0
  37. package/dist/src/common/events/models/enums/EventType.d.ts +19 -0
  38. package/dist/src/common/events/models/enums/EventType.js +38 -0
  39. package/dist/src/common/events/models/enums/FlowType.d.ts +3 -0
  40. package/dist/src/common/events/models/enums/FlowType.js +22 -0
  41. package/dist/src/common/events/publisher/DefaultEventPublisher.d.ts +7 -0
  42. package/dist/src/common/events/publisher/DefaultEventPublisher.js +31 -0
  43. package/dist/src/common/events/publisher/EventPublisher.d.ts +6 -0
  44. package/dist/src/common/events/publisher/EventPublisher.js +21 -0
  45. package/dist/src/common/events/publisher/EventPublisherFactory.d.ts +9 -0
  46. package/dist/src/common/events/publisher/EventPublisherFactory.js +38 -0
  47. package/dist/src/common/events/publisher/QueuedEventPublisher.d.ts +21 -0
  48. package/dist/src/common/events/publisher/QueuedEventPublisher.js +124 -0
  49. package/dist/src/common/exception/Constants.d.ts +3 -0
  50. package/dist/src/common/exception/Constants.js +24 -0
  51. package/dist/src/common/exception/Exceptions.d.ts +45 -0
  52. package/dist/src/common/exception/Exceptions.js +102 -0
  53. package/dist/src/common/exception/index.d.ts +1 -0
  54. package/dist/src/common/exception/index.js +32 -0
  55. package/dist/src/common/http/HttpCommand.d.ts +15 -0
  56. package/dist/src/common/http/HttpCommand.js +93 -0
  57. package/dist/src/common/http/HttpMethodType.d.ts +4 -0
  58. package/dist/src/common/http/HttpMethodType.js +23 -0
  59. package/dist/src/common/http/PhonePeResponse.d.ts +12 -0
  60. package/dist/src/common/http/PhonePeResponse.js +21 -0
  61. package/dist/src/common/http/index.d.ts +2 -0
  62. package/dist/src/common/http/index.js +33 -0
  63. package/dist/src/common/index.d.ts +5 -0
  64. package/dist/src/common/index.js +36 -0
  65. package/dist/src/common/models/MetaInfo.d.ts +26 -0
  66. package/dist/src/common/models/MetaInfo.js +61 -0
  67. package/dist/src/common/models/PaymentFlow.d.ts +5 -0
  68. package/dist/src/common/models/PaymentFlow.js +24 -0
  69. package/dist/src/common/models/PaymentFlowType.d.ts +4 -0
  70. package/dist/src/common/models/PaymentFlowType.js +23 -0
  71. package/dist/src/common/models/PgV2InstrumentType.d.ts +9 -0
  72. package/dist/src/common/models/PgV2InstrumentType.js +28 -0
  73. package/dist/src/common/models/index.d.ts +6 -0
  74. package/dist/src/common/models/index.js +37 -0
  75. package/dist/src/common/models/request/AccountConstraint.d.ts +18 -0
  76. package/dist/src/common/models/request/AccountConstraint.js +49 -0
  77. package/dist/src/common/models/request/DeviceContext.d.ts +17 -0
  78. package/dist/src/common/models/request/DeviceContext.js +46 -0
  79. package/dist/src/common/models/request/InstrumentConstraint.d.ts +5 -0
  80. package/dist/src/common/models/request/InstrumentConstraint.js +24 -0
  81. package/dist/src/common/models/request/PaymentInstrumentType.d.ts +3 -0
  82. package/dist/src/common/models/request/PaymentInstrumentType.js +22 -0
  83. package/dist/src/common/models/request/RefundRequest.d.ts +20 -0
  84. package/dist/src/common/models/request/RefundRequest.js +51 -0
  85. package/dist/src/common/models/request/index.d.ts +5 -0
  86. package/dist/src/common/models/request/index.js +36 -0
  87. package/dist/src/common/models/request/instruments/BillingAddress.d.ts +29 -0
  88. package/dist/src/common/models/request/instruments/BillingAddress.js +60 -0
  89. package/dist/src/common/models/request/instruments/CardPayRequestBuilder.d.ts +39 -0
  90. package/dist/src/common/models/request/instruments/CardPayRequestBuilder.js +113 -0
  91. package/dist/src/common/models/request/instruments/CardPaymentV2Instrument.d.ts +22 -0
  92. package/dist/src/common/models/request/instruments/CardPaymentV2Instrument.js +56 -0
  93. package/dist/src/common/models/request/instruments/CollectPaymentDetails.d.ts +5 -0
  94. package/dist/src/common/models/request/instruments/CollectPaymentDetails.js +24 -0
  95. package/dist/src/common/models/request/instruments/CollectPaymentDetailsType.d.ts +4 -0
  96. package/dist/src/common/models/request/instruments/CollectPaymentDetailsType.js +23 -0
  97. package/dist/src/common/models/request/instruments/CollectPaymentV2Instrument.d.ts +19 -0
  98. package/dist/src/common/models/request/instruments/CollectPaymentV2Instrument.js +49 -0
  99. package/dist/src/common/models/request/instruments/Expiry.d.ts +14 -0
  100. package/dist/src/common/models/request/instruments/Expiry.js +43 -0
  101. package/dist/src/common/models/request/instruments/IntentPaymentV2Instrument.d.ts +12 -0
  102. package/dist/src/common/models/request/instruments/IntentPaymentV2Instrument.js +41 -0
  103. package/dist/src/common/models/request/instruments/NetBankingPayRequestBuilder.d.ts +25 -0
  104. package/dist/src/common/models/request/instruments/NetBankingPayRequestBuilder.js +71 -0
  105. package/dist/src/common/models/request/instruments/NetBankingPaymentV2Instrument.d.ts +15 -0
  106. package/dist/src/common/models/request/instruments/NetBankingPaymentV2Instrument.js +46 -0
  107. package/dist/src/common/models/request/instruments/NewCardDetails.d.ts +29 -0
  108. package/dist/src/common/models/request/instruments/NewCardDetails.js +61 -0
  109. package/dist/src/common/models/request/instruments/PaymentV2Instrument.d.ts +7 -0
  110. package/dist/src/common/models/request/instruments/PaymentV2Instrument.js +24 -0
  111. package/dist/src/common/models/request/instruments/PhoneNumberCollectPaymentDetails.d.ts +12 -0
  112. package/dist/src/common/models/request/instruments/PhoneNumberCollectPaymentDetails.js +41 -0
  113. package/dist/src/common/models/request/instruments/TokenDetails.d.ts +39 -0
  114. package/dist/src/common/models/request/instruments/TokenDetails.js +81 -0
  115. package/dist/src/common/models/request/instruments/TokenPayRequestBuilder.d.ts +41 -0
  116. package/dist/src/common/models/request/instruments/TokenPayRequestBuilder.js +118 -0
  117. package/dist/src/common/models/request/instruments/TokenPaymentV2Instrument.d.ts +19 -0
  118. package/dist/src/common/models/request/instruments/TokenPaymentV2Instrument.js +51 -0
  119. package/dist/src/common/models/request/instruments/UpiCollectPayViaPhoneNumberRequestBuilder.d.ts +25 -0
  120. package/dist/src/common/models/request/instruments/UpiCollectPayViaPhoneNumberRequestBuilder.js +73 -0
  121. package/dist/src/common/models/request/instruments/UpiCollectPayViaVpaRequestBuilder.d.ts +25 -0
  122. package/dist/src/common/models/request/instruments/UpiCollectPayViaVpaRequestBuilder.js +71 -0
  123. package/dist/src/common/models/request/instruments/UpiIntentPayRequestBuilder.d.ts +25 -0
  124. package/dist/src/common/models/request/instruments/UpiIntentPayRequestBuilder.js +71 -0
  125. package/dist/src/common/models/request/instruments/UpiQrPaymentV2Instrument.d.ts +9 -0
  126. package/dist/src/common/models/request/instruments/UpiQrPaymentV2Instrument.js +36 -0
  127. package/dist/src/common/models/request/instruments/UpiQrRequestBuilder.d.ts +19 -0
  128. package/dist/src/common/models/request/instruments/UpiQrRequestBuilder.js +55 -0
  129. package/dist/src/common/models/request/instruments/VpaCollectPaymentDetails.d.ts +12 -0
  130. package/dist/src/common/models/request/instruments/VpaCollectPaymentDetails.js +41 -0
  131. package/dist/src/common/models/request/instruments/index.d.ts +21 -0
  132. package/dist/src/common/models/request/instruments/index.js +52 -0
  133. package/dist/src/common/models/response/CallbackData.d.ts +17 -0
  134. package/dist/src/common/models/response/CallbackData.js +21 -0
  135. package/dist/src/common/models/response/CallbackResponse.d.ts +6 -0
  136. package/dist/src/common/models/response/CallbackResponse.js +21 -0
  137. package/dist/src/common/models/response/CallbackType.d.ts +11 -0
  138. package/dist/src/common/models/response/CallbackType.js +30 -0
  139. package/dist/src/common/models/response/InstrumentCombo.d.ts +15 -0
  140. package/dist/src/common/models/response/InstrumentCombo.js +21 -0
  141. package/dist/src/common/models/response/OrderStatusResponse.d.ts +16 -0
  142. package/dist/src/common/models/response/OrderStatusResponse.js +21 -0
  143. package/dist/src/common/models/response/PaymentDetail.d.ts +24 -0
  144. package/dist/src/common/models/response/PaymentDetail.js +21 -0
  145. package/dist/src/common/models/response/PaymentRefundDetail.d.ts +24 -0
  146. package/dist/src/common/models/response/PaymentRefundDetail.js +21 -0
  147. package/dist/src/common/models/response/RefundResponse.d.ts +5 -0
  148. package/dist/src/common/models/response/RefundResponse.js +21 -0
  149. package/dist/src/common/models/response/RefundStatusResponse.d.ts +9 -0
  150. package/dist/src/common/models/response/RefundStatusResponse.js +21 -0
  151. package/dist/src/common/models/response/index.d.ts +11 -0
  152. package/dist/src/common/models/response/index.js +42 -0
  153. package/dist/src/common/models/response/paymentinstruments/AccountInstrumentV2.d.ts +10 -0
  154. package/dist/src/common/models/response/paymentinstruments/AccountInstrumentV2.js +22 -0
  155. package/dist/src/common/models/response/paymentinstruments/CreditCardPaymentInstrumentV2.d.ts +7 -0
  156. package/dist/src/common/models/response/paymentinstruments/CreditCardPaymentInstrumentV2.js +22 -0
  157. package/dist/src/common/models/response/paymentinstruments/DebitCardPaymentInstrumentV2.d.ts +7 -0
  158. package/dist/src/common/models/response/paymentinstruments/DebitCardPaymentInstrumentV2.js +22 -0
  159. package/dist/src/common/models/response/paymentinstruments/EgvPaymentInstrumentV2.d.ts +5 -0
  160. package/dist/src/common/models/response/paymentinstruments/EgvPaymentInstrumentV2.js +22 -0
  161. package/dist/src/common/models/response/paymentinstruments/NetbankingPaymentInstrumentV2.d.ts +7 -0
  162. package/dist/src/common/models/response/paymentinstruments/NetbankingPaymentInstrumentV2.js +22 -0
  163. package/dist/src/common/models/response/paymentinstruments/PaymentInstrumentType.d.ts +8 -0
  164. package/dist/src/common/models/response/paymentinstruments/PaymentInstrumentType.js +27 -0
  165. package/dist/src/common/models/response/paymentinstruments/PaymentInstrumentV2.d.ts +4 -0
  166. package/dist/src/common/models/response/paymentinstruments/PaymentInstrumentV2.js +21 -0
  167. package/dist/src/common/models/response/paymentinstruments/WalletPaymentInstrumentV2.d.ts +4 -0
  168. package/dist/src/common/models/response/paymentinstruments/WalletPaymentInstrumentV2.js +22 -0
  169. package/dist/src/common/models/response/paymentinstruments/index.d.ts +8 -0
  170. package/dist/src/common/models/response/paymentinstruments/index.js +39 -0
  171. package/dist/src/common/models/response/rails/PaymentRail.d.ts +9 -0
  172. package/dist/src/common/models/response/rails/PaymentRail.js +28 -0
  173. package/dist/src/common/models/response/rails/PgPaymentRail.d.ts +6 -0
  174. package/dist/src/common/models/response/rails/PgPaymentRail.js +22 -0
  175. package/dist/src/common/models/response/rails/PpiEgvPaymentRail.d.ts +3 -0
  176. package/dist/src/common/models/response/rails/PpiEgvPaymentRail.js +22 -0
  177. package/dist/src/common/models/response/rails/PpiWalletPaymentRail.d.ts +3 -0
  178. package/dist/src/common/models/response/rails/PpiWalletPaymentRail.js +22 -0
  179. package/dist/src/common/models/response/rails/UpiPaymentRail.d.ts +6 -0
  180. package/dist/src/common/models/response/rails/UpiPaymentRail.js +22 -0
  181. package/dist/src/common/models/response/rails/index.d.ts +5 -0
  182. package/dist/src/common/models/response/rails/index.js +36 -0
  183. package/dist/src/common/tokenhandler/OAuthRequest.d.ts +6 -0
  184. package/dist/src/common/tokenhandler/OAuthRequest.js +17 -0
  185. package/dist/src/common/tokenhandler/OAuthResponse.d.ts +10 -0
  186. package/dist/src/common/tokenhandler/OAuthResponse.js +52 -0
  187. package/dist/src/common/tokenhandler/TokenConstants.d.ts +4 -0
  188. package/dist/src/common/tokenhandler/TokenConstants.js +23 -0
  189. package/dist/src/common/tokenhandler/TokenService.d.ts +22 -0
  190. package/dist/src/common/tokenhandler/TokenService.js +115 -0
  191. package/dist/src/common/tokenhandler/index.d.ts +2 -0
  192. package/dist/src/common/tokenhandler/index.js +33 -0
  193. package/dist/src/index.d.ts +4 -0
  194. package/dist/src/index.js +35 -0
  195. package/dist/src/payments/v2/CustomCheckoutClient.d.ts +86 -0
  196. package/dist/src/payments/v2/CustomCheckoutClient.js +229 -0
  197. package/dist/src/payments/v2/StandardCheckoutClient.d.ts +86 -0
  198. package/dist/src/payments/v2/StandardCheckoutClient.js +227 -0
  199. package/dist/src/payments/v2/customcheckout/Constants.d.ts +9 -0
  200. package/dist/src/payments/v2/customcheckout/Constants.js +28 -0
  201. package/dist/src/payments/v2/index.d.ts +3 -0
  202. package/dist/src/payments/v2/index.js +34 -0
  203. package/dist/src/payments/v2/models/index.d.ts +2 -0
  204. package/dist/src/payments/v2/models/index.js +33 -0
  205. package/dist/src/payments/v2/models/request/CreateSdkOrderRequest.d.ts +63 -0
  206. package/dist/src/payments/v2/models/request/CreateSdkOrderRequest.js +130 -0
  207. package/dist/src/payments/v2/models/request/CustomCheckoutPayRequest.d.ts +37 -0
  208. package/dist/src/payments/v2/models/request/CustomCheckoutPayRequest.js +79 -0
  209. package/dist/src/payments/v2/models/request/MerchantUrls.d.ts +4 -0
  210. package/dist/src/payments/v2/models/request/MerchantUrls.js +24 -0
  211. package/dist/src/payments/v2/models/request/PgCheckoutPaymentFlow.d.ts +18 -0
  212. package/dist/src/payments/v2/models/request/PgCheckoutPaymentFlow.js +48 -0
  213. package/dist/src/payments/v2/models/request/PgPaymentFlow.d.ts +20 -0
  214. package/dist/src/payments/v2/models/request/PgPaymentFlow.js +50 -0
  215. package/dist/src/payments/v2/models/request/PrefillUserLoginDetails.d.ts +16 -0
  216. package/dist/src/payments/v2/models/request/PrefillUserLoginDetails.js +38 -0
  217. package/dist/src/payments/v2/models/request/StandardCheckoutPayRequest.d.ts +40 -0
  218. package/dist/src/payments/v2/models/request/StandardCheckoutPayRequest.js +82 -0
  219. package/dist/src/payments/v2/models/request/index.d.ts +7 -0
  220. package/dist/src/payments/v2/models/request/index.js +38 -0
  221. package/dist/src/payments/v2/models/response/CreateSdkOrderResponse.d.ts +6 -0
  222. package/dist/src/payments/v2/models/response/CreateSdkOrderResponse.js +21 -0
  223. package/dist/src/payments/v2/models/response/CustomCheckoutPayResponse.d.ts +8 -0
  224. package/dist/src/payments/v2/models/response/CustomCheckoutPayResponse.js +21 -0
  225. package/dist/src/payments/v2/models/response/StandardCheckoutPayResponse.d.ts +6 -0
  226. package/dist/src/payments/v2/models/response/StandardCheckoutPayResponse.js +21 -0
  227. package/dist/src/payments/v2/models/response/index.d.ts +3 -0
  228. package/dist/src/payments/v2/models/response/index.js +34 -0
  229. package/dist/src/payments/v2/standardcheckout/Constants.d.ts +9 -0
  230. package/dist/src/payments/v2/standardcheckout/Constants.js +28 -0
  231. package/package.json +58 -0
@@ -0,0 +1,55 @@
1
+ import { DeviceContext, PaymentFlowType, PgV2InstrumentType } from '../../models';
2
+ import { EventState } from '../models/enums/EventState';
3
+ import { FlowType } from '../models/enums/FlowType';
4
+ import { EventData } from '../models/EventData';
5
+ export declare class EventDataBuilder {
6
+ flowType: FlowType;
7
+ paymentFlow?: PaymentFlowType;
8
+ sdkType: string;
9
+ sdkVersion: string;
10
+ apiPath?: string;
11
+ amount?: number;
12
+ targetApp?: string;
13
+ deviceContext?: DeviceContext;
14
+ expireAfter?: number;
15
+ merchantRefundId?: string;
16
+ originalMerchantOrderId?: string;
17
+ transactionId?: string;
18
+ eventState: EventState;
19
+ paymentInstrument?: PgV2InstrumentType;
20
+ cachedTokenIssuedAt?: number;
21
+ cachedTokenExpiresAt?: number;
22
+ tokenFetchAttemptTimestamp?: number;
23
+ exceptionClass?: string;
24
+ exceptionMessage?: string;
25
+ exceptionCode?: string;
26
+ exceptionHttpStatusCode?: number;
27
+ exceptionData?: {
28
+ [key: string]: object;
29
+ };
30
+ setFlowType: (flowType: FlowType) => this;
31
+ setPaymentFlow: (paymentFlow?: PaymentFlowType) => this;
32
+ setSdkType: (sdkType: string) => this;
33
+ setSdkVersion: (sdkVersion: string) => this;
34
+ setApiPath: (apiPath: string) => this;
35
+ setAmount: (amount?: number) => this;
36
+ setTargetApp: (targetApp?: string) => this;
37
+ setDeviceContext: (deviceContext?: DeviceContext) => this;
38
+ setExpireAfter: (expireAfter?: number) => this;
39
+ setMerchantRefundId: (merchantRefundId: string) => this;
40
+ setOriginalMerchantOrderId: (originalMerchantOrderId: string) => this;
41
+ setTransactionId: (transactionId: string) => this;
42
+ setEventState: (eventState: EventState) => this;
43
+ setPaymentInstrument: (paymentInstrument: PgV2InstrumentType) => this;
44
+ setCachedTokenIssuesAt: (cachedTokenIssuedAt: number) => this;
45
+ setCachedTokenExpiresAt: (cachedTokenExpiresAt: number) => this;
46
+ setTokenFetchAttemptTimestamp: (tokenFetchAttemptTimestamp: number) => this;
47
+ setExceptionClass: (exceptionClass: string) => this;
48
+ setExceptionMessage: (exceptionMessage: string) => this;
49
+ setExceptionCode: (exceptionCode: string) => this;
50
+ setExceptionHttpStatusCode: (exceptionHttpStatusCode: number) => this;
51
+ setExceptionData: (exceptionData: {
52
+ [key: string]: object;
53
+ }) => this;
54
+ build: () => EventData;
55
+ }
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.EventDataBuilder = void 0;
19
+ const EventData_1 = require("../models/EventData");
20
+ class EventDataBuilder {
21
+ constructor() {
22
+ this.setFlowType = (flowType) => {
23
+ this.flowType = flowType;
24
+ return this;
25
+ };
26
+ this.setPaymentFlow = (paymentFlow) => {
27
+ this.paymentFlow = paymentFlow;
28
+ return this;
29
+ };
30
+ this.setSdkType = (sdkType) => {
31
+ this.sdkType = sdkType;
32
+ return this;
33
+ };
34
+ this.setSdkVersion = (sdkVersion) => {
35
+ this.sdkVersion = sdkVersion;
36
+ return this;
37
+ };
38
+ this.setApiPath = (apiPath) => {
39
+ this.apiPath = apiPath;
40
+ return this;
41
+ };
42
+ this.setAmount = (amount) => {
43
+ this.amount = amount;
44
+ return this;
45
+ };
46
+ this.setTargetApp = (targetApp) => {
47
+ this.targetApp = targetApp;
48
+ return this;
49
+ };
50
+ this.setDeviceContext = (deviceContext) => {
51
+ this.deviceContext = deviceContext;
52
+ return this;
53
+ };
54
+ this.setExpireAfter = (expireAfter) => {
55
+ this.expireAfter = expireAfter;
56
+ return this;
57
+ };
58
+ this.setMerchantRefundId = (merchantRefundId) => {
59
+ this.merchantRefundId = merchantRefundId;
60
+ return this;
61
+ };
62
+ this.setOriginalMerchantOrderId = (originalMerchantOrderId) => {
63
+ this.originalMerchantOrderId = originalMerchantOrderId;
64
+ return this;
65
+ };
66
+ this.setTransactionId = (transactionId) => {
67
+ this.transactionId = transactionId;
68
+ return this;
69
+ };
70
+ this.setEventState = (eventState) => {
71
+ this.eventState = eventState;
72
+ return this;
73
+ };
74
+ this.setPaymentInstrument = (paymentInstrument) => {
75
+ this.paymentInstrument = paymentInstrument;
76
+ return this;
77
+ };
78
+ this.setCachedTokenIssuesAt = (cachedTokenIssuedAt) => {
79
+ this.cachedTokenIssuedAt = cachedTokenIssuedAt;
80
+ return this;
81
+ };
82
+ this.setCachedTokenExpiresAt = (cachedTokenExpiresAt) => {
83
+ this.cachedTokenExpiresAt = cachedTokenExpiresAt;
84
+ return this;
85
+ };
86
+ this.setTokenFetchAttemptTimestamp = (tokenFetchAttemptTimestamp) => {
87
+ this.tokenFetchAttemptTimestamp = tokenFetchAttemptTimestamp;
88
+ return this;
89
+ };
90
+ this.setExceptionClass = (exceptionClass) => {
91
+ this.exceptionClass = exceptionClass;
92
+ return this;
93
+ };
94
+ this.setExceptionMessage = (exceptionMessage) => {
95
+ this.exceptionMessage = exceptionMessage;
96
+ return this;
97
+ };
98
+ this.setExceptionCode = (exceptionCode) => {
99
+ this.exceptionCode = exceptionCode;
100
+ return this;
101
+ };
102
+ this.setExceptionHttpStatusCode = (exceptionHttpStatusCode) => {
103
+ this.exceptionHttpStatusCode = exceptionHttpStatusCode;
104
+ return this;
105
+ };
106
+ this.setExceptionData = (exceptionData) => {
107
+ this.exceptionData = exceptionData;
108
+ return this;
109
+ };
110
+ this.build = () => {
111
+ return new EventData_1.EventData(this);
112
+ };
113
+ }
114
+ }
115
+ exports.EventDataBuilder = EventDataBuilder;
@@ -0,0 +1,11 @@
1
+ import { BaseEventBuilder } from '../builders/BaseEventBuilder';
2
+ import { EventType } from './enums/EventType';
3
+ import { EventData } from './EventData';
4
+ export declare class BaseEvent {
5
+ merchantOrderId: string;
6
+ eventName: EventType;
7
+ eventTime: number;
8
+ data: EventData;
9
+ constructor(merchantOrderId: string, eventName: EventType, eventTime: number, data: EventData);
10
+ static builder(): BaseEventBuilder;
11
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.BaseEvent = void 0;
19
+ const BaseEventBuilder_1 = require("../builders/BaseEventBuilder");
20
+ class BaseEvent {
21
+ constructor(merchantOrderId, eventName, eventTime, data) {
22
+ this.merchantOrderId = merchantOrderId;
23
+ this.eventName = eventName;
24
+ this.eventTime = eventTime;
25
+ this.data = data;
26
+ }
27
+ static builder() {
28
+ return new BaseEventBuilder_1.BaseEventBuilder();
29
+ }
30
+ }
31
+ exports.BaseEvent = BaseEvent;
@@ -0,0 +1,18 @@
1
+ import { BaseEvent } from './BaseEvent';
2
+ export declare class BulkEvent {
3
+ events: BaseEvent[];
4
+ source: string;
5
+ clientVersion: string;
6
+ constructor(events: BaseEvent[], source: string, clientVersion: string);
7
+ static builder: () => BulkEventBuilder;
8
+ }
9
+ declare class BulkEventBuilder {
10
+ private _events;
11
+ private _source;
12
+ private _clientVersion;
13
+ events: (eventList: BaseEvent[]) => this;
14
+ source: (source: string) => this;
15
+ clientVersion: (clientVersion: string) => this;
16
+ build: () => BulkEvent;
17
+ }
18
+ export {};
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.BulkEvent = void 0;
19
+ const Headers_1 = require("../../constants/Headers");
20
+ const Constants_1 = require("../Constants");
21
+ class BulkEvent {
22
+ constructor(events, source, clientVersion) {
23
+ this.source = Constants_1.Constants.SOURCE;
24
+ this.clientVersion = Headers_1.Headers.SDK_TYPE + ':' + Headers_1.Headers.SDK_VERSION;
25
+ this.events = events;
26
+ this.source = source;
27
+ this.clientVersion = clientVersion;
28
+ }
29
+ }
30
+ exports.BulkEvent = BulkEvent;
31
+ BulkEvent.builder = () => {
32
+ return new BulkEventBuilder();
33
+ };
34
+ class BulkEventBuilder {
35
+ constructor() {
36
+ this.events = (eventList) => {
37
+ this._events = eventList;
38
+ return this;
39
+ };
40
+ this.source = (source) => {
41
+ this._source = source;
42
+ return this;
43
+ };
44
+ this.clientVersion = (clientVersion) => {
45
+ this._clientVersion = clientVersion;
46
+ return this;
47
+ };
48
+ this.build = () => {
49
+ var _a, _b;
50
+ this._source = (_a = this._source) !== null && _a !== void 0 ? _a : Constants_1.Constants.SOURCE;
51
+ this._clientVersion =
52
+ (_b = this._clientVersion) !== null && _b !== void 0 ? _b : Headers_1.Headers.SDK_TYPE + ':' + Headers_1.Headers.SDK_VERSION;
53
+ return new BulkEvent(this._events, this._source, this._clientVersion);
54
+ };
55
+ }
56
+ }
@@ -0,0 +1,32 @@
1
+ import { DeviceContext, PaymentFlowType, PgV2InstrumentType } from '../../models';
2
+ import { EventDataBuilder } from '../builders/EventDataBuilder';
3
+ import { EventState } from './enums/EventState';
4
+ import { FlowType } from './enums/FlowType';
5
+ export declare class EventData {
6
+ flowType: FlowType;
7
+ paymentFlow?: PaymentFlowType;
8
+ sdkType: string;
9
+ sdkVersion: string;
10
+ apiPath?: string;
11
+ amount?: number;
12
+ targetApp?: string;
13
+ deviceContext?: DeviceContext;
14
+ expireAfter?: number;
15
+ merchantRefundId?: string;
16
+ originalMerchantOrderId?: string;
17
+ transactionId?: string;
18
+ eventState: EventState;
19
+ paymentInstrument?: PgV2InstrumentType;
20
+ cachedTokenIssuedAt?: number;
21
+ cachedTokenExpiresAt?: number;
22
+ tokenFetchAttemptTimestamp?: number;
23
+ exceptionClass?: string;
24
+ exceptionMessage?: string;
25
+ exceptionCode?: string;
26
+ exceptionHttpStatusCode?: number;
27
+ exceptionData?: {
28
+ [key: string]: object;
29
+ };
30
+ constructor(builder: EventDataBuilder);
31
+ static builder(): EventDataBuilder;
32
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.EventData = void 0;
19
+ const Headers_1 = require("../../constants/Headers");
20
+ const EventDataBuilder_1 = require("../builders/EventDataBuilder");
21
+ class EventData {
22
+ constructor(builder) {
23
+ var _a, _b;
24
+ this.sdkType = Headers_1.Headers.SDK_TYPE;
25
+ this.sdkVersion = Headers_1.Headers.SDK_VERSION;
26
+ this.flowType = builder.flowType;
27
+ this.paymentFlow = builder.paymentFlow;
28
+ this.sdkType = (_a = builder.sdkType) !== null && _a !== void 0 ? _a : this.sdkType;
29
+ this.sdkVersion = (_b = builder.sdkVersion) !== null && _b !== void 0 ? _b : this.sdkVersion;
30
+ this.apiPath = builder.apiPath;
31
+ this.amount = builder.amount;
32
+ this.targetApp = builder.targetApp;
33
+ this.deviceContext = builder.deviceContext;
34
+ this.expireAfter = builder.expireAfter;
35
+ this.merchantRefundId = builder.merchantRefundId;
36
+ this.originalMerchantOrderId = builder.originalMerchantOrderId;
37
+ this.transactionId = builder.transactionId;
38
+ this.eventState = builder.eventState;
39
+ this.paymentInstrument = builder.paymentInstrument;
40
+ this.cachedTokenIssuedAt = builder.cachedTokenIssuedAt;
41
+ this.cachedTokenExpiresAt = builder.cachedTokenExpiresAt;
42
+ this.tokenFetchAttemptTimestamp = builder.tokenFetchAttemptTimestamp;
43
+ this.exceptionClass = builder.exceptionClass;
44
+ this.exceptionMessage = builder.exceptionMessage;
45
+ this.exceptionCode = builder.exceptionCode;
46
+ this.exceptionHttpStatusCode = builder.exceptionHttpStatusCode;
47
+ this.exceptionData = builder.exceptionData;
48
+ }
49
+ static builder() {
50
+ return new EventDataBuilder_1.EventDataBuilder();
51
+ }
52
+ }
53
+ exports.EventData = EventData;
@@ -0,0 +1,5 @@
1
+ export declare enum EventState {
2
+ SUCCESS = "SUCCESS",
3
+ FAILED = "FAILED",
4
+ INITIATED = "INITIATED"
5
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.EventState = void 0;
19
+ var EventState;
20
+ (function (EventState) {
21
+ EventState["SUCCESS"] = "SUCCESS";
22
+ EventState["FAILED"] = "FAILED";
23
+ EventState["INITIATED"] = "INITIATED";
24
+ })(EventState = exports.EventState || (exports.EventState = {}));
@@ -0,0 +1,19 @@
1
+ export declare enum EventType {
2
+ PAY_SUCCESS = "PAY_SUCCESS",
3
+ PAY_FAILED = "PAY_FAILED",
4
+ REFUND_SUCCESS = "REFUND_SUCCESS",
5
+ REFUND_FAILED = "REFUND_FAILED",
6
+ REFUND_STATUS_SUCCESS = "REFUND_STATUS_SUCCESS",
7
+ REFUND_STATUS_FAILED = "REFUND_STATUS_FAILED",
8
+ ORDER_STATUS_SUCCESS = "ORDER_STATUS_SUCCESS",
9
+ ORDER_STATUS_FAILED = "ORDER_STATUS_FAILED",
10
+ TRANSACTION_STATUS_SUCCESS = "TRANSACTION_STATUS_SUCCESS",
11
+ TRANSACTION_STATUS_FAILED = "TRANSACTION_STATUS_FAILED",
12
+ CREATE_SDK_ORDER_SUCCESS = "CREATE_SDK_ORDER_SUCCESS",
13
+ CREATE_SDK_ORDER_FAILED = "CREATE_SDK_ORDER_FAILED",
14
+ STANDARD_CHECKOUT_CLIENT_INITIALIZED = "STANDARD_CHECKOUT_CLIENT_INITIALIZED",
15
+ CUSTOM_CHECKOUT_CLIENT_INITIALIZED = "CUSTOM_CHECKOUT_CLIENT_INITIALIZED",
16
+ TOKEN_SERVICE_INITIALIZED = "TOKEN_SERVICE_INITIALIZED",
17
+ OAUTH_FETCH_FAILED_USED_CACHED_TOKEN = "OAUTH_FETCH_FAILED_USED_CACHED_TOKEN",
18
+ CALLBACK_SERIALIZATION_FAILED = "CALLBACK_SERIALIZATION_FAILED"
19
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.EventType = void 0;
19
+ var EventType;
20
+ (function (EventType) {
21
+ EventType["PAY_SUCCESS"] = "PAY_SUCCESS";
22
+ EventType["PAY_FAILED"] = "PAY_FAILED";
23
+ EventType["REFUND_SUCCESS"] = "REFUND_SUCCESS";
24
+ EventType["REFUND_FAILED"] = "REFUND_FAILED";
25
+ EventType["REFUND_STATUS_SUCCESS"] = "REFUND_STATUS_SUCCESS";
26
+ EventType["REFUND_STATUS_FAILED"] = "REFUND_STATUS_FAILED";
27
+ EventType["ORDER_STATUS_SUCCESS"] = "ORDER_STATUS_SUCCESS";
28
+ EventType["ORDER_STATUS_FAILED"] = "ORDER_STATUS_FAILED";
29
+ EventType["TRANSACTION_STATUS_SUCCESS"] = "TRANSACTION_STATUS_SUCCESS";
30
+ EventType["TRANSACTION_STATUS_FAILED"] = "TRANSACTION_STATUS_FAILED";
31
+ EventType["CREATE_SDK_ORDER_SUCCESS"] = "CREATE_SDK_ORDER_SUCCESS";
32
+ EventType["CREATE_SDK_ORDER_FAILED"] = "CREATE_SDK_ORDER_FAILED";
33
+ EventType["STANDARD_CHECKOUT_CLIENT_INITIALIZED"] = "STANDARD_CHECKOUT_CLIENT_INITIALIZED";
34
+ EventType["CUSTOM_CHECKOUT_CLIENT_INITIALIZED"] = "CUSTOM_CHECKOUT_CLIENT_INITIALIZED";
35
+ EventType["TOKEN_SERVICE_INITIALIZED"] = "TOKEN_SERVICE_INITIALIZED";
36
+ EventType["OAUTH_FETCH_FAILED_USED_CACHED_TOKEN"] = "OAUTH_FETCH_FAILED_USED_CACHED_TOKEN";
37
+ EventType["CALLBACK_SERIALIZATION_FAILED"] = "CALLBACK_SERIALIZATION_FAILED";
38
+ })(EventType = exports.EventType || (exports.EventType = {}));
@@ -0,0 +1,3 @@
1
+ export declare enum FlowType {
2
+ B2B_PG = "B2B_PG"
3
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.FlowType = void 0;
19
+ var FlowType;
20
+ (function (FlowType) {
21
+ FlowType["B2B_PG"] = "B2B_PG";
22
+ })(FlowType = exports.FlowType || (exports.FlowType = {}));
@@ -0,0 +1,7 @@
1
+ import { BaseEvent } from '../models/BaseEvent';
2
+ import { EventPublisher } from './EventPublisher';
3
+ export declare class DefaultEventPublisher extends EventPublisher {
4
+ setAuthTokenSupplier(authTokenSupplier: () => Promise<string>): void;
5
+ startPublishingEvents(authTokenSupplier: () => Promise<string>): void;
6
+ send(event: BaseEvent): void;
7
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DefaultEventPublisher = void 0;
19
+ const EventPublisher_1 = require("./EventPublisher");
20
+ class DefaultEventPublisher extends EventPublisher_1.EventPublisher {
21
+ setAuthTokenSupplier(authTokenSupplier) {
22
+ // will be used when shouldPublishEvents = false
23
+ }
24
+ startPublishingEvents(authTokenSupplier) {
25
+ // will be used when shouldPublishEvents = false
26
+ }
27
+ send(event) {
28
+ // will be used when shouldPublishEvents = false
29
+ }
30
+ }
31
+ exports.DefaultEventPublisher = DefaultEventPublisher;
@@ -0,0 +1,6 @@
1
+ import { BaseEvent } from '../models/BaseEvent';
2
+ export declare abstract class EventPublisher {
3
+ abstract setAuthTokenSupplier(authTokenSupplier: () => Promise<string>): void;
4
+ abstract startPublishingEvents(authTokenSupplier: () => Promise<string>): void;
5
+ abstract send(event: BaseEvent): void;
6
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.EventPublisher = void 0;
19
+ class EventPublisher {
20
+ }
21
+ exports.EventPublisher = EventPublisher;
@@ -0,0 +1,9 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { EventPublisher } from './EventPublisher';
3
+ export declare class EventPublisherFactory {
4
+ private httpClient;
5
+ private hostUrl;
6
+ private static cachedEventPublisher;
7
+ constructor(httpClient: AxiosInstance, hostUrl: string);
8
+ getEventPublisher(shouldPublishEvents: boolean): EventPublisher;
9
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Original Author(s), PhonePe India Pvt. Ltd.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.EventPublisherFactory = void 0;
19
+ const QueuedEventPublisher_1 = require("./QueuedEventPublisher");
20
+ const DefaultEventPublisher_1 = require("./DefaultEventPublisher");
21
+ const Constants_1 = require("../Constants");
22
+ const EventQueueHandler_1 = require("../EventQueueHandler");
23
+ class EventPublisherFactory {
24
+ constructor(httpClient, hostUrl) {
25
+ this.httpClient = httpClient;
26
+ this.hostUrl = hostUrl;
27
+ }
28
+ getEventPublisher(shouldPublishEvents) {
29
+ if (shouldPublishEvents) {
30
+ if (EventPublisherFactory.cachedEventPublisher == undefined) {
31
+ EventPublisherFactory.cachedEventPublisher = new QueuedEventPublisher_1.QueuedEventPublisher(this.httpClient, this.hostUrl, new EventQueueHandler_1.EventQueueHandler(Constants_1.Constants.QUEUE_MAX_SIZE));
32
+ }
33
+ return EventPublisherFactory.cachedEventPublisher;
34
+ }
35
+ return new DefaultEventPublisher_1.DefaultEventPublisher();
36
+ }
37
+ }
38
+ exports.EventPublisherFactory = EventPublisherFactory;
@@ -0,0 +1,21 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { BaseEvent } from '../models/BaseEvent';
3
+ import { EventPublisher } from './EventPublisher';
4
+ import { EventQueueHandler } from '../EventQueueHandler';
5
+ export declare class QueuedEventPublisher extends EventPublisher {
6
+ scheduler: boolean;
7
+ private _queueHandler;
8
+ private _authTokenSupplier;
9
+ private _httpCommand;
10
+ constructor(httpClient: AxiosInstance, hostUrl: string, queueHandler: EventQueueHandler);
11
+ setAuthTokenSupplier(authTokenSupplier: () => Promise<string>): void;
12
+ startPublishingEvents(authTokenSupplier: () => Promise<string>): void;
13
+ send(event: BaseEvent): Promise<void>;
14
+ run(): Promise<void>;
15
+ sendEvents(): Promise<void>;
16
+ sendBatchData(sdkEventList: BaseEvent[]): Promise<void>;
17
+ getHeaders(): Promise<{
18
+ [x: string]: string;
19
+ }>;
20
+ createEventBatches(): Promise<BaseEvent[][]>;
21
+ }