globalpayments-api 3.7.0 → 3.8.1
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 +17 -1
- package/LICENSE.md +257 -257
- package/README.md +141 -141
- 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 +26 -6
- package/lib/src/Builders/ManagementBuilder.js +66 -34
- 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/AdditionalTaxDetails.d.ts +5 -0
- package/lib/src/Entities/AdditionalTaxDetails.js +10 -0
- package/lib/src/Entities/AdditionalTaxDetails.js.map +1 -0
- package/lib/src/Entities/CommercialData.d.ts +26 -0
- package/lib/src/Entities/CommercialData.js +36 -0
- package/lib/src/Entities/CommercialData.js.map +1 -0
- package/lib/src/Entities/CommercialLineItem.d.ts +21 -0
- package/lib/src/Entities/CommercialLineItem.js +24 -0
- package/lib/src/Entities/CommercialLineItem.js.map +1 -0
- package/lib/src/Entities/DiscountDetails.d.ts +8 -0
- package/lib/src/Entities/DiscountDetails.js +13 -0
- package/lib/src/Entities/DiscountDetails.js.map +1 -0
- 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 +17 -1
- package/lib/src/Entities/Enums.js +20 -2
- 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/Transaction.js +3 -0
- package/lib/src/Entities/Transaction.js.map +1 -1
- package/lib/src/Entities/TransactionSummary.d.ts +1 -0
- package/lib/src/Entities/TransactionSummary.js +1 -0
- package/lib/src/Entities/TransactionSummary.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/Gateways/PayPlanConnector.d.ts +1 -1
- package/lib/src/Gateways/PorticoConnector.d.ts +3 -3
- package/lib/src/Gateways/PorticoConnector.js +117 -4
- package/lib/src/Gateways/PorticoConnector.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/{3DS2Test.js → 3DS2.test.js} +338 -341
- package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/{3DSecureTest.js → 3DSecure.test.js} +167 -173
- package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.js.map +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.js +1070 -0
- package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresent.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/{DebitCardTest.js → DebitCard.test.js} +27 -33
- package/lib/test/Integration/Gateways/GpApiConnector/DebitCard.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/{GpApiCertificationTest.js → GpApiCertification.test.js} +211 -208
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertification.test.js.map +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/{ReportingDepositsTest.js → ReportingDeposits.test.js} +103 -103
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingDeposits.test.js.map +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/{ReportingSettlementTransactionsTest.js → ReportingSettlementTransactions.test.js} +104 -108
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactions.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/{ReportingStoredPaymentMethodsTest.js → ReportingStoredPaymentMethods.test.js} +75 -76
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethods.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/{ReportingTransactionsTest.js → ReportingTransactions.test.js} +97 -95
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactions.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/{AuthTest.js → Auth.test.js} +441 -461
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Auth.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/{AvsTest.js → Avs.test.js} +274 -218
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Avs.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/{CreditTest.js → Credit.test.js} +317 -321
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Credit.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/{HoldTest.js → Hold.test.js} +290 -257
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Hold.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/{CreditTest.js → Credit.test.js} +76 -84
- package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.js.map +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.js +124 -0
- package/lib/test/Integration/Gateways/GpEcomConnector/Recurring.test.js.map +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.js +357 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Check.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{EcommerceTest.js → Ecommerce.test.js} +403 -459
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Ecommerce.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{EcommerceCheckTest.js → EcommerceCheck.test.js} +17 -23
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheck.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{MotoTest.js → Moto.test.js} +377 -650
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Moto.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{MotoCheckTest.js → MotoCheck.test.js} +16 -22
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheck.test.js.map +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/{RetailTest.js → Retail.test.js} +481 -600
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Retail.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js +433 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/{DebitTest.js → Debit.test.js} +32 -37
- package/lib/test/Integration/Gateways/PorticoConnector/Debit.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/{EbtTest.js → Ebt.test.js} +30 -39
- package/lib/test/Integration/Gateways/PorticoConnector/Ebt.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/{EcommerceTest.js → Ecommerce.test.js} +38 -45
- package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.js.map +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/{PorticoManagementTokenTest.js → PorticoManagementToken.test.js} +8 -16
- package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementToken.test.js.map +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/{ReportingTest.js → Reporting.test.js} +12 -18
- package/lib/test/Integration/Gateways/PorticoConnector/Reporting.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/{GetInformationCertificationTest.js → GetInformationCertification.test.js} +12 -18
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertification.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/{ProPayAccountCertificationTest.js → ProPayAccountCertification.test.js} +49 -64
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertification.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/{ProPayFundCertificationTest.js → ProPayFundCertification.test.js} +14 -22
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertification.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/{ProPayInNetworkTransactionCertificationTest.js → ProPayInNetworkTransactionCertification.test.js} +18 -26
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertification.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/{GetInformationTest.js → GetInformation.test.js} +11 -18
- package/lib/test/Integration/Gateways/ProPayConnector/GetInformation.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/{ProPayAccountTest.js → ProPayAccount.test.js} +63 -83
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccount.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/{ProPayFundsTest.js → ProPayFunds.test.js} +15 -22
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayFunds.test.js.map +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/{ProPayInNetworkTransactionTest.js → ProPayInNetworkTransaction.test.js} +17 -25
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransaction.test.js.map +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/{CheckServiceTest.js → CheckService.test.js} +11 -18
- package/lib/test/Integration/Services/CheckService.test.js.map +1 -0
- package/lib/test/Integration/Services/{CreditServiceTest.js → CreditService.test.js} +48 -64
- package/lib/test/Integration/Services/CreditService.test.js.map +1 -0
- package/lib/test/Integration/Services/{DebitServiceTest.js → DebitService.test.js} +28 -32
- package/lib/test/Integration/Services/DebitService.test.js.map +1 -0
- package/lib/test/Integration/Services/{EBTServiceTest.js → EBTService.test.js} +16 -26
- package/lib/test/Integration/Services/EBTService.test.js.map +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.js +66 -0
- package/lib/test/Unit/Builders/ReportBuilder/Validation.test.js.map +1 -0
- package/lib/test/Unit/Gateways/GpEcomConnector/{CreditTest.js → Credit.test.js} +13 -15
- package/lib/test/Unit/Gateways/GpEcomConnector/Credit.test.js.map +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
- package/lib/test/Integration/Gateways/GpApiConnector/3DS2Test.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/3DSecureTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/AccessTokenTest.js +0 -109
- package/lib/test/Integration/Gateways/GpApiConnector/AccessTokenTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.js +0 -1025
- package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.js +0 -439
- package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.js +0 -149
- package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AuthTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AvsTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/CreditTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpEcomConnector/Certification/HoldTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpEcomConnector/CreditTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpEcomConnector/HppTest.js +0 -99
- package/lib/test/Integration/Gateways/GpEcomConnector/HppTest.js.map +0 -1
- package/lib/test/Integration/Gateways/GpEcomConnector/RecurringTest.js +0 -133
- package/lib/test/Integration/Gateways/GpEcomConnector/RecurringTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js +0 -59
- package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js +0 -378
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js +0 -420
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js +0 -392
- package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js +0 -147
- package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js +0 -101
- package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js.map +0 -1
- package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js.map +0 -1
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.js.map +0 -1
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.js.map +0 -1
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.js.map +0 -1
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.js.map +0 -1
- package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.js.map +0 -1
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.js.map +0 -1
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.js.map +0 -1
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.js.map +0 -1
- package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.js +0 -149
- package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.js.map +0 -1
- package/lib/test/Integration/Services/CheckServiceTest.js.map +0 -1
- package/lib/test/Integration/Services/CreditServiceTest.js.map +0 -1
- package/lib/test/Integration/Services/DebitServiceTest.js.map +0 -1
- package/lib/test/Integration/Services/EBTServiceTest.js.map +0 -1
- package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js +0 -111
- package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js.map +0 -1
- package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js +0 -62
- package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js.map +0 -1
- package/lib/test/Unit/Gateways/GpEcomConnector/CreditTest.js.map +0 -1
- package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js +0 -125
- package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js.map +0 -1
- /package/lib/test/Integration/Gateways/GpApiConnector/{3DS2Test.d.ts → 3DS2.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{3DSecureTest.d.ts → 3DSecure.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{AccessTokenTest.d.ts → AccessToken.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{CreditCardNotPresentTest.d.ts → CreditCardNotPresent.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{CreditCardPresentTest.d.ts → DebitCard.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{DebitCardTest.d.ts → GpApiCertification.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{GpApiCertificationTest.d.ts → GpApiTokenManagement.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{GpApiTokenManagementTest.d.ts → ReportingDeposits.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{ReportingDepositsTest.d.ts → ReportingDisputes.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{ReportingSettlementTransactionsTest.d.ts → ReportingSettlementTransactions.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{ReportingStoredPaymentMethodsTest.d.ts → ReportingStoredPaymentMethods.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpApiConnector/{ReportingTransactionsTest.d.ts → ReportingTransactions.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpEcomConnector/Certification/{AuthTest.d.ts → Auth.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpEcomConnector/Certification/{AvsTest.d.ts → Avs.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpEcomConnector/Certification/{CreditTest.d.ts → Credit.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpEcomConnector/Certification/{HoldTest.d.ts → Hold.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpEcomConnector/{CreditTest.d.ts → Credit.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpEcomConnector/{HppTest.d.ts → Hpp.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/GpEcomConnector/{RecurringTest.d.ts → Recurring.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/{AchTest.d.ts → Ach.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{CheckTest.d.ts → Check.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{EcommerceCheckTest.d.ts → Ecommerce.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{EcommerceTest.d.ts → EcommerceCheck.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{MotoCheckTest.d.ts → Moto.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{MotoTest.d.ts → MotoCheck.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{RecurringTest.d.ts → Recurring.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/Certifications/{RetailTest.d.ts → Retail.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/{CreditTest.d.ts → Credit.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/{DebitTest.d.ts → Debit.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/{EbtTest.d.ts → Ebt.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/{EcommerceTest.d.ts → Ecommerce.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/{GiftTest.d.ts → Gift.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/{PorticoManagementTokenTest.d.ts → PorticoManagementToken.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/{RecurringTest.d.ts → Recurring.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/PorticoConnector/{ReportingTest.d.ts → Reporting.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/ProPayConnector/Certifications/{GetInformationCertificationTest.d.ts → GetInformationCertification.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/ProPayConnector/Certifications/{ProPayAccountCertificationTest.d.ts → ProPayAccountCertification.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/ProPayConnector/Certifications/{ProPayFundCertificationTest.d.ts → ProPayFundCertification.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/ProPayConnector/Certifications/{ProPayInNetworkTransactionCertificationTest.d.ts → ProPayInNetworkTransactionCertification.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/ProPayConnector/{GetInformationTest.d.ts → GetInformation.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/ProPayConnector/{ProPayAccountTest.d.ts → ProPayAccount.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/ProPayConnector/{ProPayFundsTest.d.ts → ProPayFunds.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/ProPayConnector/{ProPayInNetworkTransactionTest.d.ts → ProPayInNetworkTransaction.test.d.ts} +0 -0
- /package/lib/test/Integration/Gateways/Terminals/UPA/{UpaMicTest.d.ts → UpaMic.test.d.ts} +0 -0
- /package/lib/test/Integration/Services/{CheckServiceTest.d.ts → CheckService.test.d.ts} +0 -0
- /package/lib/test/Integration/Services/{CreditServiceTest.d.ts → CreditService.test.d.ts} +0 -0
- /package/lib/test/Integration/Services/{DebitServiceTest.d.ts → DebitService.test.d.ts} +0 -0
- /package/lib/test/Integration/Services/{EBTServiceTest.d.ts → EBTService.test.d.ts} +0 -0
- /package/lib/test/Unit/Builders/AuthorizationBuilder/{ValidationTest.d.ts → Validation.test.d.ts} +0 -0
- /package/lib/test/Unit/Builders/ReportBuilder/{ValidationTest.d.ts → Validation.test.d.ts} +0 -0
- /package/lib/test/Unit/Gateways/GpEcomConnector/{CreditTest.d.ts → Credit.test.d.ts} +0 -0
- /package/lib/test/Unit/Gateways/PorticoConnector/{InputValidationTest.d.ts → InputValidation.test.d.ts} +0 -0
|
@@ -0,0 +1,1070 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const src_1 = require("../../../../src");
|
|
4
|
+
const BaseGpApiTestConfig_1 = require("../../../Data/BaseGpApiTestConfig");
|
|
5
|
+
const DTO_1 = require("../../../../src/Entities/GpApi/DTO");
|
|
6
|
+
const date = new Date();
|
|
7
|
+
const currency = "USD";
|
|
8
|
+
const card = new src_1.CreditCardData();
|
|
9
|
+
card.number = "4263970000005262";
|
|
10
|
+
card.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
11
|
+
card.expYear = (date.getFullYear() + 1).toString();
|
|
12
|
+
card.cvn = "131";
|
|
13
|
+
card.cardHolderName = "James Mason";
|
|
14
|
+
beforeAll(() => {
|
|
15
|
+
src_1.ServicesContainer.configureService(BaseGpApiTestConfig_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent));
|
|
16
|
+
});
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
src_1.ServicesContainer.configureService(BaseGpApiTestConfig_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent));
|
|
19
|
+
});
|
|
20
|
+
test("credit sale", async () => {
|
|
21
|
+
const address = new src_1.Address();
|
|
22
|
+
address.streetAddress1 = "123 Main St.";
|
|
23
|
+
address.city = "Dallas";
|
|
24
|
+
address.state = "TX";
|
|
25
|
+
address.postalCode = "98765";
|
|
26
|
+
address.country = "USA";
|
|
27
|
+
const response = await card
|
|
28
|
+
.charge(69)
|
|
29
|
+
.withCurrency(currency)
|
|
30
|
+
.withAddress(address)
|
|
31
|
+
.execute();
|
|
32
|
+
expect(response).toBeTruthy();
|
|
33
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
34
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
35
|
+
expect(response.payerDetails).toBeFalsy();
|
|
36
|
+
});
|
|
37
|
+
test("credit sale with fingerprint", async () => {
|
|
38
|
+
const address = new src_1.Address();
|
|
39
|
+
address.streetAddress1 = "123 Main St.";
|
|
40
|
+
address.city = "Dallas";
|
|
41
|
+
address.state = "TX";
|
|
42
|
+
address.postalCode = "98765";
|
|
43
|
+
address.country = "USA";
|
|
44
|
+
const customer = new src_1.Customer();
|
|
45
|
+
customer.deviceFingerPrint = "ALWAYS";
|
|
46
|
+
const response = await card
|
|
47
|
+
.charge(69)
|
|
48
|
+
.withCurrency(currency)
|
|
49
|
+
.withAddress(address)
|
|
50
|
+
.withCustomerData(customer)
|
|
51
|
+
.execute();
|
|
52
|
+
expect(response).toBeTruthy();
|
|
53
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
54
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
55
|
+
expect(response.fingerprint).toBeTruthy();
|
|
56
|
+
expect(response.fingerprintIndicator).toBeTruthy();
|
|
57
|
+
});
|
|
58
|
+
test("credit sale with fingerprint success", async () => {
|
|
59
|
+
const customer = new src_1.Customer();
|
|
60
|
+
customer.deviceFingerPrint = "ON_SUCCESS";
|
|
61
|
+
const response = await card
|
|
62
|
+
.charge(69)
|
|
63
|
+
.withCurrency(currency)
|
|
64
|
+
.withCustomerData(customer)
|
|
65
|
+
.execute();
|
|
66
|
+
expect(response).toBeTruthy();
|
|
67
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
68
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
69
|
+
expect(response.fingerprint).toBeTruthy();
|
|
70
|
+
expect(response.fingerprintIndicator).toBeTruthy();
|
|
71
|
+
});
|
|
72
|
+
test("credit authorization", async () => {
|
|
73
|
+
const response = await card
|
|
74
|
+
.authorize(42)
|
|
75
|
+
.withCurrency(currency)
|
|
76
|
+
.withAllowDuplicates(true)
|
|
77
|
+
.execute();
|
|
78
|
+
expect(response).toBeTruthy();
|
|
79
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
80
|
+
expect(src_1.TransactionStatus.PREAUTHORIZED).toBe(response.responseMessage);
|
|
81
|
+
expect(response.payerDetails).toBeFalsy();
|
|
82
|
+
});
|
|
83
|
+
test("credit authorization then capture", async () => {
|
|
84
|
+
const transaction = await card
|
|
85
|
+
.authorize(42)
|
|
86
|
+
.withCurrency(currency)
|
|
87
|
+
.withOrderId("123456-78910")
|
|
88
|
+
.withAllowDuplicates(true)
|
|
89
|
+
.execute();
|
|
90
|
+
expect(transaction).toBeTruthy();
|
|
91
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
92
|
+
expect(src_1.TransactionStatus.PREAUTHORIZED).toBe(transaction.responseMessage);
|
|
93
|
+
const capture = await transaction.capture(30).withGratuity(12).execute();
|
|
94
|
+
expect(capture).toBeTruthy();
|
|
95
|
+
expect("SUCCESS").toBe(capture.responseCode);
|
|
96
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(capture.responseMessage);
|
|
97
|
+
});
|
|
98
|
+
test("credit authorization then capture with fingerprint", async () => {
|
|
99
|
+
const customer = new src_1.Customer();
|
|
100
|
+
customer.deviceFingerPrint = "ON_SUCCESS";
|
|
101
|
+
const transaction = await card
|
|
102
|
+
.authorize(42)
|
|
103
|
+
.withCurrency(currency)
|
|
104
|
+
.withOrderId("123456-78910")
|
|
105
|
+
.withAllowDuplicates(true)
|
|
106
|
+
.withCustomerData(customer)
|
|
107
|
+
.execute();
|
|
108
|
+
expect(transaction).toBeTruthy();
|
|
109
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
110
|
+
expect(src_1.TransactionStatus.PREAUTHORIZED).toBe(transaction.responseMessage);
|
|
111
|
+
expect(transaction.fingerprint).toBeTruthy();
|
|
112
|
+
expect(transaction.fingerprintIndicator).toBeTruthy();
|
|
113
|
+
const capture = await transaction.capture(30).withGratuity(12).execute();
|
|
114
|
+
expect(capture).toBeTruthy();
|
|
115
|
+
expect("SUCCESS").toBe(capture.responseCode);
|
|
116
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(capture.responseMessage);
|
|
117
|
+
});
|
|
118
|
+
test("credit authorization then capture with idempotency", async () => {
|
|
119
|
+
const idempotencyKey = src_1.GenerationUtils.getGuuid();
|
|
120
|
+
const transaction = await card
|
|
121
|
+
.authorize(42)
|
|
122
|
+
.withCurrency(currency)
|
|
123
|
+
.withIdempotencyKey(idempotencyKey)
|
|
124
|
+
.withAllowDuplicates(true)
|
|
125
|
+
.execute();
|
|
126
|
+
expect(transaction).toBeTruthy();
|
|
127
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
128
|
+
expect(src_1.TransactionStatus.PREAUTHORIZED).toBe(transaction.responseMessage);
|
|
129
|
+
try {
|
|
130
|
+
await transaction
|
|
131
|
+
.capture(30)
|
|
132
|
+
.withIdempotencyKey(idempotencyKey)
|
|
133
|
+
.withGratuity(12)
|
|
134
|
+
.execute();
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
expect(error).toBeTruthy();
|
|
138
|
+
expect(error?.responseCode).toBe("40039");
|
|
139
|
+
expect(error?.message.includes("Idempotency Key seen before")).toBe(true);
|
|
140
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
test("credit authorization for multicapture", async () => {
|
|
144
|
+
const transaction = await card
|
|
145
|
+
.authorize(42)
|
|
146
|
+
.withCurrency("EUR")
|
|
147
|
+
.withMultiCapture(true)
|
|
148
|
+
.withAllowDuplicates(true)
|
|
149
|
+
.execute();
|
|
150
|
+
expect(transaction).toBeTruthy();
|
|
151
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
152
|
+
expect(src_1.TransactionStatus.PREAUTHORIZED).toBe(transaction.responseMessage);
|
|
153
|
+
expect(transaction.multiCapture).toBeTruthy();
|
|
154
|
+
const capture = await transaction.capture(10).execute();
|
|
155
|
+
expect(capture).toBeTruthy();
|
|
156
|
+
expect("SUCCESS").toBe(capture.responseCode);
|
|
157
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(capture.responseMessage);
|
|
158
|
+
const capture2 = await transaction.capture(10).execute();
|
|
159
|
+
expect(capture2).toBeTruthy();
|
|
160
|
+
expect("SUCCESS").toBe(capture2.responseCode);
|
|
161
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(capture2.responseMessage);
|
|
162
|
+
const capture3 = await transaction.capture(10).execute();
|
|
163
|
+
expect(capture3).toBeTruthy();
|
|
164
|
+
expect("SUCCESS").toBe(capture3.responseCode);
|
|
165
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(capture3.responseMessage);
|
|
166
|
+
});
|
|
167
|
+
test("credit charge with same idempotency key", async () => {
|
|
168
|
+
const idempotencyKey = src_1.GenerationUtils.getGuuid();
|
|
169
|
+
const transaction = await card
|
|
170
|
+
.charge(69)
|
|
171
|
+
.withCurrency("EUR")
|
|
172
|
+
.withIdempotencyKey(idempotencyKey)
|
|
173
|
+
.execute();
|
|
174
|
+
expect(transaction).toBeTruthy();
|
|
175
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
176
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(transaction.responseMessage);
|
|
177
|
+
try {
|
|
178
|
+
await card
|
|
179
|
+
.charge(69)
|
|
180
|
+
.withCurrency("EUR")
|
|
181
|
+
.withIdempotencyKey(idempotencyKey)
|
|
182
|
+
.execute();
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
expect(error).toBeTruthy();
|
|
186
|
+
expect(error?.responseCode).toBe("40039");
|
|
187
|
+
expect(error?.message.includes("Idempotency Key seen before")).toBe(true);
|
|
188
|
+
expect(error?.message.includes("DUPLICATE_ACTION")).toBe(true);
|
|
189
|
+
expect(error?.message.includes(transaction.transactionId)).toBe(true);
|
|
190
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
test("credit refund", async () => {
|
|
194
|
+
const response = await card
|
|
195
|
+
.refund(16)
|
|
196
|
+
.withCurrency(currency)
|
|
197
|
+
.withAllowDuplicates(true)
|
|
198
|
+
.execute();
|
|
199
|
+
expect(response).toBeTruthy();
|
|
200
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
201
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
202
|
+
});
|
|
203
|
+
test("credit refund with fingerprint", async () => {
|
|
204
|
+
const customer = new src_1.Customer();
|
|
205
|
+
customer.deviceFingerPrint = "ON_SUCCESS";
|
|
206
|
+
const response = await card
|
|
207
|
+
.refund(16)
|
|
208
|
+
.withCurrency(currency)
|
|
209
|
+
.withAllowDuplicates(true)
|
|
210
|
+
.withCustomerData(customer)
|
|
211
|
+
.execute();
|
|
212
|
+
expect(response).toBeTruthy();
|
|
213
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
214
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
215
|
+
expect(response.fingerprint).toBeTruthy();
|
|
216
|
+
expect(response.fingerprintIndicator).toBeTruthy();
|
|
217
|
+
});
|
|
218
|
+
test.skip("credit default refund", async () => {
|
|
219
|
+
const transaction = await card
|
|
220
|
+
.charge(50)
|
|
221
|
+
.withCurrency(currency)
|
|
222
|
+
.withAllowDuplicates(true)
|
|
223
|
+
.execute();
|
|
224
|
+
expect(transaction).toBeTruthy();
|
|
225
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
226
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(transaction.responseMessage);
|
|
227
|
+
const response = await transaction
|
|
228
|
+
.refund()
|
|
229
|
+
.withCurrency(currency)
|
|
230
|
+
.withAllowDuplicates(true)
|
|
231
|
+
.execute();
|
|
232
|
+
expect(response).toBeTruthy();
|
|
233
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
234
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
235
|
+
});
|
|
236
|
+
test("credit default refund with idempotency key", async () => {
|
|
237
|
+
const idempotencyKey = src_1.GenerationUtils.getGuuid();
|
|
238
|
+
const transaction = await card
|
|
239
|
+
.charge(50)
|
|
240
|
+
.withCurrency(currency)
|
|
241
|
+
.withIdempotencyKey(idempotencyKey)
|
|
242
|
+
.withAllowDuplicates(true)
|
|
243
|
+
.execute();
|
|
244
|
+
expect(transaction).toBeTruthy();
|
|
245
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
246
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(transaction.responseMessage);
|
|
247
|
+
try {
|
|
248
|
+
await transaction
|
|
249
|
+
.refund(50)
|
|
250
|
+
.withCurrency(currency)
|
|
251
|
+
.withIdempotencyKey(idempotencyKey)
|
|
252
|
+
.withAllowDuplicates(true)
|
|
253
|
+
.execute();
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
expect(error).toBeTruthy();
|
|
257
|
+
expect(error?.responseCode).toBe("40039");
|
|
258
|
+
expect(error?.message.includes("Idempotency Key seen before")).toBe(true);
|
|
259
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
test("credit sale tokenized with stored credentials", async () => {
|
|
263
|
+
const storedCredentials = new src_1.StoredCredential();
|
|
264
|
+
storedCredentials.initiator = src_1.StoredCredentialInitiator.Merchant;
|
|
265
|
+
storedCredentials.type = src_1.StoredCredentialType.INSTALLMENT;
|
|
266
|
+
storedCredentials.sequence = src_1.StoredCredentialSequence.SUBSEQUENT;
|
|
267
|
+
storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
|
|
268
|
+
const tokenizeResponse = await card.tokenize().execute();
|
|
269
|
+
const tokenId = tokenizeResponse.token;
|
|
270
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
271
|
+
tokenizedCard.token = tokenId;
|
|
272
|
+
tokenizedCard.cardHolderName = "James Mason";
|
|
273
|
+
const response = await tokenizedCard
|
|
274
|
+
.charge(50)
|
|
275
|
+
.withCurrency("EUR")
|
|
276
|
+
.withStoredCredentials(storedCredentials)
|
|
277
|
+
.execute();
|
|
278
|
+
expect(response).toBeTruthy();
|
|
279
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
280
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
281
|
+
});
|
|
282
|
+
test("credit sale with stored credentials", async () => {
|
|
283
|
+
const storedCredentials = new src_1.StoredCredential();
|
|
284
|
+
storedCredentials.initiator = src_1.StoredCredentialInitiator.Merchant;
|
|
285
|
+
storedCredentials.type = src_1.StoredCredentialType.INSTALLMENT;
|
|
286
|
+
storedCredentials.sequence = src_1.StoredCredentialSequence.SUBSEQUENT;
|
|
287
|
+
storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
|
|
288
|
+
const response = await card
|
|
289
|
+
.charge(50)
|
|
290
|
+
.withCurrency("EUR")
|
|
291
|
+
.withStoredCredentials(storedCredentials)
|
|
292
|
+
.execute();
|
|
293
|
+
expect(response).toBeTruthy();
|
|
294
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
295
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
296
|
+
});
|
|
297
|
+
test("credit sale with dynamic descriptor", async () => {
|
|
298
|
+
const dynamicDescriptor = "My company";
|
|
299
|
+
const response = await card
|
|
300
|
+
.charge(50)
|
|
301
|
+
.withCurrency("EUR")
|
|
302
|
+
.withDynamicDescriptor(dynamicDescriptor)
|
|
303
|
+
.execute();
|
|
304
|
+
expect(response).toBeTruthy();
|
|
305
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
306
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
307
|
+
});
|
|
308
|
+
test("credit reverse with wrong ID", async () => {
|
|
309
|
+
const transaction = new src_1.Transaction();
|
|
310
|
+
transaction.transactionId = src_1.GenerationUtils.getGuuid();
|
|
311
|
+
try {
|
|
312
|
+
await transaction
|
|
313
|
+
.reverse()
|
|
314
|
+
.withCurrency(currency)
|
|
315
|
+
.withAllowDuplicates(true)
|
|
316
|
+
.execute();
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
expect(error).toBeTruthy();
|
|
320
|
+
expect(error?.responseCode).toBe("40008");
|
|
321
|
+
expect(error?.message.includes(`RESOURCE_NOT_FOUND`)).toBe(true);
|
|
322
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
test("credit verification", async () => {
|
|
326
|
+
const response = await card.verify().withCurrency(currency).execute();
|
|
327
|
+
expect(response).toBeTruthy();
|
|
328
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
329
|
+
expect("VERIFIED").toBe(response.responseMessage);
|
|
330
|
+
});
|
|
331
|
+
test("credit verification with stored credentials", async () => {
|
|
332
|
+
const storedCredentials = new src_1.StoredCredential();
|
|
333
|
+
storedCredentials.initiator = src_1.StoredCredentialInitiator.Merchant;
|
|
334
|
+
storedCredentials.type = src_1.StoredCredentialType.INSTALLMENT;
|
|
335
|
+
storedCredentials.sequence = src_1.StoredCredentialSequence.SUBSEQUENT;
|
|
336
|
+
storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
|
|
337
|
+
const response = await card
|
|
338
|
+
.verify()
|
|
339
|
+
.withCurrency(currency)
|
|
340
|
+
.withStoredCredentials(storedCredentials)
|
|
341
|
+
.execute();
|
|
342
|
+
expect(response).toBeTruthy();
|
|
343
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
344
|
+
expect("VERIFIED").toBe(response.responseMessage);
|
|
345
|
+
});
|
|
346
|
+
test("credit verification with idempotency key", async () => {
|
|
347
|
+
const idempotencyKey = src_1.GenerationUtils.getGuuid();
|
|
348
|
+
const response = await card
|
|
349
|
+
.verify()
|
|
350
|
+
.withCurrency(currency)
|
|
351
|
+
.withIdempotencyKey(idempotencyKey)
|
|
352
|
+
.execute();
|
|
353
|
+
expect(response).toBeTruthy();
|
|
354
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
355
|
+
expect("VERIFIED").toBe(response.responseMessage);
|
|
356
|
+
try {
|
|
357
|
+
await card
|
|
358
|
+
.verify()
|
|
359
|
+
.withCurrency(currency)
|
|
360
|
+
.withIdempotencyKey(idempotencyKey)
|
|
361
|
+
.execute();
|
|
362
|
+
}
|
|
363
|
+
catch (error) {
|
|
364
|
+
expect(error).toBeTruthy();
|
|
365
|
+
expect(error?.responseCode).toBe("40039");
|
|
366
|
+
expect(error?.message.includes("Status Code: DUPLICATE_ACTION - Idempotency Key seen before: ")).toBe(true);
|
|
367
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
test("credit verification with address", async () => {
|
|
371
|
+
const address = new src_1.Address();
|
|
372
|
+
address.streetAddress1 = "123 Main St.";
|
|
373
|
+
address.city = "Downtown";
|
|
374
|
+
address.state = "NJ";
|
|
375
|
+
address.country = "US";
|
|
376
|
+
address.postalCode = "12345";
|
|
377
|
+
const response = await card
|
|
378
|
+
.verify()
|
|
379
|
+
.withCurrency(currency)
|
|
380
|
+
.withAddress(address)
|
|
381
|
+
.execute();
|
|
382
|
+
expect(response).toBeTruthy();
|
|
383
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
384
|
+
expect("VERIFIED").toBe(response.responseMessage);
|
|
385
|
+
});
|
|
386
|
+
test("credit verification without currency", async () => {
|
|
387
|
+
try {
|
|
388
|
+
await card.verify().execute();
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
expect(error).toBeTruthy();
|
|
392
|
+
expect(error?.responseCode).toBe("40005");
|
|
393
|
+
expect(error?.message.includes("Status Code: MANDATORY_DATA_MISSING - Request expects the following fields currency")).toBe(true);
|
|
394
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
test("credit verification - invalid CVV", async () => {
|
|
398
|
+
const wrongCard = new src_1.CreditCardData();
|
|
399
|
+
wrongCard.number = "4263970000005262";
|
|
400
|
+
wrongCard.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
401
|
+
wrongCard.expYear = (date.getFullYear() + 1).toString();
|
|
402
|
+
wrongCard.cardHolderName = "James Mason";
|
|
403
|
+
wrongCard.cvn = "1234";
|
|
404
|
+
try {
|
|
405
|
+
await wrongCard.verify().withCurrency(currency).execute();
|
|
406
|
+
}
|
|
407
|
+
catch (error) {
|
|
408
|
+
expect(error).toBeTruthy();
|
|
409
|
+
expect(error?.responseCode).toBe("40085");
|
|
410
|
+
expect(error?.message.includes("Status Code: INVALID_REQUEST_DATA - Security Code/CVV2/CVC must be 3 digits")).toBe(true);
|
|
411
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
test("credit verification - not numeric CVV", async () => {
|
|
415
|
+
const wrongCard = new src_1.CreditCardData();
|
|
416
|
+
wrongCard.number = "4263970000005262";
|
|
417
|
+
wrongCard.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
418
|
+
wrongCard.expYear = (date.getFullYear() + 1).toString();
|
|
419
|
+
wrongCard.cardHolderName = "James Mason";
|
|
420
|
+
wrongCard.cvn = "SMA";
|
|
421
|
+
try {
|
|
422
|
+
await wrongCard.verify().withCurrency(currency).execute();
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
expect(error).toBeTruthy();
|
|
426
|
+
expect(error?.responseCode).toBe("50018");
|
|
427
|
+
expect(error?.message.includes("Status Code: SYSTEM_ERROR_DOWNSTREAM - The line number 12 which contains ' [number] XXX [/number] ' does not conform to the schema")).toBe(true);
|
|
428
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
test("capture higher amount", async () => {
|
|
432
|
+
const transaction = await card
|
|
433
|
+
.authorize(55)
|
|
434
|
+
.withCurrency(currency)
|
|
435
|
+
.withAllowDuplicates(true)
|
|
436
|
+
.execute();
|
|
437
|
+
expect(transaction).toBeTruthy();
|
|
438
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
439
|
+
expect(src_1.TransactionStatus.PREAUTHORIZED).toBe(transaction.responseMessage);
|
|
440
|
+
const capture = await transaction.capture("60").execute();
|
|
441
|
+
expect(capture).toBeTruthy();
|
|
442
|
+
expect("SUCCESS").toBe(capture.responseCode);
|
|
443
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(capture.responseMessage);
|
|
444
|
+
const transaction2 = await card
|
|
445
|
+
.authorize(30)
|
|
446
|
+
.withCurrency(currency)
|
|
447
|
+
.withAllowDuplicates(true)
|
|
448
|
+
.execute();
|
|
449
|
+
expect(transaction2).toBeTruthy();
|
|
450
|
+
expect("SUCCESS").toBe(transaction2.responseCode);
|
|
451
|
+
expect(src_1.TransactionStatus.PREAUTHORIZED).toBe(transaction2.responseMessage);
|
|
452
|
+
try {
|
|
453
|
+
await transaction2.capture("40").execute();
|
|
454
|
+
}
|
|
455
|
+
catch (error) {
|
|
456
|
+
expect(error).toBeTruthy();
|
|
457
|
+
expect(error?.responseCode).toBe("50020");
|
|
458
|
+
expect(error?.message.includes("INVALID_REQUEST_DATA - Can't settle for more than 115% of that which you authorised")).toBe(true);
|
|
459
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
test("capture lower amount", async () => {
|
|
463
|
+
const transaction = await card
|
|
464
|
+
.authorize("55")
|
|
465
|
+
.withCurrency(currency)
|
|
466
|
+
.withAllowDuplicates(true)
|
|
467
|
+
.execute();
|
|
468
|
+
expect(transaction).toBeTruthy();
|
|
469
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
470
|
+
expect(src_1.TransactionStatus.PREAUTHORIZED).toBe(transaction.responseMessage);
|
|
471
|
+
const capture = await transaction.capture("20").execute();
|
|
472
|
+
expect(capture).toBeTruthy();
|
|
473
|
+
expect("SUCCESS").toBe(capture.responseCode);
|
|
474
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(capture.responseMessage);
|
|
475
|
+
});
|
|
476
|
+
test("charge then refund higher amount", async () => {
|
|
477
|
+
const transaction = await card
|
|
478
|
+
.charge(50)
|
|
479
|
+
.withCurrency(currency)
|
|
480
|
+
.withAllowDuplicates(true)
|
|
481
|
+
.execute();
|
|
482
|
+
expect(transaction).toBeTruthy();
|
|
483
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
484
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(transaction.responseMessage);
|
|
485
|
+
try {
|
|
486
|
+
await transaction
|
|
487
|
+
.refund(60)
|
|
488
|
+
.withCurrency(currency)
|
|
489
|
+
.withAllowDuplicates(true)
|
|
490
|
+
.execute();
|
|
491
|
+
}
|
|
492
|
+
catch (error) {
|
|
493
|
+
expect(error).toBeTruthy();
|
|
494
|
+
expect(error?.responseCode).toBe("40087");
|
|
495
|
+
expect(error?.message.includes("INVALID_REQUEST_DATA - You may only refund up to 115% of the original amount")).toBe(true);
|
|
496
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
test("capture then refund higher amount", async () => {
|
|
500
|
+
const transaction = await card
|
|
501
|
+
.authorize(55)
|
|
502
|
+
.withCurrency(currency)
|
|
503
|
+
.withAllowDuplicates(true)
|
|
504
|
+
.execute();
|
|
505
|
+
expect(transaction).toBeTruthy();
|
|
506
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
507
|
+
expect(src_1.TransactionStatus.PREAUTHORIZED).toBe(transaction.responseMessage);
|
|
508
|
+
const capture = await transaction.capture(55).execute();
|
|
509
|
+
expect(capture).toBeTruthy();
|
|
510
|
+
expect("SUCCESS").toBe(capture.responseCode);
|
|
511
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(capture.responseMessage);
|
|
512
|
+
try {
|
|
513
|
+
await transaction
|
|
514
|
+
.refund(70)
|
|
515
|
+
.withCurrency(currency)
|
|
516
|
+
.withAllowDuplicates(true)
|
|
517
|
+
.execute();
|
|
518
|
+
}
|
|
519
|
+
catch (error) {
|
|
520
|
+
expect(error).toBeTruthy();
|
|
521
|
+
expect(error?.responseCode).toBe("40087");
|
|
522
|
+
expect(error?.message.includes("INVALID_REQUEST_DATA - You may only refund up to 115% of the original amount")).toBe(true);
|
|
523
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
test("manual transaction", async () => {
|
|
527
|
+
const entryModes = [
|
|
528
|
+
src_1.ManualEntryMethod.MOTO,
|
|
529
|
+
src_1.ManualEntryMethod.MAIL,
|
|
530
|
+
src_1.ManualEntryMethod.PHONE,
|
|
531
|
+
];
|
|
532
|
+
for (const entryMode of entryModes) {
|
|
533
|
+
const entryModeCard = new src_1.CreditCardData();
|
|
534
|
+
entryModeCard.number = "4263970000005262";
|
|
535
|
+
entryModeCard.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
536
|
+
entryModeCard.expYear = (date.getFullYear() + 1).toString();
|
|
537
|
+
entryModeCard.cardHolderName = "James Mason";
|
|
538
|
+
entryModeCard.cvn = "SMA";
|
|
539
|
+
entryModeCard.entryMethod = entryMode;
|
|
540
|
+
const response = await card.charge(69).withCurrency(currency).execute();
|
|
541
|
+
expect(response).toBeTruthy();
|
|
542
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
543
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(response.responseMessage);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
test.skip("credit sale - expiry card", async () => {
|
|
547
|
+
card.expYear = (date.getFullYear() - 1).toString();
|
|
548
|
+
try {
|
|
549
|
+
await card.charge(1).withCurrency("USD").execute();
|
|
550
|
+
}
|
|
551
|
+
catch (error) {
|
|
552
|
+
expect(error).toBeTruthy();
|
|
553
|
+
expect(error?.responseCode).toBe("40085");
|
|
554
|
+
expect(error?.message.includes("Status Code: INVALID_REQUEST_DATA - Expiry date invalid")).toBe(true);
|
|
555
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
test("verify tokenized payment method with fingerprint", async () => {
|
|
559
|
+
const customer = new src_1.Customer();
|
|
560
|
+
customer.deviceFingerPrint = "ALWAYS";
|
|
561
|
+
const response = await card.tokenize().withCustomerData(customer).execute();
|
|
562
|
+
expect(response).toBeTruthy();
|
|
563
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
564
|
+
expect(response.fingerprint).toBeTruthy();
|
|
565
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
566
|
+
tokenizedCard.token = response.token;
|
|
567
|
+
const verifyResponse = await tokenizedCard
|
|
568
|
+
.verify()
|
|
569
|
+
.withCurrency(currency)
|
|
570
|
+
.withCustomerData(customer)
|
|
571
|
+
.execute();
|
|
572
|
+
expect(verifyResponse).toBeTruthy();
|
|
573
|
+
expect("SUCCESS").toBe(verifyResponse.responseCode);
|
|
574
|
+
expect("VERIFIED").toBe(verifyResponse.responseMessage);
|
|
575
|
+
expect(verifyResponse.fingerprint).toBeTruthy();
|
|
576
|
+
});
|
|
577
|
+
test("verify tokenized payment method with invalid fingerprint", async () => {
|
|
578
|
+
const customer = new src_1.Customer();
|
|
579
|
+
customer.deviceFingerPrint = "NOT_ALWAYS";
|
|
580
|
+
try {
|
|
581
|
+
await card
|
|
582
|
+
.charge(60)
|
|
583
|
+
.withCurrency(currency)
|
|
584
|
+
.withCustomerData(customer)
|
|
585
|
+
.execute();
|
|
586
|
+
}
|
|
587
|
+
catch (error) {
|
|
588
|
+
expect(error).toBeTruthy();
|
|
589
|
+
expect(error?.responseCode).toBe("40213");
|
|
590
|
+
expect(error?.message.includes("Status Code: INVALID_REQUEST_DATA - fingerprint_mode contains unexpected data")).toBe(true);
|
|
591
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
test("credit sale without permissions", async () => {
|
|
595
|
+
const config = BaseGpApiTestConfig_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent);
|
|
596
|
+
config.permissions = ["TRN_POST_Capture"];
|
|
597
|
+
src_1.ServicesContainer.configureService(config, "configWithoutSalePermission");
|
|
598
|
+
try {
|
|
599
|
+
await card
|
|
600
|
+
.charge(50)
|
|
601
|
+
.withCurrency(currency)
|
|
602
|
+
.withAllowDuplicates(true)
|
|
603
|
+
.execute("configWithoutSalePermission");
|
|
604
|
+
}
|
|
605
|
+
catch (error) {
|
|
606
|
+
expect(error).toBeTruthy();
|
|
607
|
+
expect(error?.responseCode).toBe("40212");
|
|
608
|
+
expect(error?.message).toBe("Status Code: ACTION_NOT_AUTHORIZED - Permission not enabled to execute action");
|
|
609
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
test("transaction then refund", async () => {
|
|
613
|
+
const transaction = await card
|
|
614
|
+
.charge(50)
|
|
615
|
+
.withCurrency(currency)
|
|
616
|
+
.withAllowDuplicates(true)
|
|
617
|
+
.execute();
|
|
618
|
+
expect(transaction).toBeTruthy();
|
|
619
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
620
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(transaction.responseMessage);
|
|
621
|
+
const partialAmount = "7.51";
|
|
622
|
+
const partialRefund = await transaction
|
|
623
|
+
.refund(partialAmount)
|
|
624
|
+
.withCurrency(currency)
|
|
625
|
+
.execute();
|
|
626
|
+
expect(partialRefund).toBeTruthy();
|
|
627
|
+
expect("SUCCESS").toBe(partialRefund.responseCode);
|
|
628
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(partialRefund.responseMessage);
|
|
629
|
+
expect(partialAmount).toBe(partialRefund.balanceAmount);
|
|
630
|
+
try {
|
|
631
|
+
await transaction.refund().withCurrency(currency).execute();
|
|
632
|
+
}
|
|
633
|
+
catch (error) {
|
|
634
|
+
expect(error).toBeTruthy();
|
|
635
|
+
expect(error?.responseCode).toBe("40087");
|
|
636
|
+
expect(error?.message.includes("INVALID_REQUEST_DATA - You may only refund up to 115% of the original amount")).toBe(true);
|
|
637
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
test("transaction then reverersal", async () => {
|
|
641
|
+
const transaction = await card
|
|
642
|
+
.charge(20)
|
|
643
|
+
.withCurrency(currency)
|
|
644
|
+
.withAllowDuplicates(true)
|
|
645
|
+
.execute();
|
|
646
|
+
expect(transaction).toBeTruthy();
|
|
647
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
648
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(transaction.responseMessage);
|
|
649
|
+
const reverse = await transaction.reverse(20).execute();
|
|
650
|
+
expect(reverse).toBeTruthy();
|
|
651
|
+
expect("SUCCESS").toBe(reverse.responseCode);
|
|
652
|
+
expect(src_1.TransactionStatus.REVERSED).toBe(reverse.responseMessage);
|
|
653
|
+
});
|
|
654
|
+
test("transaction then default reverersal", async () => {
|
|
655
|
+
const transaction = await card
|
|
656
|
+
.charge(20)
|
|
657
|
+
.withCurrency(currency)
|
|
658
|
+
.withAllowDuplicates(true)
|
|
659
|
+
.execute();
|
|
660
|
+
expect(transaction).toBeTruthy();
|
|
661
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
662
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(transaction.responseMessage);
|
|
663
|
+
const reverse = await transaction.reverse().execute();
|
|
664
|
+
expect(reverse).toBeTruthy();
|
|
665
|
+
expect("SUCCESS").toBe(reverse.responseCode);
|
|
666
|
+
expect(src_1.TransactionStatus.REVERSED).toBe(reverse.responseMessage);
|
|
667
|
+
});
|
|
668
|
+
test("transaction then reverersal with idempotency key", async () => {
|
|
669
|
+
const idempotencyKey = src_1.GenerationUtils.getGuuid();
|
|
670
|
+
const transaction = await card
|
|
671
|
+
.charge(20)
|
|
672
|
+
.withCurrency(currency)
|
|
673
|
+
.withAllowDuplicates(true)
|
|
674
|
+
.withIdempotencyKey(idempotencyKey)
|
|
675
|
+
.execute();
|
|
676
|
+
expect(transaction).toBeTruthy();
|
|
677
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
678
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(transaction.responseMessage);
|
|
679
|
+
try {
|
|
680
|
+
await transaction.reverse().withIdempotencyKey(idempotencyKey).execute();
|
|
681
|
+
}
|
|
682
|
+
catch (error) {
|
|
683
|
+
expect(error).toBeTruthy();
|
|
684
|
+
expect(error?.responseCode).toBe("40039");
|
|
685
|
+
expect(error?.message.includes("Idempotency Key seen before")).toBe(true);
|
|
686
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
test("transaction then partial reverersal", async () => {
|
|
690
|
+
const transaction = await card
|
|
691
|
+
.charge(20)
|
|
692
|
+
.withCurrency(currency)
|
|
693
|
+
.withAllowDuplicates(true)
|
|
694
|
+
.execute();
|
|
695
|
+
expect(transaction).toBeTruthy();
|
|
696
|
+
expect("SUCCESS").toBe(transaction.responseCode);
|
|
697
|
+
expect(src_1.TransactionStatus.CAPTURED).toBe(transaction.responseMessage);
|
|
698
|
+
try {
|
|
699
|
+
await transaction.reverse(10).execute();
|
|
700
|
+
}
|
|
701
|
+
catch (error) {
|
|
702
|
+
expect(error).toBeTruthy();
|
|
703
|
+
expect(error?.responseCode).toBe("40214");
|
|
704
|
+
expect(error?.message).toBe("Status Code: INVALID_REQUEST_DATA - partial reversal not supported");
|
|
705
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
test("card tokenization", async () => {
|
|
709
|
+
const response = await card.tokenize().execute();
|
|
710
|
+
expect(response).toBeTruthy();
|
|
711
|
+
expect("SUCCESS").toBe(response.responseCode);
|
|
712
|
+
expect("ACTIVE").toBe(response.responseMessage);
|
|
713
|
+
});
|
|
714
|
+
test("card tokenization then paying with token - Single to Multi-Use", async () => {
|
|
715
|
+
const config = BaseGpApiTestConfig_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent);
|
|
716
|
+
config.permissions = ["PMT_POST_Create_Single"];
|
|
717
|
+
src_1.ServicesContainer.configureService(config, "singleUseToken");
|
|
718
|
+
const response = await card
|
|
719
|
+
.tokenize(true, src_1.PaymentMethodUsageMode.SINGLE)
|
|
720
|
+
.execute("singleUseToken");
|
|
721
|
+
const tokenId = response.token;
|
|
722
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
723
|
+
tokenizedCard.token = tokenId;
|
|
724
|
+
tokenizedCard.cardHolderName = "James Mason";
|
|
725
|
+
const chargeResponse = await tokenizedCard
|
|
726
|
+
.charge(10)
|
|
727
|
+
.withCurrency("USD")
|
|
728
|
+
.withRequestMultiUseToken(true)
|
|
729
|
+
.execute();
|
|
730
|
+
expect(chargeResponse).toBeTruthy();
|
|
731
|
+
expect(chargeResponse.responseCode).toBe("SUCCESS");
|
|
732
|
+
expect(chargeResponse.responseMessage).toBe(src_1.TransactionStatus.CAPTURED);
|
|
733
|
+
expect(chargeResponse.token.startsWith(DTO_1.PaymentMethod.PAYMENT_METHOD_TOKEN_PREFIX)).toBeTruthy();
|
|
734
|
+
tokenizedCard.token = chargeResponse.token;
|
|
735
|
+
const secondChargeResponse = await tokenizedCard
|
|
736
|
+
.charge(10)
|
|
737
|
+
.withCurrency("USD")
|
|
738
|
+
.execute();
|
|
739
|
+
expect(secondChargeResponse).toBeTruthy();
|
|
740
|
+
expect(secondChargeResponse.responseCode).toBe("SUCCESS");
|
|
741
|
+
expect(secondChargeResponse.responseMessage).toBe(src_1.TransactionStatus.CAPTURED);
|
|
742
|
+
});
|
|
743
|
+
test("card tokenization with idempotency key", async () => {
|
|
744
|
+
const idempotencyKey = src_1.GenerationUtils.getGuuid();
|
|
745
|
+
const response = await card
|
|
746
|
+
.tokenize()
|
|
747
|
+
.withIdempotencyKey(idempotencyKey)
|
|
748
|
+
.execute();
|
|
749
|
+
expect(response).toBeTruthy();
|
|
750
|
+
expect(response.responseCode).toBe("SUCCESS");
|
|
751
|
+
expect(response.responseMessage).toBe("ACTIVE");
|
|
752
|
+
let exceptionCaught = false;
|
|
753
|
+
try {
|
|
754
|
+
await card.tokenize().withIdempotencyKey(idempotencyKey).execute();
|
|
755
|
+
}
|
|
756
|
+
catch (e) {
|
|
757
|
+
exceptionCaught = true;
|
|
758
|
+
expect(e.responseCode).toBe("40039");
|
|
759
|
+
expect(e.message.includes("Idempotency Key seen before")).toBe(true);
|
|
760
|
+
}
|
|
761
|
+
finally {
|
|
762
|
+
expect(exceptionCaught).toBe(true);
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
test("card tokenization then paying with token", async () => {
|
|
766
|
+
const response = await card.tokenize().execute();
|
|
767
|
+
const tokenId = response.token;
|
|
768
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
769
|
+
tokenizedCard.token = tokenId;
|
|
770
|
+
tokenizedCard.cardHolderName = "James Mason";
|
|
771
|
+
const chargeResponse = await tokenizedCard
|
|
772
|
+
.charge(69)
|
|
773
|
+
.withCurrency("EUR")
|
|
774
|
+
.withOrderId("124214-214221")
|
|
775
|
+
.execute();
|
|
776
|
+
expect(chargeResponse).toBeTruthy();
|
|
777
|
+
expect(chargeResponse.responseCode).toBe("SUCCESS");
|
|
778
|
+
expect(chargeResponse.responseMessage).toBe(src_1.TransactionStatus.CAPTURED);
|
|
779
|
+
});
|
|
780
|
+
test("verify tokenized payment method", async () => {
|
|
781
|
+
const tokenizeResponse = await card.tokenize().execute();
|
|
782
|
+
expect(tokenizeResponse).toBeTruthy();
|
|
783
|
+
expect(tokenizeResponse.responseCode).toBe("SUCCESS");
|
|
784
|
+
expect(tokenizeResponse.responseMessage).toBe("ACTIVE");
|
|
785
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
786
|
+
tokenizedCard.token = tokenizeResponse.token;
|
|
787
|
+
const response = await tokenizedCard
|
|
788
|
+
.verify()
|
|
789
|
+
.withCurrency(currency)
|
|
790
|
+
.execute();
|
|
791
|
+
expect(response).toBeTruthy();
|
|
792
|
+
expect(response.responseCode).toBe("SUCCESS");
|
|
793
|
+
expect(response.responseMessage).toBe("VERIFIED");
|
|
794
|
+
});
|
|
795
|
+
test("verify tokenized payment method with idempotency key", async () => {
|
|
796
|
+
const idempotencyKey = src_1.GenerationUtils.getGuuid();
|
|
797
|
+
const tokenizeResponse = await card.tokenize().execute();
|
|
798
|
+
expect(tokenizeResponse).toBeTruthy();
|
|
799
|
+
expect(tokenizeResponse.responseCode).toBe("SUCCESS");
|
|
800
|
+
expect(tokenizeResponse.responseMessage).toBe("ACTIVE");
|
|
801
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
802
|
+
tokenizedCard.token = tokenizeResponse.token;
|
|
803
|
+
const response = await tokenizedCard
|
|
804
|
+
.verify()
|
|
805
|
+
.withCurrency(currency)
|
|
806
|
+
.withIdempotencyKey(idempotencyKey)
|
|
807
|
+
.execute();
|
|
808
|
+
expect(response).toBeTruthy();
|
|
809
|
+
expect(response.responseCode).toBe("SUCCESS");
|
|
810
|
+
expect(response.responseMessage).toBe("VERIFIED");
|
|
811
|
+
try {
|
|
812
|
+
await tokenizedCard.verify().withIdempotencyKey(idempotencyKey).execute();
|
|
813
|
+
}
|
|
814
|
+
catch (error) {
|
|
815
|
+
expect(error).toBeTruthy();
|
|
816
|
+
expect(error?.responseCode).toBe("40039");
|
|
817
|
+
expect(error?.message.includes(`Idempotency Key seen before`)).toBe(true);
|
|
818
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
test("verify tokenized payment method with wrong ID", async () => {
|
|
822
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
823
|
+
tokenizedCard.token = `PMT_${src_1.GenerationUtils.getGuuid()}`;
|
|
824
|
+
try {
|
|
825
|
+
await tokenizedCard.verify().withCurrency(currency).execute();
|
|
826
|
+
}
|
|
827
|
+
catch (error) {
|
|
828
|
+
expect(error).toBeTruthy();
|
|
829
|
+
expect(error?.responseCode).toBe("40116");
|
|
830
|
+
expect(error?.message).toBe(`Status Code: RESOURCE_NOT_FOUND - payment_method ${tokenizedCard.token} not found at this location.`);
|
|
831
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
test.skip("card tokenization then delete", async () => {
|
|
835
|
+
//Permission not enabled to execute action for this appId/appKey
|
|
836
|
+
const response = await card.tokenize().execute();
|
|
837
|
+
const tokenId = response.token;
|
|
838
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
839
|
+
tokenizedCard.token = tokenId;
|
|
840
|
+
const deleteTokenExpiryRes = await tokenizedCard.deleteToken();
|
|
841
|
+
expect(deleteTokenExpiryRes).toBeTruthy();
|
|
842
|
+
const deleteTokenExpiryRes2 = await tokenizedCard.deleteToken();
|
|
843
|
+
expect(deleteTokenExpiryRes2).toBeFalsy();
|
|
844
|
+
});
|
|
845
|
+
test.skip("card tokenization then delete with idempotency key", async () => {
|
|
846
|
+
//Permission not enabled to execute action for this appId/appKey
|
|
847
|
+
const response = await card.tokenize().execute();
|
|
848
|
+
const tokenId = response.token;
|
|
849
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
850
|
+
tokenizedCard.token = tokenId;
|
|
851
|
+
const idempotencyKey = src_1.GenerationUtils.getGuuid();
|
|
852
|
+
const deleteTokenExpiryRes = await new src_1.ManagementBuilder(src_1.TransactionType.TokenDelete)
|
|
853
|
+
.withPaymentMethod(tokenizedCard)
|
|
854
|
+
.withIdempotencyKey(idempotencyKey)
|
|
855
|
+
.execute();
|
|
856
|
+
expect(deleteTokenExpiryRes).toBeTruthy();
|
|
857
|
+
expect(deleteTokenExpiryRes.responseCode).toBe("SUCCESS");
|
|
858
|
+
expect(deleteTokenExpiryRes.responseMessage).toBe("DELETED");
|
|
859
|
+
try {
|
|
860
|
+
await new src_1.ManagementBuilder(src_1.TransactionType.TokenDelete)
|
|
861
|
+
.withPaymentMethod(tokenizedCard)
|
|
862
|
+
.withIdempotencyKey(idempotencyKey)
|
|
863
|
+
.execute();
|
|
864
|
+
}
|
|
865
|
+
catch (error) {
|
|
866
|
+
expect(error).toBeTruthy();
|
|
867
|
+
expect(error?.responseCode).toBe("40039");
|
|
868
|
+
expect(error?.message).toMatch(new RegExp("Idempotency Key seen before"));
|
|
869
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
test.skip("card delete wrong id", async () => {
|
|
873
|
+
//Permission not enabled to execute action for this appId/appKey
|
|
874
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
875
|
+
tokenizedCard.token = `PMT_${src_1.GenerationUtils.getGuuid()}`;
|
|
876
|
+
try {
|
|
877
|
+
await tokenizedCard.deleteToken();
|
|
878
|
+
}
|
|
879
|
+
catch (error) {
|
|
880
|
+
expect(error).toBeTruthy();
|
|
881
|
+
expect(error?.responseCode).toBe("40116");
|
|
882
|
+
expect(error?.message).toBe(`Status Code: RESOURCE_NOT_FOUND - payment_method ${tokenizedCard.token} not found at this location.`);
|
|
883
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
test("card tokenization then update", async () => {
|
|
887
|
+
const response = await card.tokenize().execute();
|
|
888
|
+
const tokenId = response.token;
|
|
889
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
890
|
+
tokenizedCard.token = tokenId;
|
|
891
|
+
const date = new Date();
|
|
892
|
+
tokenizedCard.expMonth = (date.getMonth() + 2).toString().padStart(2, "0");
|
|
893
|
+
tokenizedCard.expYear = (date.getFullYear() + 2).toString();
|
|
894
|
+
const updateTokenExpiryRes = await tokenizedCard.updateTokenExpiry();
|
|
895
|
+
expect(updateTokenExpiryRes).toBeTruthy();
|
|
896
|
+
});
|
|
897
|
+
test("card update wrong ID", async () => {
|
|
898
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
899
|
+
tokenizedCard.token = "PMT_" + src_1.GenerationUtils.getGuuid();
|
|
900
|
+
const date = new Date();
|
|
901
|
+
tokenizedCard.expMonth = (date.getMonth() + 2).toString().padStart(2, "0");
|
|
902
|
+
tokenizedCard.expYear = (date.getFullYear() + 2).toString();
|
|
903
|
+
try {
|
|
904
|
+
await tokenizedCard.updateTokenExpiry();
|
|
905
|
+
}
|
|
906
|
+
catch (error) {
|
|
907
|
+
expect(error).toBeTruthy();
|
|
908
|
+
expect(error?.message).toBe(`Status Code: RESOURCE_NOT_FOUND - payment_method ${tokenizedCard.token} not found at this location.`);
|
|
909
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
test("card tokenization then update with idempotency key", async () => {
|
|
913
|
+
const response = await card.tokenize().execute();
|
|
914
|
+
const tokenId = response.token;
|
|
915
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
916
|
+
tokenizedCard.token = tokenId;
|
|
917
|
+
const date = new Date();
|
|
918
|
+
tokenizedCard.expMonth = (date.getMonth() + 2).toString().padStart(2, "0");
|
|
919
|
+
tokenizedCard.expYear = (date.getFullYear() + 2).toString();
|
|
920
|
+
const idempotencyKey = src_1.GenerationUtils.getGuuid();
|
|
921
|
+
const updateTokenExpiryRes = await new src_1.ManagementBuilder(src_1.TransactionType.TokenUpdate)
|
|
922
|
+
.withPaymentMethod(tokenizedCard)
|
|
923
|
+
.withIdempotencyKey(idempotencyKey)
|
|
924
|
+
.execute();
|
|
925
|
+
expect(updateTokenExpiryRes).toBeTruthy();
|
|
926
|
+
expect(updateTokenExpiryRes.responseCode).toBe("SUCCESS");
|
|
927
|
+
expect(updateTokenExpiryRes.responseMessage).toBe("ACTIVE");
|
|
928
|
+
try {
|
|
929
|
+
await new src_1.ManagementBuilder(src_1.TransactionType.TokenUpdate)
|
|
930
|
+
.withPaymentMethod(tokenizedCard)
|
|
931
|
+
.withIdempotencyKey(idempotencyKey)
|
|
932
|
+
.execute();
|
|
933
|
+
}
|
|
934
|
+
catch (error) {
|
|
935
|
+
expect(error).toBeTruthy();
|
|
936
|
+
expect(error?.responseCode).toBe("40039");
|
|
937
|
+
expect(error?.responseMessage).toMatch(new RegExp("Idempotency Key seen before"));
|
|
938
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
939
|
+
}
|
|
940
|
+
const verifyResponse = await tokenizedCard
|
|
941
|
+
.verify()
|
|
942
|
+
.withCurrency(currency)
|
|
943
|
+
.withIdempotencyKey(idempotencyKey)
|
|
944
|
+
.execute();
|
|
945
|
+
expect(verifyResponse).toBeTruthy();
|
|
946
|
+
expect(verifyResponse.responseCode).toBe("SUCCESS");
|
|
947
|
+
expect(verifyResponse.responseMessage).toBe("VERIFIED");
|
|
948
|
+
tokenizedCard.expYear = (date.getFullYear() + 3).toString();
|
|
949
|
+
const updateTokenExpiryRes2 = await tokenizedCard.updateTokenExpiry();
|
|
950
|
+
expect(updateTokenExpiryRes2).toBeTruthy();
|
|
951
|
+
});
|
|
952
|
+
test("credit refund transaction wrong ID", async () => {
|
|
953
|
+
const transaction = new src_1.Transaction();
|
|
954
|
+
transaction.transactionId = src_1.GenerationUtils.getGuuid();
|
|
955
|
+
try {
|
|
956
|
+
await transaction
|
|
957
|
+
.refund(10)
|
|
958
|
+
.withCurrency(currency)
|
|
959
|
+
.withAllowDuplicates(true)
|
|
960
|
+
.execute();
|
|
961
|
+
}
|
|
962
|
+
catch (error) {
|
|
963
|
+
expect(error).toBeTruthy();
|
|
964
|
+
expect(error?.message.includes(`RESOURCE_NOT_FOUND`)).toBe(true);
|
|
965
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
test("card tokenization - Missing card number", async () => {
|
|
969
|
+
const card = new src_1.CreditCardData();
|
|
970
|
+
try {
|
|
971
|
+
await card.tokenize().execute();
|
|
972
|
+
}
|
|
973
|
+
catch (error) {
|
|
974
|
+
expect(error).toBeTruthy();
|
|
975
|
+
expect(error?.message).toBe("Status Code: MANDATORY_DATA_MISSING - Request expects the following fields : number");
|
|
976
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
test("update payment token", async () => {
|
|
980
|
+
const startDate = new Date();
|
|
981
|
+
startDate.setDate(startDate.getDate() - 30);
|
|
982
|
+
startDate.setHours(0);
|
|
983
|
+
startDate.setMinutes(0);
|
|
984
|
+
startDate.setSeconds(0);
|
|
985
|
+
const response = await src_1.ReportingService.findStoredPaymentMethodsPaged(1, 1)
|
|
986
|
+
.orderBy(src_1.StoredPaymentMethodSortProperty.TimeCreated, src_1.SortDirection.Desc)
|
|
987
|
+
.where(src_1.SearchCriteria.StartDate, `${startDate.getFullYear()}-${(startDate.getMonth() + 1)
|
|
988
|
+
.toString()
|
|
989
|
+
.padStart(2, "0")}-${startDate.getDate().toString().padStart(2, "0")}`)
|
|
990
|
+
.execute();
|
|
991
|
+
expect(response.result.length).toBe(1);
|
|
992
|
+
const pmtToken = response.result[0];
|
|
993
|
+
expect(pmtToken).toBeTruthy();
|
|
994
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
995
|
+
tokenizedCard.token = pmtToken.paymentMethodId;
|
|
996
|
+
const date = new Date();
|
|
997
|
+
tokenizedCard.cardHolderName = "James BondUp";
|
|
998
|
+
tokenizedCard.expMonth = (date.getMonth() + 2).toString().padStart(2, "0");
|
|
999
|
+
tokenizedCard.expYear = (date.getFullYear() + 4).toString();
|
|
1000
|
+
tokenizedCard.number = "4263970000005262";
|
|
1001
|
+
const responseUpdateToken = await tokenizedCard
|
|
1002
|
+
.updateToken()
|
|
1003
|
+
.withPaymentMethodUsageMode(src_1.PaymentMethodUsageMode.MULTIPLE)
|
|
1004
|
+
.execute();
|
|
1005
|
+
expect(responseUpdateToken).toBeTruthy();
|
|
1006
|
+
expect(responseUpdateToken.responseCode).toBe("SUCCESS");
|
|
1007
|
+
expect(responseUpdateToken.responseMessage).toBe("ACTIVE");
|
|
1008
|
+
expect(responseUpdateToken.token).toBe(pmtToken.paymentMethodId);
|
|
1009
|
+
expect(responseUpdateToken.tokenUsageMode).toBe(src_1.PaymentMethodUsageMode.MULTIPLE);
|
|
1010
|
+
});
|
|
1011
|
+
test("card tokenization then update then charge", async () => {
|
|
1012
|
+
const config = BaseGpApiTestConfig_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent);
|
|
1013
|
+
config.permissions = ["PMT_POST_Create_Single"];
|
|
1014
|
+
src_1.ServicesContainer.configureService(config, "singleUseToken");
|
|
1015
|
+
const response = await card
|
|
1016
|
+
.tokenize()
|
|
1017
|
+
.withPaymentMethodUsageMode(src_1.PaymentMethodUsageMode.SINGLE)
|
|
1018
|
+
.execute("singleUseToken");
|
|
1019
|
+
const tokenId = response.token;
|
|
1020
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
1021
|
+
tokenizedCard.token = tokenId;
|
|
1022
|
+
tokenizedCard.cardHolderName = "GpApi";
|
|
1023
|
+
const responseUpdateToken = await tokenizedCard
|
|
1024
|
+
.updateToken()
|
|
1025
|
+
.withPaymentMethodUsageMode(src_1.PaymentMethodUsageMode.MULTIPLE)
|
|
1026
|
+
.execute();
|
|
1027
|
+
expect(responseUpdateToken).toBeTruthy();
|
|
1028
|
+
expect(responseUpdateToken.responseCode).toBe("SUCCESS");
|
|
1029
|
+
expect(responseUpdateToken.responseMessage).toBe("ACTIVE");
|
|
1030
|
+
expect(responseUpdateToken.tokenUsageMode).toBe(src_1.PaymentMethodUsageMode.MULTIPLE);
|
|
1031
|
+
const chargeResponse = await tokenizedCard
|
|
1032
|
+
.charge(1)
|
|
1033
|
+
.withCurrency(currency)
|
|
1034
|
+
.execute();
|
|
1035
|
+
expect(chargeResponse).toBeTruthy();
|
|
1036
|
+
expect(chargeResponse.responseCode).toBe("SUCCESS");
|
|
1037
|
+
expect(chargeResponse.responseMessage).toBe(src_1.TransactionStatus.CAPTURED);
|
|
1038
|
+
});
|
|
1039
|
+
test("card tokenization then update to single usage", async () => {
|
|
1040
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
1041
|
+
tokenizedCard.token = `PMT_${src_1.GenerationUtils.getGuuid()}`;
|
|
1042
|
+
try {
|
|
1043
|
+
await tokenizedCard
|
|
1044
|
+
.updateToken()
|
|
1045
|
+
.withPaymentMethodUsageMode(src_1.PaymentMethodUsageMode.SINGLE)
|
|
1046
|
+
.execute();
|
|
1047
|
+
}
|
|
1048
|
+
catch (error) {
|
|
1049
|
+
expect(error).toBeTruthy();
|
|
1050
|
+
expect(error?.responseCode).toBe("50020");
|
|
1051
|
+
expect(error?.message).toBe("Status Code: INVALID_REQUEST_DATA - Tokentype can only be MULTI");
|
|
1052
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
test("card tokenization then update to without usage mode", async () => {
|
|
1056
|
+
const tokenizedCard = new src_1.CreditCardData();
|
|
1057
|
+
tokenizedCard.token = `PMT_${src_1.GenerationUtils.getGuuid()}`;
|
|
1058
|
+
try {
|
|
1059
|
+
await tokenizedCard.updateToken().execute();
|
|
1060
|
+
}
|
|
1061
|
+
catch (error) {
|
|
1062
|
+
expect(error).toBeTruthy();
|
|
1063
|
+
expect(error?.responseCode).toBe("50021");
|
|
1064
|
+
expect(error?.message).toBe("Status Code: MANDATORY_DATA_MISSING - Mandatory Fields missing [card expdate] See Developers Guide");
|
|
1065
|
+
expect(error instanceof src_1.GatewayError).toBe(true);
|
|
1066
|
+
}
|
|
1067
|
+
});
|
|
1068
|
+
afterAll(() => BaseGpApiTestConfig_1.BaseGpApiTestConfig.resetGpApiConfig());
|
|
1069
|
+
afterEach(() => BaseGpApiTestConfig_1.BaseGpApiTestConfig.resetGpApiConfig());
|
|
1070
|
+
//# sourceMappingURL=CreditCardNotPresent.test.js.map
|