@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.
- package/.prettierrc +4 -4
- package/LICENSE.md +264 -264
- package/README.md +733 -700
- package/TODO +5 -5
- package/bin/replace-gp-ref.js +17 -17
- package/bin/update-version.js +19 -18
- package/config/rollup.js +67 -67
- package/cypress.json +11 -11
- package/package.json +51 -36
- package/types/credit-card/index.d.ts +16 -0
- package/types/echeck/index.d.ts +8 -0
- package/types/gift-and-loyalty/index.d.ts +8 -0
- package/types/global-type.d.ts +7 -7
- package/types/internal/gateways/index.d.ts +2 -0
- package/types/internal/lib/card.d.ts +1 -1
- package/types/internal/lib/dot-placeholders.d.ts +2 -0
- package/types/internal/lib/events.d.ts +3 -0
- package/types/internal/lib/styles/gp-default.d.ts +9 -0
- package/types/lib/version.d.ts +1 -1
- package/types/payment-request/complete.d.ts +6 -0
- package/types/payment-request/setup.d.ts +18 -0
- package/types/tools/configure.d.ts +16 -5
- package/types/ui/form/index.d.ts +57 -1
- package/types/ui/iframe-field/action-accumulate-data-and-tokenize.d.ts +6 -0
- package/types/ui/iframe-field/action-card-track-button-click.d.ts +6 -0
- package/types/ui/iframe-field/action-get-cvv.d.ts +7 -0
- package/types/ui/iframe-field/action-payment-request-complete.d.ts +10 -0
- package/types/ui/iframe-field/action-payment-request-start.d.ts +11 -0
- package/types/ui/iframe-field/action-request-data.d.ts +9 -0
- package/types/ui/iframe-field/action-set-card-type.d.ts +9 -0
- package/types/ui/iframe-field/action-set-focus.d.ts +3 -0
- package/types/ui/iframe-field/action-set-label.d.ts +5 -0
- package/types/ui/iframe-field/action-set-placeholder.d.ts +5 -0
- package/types/ui/iframe-field/action-set-text.d.ts +5 -0
- package/types/ui/iframe-field/action-set-type-cvv.d.ts +10 -0
- package/types/ui/iframe-field/action-set-value.d.ts +5 -0
- package/types/ui/iframe-field/index.d.ts +79 -2
- package/types/ui/index.d.ts +7 -0
- package/dist/field.html +0 -45
- package/dist/globalpayments.js +0 -5811
- package/dist/globalpayments.js.map +0 -1
- package/dist/globalpayments.min.js +0 -2
- package/dist/globalpayments.min.js.map +0 -1
- package/dist/images/amex.svg +0 -1
- package/dist/images/cvv-amex.png +0 -0
- package/dist/images/cvv.png +0 -0
- package/dist/images/discover.svg +0 -1
- package/dist/images/gp-cc-amex.svg +0 -6
- package/dist/images/gp-cc-dinnersclub.svg +0 -33
- package/dist/images/gp-cc-discover.svg +0 -14
- package/dist/images/gp-cc-generic.svg +0 -4
- package/dist/images/gp-cc-jcb.svg +0 -12
- package/dist/images/gp-cc-maestro.svg +0 -14
- package/dist/images/gp-cc-mastercard.svg +0 -11
- package/dist/images/gp-cc-visa.svg +0 -6
- package/dist/images/gp-fa-question-circle.svg +0 -3
- package/dist/images/gp-lock.svg +0 -7
- package/dist/images/gp-secure-logo.svg +0 -8
- package/dist/images/gp-secure-ssl-logo.svg +0 -8
- package/dist/images/jcb.svg +0 -1
- package/dist/images/logo-amex@2x.png +0 -0
- package/dist/images/logo-discover@2x.png +0 -0
- package/dist/images/logo-jcb@2x.png +0 -0
- package/dist/images/logo-mastercard@2x.png +0 -0
- package/dist/images/logo-unknown@2x.png +0 -0
- package/dist/images/logo-visa@2x.png +0 -0
- package/dist/images/mastercard.svg +0 -1
- package/dist/images/shield-and-logos@2x.png +0 -0
- package/dist/images/visa.svg +0 -1
- package/examples/accessibility.html +0 -100
- package/examples/billpay.html +0 -181
- package/examples/genius.html +0 -80
- package/examples/globalpayments/hash.php +0 -19
- package/examples/globalpayments.html +0 -94
- package/examples/gp-api.php +0 -60
- package/examples/heartland.html +0 -247
- package/examples/index.html +0 -22
- package/examples/openedge.html +0 -61
- package/examples/transit/create-manifest.php +0 -80
- package/examples/transit/curl.php +0 -40
- package/examples/transit/index.php +0 -83
package/examples/index.html
DELETED
|
@@ -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>
|
package/examples/openedge.html
DELETED
|
@@ -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>
|