@explorins/pers-sdk 1.1.0-beta.0 → 1.1.3

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 (239) hide show
  1. package/dist/analytics/api/analytics-api.d.ts +17 -0
  2. package/dist/analytics/api/analytics-api.d.ts.map +1 -0
  3. package/dist/analytics/index.d.ts +28 -0
  4. package/dist/analytics/index.d.ts.map +1 -0
  5. package/dist/analytics/models/index.d.ts +61 -0
  6. package/dist/analytics/models/index.d.ts.map +1 -0
  7. package/dist/analytics/services/analytics-service.d.ts +19 -0
  8. package/dist/analytics/services/analytics-service.d.ts.map +1 -0
  9. package/dist/analytics.cjs +76 -0
  10. package/dist/analytics.cjs.map +1 -0
  11. package/dist/analytics.d.ts +28 -0
  12. package/dist/analytics.js +72 -0
  13. package/dist/analytics.js.map +1 -0
  14. package/dist/auth-admin/api/auth-admin-api.d.ts +27 -0
  15. package/dist/auth-admin/api/auth-admin-api.d.ts.map +1 -0
  16. package/dist/auth-admin/index.d.ts +26 -0
  17. package/dist/auth-admin/index.d.ts.map +1 -0
  18. package/dist/auth-admin/services/auth-admin-service.d.ts +23 -0
  19. package/dist/auth-admin/services/auth-admin-service.d.ts.map +1 -0
  20. package/dist/auth-admin.cjs +96 -0
  21. package/dist/auth-admin.cjs.map +1 -0
  22. package/dist/auth-admin.d.ts +26 -0
  23. package/dist/auth-admin.js +92 -0
  24. package/dist/auth-admin.js.map +1 -0
  25. package/dist/business/api/business-api.d.ts +133 -0
  26. package/dist/business/api/business-api.d.ts.map +1 -0
  27. package/dist/business/index.d.ts +34 -0
  28. package/dist/business/index.d.ts.map +1 -0
  29. package/{src/business/models/index.ts → dist/business/models/index.d.ts} +8 -13
  30. package/dist/business/models/index.d.ts.map +1 -0
  31. package/dist/business/services/business-service.d.ts +51 -0
  32. package/dist/business/services/business-service.d.ts.map +1 -0
  33. package/dist/business.cjs +303 -0
  34. package/dist/business.cjs.map +1 -0
  35. package/dist/business.d.ts +34 -0
  36. package/dist/business.js +299 -0
  37. package/dist/business.js.map +1 -0
  38. package/dist/campaign/api/campaign-api.d.ts +213 -0
  39. package/dist/campaign/api/campaign-api.d.ts.map +1 -0
  40. package/dist/campaign/index.d.ts +44 -0
  41. package/dist/campaign/index.d.ts.map +1 -0
  42. package/dist/campaign/services/campaign-service.d.ts +88 -0
  43. package/dist/campaign/services/campaign-service.d.ts.map +1 -0
  44. package/dist/campaign.cjs +506 -0
  45. package/dist/campaign.cjs.map +1 -0
  46. package/dist/campaign.d.ts +44 -0
  47. package/dist/campaign.js +502 -0
  48. package/dist/campaign.js.map +1 -0
  49. package/dist/core/abstractions/http-client.d.ts +22 -0
  50. package/dist/core/abstractions/http-client.d.ts.map +1 -0
  51. package/dist/core/auth/auth-provider.interface.d.ts +12 -0
  52. package/dist/core/auth/auth-provider.interface.d.ts.map +1 -0
  53. package/dist/core/auth/create-auth-provider.d.ts +27 -0
  54. package/dist/core/auth/create-auth-provider.d.ts.map +1 -0
  55. package/dist/core/auth/simple-auth-config.interface.d.ts +15 -0
  56. package/dist/core/auth/simple-auth-config.interface.d.ts.map +1 -0
  57. package/dist/core/index.d.ts +13 -0
  58. package/dist/core/index.d.ts.map +1 -0
  59. package/dist/core/pers-api-client.d.ts +54 -0
  60. package/dist/core/pers-api-client.d.ts.map +1 -0
  61. package/dist/core/pers-config.d.ts +38 -0
  62. package/dist/core/pers-config.d.ts.map +1 -0
  63. package/dist/core/utils/jwt.function.d.ts +2 -0
  64. package/dist/core/utils/jwt.function.d.ts.map +1 -0
  65. package/dist/core.cjs +506 -0
  66. package/dist/core.cjs.map +1 -0
  67. package/dist/core.d.ts +13 -0
  68. package/dist/core.js +497 -0
  69. package/dist/core.js.map +1 -0
  70. package/dist/donation/api/donation-api.d.ts +18 -0
  71. package/dist/donation/api/donation-api.d.ts.map +1 -0
  72. package/dist/donation/index.d.ts +25 -0
  73. package/dist/donation/index.d.ts.map +1 -0
  74. package/dist/donation/models/index.d.ts +8 -0
  75. package/dist/donation/models/index.d.ts.map +1 -0
  76. package/dist/donation/services/donation-service.d.ts +19 -0
  77. package/dist/donation/services/donation-service.d.ts.map +1 -0
  78. package/dist/donation.cjs +78 -0
  79. package/dist/donation.cjs.map +1 -0
  80. package/dist/donation.d.ts +25 -0
  81. package/dist/donation.js +74 -0
  82. package/dist/donation.js.map +1 -0
  83. package/dist/index.cjs +4217 -0
  84. package/dist/index.cjs.map +1 -0
  85. package/dist/index.d.ts +21 -0
  86. package/dist/index.d.ts.map +1 -0
  87. package/dist/index.js +4164 -0
  88. package/dist/index.js.map +1 -0
  89. package/dist/package.json +148 -0
  90. package/dist/payment/api/payment-api.d.ts +105 -0
  91. package/dist/payment/api/payment-api.d.ts.map +1 -0
  92. package/dist/payment/index.d.ts +36 -0
  93. package/dist/payment/index.d.ts.map +1 -0
  94. package/dist/payment/models/index.d.ts +12 -0
  95. package/dist/payment/models/index.d.ts.map +1 -0
  96. package/dist/payment/services/payment-service.d.ts +40 -0
  97. package/dist/payment/services/payment-service.d.ts.map +1 -0
  98. package/dist/payment.cjs +258 -0
  99. package/dist/payment.cjs.map +1 -0
  100. package/dist/payment.d.ts +36 -0
  101. package/dist/payment.js +254 -0
  102. package/dist/payment.js.map +1 -0
  103. package/dist/pers-sdk.d.ts +29 -0
  104. package/dist/pers-sdk.d.ts.map +1 -0
  105. package/dist/redemption/api/redemption-api.d.ts +147 -0
  106. package/dist/redemption/api/redemption-api.d.ts.map +1 -0
  107. package/dist/redemption/index.d.ts +35 -0
  108. package/dist/redemption/index.d.ts.map +1 -0
  109. package/dist/redemption/models/index.d.ts +8 -0
  110. package/dist/redemption/models/index.d.ts.map +1 -0
  111. package/dist/redemption/services/redemption-service.d.ts +56 -0
  112. package/dist/redemption/services/redemption-service.d.ts.map +1 -0
  113. package/dist/redemption.cjs +333 -0
  114. package/dist/redemption.cjs.map +1 -0
  115. package/dist/redemption.d.ts +35 -0
  116. package/dist/redemption.js +329 -0
  117. package/dist/redemption.js.map +1 -0
  118. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts +18 -0
  119. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts.map +1 -0
  120. package/dist/tenant/api/tenant-api.d.ts +56 -0
  121. package/dist/tenant/api/tenant-api.d.ts.map +1 -0
  122. package/dist/tenant/index.d.ts +34 -0
  123. package/dist/tenant/index.d.ts.map +1 -0
  124. package/dist/tenant/models/index.d.ts +11 -0
  125. package/dist/tenant/models/index.d.ts.map +1 -0
  126. package/dist/tenant/services/tenant-service.d.ts +46 -0
  127. package/dist/tenant/services/tenant-service.d.ts.map +1 -0
  128. package/dist/tenant.cjs +177 -0
  129. package/dist/tenant.cjs.map +1 -0
  130. package/dist/tenant.d.ts +34 -0
  131. package/dist/tenant.js +173 -0
  132. package/dist/tenant.js.map +1 -0
  133. package/dist/token/api/token-api.d.ts +64 -0
  134. package/dist/token/api/token-api.d.ts.map +1 -0
  135. package/dist/token/base/base-token-service.d.ts +87 -0
  136. package/dist/token/base/base-token-service.d.ts.map +1 -0
  137. package/dist/token/index.d.ts +13 -0
  138. package/dist/token/index.d.ts.map +1 -0
  139. package/dist/token/models/index.d.ts +18 -0
  140. package/dist/token/models/index.d.ts.map +1 -0
  141. package/dist/token/services/token-service.d.ts +68 -0
  142. package/dist/token/services/token-service.d.ts.map +1 -0
  143. package/dist/token/token-sdk.d.ts +140 -0
  144. package/dist/token/token-sdk.d.ts.map +1 -0
  145. package/dist/token.cjs +537 -0
  146. package/dist/token.cjs.map +1 -0
  147. package/dist/token.d.ts +13 -0
  148. package/dist/token.js +532 -0
  149. package/dist/token.js.map +1 -0
  150. package/dist/transaction/api/transaction-api.d.ts +133 -0
  151. package/dist/transaction/api/transaction-api.d.ts.map +1 -0
  152. package/dist/transaction/index.d.ts +38 -0
  153. package/dist/transaction/index.d.ts.map +1 -0
  154. package/dist/transaction/models/index.d.ts +42 -0
  155. package/dist/transaction/models/index.d.ts.map +1 -0
  156. package/dist/transaction/services/transaction-service.d.ts +56 -0
  157. package/dist/transaction/services/transaction-service.d.ts.map +1 -0
  158. package/dist/transaction.cjs +394 -0
  159. package/dist/transaction.cjs.map +1 -0
  160. package/dist/transaction.d.ts +38 -0
  161. package/dist/transaction.js +390 -0
  162. package/dist/transaction.js.map +1 -0
  163. package/dist/user/api/user-api.d.ts +56 -0
  164. package/dist/user/api/user-api.d.ts.map +1 -0
  165. package/dist/user/index.d.ts +36 -0
  166. package/dist/user/index.d.ts.map +1 -0
  167. package/dist/user/models/index.d.ts +12 -0
  168. package/dist/user/models/index.d.ts.map +1 -0
  169. package/dist/user/services/user-service.d.ts +46 -0
  170. package/dist/user/services/user-service.d.ts.map +1 -0
  171. package/dist/user-status/api/user-status-api.d.ts +37 -0
  172. package/dist/user-status/api/user-status-api.d.ts.map +1 -0
  173. package/dist/user-status/index.d.ts +28 -0
  174. package/dist/user-status/index.d.ts.map +1 -0
  175. package/dist/user-status/models/index.d.ts +8 -0
  176. package/dist/user-status/models/index.d.ts.map +1 -0
  177. package/dist/user-status/services/user-status-service.d.ts +26 -0
  178. package/dist/user-status/services/user-status-service.d.ts.map +1 -0
  179. package/dist/user-status.cjs +147 -0
  180. package/dist/user-status.cjs.map +1 -0
  181. package/dist/user-status.d.ts +28 -0
  182. package/dist/user-status.js +143 -0
  183. package/dist/user-status.js.map +1 -0
  184. package/dist/user.cjs +188 -0
  185. package/dist/user.cjs.map +1 -0
  186. package/dist/user.d.ts +36 -0
  187. package/dist/user.js +184 -0
  188. package/dist/user.js.map +1 -0
  189. package/dist/web3/api/web3-api.d.ts +27 -0
  190. package/dist/web3/api/web3-api.d.ts.map +1 -0
  191. package/dist/web3/index.d.ts +16 -0
  192. package/dist/web3/index.d.ts.map +1 -0
  193. package/dist/web3/models/index.d.ts +92 -0
  194. package/dist/web3/models/index.d.ts.map +1 -0
  195. package/dist/web3/services/web3-service.d.ts +21 -0
  196. package/dist/web3/services/web3-service.d.ts.map +1 -0
  197. package/dist/web3-chain/api/web3-chain-api.d.ts +19 -0
  198. package/dist/web3-chain/api/web3-chain-api.d.ts.map +1 -0
  199. package/dist/web3-chain/index.d.ts +17 -0
  200. package/dist/web3-chain/index.d.ts.map +1 -0
  201. package/dist/web3-chain/models/index.d.ts +38 -0
  202. package/dist/web3-chain/models/index.d.ts.map +1 -0
  203. package/dist/web3-chain/services/getWeb3FCD.service.d.ts +8 -0
  204. package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -0
  205. package/dist/web3-chain/services/provider.service.d.ts +15 -0
  206. package/dist/web3-chain/services/provider.service.d.ts.map +1 -0
  207. package/dist/web3-chain/services/public-http-provider.service.d.ts +8 -0
  208. package/dist/web3-chain/services/public-http-provider.service.d.ts.map +1 -0
  209. package/dist/web3-chain/services/web3-chain-service.d.ts +17 -0
  210. package/dist/web3-chain/services/web3-chain-service.d.ts.map +1 -0
  211. package/dist/web3-chain.cjs +316 -0
  212. package/dist/web3-chain.cjs.map +1 -0
  213. package/dist/web3-chain.d.ts +17 -0
  214. package/dist/web3-chain.js +310 -0
  215. package/dist/web3-chain.js.map +1 -0
  216. package/dist/web3.cjs +516 -0
  217. package/dist/web3.cjs.map +1 -0
  218. package/dist/web3.d.ts +16 -0
  219. package/dist/web3.js +513 -0
  220. package/dist/web3.js.map +1 -0
  221. package/package.json +105 -17
  222. package/explorins-pers-sdk-1.0.0-alpha.1.tgz +0 -0
  223. package/rollup.config.js +0 -84
  224. package/src/business/api/business-api.ts +0 -72
  225. package/src/business/business/tsconfig.json +0 -18
  226. package/src/business/index.ts +0 -52
  227. package/src/business/services/business-service.ts +0 -88
  228. package/src/core/abstractions/core-interfaces.ts +0 -56
  229. package/src/core/abstractions/http-client.ts +0 -23
  230. package/src/core/auth/auth-provider.interface.ts +0 -16
  231. package/src/core/auth/create-auth-provider.ts +0 -136
  232. package/src/core/auth/simple-auth-config.interface.ts +0 -15
  233. package/src/core/core.ts +0 -30
  234. package/src/core/pers-api-client.ts +0 -151
  235. package/src/core/pers-config.ts +0 -38
  236. package/src/core.ts +0 -30
  237. package/src/index.ts +0 -16
  238. package/src/pers-sdk.ts +0 -45
  239. package/tsconfig.json +0 -28
