@tax1driver/ts-przelewy24 2.1.0

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 (201) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/.yarnrc.yml +1 -0
  3. package/LICENSE +21 -0
  4. package/README.md +330 -0
  5. package/dist/blik/Alias.d.ts +80 -0
  6. package/dist/blik/Alias.d.ts.map +1 -0
  7. package/dist/blik/Alias.js +3 -0
  8. package/dist/blik/Alias.js.map +1 -0
  9. package/dist/blik/ChargeBlik.d.ts +151 -0
  10. package/dist/blik/ChargeBlik.d.ts.map +1 -0
  11. package/dist/blik/ChargeBlik.js +4 -0
  12. package/dist/blik/ChargeBlik.js.map +1 -0
  13. package/dist/blik/RecurringParams.d.ts +37 -0
  14. package/dist/blik/RecurringParams.d.ts.map +1 -0
  15. package/dist/blik/RecurringParams.js +3 -0
  16. package/dist/blik/RecurringParams.js.map +1 -0
  17. package/dist/blik/index.d.ts +4 -0
  18. package/dist/blik/index.d.ts.map +1 -0
  19. package/dist/blik/index.js +20 -0
  20. package/dist/blik/index.js.map +1 -0
  21. package/dist/cards/CardInfo.d.ts +45 -0
  22. package/dist/cards/CardInfo.d.ts.map +1 -0
  23. package/dist/cards/CardInfo.js +3 -0
  24. package/dist/cards/CardInfo.js.map +1 -0
  25. package/dist/cards/CardNotification.d.ts +178 -0
  26. package/dist/cards/CardNotification.d.ts.map +1 -0
  27. package/dist/cards/CardNotification.js +3 -0
  28. package/dist/cards/CardNotification.js.map +1 -0
  29. package/dist/cards/ChargeCard.d.ts +81 -0
  30. package/dist/cards/ChargeCard.d.ts.map +1 -0
  31. package/dist/cards/ChargeCard.js +3 -0
  32. package/dist/cards/ChargeCard.js.map +1 -0
  33. package/dist/cards/index.d.ts +4 -0
  34. package/dist/cards/index.d.ts.map +1 -0
  35. package/dist/cards/index.js +20 -0
  36. package/dist/cards/index.js.map +1 -0
  37. package/dist/enums/Channel.d.ts +18 -0
  38. package/dist/enums/Channel.d.ts.map +1 -0
  39. package/dist/enums/Channel.js +22 -0
  40. package/dist/enums/Channel.js.map +1 -0
  41. package/dist/enums/Country.d.ts +67 -0
  42. package/dist/enums/Country.d.ts.map +1 -0
  43. package/dist/enums/Country.js +71 -0
  44. package/dist/enums/Country.js.map +1 -0
  45. package/dist/enums/Currency.d.ts +36 -0
  46. package/dist/enums/Currency.d.ts.map +1 -0
  47. package/dist/enums/Currency.js +40 -0
  48. package/dist/enums/Currency.js.map +1 -0
  49. package/dist/enums/Encoding.d.ts +35 -0
  50. package/dist/enums/Encoding.d.ts.map +1 -0
  51. package/dist/enums/Encoding.js +39 -0
  52. package/dist/enums/Encoding.js.map +1 -0
  53. package/dist/enums/Language.d.ts +37 -0
  54. package/dist/enums/Language.d.ts.map +1 -0
  55. package/dist/enums/Language.js +41 -0
  56. package/dist/enums/Language.js.map +1 -0
  57. package/dist/enums/ShippingType.d.ts +13 -0
  58. package/dist/enums/ShippingType.d.ts.map +1 -0
  59. package/dist/enums/ShippingType.js +17 -0
  60. package/dist/enums/ShippingType.js.map +1 -0
  61. package/dist/enums/index.d.ts +7 -0
  62. package/dist/enums/index.d.ts.map +1 -0
  63. package/dist/enums/index.js +23 -0
  64. package/dist/enums/index.js.map +1 -0
  65. package/dist/errors/P24Error.d.ts +38 -0
  66. package/dist/errors/P24Error.d.ts.map +1 -0
  67. package/dist/errors/P24Error.js +49 -0
  68. package/dist/errors/P24Error.js.map +1 -0
  69. package/dist/errors/index.d.ts +2 -0
  70. package/dist/errors/index.d.ts.map +1 -0
  71. package/dist/errors/index.js +18 -0
  72. package/dist/errors/index.js.map +1 -0
  73. package/dist/index.d.ts +11 -0
  74. package/dist/index.d.ts.map +1 -0
  75. package/dist/index.js +27 -0
  76. package/dist/index.js.map +1 -0
  77. package/dist/orders/Additional.d.ts +17 -0
  78. package/dist/orders/Additional.d.ts.map +1 -0
  79. package/dist/orders/Additional.js +3 -0
  80. package/dist/orders/Additional.js.map +1 -0
  81. package/dist/orders/CartItem.d.ts +58 -0
  82. package/dist/orders/CartItem.d.ts.map +1 -0
  83. package/dist/orders/CartItem.js +3 -0
  84. package/dist/orders/CartItem.js.map +1 -0
  85. package/dist/orders/OfflineTransaction.d.ts +51 -0
  86. package/dist/orders/OfflineTransaction.d.ts.map +1 -0
  87. package/dist/orders/OfflineTransaction.js +3 -0
  88. package/dist/orders/OfflineTransaction.js.map +1 -0
  89. package/dist/orders/Order.d.ts +211 -0
  90. package/dist/orders/Order.d.ts.map +1 -0
  91. package/dist/orders/Order.js +3 -0
  92. package/dist/orders/Order.js.map +1 -0
  93. package/dist/orders/OrderCreatedData.d.ts +16 -0
  94. package/dist/orders/OrderCreatedData.d.ts.map +1 -0
  95. package/dist/orders/OrderCreatedData.js +3 -0
  96. package/dist/orders/OrderCreatedData.js.map +1 -0
  97. package/dist/orders/Shipping.d.ts +39 -0
  98. package/dist/orders/Shipping.d.ts.map +1 -0
  99. package/dist/orders/Shipping.js +3 -0
  100. package/dist/orders/Shipping.js.map +1 -0
  101. package/dist/orders/SplitPayment.d.ts +54 -0
  102. package/dist/orders/SplitPayment.d.ts.map +1 -0
  103. package/dist/orders/SplitPayment.js +3 -0
  104. package/dist/orders/SplitPayment.js.map +1 -0
  105. package/dist/orders/Transaction.d.ts +23 -0
  106. package/dist/orders/Transaction.d.ts.map +1 -0
  107. package/dist/orders/Transaction.js +3 -0
  108. package/dist/orders/Transaction.js.map +1 -0
  109. package/dist/orders/TransactionDetails.d.ts +135 -0
  110. package/dist/orders/TransactionDetails.d.ts.map +1 -0
  111. package/dist/orders/TransactionDetails.js +3 -0
  112. package/dist/orders/TransactionDetails.js.map +1 -0
  113. package/dist/orders/index.d.ts +10 -0
  114. package/dist/orders/index.d.ts.map +1 -0
  115. package/dist/orders/index.js +26 -0
  116. package/dist/orders/index.js.map +1 -0
  117. package/dist/p24/BaseParameters.d.ts +46 -0
  118. package/dist/p24/BaseParameters.d.ts.map +1 -0
  119. package/dist/p24/BaseParameters.js +27 -0
  120. package/dist/p24/BaseParameters.js.map +1 -0
  121. package/dist/p24/P24.d.ts +241 -0
  122. package/dist/p24/P24.d.ts.map +1 -0
  123. package/dist/p24/P24.js +484 -0
  124. package/dist/p24/P24.js.map +1 -0
  125. package/dist/p24/P24Options.d.ts +16 -0
  126. package/dist/p24/P24Options.d.ts.map +1 -0
  127. package/dist/p24/P24Options.js +3 -0
  128. package/dist/p24/P24Options.js.map +1 -0
  129. package/dist/p24/endpoints.d.ts +13 -0
  130. package/dist/p24/endpoints.d.ts.map +1 -0
  131. package/dist/p24/endpoints.js +16 -0
  132. package/dist/p24/endpoints.js.map +1 -0
  133. package/dist/p24/index.d.ts +6 -0
  134. package/dist/p24/index.d.ts.map +1 -0
  135. package/dist/p24/index.js +22 -0
  136. package/dist/p24/index.js.map +1 -0
  137. package/dist/p24/ips.d.ts +2 -0
  138. package/dist/p24/ips.d.ts.map +1 -0
  139. package/dist/p24/ips.js +11 -0
  140. package/dist/p24/ips.js.map +1 -0
  141. package/dist/payment/PaymentMethod.d.ts +76 -0
  142. package/dist/payment/PaymentMethod.d.ts.map +1 -0
  143. package/dist/payment/PaymentMethod.js +3 -0
  144. package/dist/payment/PaymentMethod.js.map +1 -0
  145. package/dist/payment/index.d.ts +2 -0
  146. package/dist/payment/index.d.ts.map +1 -0
  147. package/dist/payment/index.js +18 -0
  148. package/dist/payment/index.js.map +1 -0
  149. package/dist/refund/Refund.d.ts +37 -0
  150. package/dist/refund/Refund.d.ts.map +1 -0
  151. package/dist/refund/Refund.js +3 -0
  152. package/dist/refund/Refund.js.map +1 -0
  153. package/dist/refund/RefundRequest.d.ts +38 -0
  154. package/dist/refund/RefundRequest.d.ts.map +1 -0
  155. package/dist/refund/RefundRequest.js +3 -0
  156. package/dist/refund/RefundRequest.js.map +1 -0
  157. package/dist/refund/RefundResult.d.ts +51 -0
  158. package/dist/refund/RefundResult.d.ts.map +1 -0
  159. package/dist/refund/RefundResult.js +3 -0
  160. package/dist/refund/RefundResult.js.map +1 -0
  161. package/dist/refund/TransactionWithRefunds.d.ts +101 -0
  162. package/dist/refund/TransactionWithRefunds.d.ts.map +1 -0
  163. package/dist/refund/TransactionWithRefunds.js +3 -0
  164. package/dist/refund/TransactionWithRefunds.js.map +1 -0
  165. package/dist/refund/index.d.ts +5 -0
  166. package/dist/refund/index.d.ts.map +1 -0
  167. package/dist/refund/index.js +21 -0
  168. package/dist/refund/index.js.map +1 -0
  169. package/dist/responses/ErrorResponse.d.ts +17 -0
  170. package/dist/responses/ErrorResponse.d.ts.map +1 -0
  171. package/dist/responses/ErrorResponse.js +3 -0
  172. package/dist/responses/ErrorResponse.js.map +1 -0
  173. package/dist/responses/SuccessResponse.d.ts +17 -0
  174. package/dist/responses/SuccessResponse.d.ts.map +1 -0
  175. package/dist/responses/SuccessResponse.js +3 -0
  176. package/dist/responses/SuccessResponse.js.map +1 -0
  177. package/dist/responses/index.d.ts +3 -0
  178. package/dist/responses/index.d.ts.map +1 -0
  179. package/dist/responses/index.js +19 -0
  180. package/dist/responses/index.js.map +1 -0
  181. package/dist/utils/hash.d.ts +2 -0
  182. package/dist/utils/hash.d.ts.map +1 -0
  183. package/dist/utils/hash.js +14 -0
  184. package/dist/utils/hash.js.map +1 -0
  185. package/dist/verify/NotificationRequest.d.ts +82 -0
  186. package/dist/verify/NotificationRequest.d.ts.map +1 -0
  187. package/dist/verify/NotificationRequest.js +3 -0
  188. package/dist/verify/NotificationRequest.js.map +1 -0
  189. package/dist/verify/Verification.d.ts +38 -0
  190. package/dist/verify/Verification.d.ts.map +1 -0
  191. package/dist/verify/Verification.js +3 -0
  192. package/dist/verify/Verification.js.map +1 -0
  193. package/dist/verify/VerificationData.d.ts +16 -0
  194. package/dist/verify/VerificationData.d.ts.map +1 -0
  195. package/dist/verify/VerificationData.js +3 -0
  196. package/dist/verify/VerificationData.js.map +1 -0
  197. package/dist/verify/index.d.ts +4 -0
  198. package/dist/verify/index.d.ts.map +1 -0
  199. package/dist/verify/index.js +20 -0
  200. package/dist/verify/index.js.map +1 -0
  201. package/package.json +45 -0
