globalpayments-api 3.7.0 → 3.8.0
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 +9 -1
- package/lib/src/Builders/BaseBuilder/Validations.js +1 -1
- package/lib/src/Builders/BaseBuilder/Validations.js.map +1 -1
- package/lib/src/Builders/ManagementBuilder.d.ts +17 -1
- package/lib/src/Builders/ManagementBuilder.js +22 -0
- package/lib/src/Builders/ManagementBuilder.js.map +1 -1
- package/lib/src/Builders/RequestBuilder/GpApi/GpApiManagementRequestBuilder.js +19 -0
- package/lib/src/Builders/RequestBuilder/GpApi/GpApiManagementRequestBuilder.js.map +1 -1
- package/lib/src/Builders/RequestBuilder/GpApi/GpApiReportRequestBuilder.d.ts +2 -0
- package/lib/src/Builders/RequestBuilder/GpApi/GpApiReportRequestBuilder.js +86 -0
- package/lib/src/Builders/RequestBuilder/GpApi/GpApiReportRequestBuilder.js.map +1 -1
- package/lib/src/Builders/TransactionReportBuilder.d.ts +5 -2
- package/lib/src/Builders/TransactionReportBuilder.js +19 -0
- package/lib/src/Builders/TransactionReportBuilder.js.map +1 -1
- package/lib/src/Entities/DisputeDocument.d.ts +5 -0
- package/lib/src/Entities/DisputeDocument.js +10 -0
- package/lib/src/Entities/DisputeDocument.js.map +1 -0
- package/lib/src/Entities/Document.d.ts +10 -0
- package/lib/src/Entities/Document.js +13 -0
- package/lib/src/Entities/Document.js.map +1 -0
- package/lib/src/Entities/Enums/DisputeSortProperty.d.ts +12 -0
- package/lib/src/Entities/Enums/DisputeSortProperty.js +17 -0
- package/lib/src/Entities/Enums/DisputeSortProperty.js.map +1 -0
- package/lib/src/Entities/Enums/DisputeStage.d.ts +11 -0
- package/lib/src/Entities/Enums/DisputeStage.js +16 -0
- package/lib/src/Entities/Enums/DisputeStage.js.map +1 -0
- package/lib/src/Entities/Enums/DisputeStatus.d.ts +7 -0
- package/lib/src/Entities/Enums/DisputeStatus.js +12 -0
- package/lib/src/Entities/Enums/DisputeStatus.js.map +1 -0
- package/lib/src/Entities/Enums/DocumentCategory.d.ts +5 -0
- package/lib/src/Entities/Enums/DocumentCategory.js +10 -0
- package/lib/src/Entities/Enums/DocumentCategory.js.map +1 -0
- package/lib/src/Entities/Enums/FileType.d.ts +11 -0
- package/lib/src/Entities/Enums/FileType.js +16 -0
- package/lib/src/Entities/Enums/FileType.js.map +1 -0
- package/lib/src/Entities/Enums.d.ts +7 -0
- package/lib/src/Entities/Enums.js +7 -0
- package/lib/src/Entities/Enums.js.map +1 -1
- package/lib/src/Entities/HostedPaymentData.d.ts +3 -0
- package/lib/src/Entities/HostedPaymentData.js +3 -0
- package/lib/src/Entities/HostedPaymentData.js.map +1 -1
- package/lib/src/Entities/Reporting/DisputeSummary.d.ts +53 -0
- package/lib/src/Entities/Reporting/DisputeSummary.js +64 -0
- package/lib/src/Entities/Reporting/DisputeSummary.js.map +1 -0
- package/lib/src/Entities/Reporting/SearchCriteriaBuilder.d.ts +4 -2
- package/lib/src/Entities/Reporting/SearchCriteriaBuilder.js +2 -0
- package/lib/src/Entities/Reporting/SearchCriteriaBuilder.js.map +1 -1
- package/lib/src/Entities/Reporting/index.d.ts +1 -0
- package/lib/src/Entities/Reporting/index.js +1 -0
- package/lib/src/Entities/Reporting/index.js.map +1 -1
- package/lib/src/Entities/index.d.ts +7 -0
- package/lib/src/Entities/index.js +7 -0
- package/lib/src/Entities/index.js.map +1 -1
- package/lib/src/Gateways/GpApiConnector.js +3 -0
- package/lib/src/Gateways/GpApiConnector.js.map +1 -1
- package/lib/src/Gateways/GpEcomConnector.js +9 -0
- package/lib/src/Gateways/GpEcomConnector.js.map +1 -1
- package/lib/src/Mapping/GpApiMapping.d.ts +2 -1
- package/lib/src/Mapping/GpApiMapping.js +75 -2
- package/lib/src/Mapping/GpApiMapping.js.map +1 -1
- package/lib/src/Services/ReportingService.d.ts +6 -1
- package/lib/src/Services/ReportingService.js +15 -0
- package/lib/src/Services/ReportingService.js.map +1 -1
- package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.js +1026 -0
- package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.js +643 -0
- package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/AccessToken.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/AccessToken.test.js +130 -0
- package/lib/test/Integration/Gateways/GpApiConnector/AccessToken.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresent.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresent.test.js +1070 -0
- package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresent.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/DebitCard.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/DebitCard.test.js +137 -0
- package/lib/test/Integration/Gateways/GpApiConnector/DebitCard.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertification.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertification.test.js +642 -0
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertification.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagement.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagement.test.js +151 -0
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagement.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingDeposits.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingDeposits.test.js +226 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingDeposits.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingDisputes.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingDisputes.test.js +571 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingDisputes.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactions.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactions.test.js +430 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactions.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethods.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethods.test.js +216 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethods.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactions.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactions.test.js +340 -0
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactions.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Auth.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Auth.test.js +2426 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Auth.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Avs.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Avs.test.js +562 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Avs.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Credit.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Credit.test.js +1292 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Credit.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Hold.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Hold.test.js +880 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Hold.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.js +207 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Hpp.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Hpp.test.js +137 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Hpp.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Recurring.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Recurring.test.js +124 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Recurring.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ach.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ach.test.js +54 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ach.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Check.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Check.test.js +357 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Check.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Ecommerce.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Ecommerce.test.js +1667 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Ecommerce.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheck.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheck.test.js +80 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheck.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Moto.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Moto.test.js +1487 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Moto.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheck.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheck.test.js +80 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheck.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Recurring.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Recurring.test.js +393 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Recurring.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Retail.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Retail.test.js +2102 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Retail.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js +367 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Debit.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Debit.test.js +83 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Debit.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ebt.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ebt.test.js +63 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ebt.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.js +136 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Gift.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Gift.test.js +121 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Gift.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementToken.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementToken.test.js +40 -0
- package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementToken.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Recurring.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Recurring.test.js +87 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Recurring.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Reporting.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Reporting.test.js +44 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Reporting.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertification.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertification.test.js +38 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertification.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertification.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertification.test.js +206 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertification.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertification.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertification.test.js +52 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertification.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertification.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertification.test.js +72 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertification.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/GetInformation.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/GetInformation.test.js +37 -0
- package/lib/test/Integration/Gateways/ProPayConnector/GetInformation.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccount.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccount.test.js +310 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccount.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayFunds.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayFunds.test.js +53 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayFunds.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransaction.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransaction.test.js +72 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransaction.test.js.map +1 -0
- package/lib/test/Integration/Gateways/Terminals/UPA/UpaMic.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/Terminals/UPA/UpaMic.test.js +165 -0
- package/lib/test/Integration/Gateways/Terminals/UPA/UpaMic.test.js.map +1 -0
- package/lib/test/Integration/Services/CheckService.test.d.ts +1 -0
- package/lib/test/Integration/Services/CheckService.test.js +38 -0
- package/lib/test/Integration/Services/CheckService.test.js.map +1 -0
- package/lib/test/Integration/Services/CreditService.test.d.ts +1 -0
- package/lib/test/Integration/Services/CreditService.test.js +158 -0
- package/lib/test/Integration/Services/CreditService.test.js.map +1 -0
- package/lib/test/Integration/Services/DebitService.test.d.ts +1 -0
- package/lib/test/Integration/Services/DebitService.test.js +77 -0
- package/lib/test/Integration/Services/DebitService.test.js.map +1 -0
- package/lib/test/Integration/Services/EBTService.test.d.ts +1 -0
- package/lib/test/Integration/Services/EBTService.test.js +54 -0
- package/lib/test/Integration/Services/EBTService.test.js.map +1 -0
- package/lib/test/Unit/Builders/AuthorizationBuilder/Validation.test.d.ts +1 -0
- package/lib/test/Unit/Builders/AuthorizationBuilder/Validation.test.js +122 -0
- package/lib/test/Unit/Builders/AuthorizationBuilder/Validation.test.js.map +1 -0
- package/lib/test/Unit/Builders/ReportBuilder/Validation.test.d.ts +1 -0
- package/lib/test/Unit/Builders/ReportBuilder/Validation.test.js +66 -0
- package/lib/test/Unit/Builders/ReportBuilder/Validation.test.js.map +1 -0
- package/lib/test/Unit/Gateways/GpEcomConnector/Credit.test.d.ts +1 -0
- package/lib/test/Unit/Gateways/GpEcomConnector/Credit.test.js +32 -0
- package/lib/test/Unit/Gateways/GpEcomConnector/Credit.test.js.map +1 -0
- package/lib/test/Unit/Gateways/PorticoConnector/InputValidation.test.d.ts +1 -0
- package/lib/test/Unit/Gateways/PorticoConnector/InputValidation.test.js +128 -0
- package/lib/test/Unit/Gateways/PorticoConnector/InputValidation.test.js.map +1 -0
- package/package.json +7 -17
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const src_1 = require("../../../../src");
|
|
4
|
+
const InputValidation_1 = require("../../../../src/Utils/InputValidation");
|
|
5
|
+
const config = new src_1.PorticoConfig();
|
|
6
|
+
config.secretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w";
|
|
7
|
+
const card = new src_1.CreditCardData();
|
|
8
|
+
card.number = "4111111111111111";
|
|
9
|
+
card.expMonth = "12";
|
|
10
|
+
card.expYear = "2025";
|
|
11
|
+
card.cvn = "123";
|
|
12
|
+
card.cardHolderName = "Joe Smith";
|
|
13
|
+
beforeAll(() => {
|
|
14
|
+
src_1.ServicesContainer.configureService(config);
|
|
15
|
+
});
|
|
16
|
+
test("correctable postal code - hyphen", async () => {
|
|
17
|
+
const address = new src_1.Address();
|
|
18
|
+
address.postalCode = "12345-6789";
|
|
19
|
+
const response = await card
|
|
20
|
+
.charge(10)
|
|
21
|
+
.withCurrency("USD")
|
|
22
|
+
.withAddress(address)
|
|
23
|
+
.withAllowDuplicates(true)
|
|
24
|
+
.execute();
|
|
25
|
+
expect(response).toBeTruthy();
|
|
26
|
+
expect(response.responseCode).toBe("00");
|
|
27
|
+
});
|
|
28
|
+
test("correctable postal code - space", async () => {
|
|
29
|
+
const address = new src_1.Address();
|
|
30
|
+
address.postalCode = "12345 6789";
|
|
31
|
+
const response = await card
|
|
32
|
+
.charge(10)
|
|
33
|
+
.withCurrency("USD")
|
|
34
|
+
.withAddress(address)
|
|
35
|
+
.withAllowDuplicates(true)
|
|
36
|
+
.execute();
|
|
37
|
+
expect(response).toBeTruthy();
|
|
38
|
+
expect(response.responseCode).toBe("00");
|
|
39
|
+
});
|
|
40
|
+
test("invalid postal code - length", async () => {
|
|
41
|
+
const address = new src_1.Address();
|
|
42
|
+
address.postalCode = "1234567890";
|
|
43
|
+
try {
|
|
44
|
+
await card
|
|
45
|
+
.charge(10)
|
|
46
|
+
.withCurrency("USD")
|
|
47
|
+
.withAddress(address)
|
|
48
|
+
.withAllowDuplicates(true)
|
|
49
|
+
.execute();
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
expect(error).toBeInstanceOf(Error);
|
|
53
|
+
expect(error?.message).toBe("Zip/postal code length greater than the configured gateway's maximum length");
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
test("invalid city - length", async () => {
|
|
57
|
+
const address = new src_1.Address();
|
|
58
|
+
address.city = "abcdefghijklmnopqrstuvwxyz";
|
|
59
|
+
try {
|
|
60
|
+
await card
|
|
61
|
+
.charge(10)
|
|
62
|
+
.withCurrency("USD")
|
|
63
|
+
.withAddress(address)
|
|
64
|
+
.withAllowDuplicates(true)
|
|
65
|
+
.execute();
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
expect(error).toBeInstanceOf(Error);
|
|
69
|
+
expect(error?.message).toBe("City length greater than the configured gateway's maximum length");
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
test("invalid state - length", async () => {
|
|
73
|
+
const address = new src_1.Address();
|
|
74
|
+
address.state = "abcdefghijklmnopqrstuvwxyz";
|
|
75
|
+
try {
|
|
76
|
+
await card
|
|
77
|
+
.charge(10)
|
|
78
|
+
.withCurrency("USD")
|
|
79
|
+
.withAddress(address)
|
|
80
|
+
.withAllowDuplicates(true)
|
|
81
|
+
.execute();
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
expect(error).toBeInstanceOf(Error);
|
|
85
|
+
expect(error?.message).toBe("State/province length greater than the configured gateway's maximum length");
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
test("invalid first name - length", async () => {
|
|
89
|
+
const c = new src_1.CreditCardData();
|
|
90
|
+
c.number = card.number;
|
|
91
|
+
c.expMonth = card.expMonth;
|
|
92
|
+
c.expYear = card.expYear;
|
|
93
|
+
c.cvn = card.cvn;
|
|
94
|
+
c.cardHolderName = "abcdefghijklmnopqrstuvwxyza smith";
|
|
95
|
+
try {
|
|
96
|
+
await c.charge(10).withCurrency("USD").withAllowDuplicates(true).execute();
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
expect(error).toBeInstanceOf(Error);
|
|
100
|
+
expect(error?.message).toBe("First name length greater than the configured gateway's maximum length");
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
test("invalid last name - length", async () => {
|
|
104
|
+
const c = new src_1.CreditCardData();
|
|
105
|
+
c.number = card.number;
|
|
106
|
+
c.expMonth = card.expMonth;
|
|
107
|
+
c.expYear = card.expYear;
|
|
108
|
+
c.cvn = card.cvn;
|
|
109
|
+
c.cardHolderName = "john abcdefghijklmnopqrstuvwxyza";
|
|
110
|
+
try {
|
|
111
|
+
await c.charge(10).withCurrency("USD").withAllowDuplicates(true).execute();
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
expect(error).toBeInstanceOf(Error);
|
|
115
|
+
expect(error?.message).toBe("Last name length greater than the configured gateway's maximum length");
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
test("floating point math", async () => {
|
|
119
|
+
expect((0, InputValidation_1.validateAmount)("portico", 15.01)).toBe("15.01");
|
|
120
|
+
expect((0, InputValidation_1.validateAmount)("portico", 15.0100000000001)).toBe("15.01");
|
|
121
|
+
expect((0, InputValidation_1.validateAmount)("portico", "15.01")).toBe("15.01");
|
|
122
|
+
expect((0, InputValidation_1.validateAmount)("portico", "15.0100000000001")).toBe("15.01");
|
|
123
|
+
expect((0, InputValidation_1.validateAmount)("portico", 76.68)).toBe("76.68");
|
|
124
|
+
expect((0, InputValidation_1.validateAmount)("portico", 76.6800000000001)).toBe("76.68");
|
|
125
|
+
expect((0, InputValidation_1.validateAmount)("portico", "76.68")).toBe("76.68");
|
|
126
|
+
expect((0, InputValidation_1.validateAmount)("portico", "76.6800000000001")).toBe("76.68");
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=InputValidation.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputValidation.test.js","sourceRoot":"","sources":["../../../../../test/Unit/Gateways/PorticoConnector/InputValidation.test.ts"],"names":[],"mappings":";;AAAA,yCAKyB;AACzB,2EAAuE;AAEvE,MAAM,MAAM,GAAG,IAAI,mBAAa,EAAE,CAAC;AACnC,MAAM,CAAC,YAAY,GAAG,uDAAuD,CAAC;AAE9E,MAAM,IAAI,GAAG,IAAI,oBAAc,EAAE,CAAC;AAClC,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC;AACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;AACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;AACtB,IAAI,CAAC,GAA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AAM,CAAC,IAAA,gCAAc,EAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACtE,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "globalpayments-api",
|
|
3
|
-
"version" : "3.
|
|
3
|
+
"version" : "3.8.0",
|
|
4
4
|
"description": "Global Payments SDK for NodeJS for Heartland and Global Payments eCommerce gateways",
|
|
5
5
|
"author": "Heartland Payment Systems",
|
|
6
6
|
"license": "GPL-2.0",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"typings": "./lib/src/index",
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc",
|
|
18
|
+
"test:jest": "jest",
|
|
19
|
+
"test:serial": "jest --runInBand put/path/to-your file here",
|
|
18
20
|
"build:netsuite": "webpack --env.GP_NETSUITE_BUILD --config config/webpack.netsuite.js && node bin/netsuite-post.js",
|
|
19
21
|
"build:clean": "rimraf lib",
|
|
20
22
|
"docs": "typedoc --mode file --name \"GlobalPayments.Api\" --project tsconfig.json --out docs src",
|
|
@@ -23,8 +25,6 @@
|
|
|
23
25
|
"prepublish": "npm-run-all build",
|
|
24
26
|
"prepublishOnly": "npm-run-all build",
|
|
25
27
|
"pretest": "npm-run-all build:clean test:lint build",
|
|
26
|
-
"test:without-report": "npm-run-all build:clean test:lint build && ava",
|
|
27
|
-
"test": "ava --tap | npx tap-nyan",
|
|
28
28
|
"test:lint": "eslint \"src/**/*.ts*\" \"test/**/*.ts\" --fix"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
@@ -37,35 +37,25 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@hitc/netsuite-types": "^2017.2.32",
|
|
40
|
+
"@types/jest": "^29.5.12",
|
|
40
41
|
"@types/node": "20.6.0",
|
|
41
42
|
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
|
42
43
|
"@typescript-eslint/parser": "^6.7.3",
|
|
43
|
-
"ava": "^5.3.1",
|
|
44
44
|
"eslint": "^8.50.0",
|
|
45
45
|
"eslint-plugin-prettier": "^5.0.0",
|
|
46
|
+
"jest": "^29.7.0",
|
|
46
47
|
"npm-run-all": "^4.1.5",
|
|
47
48
|
"prettier": "3.0.3",
|
|
48
49
|
"rimraf": "^2.6.3",
|
|
50
|
+
"ts-jest": "^29.1.5",
|
|
49
51
|
"tslint": "^6.1.3",
|
|
50
52
|
"typedoc": "0.25.1",
|
|
51
53
|
"typescript": "5.2.2",
|
|
52
54
|
"webpack": "^5.88.2"
|
|
53
55
|
},
|
|
54
|
-
"ava": {
|
|
55
|
-
"concurrency": 1,
|
|
56
|
-
"timeout": "5m",
|
|
57
|
-
"failFast": false,
|
|
58
|
-
"failWithoutAssertions": false,
|
|
59
|
-
"files": [
|
|
60
|
-
"lib/test/**/*Test.js"
|
|
61
|
-
],
|
|
62
|
-
"source": [
|
|
63
|
-
"lib/src/**/*.js"
|
|
64
|
-
]
|
|
65
|
-
},
|
|
66
56
|
"files": [
|
|
67
57
|
"lib/src/**",
|
|
68
|
-
"lib/test/**",
|
|
58
|
+
"lib/test/**",
|
|
69
59
|
"appsec.properties",
|
|
70
60
|
"CHANGELOG.md"
|
|
71
61
|
]
|