@@ -0,0 +1,258 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Platform-Agnostic Purchase API Client (RESTful Architecture)
5
+ *
6
+ * Handles purchase and payment operations using the PERS backend's new RESTful endpoints.
7
+ * Uses @explorins/pers-shared DTOs for consistency with backend.
8
+ *
9
+ * Migration Status: Updated to match /purchases controller (replaces /purchase endpoints)
10
+ *
11
+ * Available Access Levels:
12
+ * - PUBLIC: Project key authentication for catalog browsing and payment operations
13
+ * - USER: Requires user authentication JWT (purchase creation, history access)
14
+ * - ADMIN: Requires tenant admin privileges (not implemented in this client)
15
+ *
16
+ * Note: This SDK focuses on backend purchase operations only.
17
+ * Payment provider integrations (Stripe, etc.) should remain in infrastructure layer.
18
+ */
19
+ class PurchaseApi {
20
+ constructor(apiClient) {
21
+ this.apiClient = apiClient;
22
+ this.basePath = '/purchases';
23
+ }
24
+ // ==========================================
25
+ // PUBLIC OPERATIONS (Project Key)
26
+ // ==========================================
27
+ /**
28
+ * PUBLIC: Get purchase tokens (Intelligent Access)
29
+ *
30
+ * RESTful endpoint: GET /purchases/tokens
31
+ * Replaces: GET /purchase/token
32
+ *
33
+ * INTELLIGENT ACCESS:
34
+ * - PUBLIC (Project Key): Returns active tokens only (active parameter ignored)
35
+ * - ADMIN (Tenant Admin JWT): Returns filtered results based on active parameter
36
+ */
37
+ async getPurchaseTokens(active) {
38
+ let url = `${this.basePath}/tokens`;
39
+ if (active !== undefined) {
40
+ url += `?active=${active}`;
41
+ }
42
+ return this.apiClient.get(url);
43
+ }
44
+ /**
45
+ * PUBLIC: Get donation types
46
+ *
47
+ * RESTful endpoint: GET /purchases/donation-types
48
+ * Replaces: GET /purchase/donation/type
49
+ */
50
+ async getDonationTypes() {
51
+ return this.apiClient.get(`${this.basePath}/donation-types`);
52
+ }
53
+ // ==========================================
54
+ // PAYMENT OPERATIONS (FINANCIAL - CRITICAL)
55
+ // ==========================================
56
+ /**
57
+ * PUBLIC: Create payment intent (FINANCIAL OPERATION)
58
+ *
59
+ * RESTful endpoint: POST /purchases/payment-intents
60
+ * Replaces: POST /purchase/payment-intent
61
+ *
62
+ * CRITICAL: Handles real money operations - tenant context required
63
+ */
64
+ async createPaymentIntent(amount, currency, receiptEmail, description) {
65
+ const body = {
66
+ amount,
67
+ currency,
68
+ receiptEmail,
69
+ description
70
+ };
71
+ return this.apiClient.post(`${this.basePath}/payment-intents`, body);
72
+ }
73
+ /**
74
+ * PUBLIC: Update payment intent (FINANCIAL OPERATION)
75
+ *
76
+ * RESTful endpoint: PUT /purchases/payment-intents/{paymentIntentId}
77
+ * Replaces: PUT /purchase/payment-intent/{paymentIntentId}
78
+ *
79
+ * CRITICAL: Handles real money operations - tenant context required
80
+ */
81
+ async updatePaymentIntent(paymentIntentId, amount, currency, receiptEmail, description) {
82
+ const body = {
83
+ amount,
84
+ currency,
85
+ receiptEmail,
86
+ description
87
+ };
88
+ return this.apiClient.put(`${this.basePath}/payment-intents/${paymentIntentId}`, body);
89
+ }
90
+ /**
91
+ * PUBLIC: Cancel payment intent (FINANCIAL OPERATION)
92
+ *
93
+ * RESTful endpoint: DELETE /purchases/payment-intents/{paymentIntentId}
94
+ * Replaces: DELETE /purchase/payment-intent/{paymentIntentId}
95
+ *
96
+ * CRITICAL: Handles real money operations - tenant context required
97
+ */
98
+ async cancelPaymentIntent(paymentIntentId) {
99
+ return this.apiClient.delete(`${this.basePath}/payment-intents/${paymentIntentId}`);
100
+ }
101
+ // ==========================================
102
+ // USER OPERATIONS (JWT + Project Key)
103
+ // ==========================================
104
+ /**
105
+ * USER: Create purchase (BUSINESS CRITICAL - FINANCIAL TRANSACTION)
106
+ *
107
+ * RESTful endpoint: POST /purchases
108
+ * Replaces: POST /purchase/auth
109
+ *
110
+ * USER-ONLY: Requires user authentication JWT for purchase creation
111
+ * CRITICAL: Real financial transaction with Stripe integration
112
+ */
113
+ async createUserPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress) {
114
+ const body = {
115
+ quantity: amount,
116
+ purchaseTokenId: purchaseTokenId || '',
117
+ donationTypeId,
118
+ donationAccountAddress,
119
+ paymentIntentId
120
+ };
121
+ return this.apiClient.post(`${this.basePath}`, body);
122
+ }
123
+ /**
124
+ * USER: Get user purchase history
125
+ *
126
+ * RESTful endpoint: GET /purchases/me/history
127
+ * Replaces: GET /purchase/auth
128
+ *
129
+ * USER-ONLY: Get authenticated user's purchase history
130
+ * FINANCIAL RECORDS: User attribution critical for compliance
131
+ */
132
+ async getUserPurchaseHistory() {
133
+ return this.apiClient.get(`${this.basePath}/me/history`);
134
+ }
135
+ // ==========================================
136
+ // CONVENIENCE METHODS (Backward Compatibility)
137
+ // ==========================================
138
+ /**
139
+ * @deprecated Use getPurchaseTokens() instead
140
+ * Backward compatibility alias for getActivePurchaseTokens
141
+ */
142
+ async getActivePurchaseTokens(active = true) {
143
+ return this.getPurchaseTokens(active);
144
+ }
145
+ /**
146
+ * @deprecated Use createUserPurchase() instead
147
+ * Backward compatibility alias for createPurchase
148
+ */
149
+ async createPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress) {
150
+ return this.createUserPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress);
151
+ }
152
+ /**
153
+ * @deprecated Use getUserPurchaseHistory() instead
154
+ * Backward compatibility alias for getAllUserPurchases
155
+ */
156
+ async getAllUserPurchases() {
157
+ return this.getUserPurchaseHistory();
158
+ }
159
+ }
160
+
161
+ /**
162
+ * Platform-Agnostic Payment Service
163
+ *
164
+ * Contains payment business logic and operations that work across platforms.
165
+ * No framework dependencies - pure TypeScript business logic.
166
+ *
167
+ * Focuses only on actual backend capabilities.
168
+ * Payment provider logic (Stripe, etc.) should remain in infrastructure layer.
169
+ */
170
+ class PaymentService {
171
+ constructor(paymentApi) {
172
+ this.paymentApi = paymentApi;
173
+ }
174
+ // ==========================================
175
+ // PUBLIC OPERATIONS
176
+ // ==========================================
177
+ /**
178
+ * PUBLIC: Get active purchase tokens
179
+ */
180
+ async getActivePurchaseTokens(active = true) {
181
+ return this.paymentApi.getActivePurchaseTokens(active);
182
+ }
183
+ /**
184
+ * PUBLIC: Create payment intent
185
+ */
186
+ async createPaymentIntent(amount, currency, receiptEmail, description) {
187
+ return this.paymentApi.createPaymentIntent(amount, currency, receiptEmail, description);
188
+ }
189
+ /**
190
+ * PUBLIC: Update payment intent
191
+ */
192
+ async updatePaymentIntent(paymentIntentId, amount, currency, receiptEmail, description) {
193
+ return this.paymentApi.updatePaymentIntent(paymentIntentId, amount, currency, receiptEmail, description);
194
+ }
195
+ /**
196
+ * PUBLIC: Cancel payment intent
197
+ */
198
+ async cancelPaymentIntent(paymentIntentId) {
199
+ return this.paymentApi.cancelPaymentIntent(paymentIntentId);
200
+ }
201
+ // ==========================================
202
+ // AUTHENTICATED OPERATIONS
203
+ // ==========================================
204
+ /**
205
+ * AUTH: Create purchase
206
+ */
207
+ async createPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress) {
208
+ return this.paymentApi.createPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress);
209
+ }
210
+ /**
211
+ * AUTH: Get all user purchases
212
+ */
213
+ async getAllUserPurchases() {
214
+ return this.paymentApi.getAllUserPurchases();
215
+ }
216
+ }
217
+
218
+ /**
219
+ * @explorins/pers-sdk-payment
220
+ *
221
+ * Platform-agnostic Payment Domain SDK for PERS ecosystem
222
+ * Handles payment intents, purchases, and purchase tokens
223
+ *
224
+ * Note: Payment provider integrations (Stripe, etc.) are kept separate
225
+ * in the infrastructure layer to maintain platform-agnostic principles.
226
+ */
227
+ // API Layer
228
+ /**
229
+ * Create a complete Payment SDK instance
230
+ *
231
+ * @param apiClient - Configured PERS API client
232
+ * @returns Payment SDK with flattened structure for better DX
233
+ */
234
+ function createPaymentSDK(apiClient) {
235
+ const paymentApi = new PurchaseApi(apiClient);
236
+ const paymentService = new PaymentService(paymentApi);
237
+ return {
238
+ // Direct access to service methods (primary interface)
239
+ // Public methods
240
+ getActivePurchaseTokens: (active) => paymentService.getActivePurchaseTokens(active),
241
+ // ✅ FIXED: Proper type instead of any
242
+ createPaymentIntent: (amount, currency, receiptEmail, description) => paymentService.createPaymentIntent(amount, currency, receiptEmail, description),
243
+ // ✅ FIXED: Proper type instead of any
244
+ updatePaymentIntent: (paymentIntentId, amount, currency, receiptEmail, description) => paymentService.updatePaymentIntent(paymentIntentId, amount, currency, receiptEmail, description),
245
+ cancelPaymentIntent: (paymentIntentId) => paymentService.cancelPaymentIntent(paymentIntentId),
246
+ // Auth methods
247
+ createPurchase: (paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress) => paymentService.createPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress),
248
+ getAllUserPurchases: () => paymentService.getAllUserPurchases(),
249
+ // Advanced access for edge cases
250
+ api: paymentApi,
251
+ service: paymentService
252
+ };
253
+ }
254
+
255
+ exports.PaymentApi = PurchaseApi;
256
+ exports.PaymentService = PaymentService;
257
+ exports.createPaymentSDK = createPaymentSDK;
258
+ //# sourceMappingURL=payment.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.cjs","sources":["../../src/payment/api/payment-api.ts","../../src/payment/services/payment-service.ts","../../src/payment/index.ts"],"sourcesContent":[null,null,null],"names":["PaymentApi"],"mappings":";;AAYA;;;;;;;;;;;;;;;AAeG;MACU,WAAW,CAAA;AACtB,IAAA,WAAA,CAAoB,SAAwB,EAAA;QAAxB,IAAA,CAAA,SAAS,GAAT,SAAS;QAEZ,IAAA,CAAA,QAAQ,GAAG,YAAY;IAFO;;;;AAQ/C;;;;;;;;;AASG;IACH,MAAM,iBAAiB,CAAC,MAAgB,EAAA;AACtC,QAAA,IAAI,GAAG,GAAG,CAAA,EAAG,IAAI,CAAC,QAAQ,SAAS;AACnC,QAAA,IAAI,MAAM,KAAK,SAAS,EAAE;AAC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M,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,CAAC;;QAEjF,mBAAmB,EAAE,CAAC,eAAuB,EAAE,MAAc,EAAE,QAA0B,EAAE,YAAoB,EAAE,WAAmB,KAClI,cAAc,CAAC,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,CAAC;QAClG,mBAAmB,EAAE,CAAC,eAAuB,KAAK,cAAc,CAAC,mBAAmB,CAAC,eAAe,CAAC;;QAGrG,cAAc,EAAE,CAAC,eAAuB,EAAE,MAAc,EAAE,eAAwB,EAAE,cAAuB,EAAE,sBAA+B,KAC1I,cAAc,CAAC,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,sBAAsB,CAAC;AACjH,QAAA,mBAAmB,EAAE,MAAM,cAAc,CAAC,mBAAmB,EAAE;;AAG/D,QAAA,GAAG,EAAE,UAAU;AACf,QAAA,OAAO,EAAE;KACV;AACH;;;;;;"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @explorins/pers-sdk-payment
3
+ *
4
+ * Platform-agnostic Payment Domain SDK for PERS ecosystem
5
+ * Handles payment intents, purchases, and purchase tokens
6
+ *
7
+ * Note: Payment provider integrations (Stripe, etc.) are kept separate
8
+ * in the infrastructure layer to maintain platform-agnostic principles.
9
+ */
10
+ export { PaymentApi } from './payment/api/payment-api';
11
+ export { PaymentService } from './payment/services/payment-service';
12
+ export * from './payment/models';
13
+ export * from './shared/interfaces/pers-shared-lib.interfaces';
14
+ export * from './payment/models';
15
+ import { PersApiClient } from './core/pers-api-client';
16
+ import { PaymentApi } from './payment/api/payment-api';
17
+ import { PurchaseCurrency } from './payment/models';
18
+ import { PaymentService } from './payment/services/payment-service';
19
+ /**
20
+ * Create a complete Payment SDK instance
21
+ *
22
+ * @param apiClient - Configured PERS API client
23
+ * @returns Payment SDK with flattened structure for better DX
24
+ */
25
+ export declare function createPaymentSDK(apiClient: PersApiClient): {
26
+ getActivePurchaseTokens: (active?: boolean) => Promise<PurchaseTokenDTO[]>;
27
+ createPaymentIntent: (amount: number, currency: PurchaseCurrency, receiptEmail: string, description: string) => Promise<PaymentIntentDTO>;
28
+ updatePaymentIntent: (paymentIntentId: string, amount: number, currency: PurchaseCurrency, receiptEmail: string, description: string) => Promise<PaymentIntentDTO>;
29
+ cancelPaymentIntent: (paymentIntentId: string) => Promise<PaymentIntentDTO>;
30
+ createPurchase: (paymentIntentId: string, amount: number, purchaseTokenId?: string, donationTypeId?: number, donationAccountAddress?: string) => Promise<PurchaseDTO>;
31
+ getAllUserPurchases: () => Promise<PurchaseDTO[]>;
32
+ api: PaymentApi;
33
+ service: PaymentService;
34
+ };
35
+ export type PaymentSDK = ReturnType<typeof createPaymentSDK>;
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,254 @@
1
+ /**
2
+ * Platform-Agnostic Purchase API Client (RESTful Architecture)
3
+ *
4
+ * Handles purchase and payment operations using the PERS backend's new RESTful endpoints.
5
+ * Uses @explorins/pers-shared DTOs for consistency with backend.
6
+ *
7
+ * Migration Status: Updated to match /purchases controller (replaces /purchase endpoints)
8
+ *
9
+ * Available Access Levels:
10
+ * - PUBLIC: Project key authentication for catalog browsing and payment operations
11
+ * - USER: Requires user authentication JWT (purchase creation, history access)
12
+ * - ADMIN: Requires tenant admin privileges (not implemented in this client)
13
+ *
14
+ * Note: This SDK focuses on backend purchase operations only.
15
+ * Payment provider integrations (Stripe, etc.) should remain in infrastructure layer.
16
+ */
17
+ class PurchaseApi {
18
+ constructor(apiClient) {
19
+ this.apiClient = apiClient;
20
+ this.basePath = '/purchases';
21
+ }
22
+ // ==========================================
23
+ // PUBLIC OPERATIONS (Project Key)
24
+ // ==========================================
25
+ /**
26
+ * PUBLIC: Get purchase tokens (Intelligent Access)
27
+ *
28
+ * RESTful endpoint: GET /purchases/tokens
29
+ * Replaces: GET /purchase/token
30
+ *
31
+ * INTELLIGENT ACCESS:
32
+ * - PUBLIC (Project Key): Returns active tokens only (active parameter ignored)
33
+ * - ADMIN (Tenant Admin JWT): Returns filtered results based on active parameter
34
+ */
35
+ async getPurchaseTokens(active) {
36
+ let url = `${this.basePath}/tokens`;
37
+ if (active !== undefined) {
38
+ url += `?active=${active}`;
39
+ }
40
+ return this.apiClient.get(url);
41
+ }
42
+ /**
43
+ * PUBLIC: Get donation types
44
+ *
45
+ * RESTful endpoint: GET /purchases/donation-types
46
+ * Replaces: GET /purchase/donation/type
47
+ */
48
+ async getDonationTypes() {
49
+ return this.apiClient.get(`${this.basePath}/donation-types`);
50
+ }
51
+ // ==========================================
52
+ // PAYMENT OPERATIONS (FINANCIAL - CRITICAL)
53
+ // ==========================================
54
+ /**
55
+ * PUBLIC: Create payment intent (FINANCIAL OPERATION)
56
+ *
57
+ * RESTful endpoint: POST /purchases/payment-intents
58
+ * Replaces: POST /purchase/payment-intent
59
+ *
60
+ * CRITICAL: Handles real money operations - tenant context required
61
+ */
62
+ async createPaymentIntent(amount, currency, receiptEmail, description) {
63
+ const body = {
64
+ amount,
65
+ currency,
66
+ receiptEmail,
67
+ description
68
+ };
69
+ return this.apiClient.post(`${this.basePath}/payment-intents`, body);
70
+ }
71
+ /**
72
+ * PUBLIC: Update payment intent (FINANCIAL OPERATION)
73
+ *
74
+ * RESTful endpoint: PUT /purchases/payment-intents/{paymentIntentId}
75
+ * Replaces: PUT /purchase/payment-intent/{paymentIntentId}
76
+ *
77
+ * CRITICAL: Handles real money operations - tenant context required
78
+ */
79
+ async updatePaymentIntent(paymentIntentId, amount, currency, receiptEmail, description) {
80
+ const body = {
81
+ amount,
82
+ currency,
83
+ receiptEmail,
84
+ description
85
+ };
86
+ return this.apiClient.put(`${this.basePath}/payment-intents/${paymentIntentId}`, body);
87
+ }
88
+ /**
89
+ * PUBLIC: Cancel payment intent (FINANCIAL OPERATION)
90
+ *
91
+ * RESTful endpoint: DELETE /purchases/payment-intents/{paymentIntentId}
92
+ * Replaces: DELETE /purchase/payment-intent/{paymentIntentId}
93
+ *
94
+ * CRITICAL: Handles real money operations - tenant context required
95
+ */
96
+ async cancelPaymentIntent(paymentIntentId) {
97
+ return this.apiClient.delete(`${this.basePath}/payment-intents/${paymentIntentId}`);
98
+ }
99
+ // ==========================================
100
+ // USER OPERATIONS (JWT + Project Key)
101
+ // ==========================================
102
+ /**
103
+ * USER: Create purchase (BUSINESS CRITICAL - FINANCIAL TRANSACTION)
104
+ *
105
+ * RESTful endpoint: POST /purchases
106
+ * Replaces: POST /purchase/auth
107
+ *
108
+ * USER-ONLY: Requires user authentication JWT for purchase creation
109
+ * CRITICAL: Real financial transaction with Stripe integration
110
+ */
111
+ async createUserPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress) {
112
+ const body = {
113
+ quantity: amount,
114
+ purchaseTokenId: purchaseTokenId || '',
115
+ donationTypeId,
116
+ donationAccountAddress,
117
+ paymentIntentId
118
+ };
119
+ return this.apiClient.post(`${this.basePath}`, body);
120
+ }
121
+ /**
122
+ * USER: Get user purchase history
123
+ *
124
+ * RESTful endpoint: GET /purchases/me/history
125
+ * Replaces: GET /purchase/auth
126
+ *
127
+ * USER-ONLY: Get authenticated user's purchase history
128
+ * FINANCIAL RECORDS: User attribution critical for compliance
129
+ */
130
+ async getUserPurchaseHistory() {
131
+ return this.apiClient.get(`${this.basePath}/me/history`);
132
+ }
133
+ // ==========================================
134
+ // CONVENIENCE METHODS (Backward Compatibility)
135
+ // ==========================================
136
+ /**
137
+ * @deprecated Use getPurchaseTokens() instead
138
+ * Backward compatibility alias for getActivePurchaseTokens
139
+ */
140
+ async getActivePurchaseTokens(active = true) {
141
+ return this.getPurchaseTokens(active);
142
+ }
143
+ /**
144
+ * @deprecated Use createUserPurchase() instead
145
+ * Backward compatibility alias for createPurchase
146
+ */
147
+ async createPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress) {
148
+ return this.createUserPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress);
149
+ }
150
+ /**
151
+ * @deprecated Use getUserPurchaseHistory() instead
152
+ * Backward compatibility alias for getAllUserPurchases
153
+ */
154
+ async getAllUserPurchases() {
155
+ return this.getUserPurchaseHistory();
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Platform-Agnostic Payment Service
161
+ *
162
+ * Contains payment business logic and operations that work across platforms.
163
+ * No framework dependencies - pure TypeScript business logic.
164
+ *
165
+ * Focuses only on actual backend capabilities.
166
+ * Payment provider logic (Stripe, etc.) should remain in infrastructure layer.
167
+ */
168
+ class PaymentService {
169
+ constructor(paymentApi) {
170
+ this.paymentApi = paymentApi;
171
+ }
172
+ // ==========================================
173
+ // PUBLIC OPERATIONS
174
+ // ==========================================
175
+ /**
176
+ * PUBLIC: Get active purchase tokens
177
+ */
178
+ async getActivePurchaseTokens(active = true) {
179
+ return this.paymentApi.getActivePurchaseTokens(active);
180
+ }
181
+ /**
182
+ * PUBLIC: Create payment intent
183
+ */
184
+ async createPaymentIntent(amount, currency, receiptEmail, description) {
185
+ return this.paymentApi.createPaymentIntent(amount, currency, receiptEmail, description);
186
+ }
187
+ /**
188
+ * PUBLIC: Update payment intent
189
+ */
190
+ async updatePaymentIntent(paymentIntentId, amount, currency, receiptEmail, description) {
191
+ return this.paymentApi.updatePaymentIntent(paymentIntentId, amount, currency, receiptEmail, description);
192
+ }
193
+ /**
194
+ * PUBLIC: Cancel payment intent
195
+ */
196
+ async cancelPaymentIntent(paymentIntentId) {
197
+ return this.paymentApi.cancelPaymentIntent(paymentIntentId);
198
+ }
199
+ // ==========================================
200
+ // AUTHENTICATED OPERATIONS
201
+ // ==========================================
202
+ /**
203
+ * AUTH: Create purchase
204
+ */
205
+ async createPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress) {
206
+ return this.paymentApi.createPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress);
207
+ }
208
+ /**
209
+ * AUTH: Get all user purchases
210
+ */
211
+ async getAllUserPurchases() {
212
+ return this.paymentApi.getAllUserPurchases();
213
+ }
214
+ }
215
+
216
+ /**
217
+ * @explorins/pers-sdk-payment
218
+ *
219
+ * Platform-agnostic Payment Domain SDK for PERS ecosystem
220
+ * Handles payment intents, purchases, and purchase tokens
221
+ *
222
+ * Note: Payment provider integrations (Stripe, etc.) are kept separate
223
+ * in the infrastructure layer to maintain platform-agnostic principles.
224
+ */
225
+ // API Layer
226
+ /**
227
+ * Create a complete Payment SDK instance
228
+ *
229
+ * @param apiClient - Configured PERS API client
230
+ * @returns Payment SDK with flattened structure for better DX
231
+ */
232
+ function createPaymentSDK(apiClient) {
233
+ const paymentApi = new PurchaseApi(apiClient);
234
+ const paymentService = new PaymentService(paymentApi);
235
+ return {
236
+ // Direct access to service methods (primary interface)
237
+ // Public methods
238
+ getActivePurchaseTokens: (active) => paymentService.getActivePurchaseTokens(active),
239
+ // ✅ FIXED: Proper type instead of any
240
+ createPaymentIntent: (amount, currency, receiptEmail, description) => paymentService.createPaymentIntent(amount, currency, receiptEmail, description),
241
+ // ✅ FIXED: Proper type instead of any
242
+ updatePaymentIntent: (paymentIntentId, amount, currency, receiptEmail, description) => paymentService.updatePaymentIntent(paymentIntentId, amount, currency, receiptEmail, description),
243
+ cancelPaymentIntent: (paymentIntentId) => paymentService.cancelPaymentIntent(paymentIntentId),
244
+ // Auth methods
245
+ createPurchase: (paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress) => paymentService.createPurchase(paymentIntentId, amount, purchaseTokenId, donationTypeId, donationAccountAddress),
246
+ getAllUserPurchases: () => paymentService.getAllUserPurchases(),
247
+ // Advanced access for edge cases
248
+ api: paymentApi,
249
+ service: paymentService
250
+ };
251
+ }
252
+
253
+ export { PurchaseApi as PaymentApi, PaymentService, createPaymentSDK };
254
+ //# sourceMappingURL=payment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.js","sources":["../../src/payment/api/payment-api.ts","../../src/payment/services/payment-service.ts","../../src/payment/index.ts"],"sourcesContent":[null,null,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G;AACG,SAAU,gBAAgB,CAAC,SAAwB,EAAA;AACvD,IAAA,MAAM,UAAU,GAAG,IAAIA,WAAU,CAAC,SAAS,CAAC;AAC5C,IAAA,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,UAAU,CAAC;IAErD,OAAO;;;QAIL,uBAAuB,EAAE,CAAC,MAAgB,KAAK,cAAc,CAAC,uBAAuB,CAAC,MAAM,CAAC;;QAE7F,mBAAmB,EAAE,CAAC,MAAc,EAAE,QAA0B,EAAE,YAAoB,EAAE,WAAmB,KACzG,cAAc,CAAC,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,CAAC;;QAEjF,mBAAmB,EAAE,CAAC,eAAuB,EAAE,MAAc,EAAE,QAA0B,EAAE,YAAoB,EAAE,WAAmB,KAClI,cAAc,CAAC,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,CAAC;QAClG,mBAAmB,EAAE,CAAC,eAAuB,KAAK,cAAc,CAAC,mBAAmB,CAAC,eAAe,CAAC;;QAGrG,cAAc,EAAE,CAAC,eAAuB,EAAE,MAAc,EAAE,eAAwB,EAAE,cAAuB,EAAE,sBAA+B,KAC1I,cAAc,CAAC,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,sBAAsB,CAAC;AACjH,QAAA,mBAAmB,EAAE,MAAM,cAAc,CAAC,mBAAmB,EAAE;;AAG/D,QAAA,GAAG,EAAE,UAAU;AACf,QAAA,OAAO,EAAE;KACV;AACH;;;;"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * PERS SDK - Minimal platform-agnostic client with built-in authentication
3
+ * Authentication is now handled at the SDK core level for better scalability
4
+ */
5
+ import { HttpClient } from './core/abstractions/http-client';
6
+ import { PersConfig } from './core/pers-config';
7
+ import { PersApiClient } from './core/pers-api-client';
8
+ /**
9
+ * Minimal PERS SDK - API client with authentication built-in
10
+ * Platform adapters provide auth providers and HTTP clients
11
+ */
12
+ export declare class PersSDK {
13
+ private apiClient;
14
+ constructor(httpClient: HttpClient, config: PersConfig);
15
+ /**
16
+ * Get the API client for direct PERS API calls
17
+ * This is the main interface - keep it simple!
18
+ */
19
+ api(): PersApiClient;
20
+ /**
21
+ * Quick config check
22
+ */
23
+ isProduction(): boolean;
24
+ }
25
+ /**
26
+ * Simple factory function
27
+ */
28
+ export declare function createPersSDK(httpClient: HttpClient, config: PersConfig): PersSDK;
29
+ //# sourceMappingURL=pers-sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pers-sdk.d.ts","sourceRoot":"","sources":["../src/pers-sdk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;GAGG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,SAAS,CAAgB;gBAErB,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU;IAItD;;;OAGG;IACH,GAAG,IAAI,aAAa;IAIpB;;OAEG;IACH,YAAY,IAAI,OAAO;CAGxB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,UAAU,GACjB,OAAO,CAET"}