paynl-pos-sdk-react-native 0.0.57 → 0.0.60

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.
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "paynl-pos-sdk-react-native",
3
- "version": "0.0.57",
3
+ "version": "0.0.60",
4
4
  "description": "A PayNL sdk to accept and process payments",
5
- "source": "./src/index.tsx",
6
5
  "main": "./lib/commonjs/index.js",
7
6
  "module": "./lib/module/index.js",
8
7
  "exports": {
@@ -19,6 +18,7 @@
19
18
  },
20
19
  "access": "public",
21
20
  "files": [
21
+ "src",
22
22
  "lib",
23
23
  "android",
24
24
  "ios",
@@ -0,0 +1,514 @@
1
+ import { type TurboModule, TurboModuleRegistry } from 'react-native';
2
+ import type {EventEmitter} from 'react-native/Libraries/Types/CodegenTypes';
3
+
4
+ export interface Spec extends TurboModule {
5
+ /**
6
+ * Initialize the SDK. When booting the app, this is always the first step.
7
+ *
8
+ * @returns {NativeInitResult} - This value determines the next step.
9
+ *
10
+ * If *needs_login*, the app needs to call either *loginViaCode* or *loginViaCredentials*.
11
+ *
12
+ * If *ready_for_payments*, the app is ready to process the payment
13
+ */
14
+ initSdk(params: NativeInitModel): Promise<NativeInitResult>;
15
+
16
+ /**
17
+ * This allows you to update the configuration of the SDK
18
+ */
19
+ setConfiguration(params: NativeInitModel): void;
20
+
21
+ /**
22
+ * Fetches the activation code for login
23
+ */
24
+ getActivationCode(): Promise<ActivationResponseModel>;
25
+
26
+ /**
27
+ * Start login flow via the activation code
28
+ * @param code - The activated code. This value can be fetched via *getActivationCode()*
29
+ */
30
+ loginViaCode(code: string): Promise<void>;
31
+
32
+ /**
33
+ * Start login flow via credentials. a-code and sl & secret are request to start this process
34
+ * @param aCode
35
+ * @param serviceCode
36
+ * @param serviceSecret
37
+ */
38
+ loginViaCredentials(
39
+ aCode: string,
40
+ serviceCode: string,
41
+ serviceSecret: string
42
+ ): Promise<void>;
43
+
44
+ /**
45
+ * Starts a transaction via the Native SDK
46
+ */
47
+ startTransaction(params: { transaction: Transaction, forService?: Service }): Promise<TransactionResponseModel>;
48
+
49
+ cancelTransaction(): Promise<void>;
50
+
51
+ sendTicketViaEmail(email: string, transactionId: string, ticket: string): Promise<void>;
52
+
53
+ /**
54
+ * Prints a ticket with a supported printer
55
+ * @param ticket the base64 ticket
56
+ */
57
+ printTicket(ticket: string): Promise<void>;
58
+
59
+ /**
60
+ * Returns whether the PAY.SDK can find a supported printer on the device for ticket printing.
61
+ */
62
+ hasPrinter(): boolean;
63
+
64
+ getTerminalInfo(): TerminalInfo | undefined;
65
+
66
+ getAllowedCurrencies(): AllowedCurrency[] | undefined;
67
+
68
+ logout(): void;
69
+
70
+ sendLogs(): Promise<void>;
71
+
72
+ getOfflineQueue(): OfflineQueue;
73
+
74
+ triggerFullOfflineProcessing(): Promise<TransactionResponseModel[]>;
75
+
76
+ triggerSingleOfflineProcessing(id: string): Promise<TransactionResponseModel>;
77
+
78
+ clearOfflineItem(id: string): boolean;
79
+
80
+ onPaymentEvent: EventEmitter<OnPaymentEventParam>;
81
+ }
82
+
83
+ export interface NativeInitModel {
84
+ /**
85
+ * The integrationId needed to process payments.
86
+ * You can get one via PayNL support
87
+ */
88
+ integrationId: string;
89
+
90
+ /**
91
+ * The name of the license file in the application's assets folder
92
+ *
93
+ * _Android only_
94
+ */
95
+ licenseName?: string;
96
+
97
+ overlayParams?: PaymentOverlayParams;
98
+
99
+ pinPadLayoutParams?: PinPadLayoutParams;
100
+
101
+ /**
102
+ * This property allows the SDK to generate sounds based on the state of the reader.
103
+ * These are the same sounds generated by the PAY.POS application.
104
+ *
105
+ * If disabled, it is recommended to generate your own feedback (sounds/vibrations) for the user to track the reader state
106
+ *
107
+ * Default: true
108
+ *
109
+ * _Android only_
110
+ */
111
+ enableSound?: boolean;
112
+
113
+ /**
114
+ * Use the external display of the device (if available)
115
+ *
116
+ * Default: true
117
+ *
118
+ * _Android only_
119
+ */
120
+ useExternalDisplay?: boolean;
121
+
122
+ /**
123
+ * Allows the logger to persist logs.
124
+ * Logs older than 7days will be deleted.
125
+ *
126
+ * Allows the usages of the `PayNlSDK.sendLogs()` method
127
+ */
128
+ enableLogging?: boolean;
129
+
130
+ /**
131
+ * Enables scanning for Mifare cards. Make sure you handle Payment event MIFARE.
132
+ *
133
+ * Default: false
134
+ */
135
+ enableMifareScanning?: boolean;
136
+
137
+ /**
138
+ * Allows payments to be stored in cases of connection issues
139
+ */
140
+ enableOfflineProcessing?: boolean;
141
+
142
+ /**
143
+ * Enforces pin prompt during offline payment (if supported by card)
144
+ */
145
+ enforcePinCodeDuringOfflineProcessing?: boolean;
146
+
147
+ payNlCore: 'CPOC' | 'MULTI' | 'ZERO';
148
+ }
149
+
150
+ export type NativeInitResult = 'needs_login' | 'ready_for_payment';
151
+
152
+ export interface ActivationResponseModel {
153
+ code: string;
154
+ expiresAt: string;
155
+ }
156
+ export interface PaymentOverlayParams {
157
+ /**
158
+ * Enables the overlay.
159
+ * <i>Default</i>: true
160
+ */
161
+ enabled?: boolean;
162
+
163
+ /**
164
+ * Controls the delay before automatically closing the overlay.
165
+ * If delay = 0, overlay will not be closed and dismiss & ticket buttons will be shown.
166
+ * <i>Default</i>: 0
167
+ */
168
+ closeDelayInMs?: number;
169
+
170
+ /**
171
+ * At the top of the overlay a logo is shown.
172
+ * Place your logo in the Android drawable and add the reference here.
173
+ * <i>Default</i>: res/drawable/paynl.png (PayNL logo)
174
+ */
175
+ logoImage?: string;
176
+
177
+ /**
178
+ * The reference to a custom waitingCard lottie animation.
179
+ * Make sure the Lottie JSON is placed in the res/raw folder.
180
+ * <i>Default</i>: res/raw/reader_animation.json (PayNL reader animation)
181
+ */
182
+ waitingCardAnimation?: string;
183
+
184
+ /**
185
+ * Customise the button styling.
186
+ * <i>Default</i>: res/drawable/pay_btn.xml (PayNl button shape)
187
+ */
188
+ buttonShape?: string;
189
+
190
+ /**
191
+ * The font family of the amount.
192
+ * <i>Default</i>: Lufga semibold
193
+ */
194
+ amountTextFontFamily?: string;
195
+
196
+ /**
197
+ * The font family of the payer message.
198
+ * <i>Default</i>: Inter regular
199
+ */
200
+ payerMessageTextFontFamily?: string;
201
+
202
+ /**
203
+ * The background color of the overlay.
204
+ * <i>Default</i>: #FFFFFFFF (white)
205
+ */
206
+ backgroundColor?: string;
207
+
208
+ /**
209
+ * The text color of the amount.
210
+ * <i>Default</i>: #FF444444
211
+ */
212
+ amountTextColor?: string;
213
+
214
+ /**
215
+ * The text color of the payerMessage.
216
+ * <i>Default</i>: #FF888888
217
+ */
218
+ payerMessageTextColor?: string;
219
+
220
+ /**
221
+ * The color of the loading spinner. Hex value only supported.
222
+ * <i>Default</i>: #FF585FFF
223
+ */
224
+ progressBarColor?: string;
225
+
226
+ /**
227
+ * The color of successfully payment. Hex value only supported.
228
+ * <i>Default</i>: #FF00D388
229
+ */
230
+ successColor?: string;
231
+
232
+ /**
233
+ * The color of error during payment. Hex value only supported.
234
+ * <i>Default</i>: #FFC5362C
235
+ */
236
+ errorColor?: string;
237
+
238
+ /**
239
+ * The text color of the buttons.
240
+ * <i>Default</i>: #FF000000
241
+ */
242
+ buttonTextColor?: string;
243
+
244
+ /**
245
+ * The text for the cancel button.
246
+ * <i>Default</i>: Annuleren
247
+ */
248
+ cancelButtonLabel?: string;
249
+
250
+ /**
251
+ * The text for the close button. Only visible if closeDelay = 0.
252
+ * <i>Default</i>: Sluiten
253
+ */
254
+ closeButtonLabel?: string;
255
+
256
+ /**
257
+ * The text for the "show ticket" button. Only visible if closeDelay = 0.
258
+ * <i>Default</i>: Open bon
259
+ */
260
+ ticketButtonLabel?: string;
261
+
262
+ /**
263
+ * The text while waiting for NFC detection.
264
+ * <i>Default</i>: Bied uw kaart aan
265
+ */
266
+ waitingCardLabel?: string;
267
+
268
+ /**
269
+ * The text while processing payment.
270
+ * <i>Default</i>: Betaling verwerken...
271
+ */
272
+ processingCardLabel?: string;
273
+
274
+ /**
275
+ * The text for in the header of the ticket viewer
276
+ * <i>Default</i>: Betaling succesvol!
277
+ */
278
+ ticketHeaderLabel?: string;
279
+
280
+ /**
281
+ * The text for in the header of the email prompt
282
+ * <i>Default</i>: Voer email adres in
283
+ */
284
+ emailHeaderLabel?: string;
285
+
286
+ /**
287
+ * The text for the email action
288
+ * <i>Default</i>: Mailen
289
+ */
290
+ emailButtonLabel?: string;
291
+ }
292
+
293
+ export interface PinPadLayoutParams {
294
+ /**
295
+ * The upper part of the screen shows a shadow during the WAIRTING_PINCODE.
296
+ * You can disable this and show your own content in the top part via this property
297
+ * <i>Default</i>: false
298
+ */
299
+ hideShadow?: boolean;
300
+
301
+ /**
302
+ * The hint text during WAITING_PINCODE.
303
+ * <i>Default</i>: Voer uw pincode in
304
+ */
305
+ waitingPincode?: string;
306
+
307
+ /**
308
+ * The background color of the overlay
309
+ * <i>Default</i>: #FFDDDDDD
310
+ */
311
+ backgroundColor?: string;
312
+
313
+ /**
314
+ * The text color of the numbers in the pin pad
315
+ * <i>Default</i>: #FF666666
316
+ */
317
+ numTextColor?: string;
318
+
319
+ /**
320
+ * The background color of the OK button in the pin pad
321
+ * <i>Default</i>: FF03A311
322
+ */
323
+ okButtonColor?: string;
324
+
325
+ /**
326
+ * The text color of the OK button in the pin pad
327
+ * <i>Default</i>: #FFFFFFFF
328
+ */
329
+ okButtonTextColor?: string;
330
+
331
+ /**
332
+ * The button color of the Clear button in the pin pad
333
+ * <i>Default</i>: #FFC5362C
334
+ */
335
+ clearButtonColor?: string;
336
+
337
+ /**
338
+ * The button color of the Delete button in the pin pad
339
+ * <i>Default</i>: #FFE37005
340
+ */
341
+ deleteButtonColor?: string;
342
+ }
343
+
344
+
345
+ type StatusAction = 'PAID' | 'FAILED' | 'DECLINED' | 'OFFLINE' | 'CANCELLED' | 'MIFARE';
346
+ export interface TransactionResponseModel {
347
+ statusAction: StatusAction;
348
+ transactionId: string;
349
+ mifareSerial: string;
350
+ payerMessage: string;
351
+ orderId: string;
352
+ reference: string;
353
+ ticket: string;
354
+ }
355
+
356
+ export interface Transaction {
357
+ type?: 'PAYMENT' | 'REFUND';
358
+ serviceId?: string;
359
+ description?: string;
360
+ reference?: string;
361
+ exchangeUrl?: string;
362
+ amount: Amount;
363
+ paymentMethod?: PaymentMethod;
364
+ customer?: Customer;
365
+ order?: Order;
366
+ notification?: Notification;
367
+ stats?: Stats;
368
+ transferData?: TransferData[];
369
+ tguReference?: string;
370
+ ecrInitiated?: boolean;
371
+ }
372
+
373
+ export interface Amount {
374
+ value: number;
375
+ currency: string;
376
+ }
377
+
378
+ export interface PaymentMethod {
379
+ id?: string;
380
+ subId?: string;
381
+ }
382
+
383
+ export interface Company {
384
+ countryCode?: string;
385
+ coc?: string;
386
+ vat?: string;
387
+ name?: string;
388
+ }
389
+
390
+ export interface Customer {
391
+ firstName?: string;
392
+ lastName?: string;
393
+ phone?: string;
394
+ birthDate?: string;
395
+ gender?: string;
396
+ email?: string;
397
+ ipAddress?: string;
398
+ trust?: number;
399
+ reference?: string;
400
+ company?: Company;
401
+ }
402
+
403
+ export interface Address {
404
+ firstName?: string;
405
+ lastName?: string;
406
+ streetName?: string;
407
+ streetNumber?: string;
408
+ streetNumberExtension?: string;
409
+ zipCode?: string;
410
+ city?: string;
411
+ countryCode?: string;
412
+ }
413
+
414
+ export interface Product {
415
+ id?: string;
416
+ description?: string;
417
+ type?: string;
418
+ price?: ProductAmount;
419
+ quantity?: number;
420
+ vatCode?: string;
421
+ }
422
+
423
+ export interface ProductAmount {
424
+ value?: number;
425
+ currency?: string;
426
+ }
427
+
428
+ export interface DeliveryData {
429
+ firstName?: string;
430
+ lastName?: string;
431
+ streetName?: string;
432
+ streetNumber?: string;
433
+ streetNumberExtension?: string;
434
+ zipCode?: string;
435
+ city?: string;
436
+ countryCode?: string;
437
+ }
438
+
439
+ export interface Order {
440
+ countryCode?: string;
441
+ deliveryDate?: string;
442
+ invoiceDate?: string;
443
+ deliveryAddress?: DeliveryData;
444
+ invoiceAddress?: Address;
445
+ products?: Product[];
446
+ }
447
+
448
+ export interface Notification {
449
+ type?: string;
450
+ recipient?: string;
451
+ }
452
+
453
+ export interface Stats {
454
+ info?: string;
455
+ tool?: string;
456
+ extra1?: string;
457
+ extra2?: string;
458
+ extra3?: string;
459
+ }
460
+
461
+ export interface TransferData {
462
+ name: string;
463
+ value: string;
464
+ }
465
+
466
+ export interface Service {
467
+ serviceId: string;
468
+ secret: string;
469
+ }
470
+
471
+ export interface TerminalInfo {
472
+ terminal: { code: string; name: string; }
473
+ merchant: { code: string; name: string; }
474
+ service: { code: string; name: string; }
475
+ tradeName: { code: string; name: string; }
476
+ merchantLocation: { id: number; code: string; name: string; }
477
+ }
478
+
479
+ export interface AllowedCurrency {
480
+ id: string;
481
+ code: string;
482
+ sign: string;
483
+ }
484
+
485
+ export interface OfflineQueue {
486
+ size: number;
487
+ queue: OfflineQueueItem[];
488
+ }
489
+
490
+ export interface OfflineQueueItem {
491
+ id: string;
492
+ reference: string;
493
+ enqueuedAt: string;
494
+ }
495
+
496
+ export type OnPaymentEventType = 'PAYMENT_WAITING_CARD' | 'PAYMENT_PROCESSING' | 'PAYMENT_COMPLETED' | 'PAYMENT_FAILED' | 'PIN_WAITING' | 'PIN_CANCELLED' | 'MIFARE';
497
+
498
+ export type OnPaymentEventParam = {
499
+ event: OnPaymentEventType;
500
+ data?: {
501
+ code?: string;
502
+ description?: string;
503
+ schemeBrand?: string;
504
+ usingSecondaryScreen?: 'true' | 'false';
505
+ statusAction?: StatusAction;
506
+ transactionId?: string;
507
+ orderId?: string;
508
+ reference?: string;
509
+ ticket?: string;
510
+ mifareSerial?: string;
511
+ };
512
+ }
513
+
514
+ export default TurboModuleRegistry.getEnforcing<Spec>('PaynlSdk');
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ import PayNlSdk from './NativePayNlSdk';
2
+ import type { Transaction, Service, Amount, Product, Order, Customer, ProductAmount, TransferData, Address, DeliveryData, Company, Stats, Notification, PaymentMethod, TerminalInfo, AllowedCurrency, OnPaymentEventParam, OfflineQueue, OfflineQueueItem } from './NativePayNlSdk'
3
+
4
+ export { PayNlSdk };
5
+ export type { Transaction, Service, Amount, Product, Order, Customer, ProductAmount, TransferData, Address, DeliveryData, Company, Stats, Notification, PaymentMethod, TerminalInfo, AllowedCurrency, OnPaymentEventParam, OfflineQueue, OfflineQueueItem };