@pixelpay/sdk-core 2.0.3 → 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.
- package/CHANGELOG.md +4 -0
- package/index.html +80 -89
- package/lib/base/Helpers.d.ts +1 -1
- package/lib/base/Helpers.js +1 -1
- package/lib/browser/index.js +2 -2
- package/lib/libraries/CardinalManager.d.ts +1 -1
- package/lib/libraries/CardinalManager.js +17 -2
- package/lib/libraries/CardinalManager.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ El formato se basa en [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
5
5
|
y este proyecto se adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
Tipos de cambios: `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`.
|
|
7
7
|
|
|
8
|
+
## [v2.0.4] - 2022-11-04
|
|
9
|
+
### Fixed
|
|
10
|
+
- Arreglar eventos de Cardinal duplicándose en algunos casos
|
|
11
|
+
|
|
8
12
|
## [v2.0.3] - 2022-05-08
|
|
9
13
|
### Added
|
|
10
14
|
- Se agrega recoleccion de datos para garantizar 3DS EMV (v2.^)
|
package/index.html
CHANGED
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
</fieldset>
|
|
122
122
|
</div>
|
|
123
123
|
</div>
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
<div class="row">
|
|
126
126
|
<div class="column">
|
|
127
127
|
<fieldset>
|
|
@@ -182,34 +182,34 @@
|
|
|
182
182
|
|
|
183
183
|
</main>
|
|
184
184
|
|
|
185
|
+
<script src="https://unpkg.com/@pixelpay/sdk-core"></script>
|
|
185
186
|
<script src="./lib/browser/index.js"></script>
|
|
186
187
|
|
|
187
188
|
<script>
|
|
188
|
-
|
|
189
189
|
function getCard() {
|
|
190
|
-
|
|
190
|
+
const card = new Models.Card();
|
|
191
191
|
card.number = document.querySelector('input[name=card_number]').value;
|
|
192
192
|
card.cardholder = document.querySelector('input[name=card_holder]').value;
|
|
193
193
|
card.expire_month = document.querySelector('input[name=expire_month]').value;;
|
|
194
194
|
card.expire_year = document.querySelector('input[name=expire_year]').value;;
|
|
195
195
|
card.cvv2 = document.querySelector('input[name=card_cvv]').value;;
|
|
196
196
|
|
|
197
|
-
return card
|
|
197
|
+
return card;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
function getBilling() {
|
|
201
|
-
|
|
201
|
+
const billing = new Models.Billing();
|
|
202
202
|
billing.address = 'Ave Circunvalacion';
|
|
203
203
|
billing.country = 'HN';
|
|
204
204
|
billing.state = 'HN-CR';
|
|
205
205
|
billing.city = 'San Pedro Sula';
|
|
206
|
-
billing.phone = '
|
|
206
|
+
billing.phone = '50499999999';
|
|
207
207
|
|
|
208
208
|
return billing;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
function getOrder() {
|
|
212
|
-
|
|
212
|
+
const order = new Models.Order();
|
|
213
213
|
order.id = document.querySelector('input[name="uuid"]').value || 'TEST-1234';
|
|
214
214
|
order.currency = 'HNL';
|
|
215
215
|
order.amount = parseFloat(document.querySelector('input[name=amount]').value);
|
|
@@ -222,12 +222,11 @@
|
|
|
222
222
|
function showResponse(response) {
|
|
223
223
|
var json = JSON.parse(response);
|
|
224
224
|
json = JSON.stringify(json, undefined, 4);
|
|
225
|
-
document.querySelector('textarea[name="response"]').value = json
|
|
225
|
+
document.querySelector('textarea[name="response"]').value = json;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
document.getElementById(
|
|
229
|
-
|
|
230
|
-
var card_selected = document.querySelector('select[name="cards"]').value;
|
|
228
|
+
document.getElementById('cards').onchange = () => {
|
|
229
|
+
const card_selected = document.querySelector('select[name="cards"]').value;
|
|
231
230
|
document.querySelector('input[name=card_number]').value = card_selected;
|
|
232
231
|
}
|
|
233
232
|
|
|
@@ -236,22 +235,22 @@
|
|
|
236
235
|
}
|
|
237
236
|
|
|
238
237
|
document.querySelector('button[name=sale]').onclick = () => {
|
|
239
|
-
|
|
238
|
+
const settings = new Models.Settings();
|
|
240
239
|
settings.setupSandbox();
|
|
241
240
|
|
|
242
|
-
|
|
241
|
+
const service = new Services.Transaction(settings);
|
|
243
242
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
243
|
+
const card = getCard();
|
|
244
|
+
const billing = getBilling();
|
|
245
|
+
const order = getOrder();
|
|
246
|
+
|
|
247
|
+
const sale = new Requests.SaleTransaction();
|
|
249
248
|
sale.setCard(card);
|
|
250
249
|
sale.setBilling(billing);
|
|
251
250
|
sale.setOrder(order);
|
|
252
|
-
|
|
251
|
+
|
|
253
252
|
if (document.querySelector('input[name="3ds"]') && document.querySelector('input[name="3ds"]').checked) {
|
|
254
|
-
sale.
|
|
253
|
+
sale.withAuthenticationRequest();
|
|
255
254
|
}
|
|
256
255
|
|
|
257
256
|
service.doSale(sale).then(response => {
|
|
@@ -260,27 +259,26 @@
|
|
|
260
259
|
}).catch(err => {
|
|
261
260
|
console.error(err);
|
|
262
261
|
alert(`${err.message} (ERR)`);
|
|
263
|
-
})
|
|
262
|
+
});
|
|
264
263
|
}
|
|
265
264
|
|
|
266
265
|
document.querySelector('button[name=auth]').onclick = () => {
|
|
267
|
-
|
|
268
|
-
settings.
|
|
269
|
-
|
|
266
|
+
const settings = new Models.Settings();
|
|
267
|
+
settings.setupSandbox();
|
|
268
|
+
|
|
269
|
+
const service = new Services.Transaction(settings);
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
const card = getCard();
|
|
272
|
+
const billing = getBilling();
|
|
273
|
+
const order = getOrder();
|
|
272
274
|
|
|
273
|
-
|
|
274
|
-
var billing = getBilling();
|
|
275
|
-
var order = getOrder();
|
|
276
|
-
|
|
277
|
-
var auth = new Requests.AuthTransaction();
|
|
275
|
+
const auth = new Requests.AuthTransaction();
|
|
278
276
|
auth.setCard(card);
|
|
279
277
|
auth.setBilling(billing);
|
|
280
278
|
auth.setOrder(order);
|
|
281
|
-
|
|
279
|
+
|
|
282
280
|
if (document.querySelector('input[name="3ds"]') && document.querySelector('input[name="3ds"]').checked) {
|
|
283
|
-
|
|
281
|
+
sale.withAuthenticationRequest();
|
|
284
282
|
}
|
|
285
283
|
|
|
286
284
|
service.doAuth(auth).then(response => {
|
|
@@ -289,16 +287,15 @@
|
|
|
289
287
|
}).catch(err => {
|
|
290
288
|
console.error(err);
|
|
291
289
|
alert(`${err.message} (ERR)`);
|
|
292
|
-
})
|
|
290
|
+
});
|
|
293
291
|
}
|
|
294
292
|
|
|
295
293
|
document.querySelector('button[name=capture]').onclick = () => {
|
|
296
|
-
|
|
297
|
-
settings.
|
|
298
|
-
settings.setupCredentials('2212294583', 'c7dd7a6cf3e47417edb3456c22218a5d');
|
|
294
|
+
const settings = new Models.Settings();
|
|
295
|
+
settings.setupSandbox();
|
|
299
296
|
|
|
300
|
-
|
|
301
|
-
|
|
297
|
+
const service = new Services.Transaction(settings);
|
|
298
|
+
const capture = new Requests.CaptureTransaction();
|
|
302
299
|
capture.payment_uuid = document.querySelector('input[name="uuid"]').value
|
|
303
300
|
capture.transaction_approved_amount = 1.00;
|
|
304
301
|
|
|
@@ -308,47 +305,45 @@
|
|
|
308
305
|
}).catch(err => {
|
|
309
306
|
console.error(err);
|
|
310
307
|
alert(`${err.message} (ERR)`);
|
|
311
|
-
})
|
|
308
|
+
});
|
|
312
309
|
}
|
|
313
310
|
|
|
314
311
|
document.querySelector('button[name=void]').onclick = () => {
|
|
315
|
-
|
|
316
|
-
settings.
|
|
317
|
-
|
|
312
|
+
const settings = new Models.Settings();
|
|
313
|
+
settings.setupSandbox();
|
|
314
|
+
|
|
318
315
|
user = document.querySelector('input[name="user"]').value
|
|
319
316
|
if (user) {
|
|
320
317
|
settings.setupPlatformUser(user);
|
|
321
318
|
}
|
|
322
319
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
320
|
+
const service = new Services.Transaction(settings);
|
|
321
|
+
const voidTx = new Requests.VoidTransaction();
|
|
322
|
+
voidTx.payment_uuid = document.querySelector('input[name="uuid"]').value
|
|
323
|
+
voidTx.void_reason = 'Transaction Test';
|
|
327
324
|
|
|
328
|
-
service.doVoid(
|
|
325
|
+
service.doVoid(voidTx).then(response => {
|
|
329
326
|
showResponse(response.toJson())
|
|
330
327
|
alert(`${response.message} (${response.status})`);
|
|
331
328
|
}).catch(err => {
|
|
332
329
|
console.error(err);
|
|
333
330
|
alert(`${err.message} (ERR)`);
|
|
334
|
-
})
|
|
331
|
+
});
|
|
335
332
|
}
|
|
336
333
|
|
|
337
334
|
document.querySelector('button[name=status]').onclick = () => {
|
|
338
|
-
|
|
339
|
-
settings.
|
|
340
|
-
settings.setupCredentials('2212294583', 'c7dd7a6cf3e47417edb3456c22218a5d');
|
|
335
|
+
const settings = new Models.Settings();
|
|
336
|
+
settings.setupSandbox();
|
|
341
337
|
|
|
342
|
-
|
|
338
|
+
const service = new Services.Transaction(settings);
|
|
343
339
|
|
|
344
|
-
|
|
340
|
+
const statusTx = new Requests.StatusTransaction();
|
|
345
341
|
statusTx.payment_uuid = document.querySelector('input[name="uuid"]').value
|
|
346
342
|
|
|
347
|
-
service.getStatus(statusTx).then(
|
|
348
|
-
console.log(response);
|
|
343
|
+
service.getStatus(statusTx).then(response => {
|
|
349
344
|
showResponse(response.toJson())
|
|
350
345
|
alert(`${response.message} (${response.status})`);
|
|
351
|
-
}).catch(
|
|
346
|
+
}).catch(err => {
|
|
352
347
|
console.error(err);
|
|
353
348
|
alert(`${err.message} (ERR)`);
|
|
354
349
|
});
|
|
@@ -359,96 +354,92 @@
|
|
|
359
354
|
UI.PixelPayLoading.hide();
|
|
360
355
|
}
|
|
361
356
|
}
|
|
362
|
-
|
|
357
|
+
|
|
363
358
|
document.querySelector('button[name=vault]').onclick = () => {
|
|
364
|
-
|
|
359
|
+
const settings = new Models.Settings();
|
|
365
360
|
settings.setupSandbox();
|
|
366
361
|
|
|
367
|
-
|
|
368
|
-
|
|
362
|
+
const service = new Services.Tokenization(settings);
|
|
363
|
+
const cardRequest = new Requests.CardTokenization();
|
|
369
364
|
cardRequest.setCard(getCard());
|
|
370
365
|
cardRequest.setBilling(getBilling());
|
|
371
366
|
|
|
372
|
-
service.vaultCard(cardRequest).then(
|
|
367
|
+
service.vaultCard(cardRequest).then(response => {
|
|
373
368
|
token = document.querySelector('input[name="token"]').value = response.getData("token");
|
|
374
369
|
|
|
375
370
|
showResponse(response.toJson())
|
|
376
371
|
alert(`${response.message} (${response.status})`);
|
|
377
|
-
}).catch(
|
|
372
|
+
}).catch(err => {
|
|
378
373
|
console.error(err);
|
|
379
374
|
alert(`${err.message} (ERR)`);
|
|
380
375
|
});
|
|
381
376
|
}
|
|
382
377
|
|
|
383
378
|
document.querySelector('button[name=show]').onclick = () => {
|
|
384
|
-
|
|
379
|
+
const settings = new Models.Settings();
|
|
385
380
|
settings.setupSandbox();
|
|
386
381
|
|
|
387
|
-
|
|
382
|
+
const service = new Services.Tokenization(settings);
|
|
388
383
|
|
|
389
384
|
token = document.querySelector('input[name="token"]').value;
|
|
390
385
|
if (token.includes(',')) {
|
|
391
|
-
|
|
392
|
-
service.showCards(tokens).then(
|
|
386
|
+
const tokens = token.split(',');
|
|
387
|
+
service.showCards(tokens).then(response => {
|
|
393
388
|
showResponse(response.toJson())
|
|
394
389
|
alert(`${response.message} (${response.status})`);
|
|
395
|
-
}).catch(
|
|
390
|
+
}).catch(err => {
|
|
396
391
|
console.error(err);
|
|
397
392
|
alert(`${err.message} (ERR)`);
|
|
398
393
|
});
|
|
399
394
|
} else {
|
|
400
|
-
service.showCard(token).then(
|
|
395
|
+
service.showCard(token).then(response => {
|
|
401
396
|
showResponse(response.toJson())
|
|
402
397
|
alert(`${response.message} (${response.status})`);
|
|
403
|
-
}).catch(
|
|
398
|
+
}).catch(err => {
|
|
404
399
|
console.error(err);
|
|
405
400
|
alert(`${err.message} (ERR)`);
|
|
406
401
|
});
|
|
407
402
|
}
|
|
408
|
-
|
|
409
403
|
}
|
|
410
|
-
|
|
404
|
+
|
|
411
405
|
document.querySelector('button[name=update]').onclick = () => {
|
|
412
|
-
|
|
406
|
+
const settings = new Models.Settings();
|
|
413
407
|
settings.setupSandbox();
|
|
414
408
|
|
|
415
|
-
|
|
416
|
-
|
|
409
|
+
const service = new Services.Tokenization(settings);
|
|
410
|
+
const cardRequest = new Requests.CardTokenization();
|
|
417
411
|
cardRequest.setCard(getCard());
|
|
418
412
|
cardRequest.setBilling(getBilling());
|
|
419
|
-
|
|
420
|
-
var input_uuid = document.querySelector('input[name="token"]');
|
|
421
413
|
|
|
422
|
-
|
|
414
|
+
const input_uuid = document.querySelector('input[name="token"]');
|
|
415
|
+
|
|
416
|
+
service.updateCard(input_uuid.value, cardRequest).then(response => {
|
|
423
417
|
token = input_uuid.value = response.getData("token");
|
|
424
418
|
|
|
425
419
|
showResponse(response.toJson())
|
|
426
420
|
alert(`${response.message} (${response.status})`);
|
|
427
|
-
}).catch(
|
|
421
|
+
}).catch(err => {
|
|
428
422
|
console.error(err);
|
|
429
423
|
alert(`${err.message} (ERR)`);
|
|
430
424
|
})
|
|
431
425
|
}
|
|
432
|
-
|
|
426
|
+
|
|
433
427
|
document.querySelector('button[name=delete]').onclick = () => {
|
|
434
|
-
|
|
428
|
+
const settings = new Models.Settings();
|
|
435
429
|
settings.setupSandbox();
|
|
436
430
|
|
|
437
|
-
|
|
431
|
+
const service = new Services.Tokenization(settings);
|
|
438
432
|
|
|
439
|
-
token = document.querySelector('input[name="token"]').value;
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
console.log(response);
|
|
443
|
-
showResponse(response.toJson())
|
|
433
|
+
token = document.querySelector('input[name="token"]').value;
|
|
434
|
+
service.deleteCard(token).then(response => {
|
|
435
|
+
showResponse(response.toJson());
|
|
444
436
|
alert(`${response.message} (${response.status})`);
|
|
445
|
-
}).catch(
|
|
437
|
+
}).catch(err => {
|
|
446
438
|
console.error(err);
|
|
447
439
|
alert(`${err.message} (ERR)`);
|
|
448
440
|
});
|
|
449
441
|
}
|
|
450
|
-
|
|
451
442
|
</script>
|
|
452
443
|
</body>
|
|
453
444
|
|
|
454
|
-
</html>
|
|
445
|
+
</html>
|
package/lib/base/Helpers.d.ts
CHANGED