Binary file
package/.yarnrc.yml ADDED
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Kasun Vithanage
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,330 @@
1
+ # ts-przelewy24
2
+
3
+ ![Build](https://github.com/tax1driver/ts-przelewy24/workflows/Build/badge.svg) ![](https://img.shields.io/github/license/tax1driver/ts-przelewy24) ![](https://img.shields.io/npm/v/@tax1driver/ts-przelewy24) ![](https://img.shields.io/github/last-commit/tax1driver/ts-przelewy24)
4
+
5
+ A type safe Przelewy24 client for TypeScript. Originally authored by [kasvith](https://github.com/kasvith), updated by me to extend API coverage.
6
+
7
+ This library provides an elegant way to create/verify transactions easily.
8
+
9
+ **Note: Now this library uses the new REST API available in [here](https://developers.przelewy24.pl/index.php?en).**
10
+
11
+ > Previous legacy API support is still available in **v1.1.1**
12
+ > Future versions will support new REST API only. If you use legacy API please use that version.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install --save @tax1driver/ts-przelewy24
18
+ ```
19
+
20
+ ## Reference
21
+
22
+ [Full API & Types Reference](https://tax1driver.github.io/ts-przelewy24)
23
+
24
+ ## Basic Usage
25
+
26
+ ### Importing
27
+
28
+ ```typescript
29
+ import {
30
+ P24,
31
+ Order,
32
+ Currency,
33
+ Country,
34
+ Language,
35
+ NotificationRequest,
36
+ Verification
37
+ } from "@tax1driver/ts-przelewy24";
38
+ ```
39
+
40
+ ### Initialization
41
+
42
+ - **merchantId** : ID given by P24
43
+ - **posId** : Given by P24(often this referes to Merchant ID)
44
+ - **apiKey** : API Key from p24 panel(Klucz do raportów)
45
+ - **crcKey** : CRC value obtained from p24 panel
46
+
47
+ ```typescript
48
+ const p24 = new P24(
49
+ merchantId,
50
+ posId,
51
+ apiKey,
52
+ crcKey,
53
+ {
54
+ sandbox: false // enable or disable sandbox
55
+ }
56
+ );
57
+ ```
58
+
59
+ ### Test access to P24
60
+
61
+ Test your connection to the Przelewy24 API.
62
+
63
+ ```typescript
64
+ const result = await p24.testAccess();
65
+ console.log(result); // true on success or an error being thrown P24Error
66
+ ```
67
+
68
+ ### Create an order
69
+
70
+ Prepare the following details to initiate a payment:
71
+
72
+ ```typescript
73
+ const order: Order = {
74
+ sessionId: "c837e1a3-c5a3-4e89-adf1-05faffd8913b",
75
+ amount: 1000, // Transaction amount expressed in lowest currency unit, e.g. 1.23 PLN = 123
76
+ currency: Currency.PLN,
77
+ description: "test order",
78
+ email: "john.doe@example.com",
79
+ country: Country.Poland,
80
+ language: Language.PL,
81
+ urlReturn: "http://myawesomeapp.com/continue",
82
+ urlStatus: "http://myawesomeapp.com/p24callback", // callback to get notification
83
+ timeLimit: 15, // 15min
84
+ encoding: Encoding.UTF8,
85
+ }
86
+ const result = await p24.createTransaction(order)
87
+ console.log(result) // returns a valid URL to complete payment or throws an error
88
+ ```
89
+
90
+ ### Verify notification
91
+
92
+ The P24 system will send a notification to the `urlStatus` provided in the transaction order. You need to **verify** this notification request before verifying the transaction.
93
+
94
+ ```typescript
95
+ const verify: NotificationRequest = req.body
96
+ const res = p24.verifyNotification(verify)
97
+ console.log(res) // true when the notification is valid
98
+ ```
99
+
100
+ ### Verify transaction
101
+
102
+ To accept the payment to your merchant account, after validating the notification request, you need to verify the transaction with the P24 system. **If you don't do this, the funds will not be transferred to your account**.
103
+
104
+ ```typescript
105
+ // extract all information from callback request
106
+ const verifyRequest: Verification = {
107
+ amount: 1000,
108
+ currency: Currency.PLN,
109
+ orderId: 3030,
110
+ sessionId: 'c837e1a3-c5a3-4e89-adf1-05faffd8913b'
111
+ }
112
+
113
+ const res = await p24.verifyTransaction(verifyRequest)
114
+ console.log(res) // true on success, otherwise throws P24Error
115
+ ```
116
+
117
+ ### Refund an order
118
+
119
+ To refund a customer, you need to create a refund request.
120
+
121
+ ```typescript
122
+ const ref = {
123
+ refundsUuid: '94c1fb0b-f40f-4201-b2a0-f4166839d06c',
124
+ requestId: 'afa379ac-c3ca-43d0-892f-e7a3f13ee4cc',
125
+ refunds: [
126
+ {
127
+ amount: 1000,
128
+ description: 'test',
129
+ orderId: 3030,
130
+ sessionId: 'c837e1a3-c5a3-4e89-adf1-05faffd8913b'
131
+ }
132
+ ],
133
+ }
134
+
135
+ const result = await p24.refund(ref)
136
+ console.log(result) // returns a SuccessResponse<RefundResult[]> with details about each refund request
137
+ ```
138
+
139
+ ### Get transaction details
140
+
141
+ Retrieve detailed information about a transaction by session ID.
142
+
143
+ ```typescript
144
+ const details = await p24.getTransactionDetails('c837e1a3-c5a3-4e89-adf1-05faffd8913b')
145
+ console.log(details) // returns TransactionDetails object with all transaction information
146
+ ```
147
+
148
+ ### Get payment methods
149
+
150
+ Retrieve available payment methods for the merchant. Optionally filter by amount and currency.
151
+
152
+ ```typescript
153
+ const methods = await p24.listPaymentMethods('en', {
154
+ amount: 1000,
155
+ currency: Currency.PLN
156
+ })
157
+ console.log(methods) // returns array of PaymentMethod objects
158
+ ```
159
+
160
+ ### Get refunds by order ID
161
+
162
+ Retrieve all refunds for a specific order.
163
+
164
+ ```typescript
165
+ const refunds = await p24.getRefundsByOrderId('3030')
166
+ console.log(refunds) // returns TransactionWithRefunds object containing transaction and refund details
167
+ ```
168
+
169
+ ### Register offline transaction
170
+
171
+ Register an offline transaction (e.g., bank transfer, cash).
172
+
173
+ ```typescript
174
+ const offlineTransaction = await p24.registerOfflineTransaction(token)
175
+ console.log(offlineTransaction) // returns OfflineTransaction with bank account details
176
+ ```
177
+
178
+ ### Create split payment
179
+
180
+ Create a transaction with split payments to multiple recipients.
181
+
182
+ ```typescript
183
+ const splitOrder = {
184
+ ...order, // standard Order fields
185
+ splits: [
186
+ {
187
+ amount: 500,
188
+ description: 'Split 1',
189
+ email: 'recipient1@example.com'
190
+ },
191
+ {
192
+ amount: 500,
193
+ description: 'Split 2',
194
+ email: 'recipient2@example.com'
195
+ }
196
+ ]
197
+ }
198
+
199
+ const result = await p24.splitPayment(splitOrder)
200
+ console.log(result) // returns Transaction with token and link
201
+ ```
202
+
203
+ ## BLIK Payments
204
+
205
+ ### Charge BLIK by code
206
+
207
+ Charge a customer's BLIK account using a 6-digit BLIK code.
208
+
209
+ ```typescript
210
+ const blikParams = {
211
+ token: 'transaction_token',
212
+ blikCode: '123456',
213
+ aliasValue: 'optional_alias', // optional: for future payments
214
+ aliasLabel: 'My Phone', // optional: alias label
215
+ recurring: { // optional: for recurring payments
216
+ expiryDate: '2025-12-31',
217
+ period: 'month'
218
+ }
219
+ }
220
+
221
+ const result = await p24.chargeBlikByCode(blikParams)
222
+ console.log(result) // returns ChargeBlikData with orderId
223
+ ```
224
+
225
+ ### Charge BLIK by alias
226
+
227
+ Charge using a saved BLIK alias (for recurring payments).
228
+
229
+ ```typescript
230
+ const blikParams = {
231
+ token: 'transaction_token',
232
+ aliasValue: 'saved_alias',
233
+ aliasLabel: 'My Phone'
234
+ }
235
+
236
+ const result = await p24.chargeBlikByAlias(blikParams)
237
+ console.log(result) // returns ChargeBlikData with orderId
238
+ ```
239
+
240
+ ### Get BLIK aliases
241
+
242
+ Retrieve BLIK aliases for a customer by email.
243
+
244
+ ```typescript
245
+ // Get standard BLIK aliases
246
+ const aliases = await p24.getBlikAliasesByEmail('customer@example.com')
247
+ console.log(aliases) // returns array of BlikAlias objects
248
+
249
+ // Get custom BLIK aliases (registered with aliasValue and aliasLabel)
250
+ const customAliases = await p24.getBlikAliasesByEmailCustom('customer@example.com')
251
+ console.log(customAliases) // returns array of BlikAlias objects
252
+ ```
253
+
254
+ ## Card Payments
255
+
256
+ ### Charge card with 3D Secure
257
+
258
+ Initiate a card payment with 3D Secure authentication.
259
+
260
+ ```typescript
261
+ const result = await p24.chargeCard3DS(token)
262
+ console.log(result) // returns { orderId, redirectUrl } for 3DS authentication
263
+ // Redirect customer to result.redirectUrl for authentication
264
+ ```
265
+
266
+ ### Charge card without 3D Secure
267
+
268
+ Charge a card directly without 3D Secure.
269
+
270
+ ```typescript
271
+ const result = await p24.chargeCard(token)
272
+ console.log(result) // returns { orderId }
273
+ ```
274
+
275
+ ### Charge card direct
276
+
277
+ Charge a card directly with custom parameters.
278
+
279
+ ```typescript
280
+ const params = {
281
+ token: 'transaction_token',
282
+ cardNumber: '4111111111111111',
283
+ cvv: '123',
284
+ expiryMonth: '12',
285
+ expiryYear: '2025'
286
+ }
287
+
288
+ const result = await p24.chargeCardDirect(params)
289
+ console.log(result) // returns { orderId } or { orderId, redirectUrl } if 3DS is required
290
+ ```
291
+
292
+ ### Verify card payment notification
293
+
294
+ Verify card payment notifications sent by P24.
295
+
296
+ ```typescript
297
+ const cardNotification: CardPaymentNotification = req.body
298
+ const isValid = p24.verifyCardNotification(cardNotification)
299
+ console.log(isValid) // true if notification is authentic
300
+ ```
301
+
302
+ ## Error Handling
303
+
304
+ The library throws `P24Error` when API calls fail. All errors include a message, error code, and details.
305
+
306
+ ```typescript
307
+ import { P24Error } from "@tax1driver/ts-przelewy24";
308
+
309
+ try {
310
+ const result = await p24.createTransaction(order)
311
+ console.log(result)
312
+ } catch (error) {
313
+ if (error instanceof P24Error) {
314
+ console.error('P24 Error:', error.message)
315
+ console.error('Error Code:', error.code)
316
+ console.error('Details:', error.details)
317
+ } else {
318
+ console.error('Unexpected error:', error)
319
+ }
320
+ }
321
+ ```
322
+
323
+ ### Validate IP addresses
324
+
325
+ Validate IP addresses against P24 backend servers.
326
+
327
+ ```typescript
328
+ const valid = P24.isIpValid("127.0.0.1");
329
+ console.log(valid); // output false if IP is not from p24
330
+ ```
@@ -0,0 +1,80 @@
1
+ /**
2
+ * BLIK alias status
3
+ *
4
+ * @export
5
+ * @type {BlikAliasStatus}
6
+ */
7
+ export type BlikAliasStatus = 'REGISTERED' | 'UNREGISTERED' | 'EXPIRED';
8
+ /**
9
+ * BLIK alias update notification
10
+ *
11
+ * @export
12
+ * @interface AliasUpdateNotification
13
+ */
14
+ export interface AliasUpdateNotification {
15
+ /**
16
+ * Alias value
17
+ *
18
+ * @type {string}
19
+ * @memberof AliasUpdateNotification
20
+ */
21
+ value: string;
22
+ /**
23
+ * Customer email address
24
+ *
25
+ * @type {string}
26
+ * @memberof AliasUpdateNotification
27
+ */
28
+ email: string;
29
+ /**
30
+ * Alias type
31
+ *
32
+ * @type {string}
33
+ * @memberof AliasUpdateNotification
34
+ */
35
+ type: string;
36
+ /**
37
+ * Alias status
38
+ *
39
+ * @type {BlikAliasStatus}
40
+ * @memberof AliasUpdateNotification
41
+ */
42
+ status: BlikAliasStatus;
43
+ }
44
+ /**
45
+ * BLIK alias information
46
+ *
47
+ * @export
48
+ * @interface BlikAlias
49
+ */
50
+ export interface BlikAlias {
51
+ /**
52
+ * Alias value
53
+ *
54
+ * @type {string}
55
+ * @memberof BlikAlias
56
+ */
57
+ value: string;
58
+ /**
59
+ * Alias type
60
+ *
61
+ * @type {string}
62
+ * @memberof BlikAlias
63
+ */
64
+ type: string;
65
+ /**
66
+ * Alias status
67
+ *
68
+ * @type {string}
69
+ * @memberof BlikAlias
70
+ */
71
+ status: string;
72
+ /**
73
+ * Alias expiration date
74
+ *
75
+ * @type {string}
76
+ * @memberof BlikAlias
77
+ */
78
+ expirationDate: string;
79
+ }
80
+ //# sourceMappingURL=Alias.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alias.d.ts","sourceRoot":"","sources":["../../src/blik/Alias.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,cAAc,GAAG,SAAS,CAAC;AAExE;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACpC;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,MAAM,EAAE,eAAe,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Alias.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alias.js","sourceRoot":"","sources":["../../src/blik/Alias.ts"],"names":[],"mappings":""}
@@ -0,0 +1,151 @@
1
+ import { RecurringParams } from './RecurringParams';
2
+ /**
3
+ * Parameters for charging BLIK account by code
4
+ *
5
+ * @export
6
+ * @interface ChargeBlikByCodeParams
7
+ */
8
+ export interface ChargeBlikByCodeParams {
9
+ /**
10
+ * Transaction token
11
+ *
12
+ * @type {string}
13
+ * @memberof ChargeBlikByCodeParams
14
+ */
15
+ token: string;
16
+ /**
17
+ * BLIK code from the customer
18
+ *
19
+ * @type {string}
20
+ * @memberof ChargeBlikByCodeParams
21
+ */
22
+ blikCode: string;
23
+ /**
24
+ * Optional alias value for future payments
25
+ *
26
+ * @type {string}
27
+ * @memberof ChargeBlikByCodeParams
28
+ */
29
+ aliasValue?: string;
30
+ /**
31
+ * Optional alias label for identification
32
+ *
33
+ * @type {string}
34
+ * @memberof ChargeBlikByCodeParams
35
+ */
36
+ aliasLabel?: string;
37
+ /**
38
+ * Optional recurring payment parameters
39
+ *
40
+ * @type {RecurringParams}
41
+ * @memberof ChargeBlikByCodeParams
42
+ */
43
+ recurring?: RecurringParams;
44
+ }
45
+ /**
46
+ * Parameters for charging BLIK account by alias
47
+ *
48
+ * @export
49
+ * @interface ChargeBlikByAliasParams
50
+ */
51
+ export interface ChargeBlikByAliasParams {
52
+ /**
53
+ * Transaction token
54
+ *
55
+ * @type {string}
56
+ * @memberof ChargeBlikByAliasParams
57
+ */
58
+ token: string;
59
+ /**
60
+ * Payment type (must be 'alias')
61
+ *
62
+ * @type {'alias'}
63
+ * @memberof ChargeBlikByAliasParams
64
+ */
65
+ type: 'alias';
66
+ /**
67
+ * BLIK alias value
68
+ *
69
+ * @type {string}
70
+ * @memberof ChargeBlikByAliasParams
71
+ */
72
+ aliasValue: string;
73
+ /**
74
+ * Optional alias label for identification
75
+ *
76
+ * @type {string}
77
+ * @memberof ChargeBlikByAliasParams
78
+ */
79
+ aliasLabel?: string;
80
+ /**
81
+ * Optional recurring payment parameters
82
+ *
83
+ * @type {RecurringParams}
84
+ * @memberof ChargeBlikByAliasParams
85
+ */
86
+ recurring?: RecurringParams;
87
+ }
88
+ /**
89
+ * BLIK charge response data
90
+ *
91
+ * @export
92
+ * @interface ChargeBlikData
93
+ */
94
+ export interface ChargeBlikData {
95
+ /**
96
+ * Order ID from Przelewy24
97
+ *
98
+ * @type {string}
99
+ * @memberof ChargeBlikData
100
+ */
101
+ orderId: string;
102
+ /**
103
+ * Response message
104
+ *
105
+ * @type {string}
106
+ * @memberof ChargeBlikData
107
+ */
108
+ message: string;
109
+ }
110
+ /**
111
+ * BLIK payment notification from Przelewy24
112
+ *
113
+ * @export
114
+ * @interface BlikPaymentNotification
115
+ */
116
+ export interface BlikPaymentNotification {
117
+ /**
118
+ * Order ID from Przelewy24
119
+ *
120
+ * @type {string}
121
+ * @memberof BlikPaymentNotification
122
+ */
123
+ orderId: string;
124
+ /**
125
+ * Transaction session ID from the Partner's system
126
+ *
127
+ * @type {string}
128
+ * @memberof BlikPaymentNotification
129
+ */
130
+ sessionId: string;
131
+ /**
132
+ * Payment method ID
133
+ *
134
+ * @type {number}
135
+ * @memberof BlikPaymentNotification
136
+ */
137
+ method: number;
138
+ /**
139
+ * Payment result details
140
+ *
141
+ * @type {{ error: string; message: string; status: string; trxRef: string }}
142
+ * @memberof BlikPaymentNotification
143
+ */
144
+ result: {
145
+ error: string;
146
+ message: string;
147
+ status: string;
148
+ trxRef: string;
149
+ };
150
+ }
151
+ //# sourceMappingURL=ChargeBlik.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChargeBlik.d.ts","sourceRoot":"","sources":["../../src/blik/ChargeBlik.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACpC;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACpC;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,MAAM,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAA;KACjB,CAAA;CACJ"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
4
+ //# sourceMappingURL=ChargeBlik.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChargeBlik.js","sourceRoot":"","sources":["../../src/blik/ChargeBlik.ts"],"names":[],"mappings":";;AAqKC,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * BLIK recurring payment parameters
3
+ *
4
+ * @export
5
+ * @interface RecurringParams
6
+ */
7
+ export interface RecurringParams {
8
+ /**
9
+ * Type of recurring payment (O - one-time, M - monthly, A - annual)
10
+ *
11
+ * @type {('O' | 'M' | 'A')}
12
+ * @memberof RecurringParams
13
+ */
14
+ type: 'O' | 'M' | 'A';
15
+ /**
16
+ * Expiration date of the recurring payment
17
+ *
18
+ * @type {string}
19
+ * @memberof RecurringParams
20
+ */
21
+ expirationDate: string;
22
+ /**
23
+ * Check if the bank supports recurring payments
24
+ *
25
+ * @type {boolean}
26
+ * @memberof RecurringParams
27
+ */
28
+ availableBanks: boolean;
29
+ /**
30
+ * Initialization date of the recurring payment
31
+ *
32
+ * @type {string}
33
+ * @memberof RecurringParams
34
+ */
35
+ initDate: string;
36
+ }
37
+ //# sourceMappingURL=RecurringParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecurringParams.d.ts","sourceRoot":"","sources":["../../src/blik/RecurringParams.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;;OAKG;IACH,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAEtB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=RecurringParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecurringParams.js","sourceRoot":"","sources":["../../src/blik/RecurringParams.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from './ChargeBlik';
2
+ export * from './RecurringParams';
3
+ export * from './Alias';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blik/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ChargeBlik"), exports);
18
+ __exportStar(require("./RecurringParams"), exports);
19
+ __exportStar(require("./Alias"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blik/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,oDAAkC;AAClC,0CAAwB"}