@globalpayments/js 1.8.3 → 1.8.9

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 (81) hide show
  1. package/.prettierrc +4 -4
  2. package/LICENSE.md +264 -264
  3. package/README.md +733 -700
  4. package/TODO +5 -5
  5. package/bin/replace-gp-ref.js +17 -17
  6. package/bin/update-version.js +19 -18
  7. package/config/rollup.js +67 -67
  8. package/cypress.json +11 -11
  9. package/package.json +51 -36
  10. package/types/credit-card/index.d.ts +16 -0
  11. package/types/echeck/index.d.ts +8 -0
  12. package/types/gift-and-loyalty/index.d.ts +8 -0
  13. package/types/global-type.d.ts +7 -7
  14. package/types/internal/gateways/index.d.ts +2 -0
  15. package/types/internal/lib/card.d.ts +1 -1
  16. package/types/internal/lib/dot-placeholders.d.ts +2 -0
  17. package/types/internal/lib/events.d.ts +3 -0
  18. package/types/internal/lib/styles/gp-default.d.ts +9 -0
  19. package/types/lib/version.d.ts +1 -1
  20. package/types/payment-request/complete.d.ts +6 -0
  21. package/types/payment-request/setup.d.ts +18 -0
  22. package/types/tools/configure.d.ts +16 -5
  23. package/types/ui/form/index.d.ts +57 -1
  24. package/types/ui/iframe-field/action-accumulate-data-and-tokenize.d.ts +6 -0
  25. package/types/ui/iframe-field/action-card-track-button-click.d.ts +6 -0
  26. package/types/ui/iframe-field/action-get-cvv.d.ts +7 -0
  27. package/types/ui/iframe-field/action-payment-request-complete.d.ts +10 -0
  28. package/types/ui/iframe-field/action-payment-request-start.d.ts +11 -0
  29. package/types/ui/iframe-field/action-request-data.d.ts +9 -0
  30. package/types/ui/iframe-field/action-set-card-type.d.ts +9 -0
  31. package/types/ui/iframe-field/action-set-focus.d.ts +3 -0
  32. package/types/ui/iframe-field/action-set-label.d.ts +5 -0
  33. package/types/ui/iframe-field/action-set-placeholder.d.ts +5 -0
  34. package/types/ui/iframe-field/action-set-text.d.ts +5 -0
  35. package/types/ui/iframe-field/action-set-type-cvv.d.ts +10 -0
  36. package/types/ui/iframe-field/action-set-value.d.ts +5 -0
  37. package/types/ui/iframe-field/index.d.ts +79 -2
  38. package/types/ui/index.d.ts +7 -0
  39. package/dist/field.html +0 -45
  40. package/dist/globalpayments.js +0 -5811
  41. package/dist/globalpayments.js.map +0 -1
  42. package/dist/globalpayments.min.js +0 -2
  43. package/dist/globalpayments.min.js.map +0 -1
  44. package/dist/images/amex.svg +0 -1
  45. package/dist/images/cvv-amex.png +0 -0
  46. package/dist/images/cvv.png +0 -0
  47. package/dist/images/discover.svg +0 -1
  48. package/dist/images/gp-cc-amex.svg +0 -6
  49. package/dist/images/gp-cc-dinnersclub.svg +0 -33
  50. package/dist/images/gp-cc-discover.svg +0 -14
  51. package/dist/images/gp-cc-generic.svg +0 -4
  52. package/dist/images/gp-cc-jcb.svg +0 -12
  53. package/dist/images/gp-cc-maestro.svg +0 -14
  54. package/dist/images/gp-cc-mastercard.svg +0 -11
  55. package/dist/images/gp-cc-visa.svg +0 -6
  56. package/dist/images/gp-fa-question-circle.svg +0 -3
  57. package/dist/images/gp-lock.svg +0 -7
  58. package/dist/images/gp-secure-logo.svg +0 -8
  59. package/dist/images/gp-secure-ssl-logo.svg +0 -8
  60. package/dist/images/jcb.svg +0 -1
  61. package/dist/images/logo-amex@2x.png +0 -0
  62. package/dist/images/logo-discover@2x.png +0 -0
  63. package/dist/images/logo-jcb@2x.png +0 -0
  64. package/dist/images/logo-mastercard@2x.png +0 -0
  65. package/dist/images/logo-unknown@2x.png +0 -0
  66. package/dist/images/logo-visa@2x.png +0 -0
  67. package/dist/images/mastercard.svg +0 -1
  68. package/dist/images/shield-and-logos@2x.png +0 -0
  69. package/dist/images/visa.svg +0 -1
  70. package/examples/accessibility.html +0 -100
  71. package/examples/billpay.html +0 -181
  72. package/examples/genius.html +0 -80
  73. package/examples/globalpayments/hash.php +0 -19
  74. package/examples/globalpayments.html +0 -94
  75. package/examples/gp-api.php +0 -60
  76. package/examples/heartland.html +0 -247
  77. package/examples/index.html +0 -22
  78. package/examples/openedge.html +0 -61
  79. package/examples/transit/create-manifest.php +0 -80
  80. package/examples/transit/curl.php +0 -40
  81. package/examples/transit/index.php +0 -83
