globalpayments-api 1.4.6 → 1.4.8
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 +16 -0
- package/lib/src/Entities/Enums.d.ts +12 -0
- package/lib/src/Entities/Enums.js +15 -1
- package/lib/src/Gateways/PorticoConnector.d.ts +2 -0
- package/lib/src/Gateways/PorticoConnector.js +29 -0
- package/lib/src/Gateways/XmlGateway.d.ts +1 -0
- package/lib/src/Gateways/XmlGateway.js +8 -0
- package/lib/src/PaymentMethods/Credit.d.ts +6 -0
- package/lib/src/ServicesConfig.d.ts +1 -0
- package/lib/src/ServicesContainer.js +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js +2 -1
- package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js +28 -2
- package/logger.txt +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Latest
|
|
4
|
+
|
|
5
|
+
#### Reporting Enhancements
|
|
6
|
+
|
|
7
|
+
- SdkNameVersion Identifier: Name and Version of the SDK used for integration, where applicable.
|
|
8
|
+
|
|
9
|
+
## v1.4.8 (12/13/22)
|
|
10
|
+
|
|
11
|
+
#### Enhancements
|
|
12
|
+
|
|
13
|
+
- Portico Connector: WalletData element added to process ApplePay/GooglePay Transactions using
|
|
14
|
+
Digital Tokens
|
|
15
|
+
|
|
16
|
+
## v1.4.7 (11/17/22)
|
|
@@ -216,3 +216,15 @@ export declare enum TransactionType {
|
|
|
216
216
|
Hold = 4194304,
|
|
217
217
|
Release = 8388608
|
|
218
218
|
}
|
|
219
|
+
export declare enum MobilePaymentMethodType {
|
|
220
|
+
APPLEPAY = "apple-pay",
|
|
221
|
+
GOOGLEPAY = "pay-with-google"
|
|
222
|
+
}
|
|
223
|
+
export declare enum PaymentDataSourceType {
|
|
224
|
+
APPLEPAY = "ApplePay",
|
|
225
|
+
APPLEPAYAPP = "ApplePayApp",
|
|
226
|
+
APPLEPAYWEB = "ApplePayWeb",
|
|
227
|
+
GOOGLEPAYAPP = "GooglePayApp",
|
|
228
|
+
GOOGLEPAYWEB = "GooglePayWeb",
|
|
229
|
+
DISCOVER3DSECURE = "Discover 3DSecure"
|
|
230
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TransactionType = exports.TransactionModifier = exports.TimeZoneConversion = exports.TaxType = exports.StoredCredentialInitiator = exports.SecCode = exports.ScheduleFrequency = exports.ReportType = exports.RecurringType = exports.RecurringSequence = exports.ReasonCode = exports.PaymentSchedule = exports.PaymentMethodType = exports.InquiryType = exports.HppVersion = exports.GiftEntryMethod = exports.FraudFilterMode = exports.ExceptionCodes = exports.EntryMethod = exports.EmailReceipt = exports.EcommerceChannel = exports.CvnPresenceIndicator = exports.CurrencyType = exports.CheckType = exports.AliasAction = exports.AddressType = exports.AccountType = void 0;
|
|
3
|
+
exports.PaymentDataSourceType = exports.MobilePaymentMethodType = exports.TransactionType = exports.TransactionModifier = exports.TimeZoneConversion = exports.TaxType = exports.StoredCredentialInitiator = exports.SecCode = exports.ScheduleFrequency = exports.ReportType = exports.RecurringType = exports.RecurringSequence = exports.ReasonCode = exports.PaymentSchedule = exports.PaymentMethodType = exports.InquiryType = exports.HppVersion = exports.GiftEntryMethod = exports.FraudFilterMode = exports.ExceptionCodes = exports.EntryMethod = exports.EmailReceipt = exports.EcommerceChannel = exports.CvnPresenceIndicator = exports.CurrencyType = exports.CheckType = exports.AliasAction = exports.AddressType = exports.AccountType = void 0;
|
|
4
4
|
var AccountType;
|
|
5
5
|
(function (AccountType) {
|
|
6
6
|
AccountType["Checking"] = "CHECKING";
|
|
@@ -251,3 +251,17 @@ var TransactionType;
|
|
|
251
251
|
TransactionType[TransactionType["Hold"] = 4194304] = "Hold";
|
|
252
252
|
TransactionType[TransactionType["Release"] = 8388608] = "Release";
|
|
253
253
|
})(TransactionType = exports.TransactionType || (exports.TransactionType = {}));
|
|
254
|
+
var MobilePaymentMethodType;
|
|
255
|
+
(function (MobilePaymentMethodType) {
|
|
256
|
+
MobilePaymentMethodType["APPLEPAY"] = "apple-pay";
|
|
257
|
+
MobilePaymentMethodType["GOOGLEPAY"] = "pay-with-google";
|
|
258
|
+
})(MobilePaymentMethodType = exports.MobilePaymentMethodType || (exports.MobilePaymentMethodType = {}));
|
|
259
|
+
var PaymentDataSourceType;
|
|
260
|
+
(function (PaymentDataSourceType) {
|
|
261
|
+
PaymentDataSourceType["APPLEPAY"] = "ApplePay";
|
|
262
|
+
PaymentDataSourceType["APPLEPAYAPP"] = "ApplePayApp";
|
|
263
|
+
PaymentDataSourceType["APPLEPAYWEB"] = "ApplePayWeb";
|
|
264
|
+
PaymentDataSourceType["GOOGLEPAYAPP"] = "GooglePayApp";
|
|
265
|
+
PaymentDataSourceType["GOOGLEPAYWEB"] = "GooglePayWeb";
|
|
266
|
+
PaymentDataSourceType["DISCOVER3DSECURE"] = "Discover 3DSecure";
|
|
267
|
+
})(PaymentDataSourceType = exports.PaymentDataSourceType || (exports.PaymentDataSourceType = {}));
|
|
@@ -11,6 +11,7 @@ export declare class PorticoConnector extends XmlGateway implements IPaymentGate
|
|
|
11
11
|
secretApiKey: string;
|
|
12
12
|
developerId: string;
|
|
13
13
|
versionNumber: string;
|
|
14
|
+
sdkNameVersion: string;
|
|
14
15
|
supportsHostedPayments: boolean;
|
|
15
16
|
processAuthorization(builder: AuthorizationBuilder): Promise<Transaction>;
|
|
16
17
|
serializeRequest(_builder: AuthorizationBuilder): string;
|
|
@@ -39,4 +40,5 @@ export declare class PorticoConnector extends XmlGateway implements IPaymentGate
|
|
|
39
40
|
protected hydrateTrackData(builder: TransactionBuilder<Transaction>, hasToken: boolean, tokenValue: string): Element;
|
|
40
41
|
protected hydrateTransactionSummary(root: Element): TransactionSummary;
|
|
41
42
|
protected shouldIncludeCredentialOnFile(builder: TransactionBuilder<Transaction>): boolean;
|
|
43
|
+
protected isAppleOrGooglePay(paymentDataSource: string): boolean;
|
|
42
44
|
}
|
|
@@ -17,6 +17,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.PorticoConnector = void 0;
|
|
19
19
|
var elementtree_1 = require("@azz/elementtree");
|
|
20
|
+
// var pjson = require('package.json')
|
|
20
21
|
var __1 = require("../");
|
|
21
22
|
var InputValidation_1 = require("../Utils/InputValidation");
|
|
22
23
|
var XmlGateway_1 = require("./XmlGateway");
|
|
@@ -132,6 +133,21 @@ var PorticoConnector = /** @class */ (function (_super) {
|
|
|
132
133
|
elementtree_1.SubElement(manualEntry, "ReaderPresent").append(elementtree_1.CData(card.readerPresent ? "Y" : "N"));
|
|
133
134
|
elementtree_1.SubElement(manualEntry, "CardPresent").append(elementtree_1.CData(card.cardPresent ? "Y" : "N"));
|
|
134
135
|
block1.append(cardData);
|
|
136
|
+
if (card instanceof __1.CreditCardData) {
|
|
137
|
+
var creditCardData = card;
|
|
138
|
+
// WalletData Element
|
|
139
|
+
if ((creditCardData.mobileType == __1.MobilePaymentMethodType.APPLEPAY
|
|
140
|
+
|| creditCardData.mobileType == __1.MobilePaymentMethodType.GOOGLEPAY)
|
|
141
|
+
&& typeof creditCardData.paymentSource != "undefined"
|
|
142
|
+
&& this.isAppleOrGooglePay(creditCardData.paymentSource)) {
|
|
143
|
+
var walletData = elementtree_1.SubElement(block1, "WalletData");
|
|
144
|
+
elementtree_1.SubElement(walletData, "PaymentSource").append(elementtree_1.CData(creditCardData.paymentSource.trim()));
|
|
145
|
+
if (typeof creditCardData.mobileType != "undefined") {
|
|
146
|
+
elementtree_1.SubElement(walletData, "DigitalPaymentToken").append(elementtree_1.CData(creditCardData.token));
|
|
147
|
+
block1.remove(cardData);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
135
151
|
if (builder.transactionModifier === __1.TransactionModifier.Recurring) {
|
|
136
152
|
var recurring = elementtree_1.SubElement(block1, "RecurringData");
|
|
137
153
|
elementtree_1.SubElement(recurring, "ScheduleID").append(elementtree_1.CData(builder.scheduleId));
|
|
@@ -422,6 +438,12 @@ var PorticoConnector = /** @class */ (function (_super) {
|
|
|
422
438
|
if (clientTransactionId) {
|
|
423
439
|
elementtree_1.SubElement(header, "ClientTxnId").append(elementtree_1.CData(clientTransactionId));
|
|
424
440
|
}
|
|
441
|
+
if (this.sdkNameVersion) {
|
|
442
|
+
elementtree_1.SubElement(header, "SDKNameVersion").append(elementtree_1.CData(this.sdkNameVersion));
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
elementtree_1.SubElement(header, "SDKNameVersion").append(elementtree_1.CData("nodejs-version:" + process.env.npm_package_version));
|
|
446
|
+
}
|
|
425
447
|
// transaction
|
|
426
448
|
elementtree_1.SubElement(version1, "Transaction").append(transaction);
|
|
427
449
|
return new elementtree_1.ElementTree(envelope).write();
|
|
@@ -983,6 +1005,13 @@ var PorticoConnector = /** @class */ (function (_super) {
|
|
|
983
1005
|
}
|
|
984
1006
|
return false;
|
|
985
1007
|
};
|
|
1008
|
+
PorticoConnector.prototype.isAppleOrGooglePay = function (paymentDataSource) {
|
|
1009
|
+
return paymentDataSource == __1.PaymentDataSourceType.APPLEPAY
|
|
1010
|
+
|| paymentDataSource == __1.PaymentDataSourceType.APPLEPAYAPP
|
|
1011
|
+
|| paymentDataSource == __1.PaymentDataSourceType.APPLEPAYWEB
|
|
1012
|
+
|| paymentDataSource == __1.PaymentDataSourceType.GOOGLEPAYAPP
|
|
1013
|
+
|| paymentDataSource == __1.PaymentDataSourceType.GOOGLEPAYWEB;
|
|
1014
|
+
};
|
|
986
1015
|
PorticoConnector.XmlNamespace = "http://Hps.Exchange.PosGateway";
|
|
987
1016
|
return PorticoConnector;
|
|
988
1017
|
}(XmlGateway_1.XmlGateway));
|
|
@@ -17,14 +17,22 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.XmlGateway = void 0;
|
|
19
19
|
var Gateway_1 = require("./Gateway");
|
|
20
|
+
var fs = require("fs");
|
|
20
21
|
var XmlGateway = /** @class */ (function (_super) {
|
|
21
22
|
__extends(XmlGateway, _super);
|
|
22
23
|
function XmlGateway() {
|
|
23
24
|
return _super.call(this, "text/xml") || this;
|
|
24
25
|
}
|
|
25
26
|
XmlGateway.prototype.doTransaction = function (requestData) {
|
|
27
|
+
this.log(requestData);
|
|
26
28
|
return this.sendRequest("POST", "", requestData);
|
|
27
29
|
};
|
|
30
|
+
XmlGateway.prototype.log = function (text) {
|
|
31
|
+
fs.appendFile('logger.txt', text + '\n', function (err) {
|
|
32
|
+
if (err)
|
|
33
|
+
throw err;
|
|
34
|
+
});
|
|
35
|
+
};
|
|
28
36
|
return XmlGateway;
|
|
29
37
|
}(Gateway_1.Gateway));
|
|
30
38
|
exports.XmlGateway = XmlGateway;
|
|
@@ -16,6 +16,12 @@ export declare abstract class Credit extends PaymentMethod implements IEncryptab
|
|
|
16
16
|
* transactions.
|
|
17
17
|
*/
|
|
18
18
|
mobileType: string;
|
|
19
|
+
/**
|
|
20
|
+
* Payment Source is the API or source of the cryptogram for WalletData.
|
|
21
|
+
*/
|
|
22
|
+
paymentSource: string;
|
|
23
|
+
cryptogram: string;
|
|
24
|
+
eci: string;
|
|
19
25
|
/**
|
|
20
26
|
* Authorizes the payment method
|
|
21
27
|
*
|
|
@@ -43,6 +43,7 @@ var ServicesContainer = /** @class */ (function () {
|
|
|
43
43
|
gateway.secretApiKey = config.secretApiKey;
|
|
44
44
|
gateway.developerId = config.developerId;
|
|
45
45
|
gateway.versionNumber = config.versionNumber;
|
|
46
|
+
gateway.sdkNameVersion = config.sdkNameVersion;
|
|
46
47
|
gateway.timeout = config.timeout;
|
|
47
48
|
gateway.serviceUrl =
|
|
48
49
|
config.serviceUrl + "/Hps.Exchange.PosGateway/PosGatewayService.asmx";
|
|
@@ -41,6 +41,7 @@ var src_1 = require("../../../../src/");
|
|
|
41
41
|
var config = new src_1.ServicesConfig();
|
|
42
42
|
config.secretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w";
|
|
43
43
|
config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
|
|
44
|
+
config.sdkNameVersion = "test";
|
|
44
45
|
var card = new src_1.CreditCardData();
|
|
45
46
|
card.number = "4111111111111111";
|
|
46
47
|
card.expMonth = "12";
|
|
@@ -170,7 +171,7 @@ ava_1.default("credit auth with cof", function (t) { return __awaiter(void 0, vo
|
|
|
170
171
|
}
|
|
171
172
|
});
|
|
172
173
|
}); });
|
|
173
|
-
ava_1.default("credit sale", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
|
+
ava_1.default.only("credit sale", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
175
|
var response;
|
|
175
176
|
return __generator(this, function (_a) {
|
|
176
177
|
switch (_a.label) {
|
|
@@ -40,11 +40,12 @@ var ava_1 = require("ava");
|
|
|
40
40
|
var src_1 = require("../../../../src/");
|
|
41
41
|
var Data_1 = require("../../../Data");
|
|
42
42
|
var config = new src_1.ServicesConfig();
|
|
43
|
-
config.secretApiKey = "
|
|
44
|
-
config.serviceUrl = "https://cert.api2
|
|
43
|
+
config.secretApiKey = "skapi_cert_MY5OAAAQrmIF_IZDKbr1ecycRr7n1Q1SxNkVgzDhwg";
|
|
44
|
+
config.serviceUrl = "https://cert.api2.heartlandportico.com";
|
|
45
45
|
var runSerially = false;
|
|
46
46
|
var test = runSerially ? ava_1.default.serial : ava_1.default;
|
|
47
47
|
var card = Data_1.TestCards.visaManual();
|
|
48
|
+
card.tokenize();
|
|
48
49
|
ava_1.default.before(function (_t) {
|
|
49
50
|
src_1.ServicesContainer.configure(config);
|
|
50
51
|
});
|
|
@@ -124,6 +125,8 @@ test("ecom with direct market invoice and ship date", function (t) { return __aw
|
|
|
124
125
|
t.plan(2);
|
|
125
126
|
ecom = new src_1.EcommerceInfo();
|
|
126
127
|
ecom.channel = src_1.EcommerceChannel.Moto;
|
|
128
|
+
ecom.shipDay = "25";
|
|
129
|
+
ecom.shipMonth = "12";
|
|
127
130
|
return [4 /*yield*/, card
|
|
128
131
|
.charge(9)
|
|
129
132
|
.withCurrency("USD")
|
|
@@ -164,3 +167,26 @@ test("ecom with secure ecommerce", function (t) { return __awaiter(void 0, void
|
|
|
164
167
|
}
|
|
165
168
|
});
|
|
166
169
|
}); });
|
|
170
|
+
test("ecom with walletdata", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
171
|
+
var response;
|
|
172
|
+
return __generator(this, function (_a) {
|
|
173
|
+
switch (_a.label) {
|
|
174
|
+
case 0:
|
|
175
|
+
t.plan(2);
|
|
176
|
+
card.mobileType = src_1.MobilePaymentMethodType.GOOGLEPAY;
|
|
177
|
+
card.paymentSource = src_1.PaymentDataSourceType.GOOGLEPAYWEB;
|
|
178
|
+
card.token = "{\"signature\":\"MEYCIQChbD9dizRQSTaboSQmp3GD3TSSKLd8kupbOr0IlL+AVgIhAKAbqM0PPn7WPTXZf7nXJPqq29h0hTQiRfusScTToLg8\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"S3P/E0IEZ32pUM1u737Susaj2kQst7cAXUw1bK7Lp9VM8GEqXTD6uaSCKSggFwhV9XNnOMvt9QYgEY69PHc5EFJBR4n9cB6QGrVjARGbUtANTXgSSJy08FFYwjFQ+/CqkHllY3JpnNjGsY5lny5cimatjkB4laTqIZv05mqc0KIzb4aUSfYQzukx6hfmDRDdrEGOfrKHiSx2EOkBguJ7r69BwcBAq58SL6Wpuvh99d8MJyhGSZLyozpD4gmhEVpyDZX5vdG5k6V0e6O6/Y53RPsnaKOH5nourzCLBMm28YBUY8TcqGY/TzRr7SNBDTXkem339CPlRYrFJNYhPRYJcutcf/Akfcrrj9NMBUMQ+Ab4bzbbcAyR/mneNGoWh/W5HFW7n8aYieZwFO2Of8TMOaUxLqpMyZv2UTguCHfSQdSKHt/fv9JxKPszlF0JuGkZmiv7ONDEaw\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BE0mGDo9yPUYbC7ERwX3JBNmnyRXRvJ9Nwj/N7B5VE+aN3yKe5UcCgUi8eUfJCwapGu0C8Rf2/9y4+rIY+72s0c\\\\u003d\\\",\\\"tag\\\":\\\"SBp7NAyNPgZ7lfyi8lIFGbo8S1sf/6ADqOqD1ZYT6y0\\\\u003d\\\"}\"}";
|
|
179
|
+
return [4 /*yield*/, card
|
|
180
|
+
.charge(10)
|
|
181
|
+
.withCurrency("USD")
|
|
182
|
+
.withInvoiceNumber("1234567890")
|
|
183
|
+
.withAllowDuplicates(true)
|
|
184
|
+
.execute()];
|
|
185
|
+
case 1:
|
|
186
|
+
response = _a.sent();
|
|
187
|
+
t.truthy(response);
|
|
188
|
+
t.is(response.responseCode, "00");
|
|
189
|
+
return [2 /*return*/];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}); });
|
package/logger.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><PosRequest xmlns="http://Hps.Exchange.PosGateway"><Ver1.0><Header><SecretAPIKey><![CDATA[skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w]]></SecretAPIKey><SDKNameVersion><![CDATA[nodejs-version:1.4.7]]></SDKNameVersion></Header><Transaction><CreditSale><Block1><AllowDup><![CDATA[Y]]></AllowDup><AllowPartialAuth><![CDATA[N]]></AllowPartialAuth><Amt><![CDATA[15.00]]></Amt><CardHolderData><CardHolderFirstName><![CDATA[Joe]]></CardHolderFirstName><CardHolderLastName><![CDATA[Smith]]></CardHolderLastName></CardHolderData><CardData><ManualEntry><CardNbr><![CDATA[4111111111111111]]></CardNbr><ExpMonth><![CDATA[12]]></ExpMonth><ExpYear><![CDATA[2025]]></ExpYear><CVV2><![CDATA[123]]></CVV2><ReaderPresent><![CDATA[N]]></ReaderPresent><CardPresent><![CDATA[N]]></CardPresent></ManualEntry><TokenRequest><![CDATA[N]]></TokenRequest></CardData></Block1></CreditSale></Transaction></Ver1.0></PosRequest></soap:Body></soap:Envelope>
|
|
3
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><PosRequest xmlns="http://Hps.Exchange.PosGateway"><Ver1.0><Header><SecretAPIKey><![CDATA[skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w]]></SecretAPIKey><SDKNameVersion><![CDATA[test]]></SDKNameVersion></Header><Transaction><CreditSale><Block1><AllowDup><![CDATA[Y]]></AllowDup><AllowPartialAuth><![CDATA[N]]></AllowPartialAuth><Amt><![CDATA[15.00]]></Amt><CardHolderData><CardHolderFirstName><![CDATA[Joe]]></CardHolderFirstName><CardHolderLastName><![CDATA[Smith]]></CardHolderLastName></CardHolderData><CardData><ManualEntry><CardNbr><![CDATA[4111111111111111]]></CardNbr><ExpMonth><![CDATA[12]]></ExpMonth><ExpYear><![CDATA[2025]]></ExpYear><CVV2><![CDATA[123]]></CVV2><ReaderPresent><![CDATA[N]]></ReaderPresent><CardPresent><![CDATA[N]]></CardPresent></ManualEntry><TokenRequest><![CDATA[N]]></TokenRequest></CardData></Block1></CreditSale></Transaction></Ver1.0></PosRequest></soap:Body></soap:Envelope>
|
package/package.json
CHANGED