@@ -1,22 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
6
- <title>Examples</title>
7
- </head>
8
- <body>
9
- <h1>Examples</h1>
10
-
11
- <ul>
12
- <li><a href="heartland.html">Heartland</a></li>
13
- <li><a href="globalpayments.html">Global Payments eCommerce</a></li>
14
- <li><a href="genius.html">GPI (Genius)</a></li>
15
- <li><a href="transit/index.php">TransIT / TSEP</a></li>
16
- <li><a href="openedge.html">GPI (OpenEdge)</a></li>
17
- <li><a href="billpay.html">Heartland BillPay</a></li>
18
- <li><a href="accessibility.html">Accessibility</a></li>
19
- <li><a href="gp-api.php">GP API</a></li>
20
- </ul>
21
- </body>
22
- </html>
@@ -1,61 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
6
- <title>GPI (OpenEdge) Examples</title>
7
- </head>
8
- <body>
9
- <h1>Examples</h1>
10
-
11
- <h2>Credit Card Form</h2>
12
-
13
- <form id="form" action="/charge" method="get">
14
- <div id="cardNumber"></div>
15
- <div id="cardCvv"></div>
16
- <div id="cardExpiration"></div>
17
- <div id="cardHolder"></div>
18
- <div id="cardSubmit"></div>
19
- </form>
20
-
21
- <script src="/dist/globalpayments.js"></script>
22
- <script>
23
- GlobalPayments.configure({
24
- "X-GP-Api-Key": 'oljHkRy0mAK9wqbQuUGZ9AUoe3ZtDrH7',
25
- "X-GP-Environment": "dev"
26
- });
27
-
28
- GlobalPayments.on("error", function (error) {
29
- console.error(error);
30
- });
31
-
32
- var cardForm = GlobalPayments.ui.form({
33
- fields: {
34
- "card-number": {
35
- placeholder: "•••• •••• •••• ••••",
36
- target: "#cardNumber"
37
- },
38
- "card-expiration": {
39
- placeholder: "MM / YYYY",
40
- target: "#cardExpiration"
41
- },
42
- "card-cvv": {
43
- placeholder: "•••",
44
- target: "#cardCvv"
45
- },
46
- "card-holder-name": {
47
- placeholder: "Jane Smith",
48
- target: "#cardHolder"
49
- },
50
- "submit": {
51
- value: "Submit",
52
- target: "#cardSubmit"
53
- }
54
- }
55
- });
56
-
57
- cardForm.on("card-number", "token-success", function (resp) { console.log(resp); });
58
- cardForm.on("card-number", "token-error", function (resp) { console.log(resp); });
59
- </script>
60
- </body>
61
- </html>
@@ -1,80 +0,0 @@
1
- <?php
2
-
3
- function asPaddedAtEndString($inString, $toLength, $padChar) {
4
- $padStr = "";
5
- if(empty($inString)) {
6
- return "";
7
- }
8
- if ($toLength === strlen($inString)) {
9
- return $inString;
10
- }
11
- if ($toLength < strlen($inString)) {
12
- return substr($inString, 0, $toLength);
13
- }
14
- $padStr = str_repeat($padChar, $toLength - strlen($inString));
15
- return $inString . $padStr;
16
- }
17
-
18
- function asPaddedAtFrontString($inString, $toLength, $padChar) {
19
- $padStr = "";
20
- if(empty($inString)) {
21
- return "";
22
- }
23
- if ($toLength === strlen($inString)) {
24
- return $inString;
25
- }
26
- if ($toLength < strlen($inString)) {
27
- return substr($inString, 0, $toLength);
28
- }
29
- $padStr = str_repeat($padChar, $toLength - strlen($inString));
30
- return $padStr . $inString;
31
- }
32
-
33
- function getTransactionKey($merchantId, $userId, $password) {
34
- $curl = require('curl.php');
35
- $url = 'https://stagegw.transnox.com';
36
- $endpoint = '/servlets/TransNox_API_Server';
37
-
38
- $generateKeyRequest = json_encode(['GenerateKey' => [
39
- 'mid' => $merchantId,
40
- 'userID' => $userId,
41
- 'password' => $password,
42
- ]]);
43
-
44
- $generateKeyResponse = json_decode(($curl($url, $endpoint, '', ['User-Agent' => 'infonox'], $generateKeyRequest))[0])->GenerateKeyResponse;
45
-
46
- // error_log('$generateKeyResponse:' . print_r($generateKeyResponse, true));
47
- return $generateKeyResponse->transactionKey;
48
- }
49
-
50
- function encryptManifest($merchantId, $deviceId, $amount, $transactionKey) {
51
- $sEncryptedData = "";
52
- $now = new \DateTime();
53
- $dateFormatString = $now->format('mdY');
54
- $plainText =
55
- asPaddedAtEndString($merchantId, 20 ,' ')
56
- . asPaddedAtEndString($deviceId, 24 ,' ')
57
- // . asPaddedAtFrontString($amount, 12 ,'0')
58
- . '000000000000'
59
- . asPaddedAtEndString($dateFormatString, 8, ' ');
60
- $tempTransactionKey = substr($transactionKey, 0, 16);
61
- $encrypted = openssl_encrypt($plainText, 'aes-128-cbc', $tempTransactionKey, OPENSSL_ZERO_PADDING, $tempTransactionKey);
62
- $sEncryptedData = bin2hex(base64_decode($encrypted));
63
- $hashKey = hash_hmac('md5', $transactionKey, $transactionKey);
64
- return substr($hashKey, 0, 4) . $sEncryptedData . substr($hashKey, -4, 4);
65
- }
66
-
67
- return function () {
68
- $merchantId = '887000003226';
69
- $userId = 'TA5622118';
70
- $password = 'f8mapGqWrE^rVaA9';
71
- $deviceId = '88700000322602';
72
- $amount = '0';
73
-
74
- $transactionKey = getTransactionKey($merchantId, $userId, $password);
75
- error_log('transactionKey: ' . $transactionKey);
76
- $manifest = encryptManifest($merchantId, $deviceId, $amount, $transactionKey);
77
- error_log('manifest: ' . $manifest);
78
-
79
- return $manifest;
80
- };
@@ -1,40 +0,0 @@
1
- <?php
2
-
3
- return function (
4
- $serviceUrl,
5
- $endpoint,
6
- $queryString,
7
- $requestHeaders,
8
- $data = null,
9
- $verb = 'POST',
10
- $contentType = 'application/json',
11
- $timeout = 65000
12
- ) {
13
- $request = curl_init($serviceUrl . $endpoint . $queryString);
14
- $requestHeaders = array_merge($requestHeaders, [
15
- 'Content-Type' => sprintf('%s', $contentType),
16
- 'Content-Length' => $data === null ? 0 : strlen($data),
17
- ]);
18
- $headers = [];
19
- foreach ($requestHeaders as $key => $value) {
20
- $headers[] = $key . ': '. $value;
21
- }
22
- curl_setopt($request, CURLOPT_CONNECTTIMEOUT, $timeout);
23
- curl_setopt($request, CURLOPT_TIMEOUT, $timeout);
24
- curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
25
- curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false); //true,);
26
- curl_setopt($request, CURLOPT_SSL_VERIFYHOST, false); //2,);
27
- curl_setopt($request, CURLOPT_CUSTOMREQUEST, strtoupper($verb));
28
- curl_setopt($request, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
29
- curl_setopt($request, CURLOPT_POSTFIELDS, $data);
30
- curl_setopt($request, CURLOPT_HTTPHEADER, $headers);
31
- curl_setopt($request, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
32
- curl_setopt($request, CURLOPT_VERBOSE, false);
33
- curl_setopt($request, CURLOPT_ENCODING, '');
34
-
35
- $curlResponse = curl_exec($request);
36
- $curlInfo = curl_getinfo($request);
37
- $curlError = curl_errno($request);
38
-
39
- return [$curlResponse, $curlInfo, $curlError];
40
- };
@@ -1,83 +0,0 @@
1
- <!DOCTYPE html>
2
- <?php $deviceId = '88700000322602'; ?>
3
- <?php $createManifest = require('create-manifest.php'); ?>
4
- <html>
5
- <head>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
- <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
8
- <title>TransIT / TSEP Examples</title>
9
- </head>
10
- <body>
11
- <h1>Examples</h1>
12
-
13
- <h2>Credit Card Form</h2>
14
-
15
- <form id="form" action="/charge" method="get">
16
- <div id="cardNumber"></div>
17
- <div id="cardCvv"></div>
18
- <div id="cardExpiration"></div>
19
- <div id="cardHolder"></div>
20
- <div id="cardSubmit"></div>
21
- </form>
22
-
23
- <h2>PaymentRequest API</h2>
24
-
25
- <div>
26
- <button type="button" id="paymentRequestPlainButton" style="display: none">Pay</button>
27
- </div>
28
-
29
- <script src="/dist/globalpayments.js"></script>
30
- <script>
31
- GlobalPayments.configure({
32
- deviceId: '<?= $deviceId ?>',
33
- manifest: '<?= $createManifest() ?>',
34
- env: 'sandbox',
35
- });
36
-
37
- GlobalPayments.on("error", function (error) {
38
- console.error(error);
39
- });
40
-
41
- var cardForm = GlobalPayments.ui.form({
42
- fields: {
43
- "card-number": {
44
- placeholder: "•••• •••• •••• ••••",
45
- target: "#cardNumber"
46
- },
47
- "card-expiration": {
48
- placeholder: "MM / YYYY",
49
- target: "#cardExpiration"
50
- },
51
- "card-cvv": {
52
- placeholder: "•••",
53
- target: "#cardCvv"
54
- },
55
- "submit": {
56
- value: "Submit",
57
- target: "#cardSubmit"
58
- }
59
- }
60
- });
61
-
62
- cardForm.on("card-number", "token-success", function (resp) {
63
- console.log(resp);
64
- cardForm.frames["card-cvv"].getCvv().then(function (c) { console.log("get-cvv", c); });
65
- });
66
- cardForm.on("card-number", "token-error", function (resp) { console.log(resp); });
67
-
68
- var paymentRequestForm = GlobalPayments.paymentRequest.setup("#paymentRequestPlainButton", {
69
- total: {
70
- label: "Total",
71
- amount: { value: 10, currency: "USD" }
72
- }
73
- });
74
-
75
- paymentRequestForm.on("token-success", function (resp) {
76
- console.log(resp);
77
- GlobalPayments.paymentRequest.complete("success");
78
- });
79
- paymentRequestForm.on("token-error", function (resp) { console.log(resp); });
80
- paymentRequestForm.on("error", function (resp) { console.log(resp); });
81
- </script>
82
- </body>
83
- </html>