@aptos-scp/scp-component-store-selling-features-domain-model 1.0.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/LICENSE.md +1 -0
- package/README.md +96 -0
- package/lib/config/DiTypes.d.ts +6 -0
- package/lib/config/DiTypes.js +10 -0
- package/lib/config/ErrorCodes.d.ts +10 -0
- package/lib/config/ErrorCodes.js +14 -0
- package/lib/config/index.d.ts +3 -0
- package/lib/config/index.js +9 -0
- package/lib/config/inversify/binding-helpers.d.ts +3 -0
- package/lib/config/inversify/binding-helpers.js +7 -0
- package/lib/config/inversify/index.d.ts +3 -0
- package/lib/config/inversify/index.js +9 -0
- package/lib/config/inversify/inversify.app.config.d.ts +19 -0
- package/lib/config/inversify/inversify.app.config.js +45 -0
- package/lib/config/inversify/inversify.terminal.config/index.d.ts +1 -0
- package/lib/config/inversify/inversify.terminal.config/index.js +7 -0
- package/lib/config/inversify/inversify.terminal.config/transaction-services.config.d.ts +11 -0
- package/lib/config/inversify/inversify.terminal.config/transaction-services.config.js +30 -0
- package/lib/domain/UIBusinessEventTypes.d.ts +305 -0
- package/lib/domain/UIBusinessEventTypes.js +313 -0
- package/lib/domain/index.d.ts +5 -0
- package/lib/domain/index.js +10 -0
- package/lib/domain/model/AddressVerification.d.ts +21 -0
- package/lib/domain/model/AddressVerification.js +3 -0
- package/lib/domain/model/ApplicationControlTransaction.d.ts +13 -0
- package/lib/domain/model/ApplicationControlTransaction.js +47 -0
- package/lib/domain/model/AtcudCodePrefixData.d.ts +19 -0
- package/lib/domain/model/AtcudCodePrefixData.js +3 -0
- package/lib/domain/model/BaseLineDecorator.d.ts +83 -0
- package/lib/domain/model/BaseLineDecorator.js +216 -0
- package/lib/domain/model/BaseTransactionLine.d.ts +71 -0
- package/lib/domain/model/BaseTransactionLine.js +183 -0
- package/lib/domain/model/CashDrawerDetail.d.ts +21 -0
- package/lib/domain/model/CashDrawerDetail.js +3 -0
- package/lib/domain/model/Constants.d.ts +977 -0
- package/lib/domain/model/Constants.js +985 -0
- package/lib/domain/model/CorruptedTransaction.d.ts +16 -0
- package/lib/domain/model/CorruptedTransaction.js +58 -0
- package/lib/domain/model/Coupon.d.ts +8 -0
- package/lib/domain/model/Coupon.js +3 -0
- package/lib/domain/model/CreateEinvoiceLine.d.ts +32 -0
- package/lib/domain/model/CreateEinvoiceLine.js +71 -0
- package/lib/domain/model/Customer.d.ts +387 -0
- package/lib/domain/model/Customer.js +320 -0
- package/lib/domain/model/CustomerServiceTransaction.d.ts +12 -0
- package/lib/domain/model/CustomerServiceTransaction.js +39 -0
- package/lib/domain/model/Department.d.ts +15 -0
- package/lib/domain/model/Department.js +3 -0
- package/lib/domain/model/EmailVerification.d.ts +24 -0
- package/lib/domain/model/EmailVerification.js +35 -0
- package/lib/domain/model/Employee.d.ts +80 -0
- package/lib/domain/model/Employee.js +73 -0
- package/lib/domain/model/EndOfTransactionTenderingSession.d.ts +39 -0
- package/lib/domain/model/EndOfTransactionTenderingSession.js +89 -0
- package/lib/domain/model/ExchangeRates.d.ts +13 -0
- package/lib/domain/model/ExchangeRates.js +8 -0
- package/lib/domain/model/FiscalControlTransaction.d.ts +12 -0
- package/lib/domain/model/FiscalControlTransaction.js +43 -0
- package/lib/domain/model/FulfillmentGroup.d.ts +35 -0
- package/lib/domain/model/FulfillmentGroup.js +137 -0
- package/lib/domain/model/IAppLocalFeaturesStorage.d.ts +78 -0
- package/lib/domain/model/IAppLocalFeaturesStorage.js +3 -0
- package/lib/domain/model/ICreateEinvoiceLine.d.ts +9 -0
- package/lib/domain/model/ICreateEinvoiceLine.js +3 -0
- package/lib/domain/model/IEmployeeDiscount.d.ts +15 -0
- package/lib/domain/model/IEmployeeDiscount.js +3 -0
- package/lib/domain/model/IFiscalTransactionNumberMaintainer.d.ts +10 -0
- package/lib/domain/model/IFiscalTransactionNumberMaintainer.js +8 -0
- package/lib/domain/model/IInvoiceOperation.d.ts +10 -0
- package/lib/domain/model/IInvoiceOperation.js +8 -0
- package/lib/domain/model/ILastRetailTransactionInfo.d.ts +13 -0
- package/lib/domain/model/ILastRetailTransactionInfo.js +3 -0
- package/lib/domain/model/ILastTransactionStatus.d.ts +5 -0
- package/lib/domain/model/ILastTransactionStatus.js +3 -0
- package/lib/domain/model/ILoyaltyVoucher.d.ts +28 -0
- package/lib/domain/model/ILoyaltyVoucher.js +9 -0
- package/lib/domain/model/IPrinterInfo.d.ts +6 -0
- package/lib/domain/model/IPrinterInfo.js +3 -0
- package/lib/domain/model/ISequence.d.ts +8 -0
- package/lib/domain/model/ISequence.js +3 -0
- package/lib/domain/model/IServiceResultLine.d.ts +4 -0
- package/lib/domain/model/IServiceResultLine.js +3 -0
- package/lib/domain/model/ISingleUseCoupon.d.ts +22 -0
- package/lib/domain/model/ISingleUseCoupon.js +38 -0
- package/lib/domain/model/ITransactionMetadataPersistanceObject.d.ts +12 -0
- package/lib/domain/model/ITransactionMetadataPersistanceObject.js +3 -0
- package/lib/domain/model/Inventory.d.ts +156 -0
- package/lib/domain/model/Inventory.js +78 -0
- package/lib/domain/model/ItemHandlingSession.d.ts +40 -0
- package/lib/domain/model/ItemHandlingSession.js +131 -0
- package/lib/domain/model/LoyaltyMembership.d.ts +153 -0
- package/lib/domain/model/LoyaltyMembership.js +23 -0
- package/lib/domain/model/MerchandiseTransaction.d.ts +310 -0
- package/lib/domain/model/MerchandiseTransaction.js +1299 -0
- package/lib/domain/model/MetricsLogs.d.ts +41 -0
- package/lib/domain/model/MetricsLogs.js +3 -0
- package/lib/domain/model/MunicipalFiscalCode.d.ts +25 -0
- package/lib/domain/model/MunicipalFiscalCode.js +3 -0
- package/lib/domain/model/NoSaleTransaction.d.ts +13 -0
- package/lib/domain/model/NoSaleTransaction.js +49 -0
- package/lib/domain/model/Order.d.ts +67 -0
- package/lib/domain/model/Order.js +190 -0
- package/lib/domain/model/OrderTotals.d.ts +44 -0
- package/lib/domain/model/OrderTotals.js +76 -0
- package/lib/domain/model/Organization.d.ts +99 -0
- package/lib/domain/model/Organization.js +3 -0
- package/lib/domain/model/PrepaidTender.d.ts +14 -0
- package/lib/domain/model/PrepaidTender.js +3 -0
- package/lib/domain/model/ReceiptSession.d.ts +87 -0
- package/lib/domain/model/ReceiptSession.js +206 -0
- package/lib/domain/model/ReprintReceiptTransaction.d.ts +49 -0
- package/lib/domain/model/ReprintReceiptTransaction.js +179 -0
- package/lib/domain/model/ResumeTransactionSession.d.ts +22 -0
- package/lib/domain/model/ResumeTransactionSession.js +56 -0
- package/lib/domain/model/RetailTransaction.d.ts +127 -0
- package/lib/domain/model/RetailTransaction.js +556 -0
- package/lib/domain/model/Sendsale.d.ts +4 -0
- package/lib/domain/model/Sendsale.js +3 -0
- package/lib/domain/model/StoreItem.d.ts +175 -0
- package/lib/domain/model/StoreItem.js +750 -0
- package/lib/domain/model/StoredValueCardSession.d.ts +29 -0
- package/lib/domain/model/StoredValueCardSession.js +65 -0
- package/lib/domain/model/StoredValueCertificateSession.d.ts +47 -0
- package/lib/domain/model/StoredValueCertificateSession.js +153 -0
- package/lib/domain/model/SubscriptionTokenSession.d.ts +22 -0
- package/lib/domain/model/SubscriptionTokenSession.js +60 -0
- package/lib/domain/model/Subscriptions.d.ts +12 -0
- package/lib/domain/model/Subscriptions.js +3 -0
- package/lib/domain/model/TaxRefundControlTransaction.d.ts +13 -0
- package/lib/domain/model/TaxRefundControlTransaction.js +50 -0
- package/lib/domain/model/TenderAuthorizationSession.d.ts +102 -0
- package/lib/domain/model/TenderAuthorizationSession.js +337 -0
- package/lib/domain/model/TenderControlTransaction.d.ts +30 -0
- package/lib/domain/model/TenderControlTransaction.js +138 -0
- package/lib/domain/model/TenderHandlingSession.d.ts +100 -0
- package/lib/domain/model/TenderHandlingSession.js +379 -0
- package/lib/domain/model/TenderType.d.ts +161 -0
- package/lib/domain/model/TenderType.js +1317 -0
- package/lib/domain/model/TerminalControlTransaction.d.ts +14 -0
- package/lib/domain/model/TerminalControlTransaction.js +55 -0
- package/lib/domain/model/TerminalSession.d.ts +49 -0
- package/lib/domain/model/TerminalSession.js +122 -0
- package/lib/domain/model/TillControlTransaction.d.ts +20 -0
- package/lib/domain/model/TillControlTransaction.js +79 -0
- package/lib/domain/model/TillSession.d.ts +67 -0
- package/lib/domain/model/TillSession.js +222 -0
- package/lib/domain/model/TransactionFlowState.d.ts +26 -0
- package/lib/domain/model/TransactionFlowState.js +72 -0
- package/lib/domain/model/TransactionReferenceLine.d.ts +112 -0
- package/lib/domain/model/TransactionReferenceLine.js +323 -0
- package/lib/domain/model/User.d.ts +115 -0
- package/lib/domain/model/User.js +210 -0
- package/lib/domain/model/UserSession.d.ts +36 -0
- package/lib/domain/model/UserSession.js +186 -0
- package/lib/domain/model/UserTransaction.d.ts +12 -0
- package/lib/domain/model/UserTransaction.js +38 -0
- package/lib/domain/model/VoidInterfaces.d.ts +15 -0
- package/lib/domain/model/VoidInterfaces.js +23 -0
- package/lib/domain/model/cashDrawer/CashDrawerRequestLine.d.ts +17 -0
- package/lib/domain/model/cashDrawer/CashDrawerRequestLine.js +50 -0
- package/lib/domain/model/cashDrawer/CashDrawerSession.d.ts +67 -0
- package/lib/domain/model/cashDrawer/CashDrawerSession.js +211 -0
- package/lib/domain/model/cashDrawer/CashDrawerStatusChangeLine.d.ts +30 -0
- package/lib/domain/model/cashDrawer/CashDrawerStatusChangeLine.js +86 -0
- package/lib/domain/model/cashDrawer/ICashDrawerRequestLine.d.ts +6 -0
- package/lib/domain/model/cashDrawer/ICashDrawerRequestLine.js +3 -0
- package/lib/domain/model/cashDrawer/ICashDrawerStatusChangeLine.d.ts +13 -0
- package/lib/domain/model/cashDrawer/ICashDrawerStatusChangeLine.js +3 -0
- package/lib/domain/model/cashDrawer/index.d.ts +5 -0
- package/lib/domain/model/cashDrawer/index.js +9 -0
- package/lib/domain/model/configuration/ConfigurationUtils.d.ts +3 -0
- package/lib/domain/model/configuration/ConfigurationUtils.js +8 -0
- package/lib/domain/model/configuration/DataEntryRule.d.ts +31 -0
- package/lib/domain/model/configuration/DataEntryRule.js +303 -0
- package/lib/domain/model/configuration/I18nReceiptFormattingInterface.d.ts +38 -0
- package/lib/domain/model/configuration/I18nReceiptFormattingInterface.js +3 -0
- package/lib/domain/model/configuration/I18nTaxFreeConfig.d.ts +11 -0
- package/lib/domain/model/configuration/I18nTaxFreeConfig.js +3 -0
- package/lib/domain/model/configuration/IAccessPolicyConfig.d.ts +5 -0
- package/lib/domain/model/configuration/IAccessPolicyConfig.js +3 -0
- package/lib/domain/model/configuration/IAdapterPoliciesConfig.d.ts +24 -0
- package/lib/domain/model/configuration/IAdapterPoliciesConfig.js +13 -0
- package/lib/domain/model/configuration/IConditionalAttributeBehaviorRuleConfig.d.ts +32 -0
- package/lib/domain/model/configuration/IConditionalAttributeBehaviorRuleConfig.js +8 -0
- package/lib/domain/model/configuration/ICustomerConfig.d.ts +31 -0
- package/lib/domain/model/configuration/ICustomerConfig.js +15 -0
- package/lib/domain/model/configuration/IDataEntryRuleConfig.d.ts +66 -0
- package/lib/domain/model/configuration/IDataEntryRuleConfig.js +22 -0
- package/lib/domain/model/configuration/IDiscountAttributesConfig .d.ts +26 -0
- package/lib/domain/model/configuration/IDiscountAttributesConfig .js +8 -0
- package/lib/domain/model/configuration/IDiscountBehaviorsConfig.d.ts +27 -0
- package/lib/domain/model/configuration/IDiscountBehaviorsConfig.js +21 -0
- package/lib/domain/model/configuration/IDonationBehaviorsConfig.d.ts +9 -0
- package/lib/domain/model/configuration/IDonationBehaviorsConfig.js +3 -0
- package/lib/domain/model/configuration/IFeatureAccessConfig.d.ts +186 -0
- package/lib/domain/model/configuration/IFeatureAccessConfig.js +51 -0
- package/lib/domain/model/configuration/IFeesConfig.d.ts +109 -0
- package/lib/domain/model/configuration/IFeesConfig.js +86 -0
- package/lib/domain/model/configuration/IPrinterTypeConfig.d.ts +25 -0
- package/lib/domain/model/configuration/IPrinterTypeConfig.js +3 -0
- package/lib/domain/model/configuration/IProductInquiryBehaviorsConfig.d.ts +8 -0
- package/lib/domain/model/configuration/IProductInquiryBehaviorsConfig.js +8 -0
- package/lib/domain/model/configuration/IReasonCodesConfig.d.ts +16 -0
- package/lib/domain/model/configuration/IReasonCodesConfig.js +3 -0
- package/lib/domain/model/configuration/IReceiptConfig.d.ts +64 -0
- package/lib/domain/model/configuration/IReceiptConfig.js +24 -0
- package/lib/domain/model/configuration/IReceiptFormattingConfig.d.ts +155 -0
- package/lib/domain/model/configuration/IReceiptFormattingConfig.js +27 -0
- package/lib/domain/model/configuration/IReceiptStylingConfig.d.ts +52 -0
- package/lib/domain/model/configuration/IReceiptStylingConfig.js +18 -0
- package/lib/domain/model/configuration/IReserveInventoryConfig.d.ts +4 -0
- package/lib/domain/model/configuration/IReserveInventoryConfig.js +8 -0
- package/lib/domain/model/configuration/ISelfCheckoutModeBehaviorsConfig.d.ts +14 -0
- package/lib/domain/model/configuration/ISelfCheckoutModeBehaviorsConfig.js +3 -0
- package/lib/domain/model/configuration/ISequenceConfig.d.ts +44 -0
- package/lib/domain/model/configuration/ISequenceConfig.js +26 -0
- package/lib/domain/model/configuration/IStoreOperationsBehavior.d.ts +7 -0
- package/lib/domain/model/configuration/IStoreOperationsBehavior.js +8 -0
- package/lib/domain/model/configuration/IStoreShippingMethodConfig.d.ts +21 -0
- package/lib/domain/model/configuration/IStoreShippingMethodConfig.js +3 -0
- package/lib/domain/model/configuration/ITaxBehaviorConfig.d.ts +14 -0
- package/lib/domain/model/configuration/ITaxBehaviorConfig.js +3 -0
- package/lib/domain/model/configuration/ITaxRefundConfig.d.ts +8 -0
- package/lib/domain/model/configuration/ITaxRefundConfig.js +3 -0
- package/lib/domain/model/configuration/ITendersConfig.d.ts +88 -0
- package/lib/domain/model/configuration/ITendersConfig.js +22 -0
- package/lib/domain/model/configuration/Ii18n.d.ts +4 -0
- package/lib/domain/model/configuration/Ii18n.js +3 -0
- package/lib/domain/model/configuration/TaxLottery.d.ts +4 -0
- package/lib/domain/model/configuration/TaxLottery.js +8 -0
- package/lib/domain/model/configuration/index.d.ts +30 -0
- package/lib/domain/model/configuration/index.js +25 -0
- package/lib/domain/model/customer/CreateCustomerLine.d.ts +151 -0
- package/lib/domain/model/customer/CreateCustomerLine.js +312 -0
- package/lib/domain/model/customer/CustomerLine.d.ts +43 -0
- package/lib/domain/model/customer/CustomerLine.js +109 -0
- package/lib/domain/model/customer/ICreateCustomerLine.d.ts +16 -0
- package/lib/domain/model/customer/ICreateCustomerLine.js +3 -0
- package/lib/domain/model/customer/ICustomerI18nFormats.d.ts +126 -0
- package/lib/domain/model/customer/ICustomerI18nFormats.js +67 -0
- package/lib/domain/model/customer/ICustomerLine.d.ts +8 -0
- package/lib/domain/model/customer/ICustomerLine.js +3 -0
- package/lib/domain/model/customer/ITaxCustomerLine.d.ts +46 -0
- package/lib/domain/model/customer/ITaxCustomerLine.js +3 -0
- package/lib/domain/model/customer/IUpdateCustomerLine.d.ts +30 -0
- package/lib/domain/model/customer/IUpdateCustomerLine.js +3 -0
- package/lib/domain/model/customer/TaxCustomerLine.d.ts +105 -0
- package/lib/domain/model/customer/TaxCustomerLine.js +252 -0
- package/lib/domain/model/customer/UpdateCustomerLine.d.ts +148 -0
- package/lib/domain/model/customer/UpdateCustomerLine.js +296 -0
- package/lib/domain/model/customer/index.d.ts +9 -0
- package/lib/domain/model/customer/index.js +11 -0
- package/lib/domain/model/digitalSignature/DigitalSignatureFailureLine.d.ts +11 -0
- package/lib/domain/model/digitalSignature/DigitalSignatureFailureLine.js +33 -0
- package/lib/domain/model/digitalSignature/index.d.ts +1 -0
- package/lib/domain/model/digitalSignature/index.js +7 -0
- package/lib/domain/model/discounts/BaseManualDiscountLine.d.ts +119 -0
- package/lib/domain/model/discounts/BaseManualDiscountLine.js +435 -0
- package/lib/domain/model/discounts/BaseManualDiscountLineDecorator.d.ts +42 -0
- package/lib/domain/model/discounts/BaseManualDiscountLineDecorator.js +107 -0
- package/lib/domain/model/discounts/BasePromotionCouponLine.d.ts +22 -0
- package/lib/domain/model/discounts/BasePromotionCouponLine.js +45 -0
- package/lib/domain/model/discounts/BasePromotionCouponLineDecorator.d.ts +15 -0
- package/lib/domain/model/discounts/BasePromotionCouponLineDecorator.js +38 -0
- package/lib/domain/model/discounts/ExpiredCouponOverrideLine.d.ts +27 -0
- package/lib/domain/model/discounts/ExpiredCouponOverrideLine.js +54 -0
- package/lib/domain/model/discounts/IManualDiscountLine.d.ts +33 -0
- package/lib/domain/model/discounts/IManualDiscountLine.js +3 -0
- package/lib/domain/model/discounts/IPromotionCouponLine.d.ts +10 -0
- package/lib/domain/model/discounts/IPromotionCouponLine.js +3 -0
- package/lib/domain/model/discounts/LoyaltyActivityDiscountLineTotalDecorator.d.ts +15 -0
- package/lib/domain/model/discounts/LoyaltyActivityDiscountLineTotalDecorator.js +32 -0
- package/lib/domain/model/discounts/LoyaltyDiscountLine.d.ts +52 -0
- package/lib/domain/model/discounts/LoyaltyDiscountLine.js +131 -0
- package/lib/domain/model/discounts/LoyaltyDiscountLineTotalDecorator.d.ts +26 -0
- package/lib/domain/model/discounts/LoyaltyDiscountLineTotalDecorator.js +66 -0
- package/lib/domain/model/discounts/ManualDiscountLineModificationDecorator.d.ts +49 -0
- package/lib/domain/model/discounts/ManualDiscountLineModificationDecorator.js +143 -0
- package/lib/domain/model/discounts/ManualDiscountLineTotalDecorator.d.ts +15 -0
- package/lib/domain/model/discounts/ManualDiscountLineTotalDecorator.js +32 -0
- package/lib/domain/model/discounts/ManualItemDiscountLine.d.ts +27 -0
- package/lib/domain/model/discounts/ManualItemDiscountLine.js +53 -0
- package/lib/domain/model/discounts/ManualTransactionDiscountLine.d.ts +22 -0
- package/lib/domain/model/discounts/ManualTransactionDiscountLine.js +40 -0
- package/lib/domain/model/discounts/ModifyManualDiscountLine.d.ts +29 -0
- package/lib/domain/model/discounts/ModifyManualDiscountLine.js +62 -0
- package/lib/domain/model/discounts/PromotionCouponLine.d.ts +22 -0
- package/lib/domain/model/discounts/PromotionCouponLine.js +59 -0
- package/lib/domain/model/discounts/VoidedDiscountLineDecorator.d.ts +15 -0
- package/lib/domain/model/discounts/VoidedDiscountLineDecorator.js +38 -0
- package/lib/domain/model/discounts/VoidedLoyaltyDiscountLineDecorator.d.ts +18 -0
- package/lib/domain/model/discounts/VoidedLoyaltyDiscountLineDecorator.js +46 -0
- package/lib/domain/model/discounts/VoidedPromotionCouponLineDecorator.d.ts +13 -0
- package/lib/domain/model/discounts/VoidedPromotionCouponLineDecorator.js +32 -0
- package/lib/domain/model/discounts/employee/EmployeeDiscountLine.d.ts +17 -0
- package/lib/domain/model/discounts/employee/EmployeeDiscountLine.js +43 -0
- package/lib/domain/model/discounts/employee/index.d.ts +1 -0
- package/lib/domain/model/discounts/employee/index.js +7 -0
- package/lib/domain/model/discounts/index.d.ts +19 -0
- package/lib/domain/model/discounts/index.js +23 -0
- package/lib/domain/model/discounts/lineTypes.d.ts +12 -0
- package/lib/domain/model/discounts/lineTypes.js +30 -0
- package/lib/domain/model/donation/BaseDonationLineDecorator.d.ts +16 -0
- package/lib/domain/model/donation/BaseDonationLineDecorator.js +38 -0
- package/lib/domain/model/donation/DonationLine.d.ts +43 -0
- package/lib/domain/model/donation/DonationLine.js +102 -0
- package/lib/domain/model/donation/IDonationLine.d.ts +9 -0
- package/lib/domain/model/donation/IDonationLine.js +3 -0
- package/lib/domain/model/donation/VoidedDonationLineDecorator.d.ts +17 -0
- package/lib/domain/model/donation/VoidedDonationLineDecorator.js +43 -0
- package/lib/domain/model/donation/index.d.ts +4 -0
- package/lib/domain/model/donation/index.js +9 -0
- package/lib/domain/model/employeeCustomer/BaseEmployeeCustomerLineDecorator.d.ts +13 -0
- package/lib/domain/model/employeeCustomer/BaseEmployeeCustomerLineDecorator.js +32 -0
- package/lib/domain/model/employeeCustomer/EmployeeCustomerLine.d.ts +39 -0
- package/lib/domain/model/employeeCustomer/EmployeeCustomerLine.js +98 -0
- package/lib/domain/model/employeeCustomer/IEmployeeCustomerLine.d.ts +8 -0
- package/lib/domain/model/employeeCustomer/IEmployeeCustomerLine.js +3 -0
- package/lib/domain/model/employeeCustomer/VoidedEmployeeCustomerLineDecorator.d.ts +15 -0
- package/lib/domain/model/employeeCustomer/VoidedEmployeeCustomerLineDecorator.js +38 -0
- package/lib/domain/model/employeeCustomer/index.d.ts +4 -0
- package/lib/domain/model/employeeCustomer/index.js +9 -0
- package/lib/domain/model/extensibilityForm/ExtensibilityFormDataLine.d.ts +26 -0
- package/lib/domain/model/extensibilityForm/ExtensibilityFormDataLine.js +74 -0
- package/lib/domain/model/extensibilityForm/IExtensibilityForm.d.ts +8 -0
- package/lib/domain/model/extensibilityForm/IExtensibilityForm.js +3 -0
- package/lib/domain/model/extensibilityForm/index.d.ts +2 -0
- package/lib/domain/model/extensibilityForm/index.js +7 -0
- package/lib/domain/model/fee/BaseFeeLineDecorator.d.ts +68 -0
- package/lib/domain/model/fee/BaseFeeLineDecorator.js +194 -0
- package/lib/domain/model/fee/FeeLine.d.ts +179 -0
- package/lib/domain/model/fee/FeeLine.js +660 -0
- package/lib/domain/model/fee/FeeLineBaseTaxAdjustmentDecorator.d.ts +18 -0
- package/lib/domain/model/fee/FeeLineBaseTaxAdjustmentDecorator.js +52 -0
- package/lib/domain/model/fee/FeeLineChangeQuantityDecorator.d.ts +14 -0
- package/lib/domain/model/fee/FeeLineChangeQuantityDecorator.js +35 -0
- package/lib/domain/model/fee/FeeLineExtendedAmountDecorator.d.ts +38 -0
- package/lib/domain/model/fee/FeeLineExtendedAmountDecorator.js +134 -0
- package/lib/domain/model/fee/FeeLineOriginalPricingAdjustmentDecorator.d.ts +22 -0
- package/lib/domain/model/fee/FeeLineOriginalPricingAdjustmentDecorator.js +82 -0
- package/lib/domain/model/fee/FeeLinePricingExtendedAmountDecorator.d.ts +22 -0
- package/lib/domain/model/fee/FeeLinePricingExtendedAmountDecorator.js +82 -0
- package/lib/domain/model/fee/FeeLineTaxExemptDecorator.d.ts +24 -0
- package/lib/domain/model/fee/FeeLineTaxExemptDecorator.js +67 -0
- package/lib/domain/model/fee/FeeLineTaxOverrideDecorator.d.ts +21 -0
- package/lib/domain/model/fee/FeeLineTaxOverrideDecorator.js +63 -0
- package/lib/domain/model/fee/FeeQuantityChangeLine.d.ts +19 -0
- package/lib/domain/model/fee/FeeQuantityChangeLine.js +52 -0
- package/lib/domain/model/fee/IFeeLine.d.ts +104 -0
- package/lib/domain/model/fee/IFeeLine.js +3 -0
- package/lib/domain/model/fee/VoidedFeeLineDecorator.d.ts +15 -0
- package/lib/domain/model/fee/VoidedFeeLineDecorator.js +38 -0
- package/lib/domain/model/fee/index.d.ts +12 -0
- package/lib/domain/model/fee/index.js +17 -0
- package/lib/domain/model/fiscalDevice/FiscalDeviceManagementLine.d.ts +34 -0
- package/lib/domain/model/fiscalDevice/FiscalDeviceManagementLine.js +69 -0
- package/lib/domain/model/fiscalDevice/FiscalDeviceManagementRetryLine.d.ts +15 -0
- package/lib/domain/model/fiscalDevice/FiscalDeviceManagementRetryLine.js +45 -0
- package/lib/domain/model/fiscalDevice/FiscalDeviceStatusLine.d.ts +35 -0
- package/lib/domain/model/fiscalDevice/FiscalDeviceStatusLine.js +87 -0
- package/lib/domain/model/fiscalDevice/index.d.ts +3 -0
- package/lib/domain/model/fiscalDevice/index.js +9 -0
- package/lib/domain/model/foreignCurrency/ExchangeRateManualEntryLine.d.ts +29 -0
- package/lib/domain/model/foreignCurrency/ExchangeRateManualEntryLine.js +67 -0
- package/lib/domain/model/foreignCurrency/index.d.ts +1 -0
- package/lib/domain/model/foreignCurrency/index.js +7 -0
- package/lib/domain/model/geoLocation.d.ts +23 -0
- package/lib/domain/model/geoLocation.js +3 -0
- package/lib/domain/model/giftCard/BalanceInquiryLine.d.ts +34 -0
- package/lib/domain/model/giftCard/BalanceInquiryLine.js +86 -0
- package/lib/domain/model/giftCard/index.d.ts +1 -0
- package/lib/domain/model/giftCard/index.js +7 -0
- package/lib/domain/model/index.d.ts +108 -0
- package/lib/domain/model/index.js +95 -0
- package/lib/domain/model/inventory/ReserveInventoryLine.d.ts +32 -0
- package/lib/domain/model/inventory/ReserveInventoryLine.js +76 -0
- package/lib/domain/model/inventory/index.d.ts +1 -0
- package/lib/domain/model/inventory/index.js +7 -0
- package/lib/domain/model/item/BaseItemLineDecorator.d.ts +148 -0
- package/lib/domain/model/item/BaseItemLineDecorator.js +400 -0
- package/lib/domain/model/item/BasePriceChangeLineDecorator.d.ts +20 -0
- package/lib/domain/model/item/BasePriceChangeLineDecorator.js +50 -0
- package/lib/domain/model/item/IAllLinePricingAdjustments.d.ts +32 -0
- package/lib/domain/model/item/IAllLinePricingAdjustments.js +66 -0
- package/lib/domain/model/item/IHardSoftStopItemInfo.d.ts +11 -0
- package/lib/domain/model/item/IHardSoftStopItemInfo.js +3 -0
- package/lib/domain/model/item/IItemLine.d.ts +313 -0
- package/lib/domain/model/item/IItemLine.js +7 -0
- package/lib/domain/model/item/ISerializedPriceCalculationResultsWithSource.d.ts +45 -0
- package/lib/domain/model/item/ISerializedPriceCalculationResultsWithSource.js +3 -0
- package/lib/domain/model/item/ItemLine.d.ts +303 -0
- package/lib/domain/model/item/ItemLine.js +1169 -0
- package/lib/domain/model/item/ItemLineBaseDiscountDecorator.d.ts +75 -0
- package/lib/domain/model/item/ItemLineBaseDiscountDecorator.js +178 -0
- package/lib/domain/model/item/ItemLineBaseTaxAdjustmentDecorator.d.ts +19 -0
- package/lib/domain/model/item/ItemLineBaseTaxAdjustmentDecorator.js +51 -0
- package/lib/domain/model/item/ItemLineCommentReceiptDecorator.d.ts +17 -0
- package/lib/domain/model/item/ItemLineCommentReceiptDecorator.js +40 -0
- package/lib/domain/model/item/ItemLineExtendedAmountDecorator.d.ts +30 -0
- package/lib/domain/model/item/ItemLineExtendedAmountDecorator.js +124 -0
- package/lib/domain/model/item/ItemLineExtensibilityFormDataDecorator.d.ts +18 -0
- package/lib/domain/model/item/ItemLineExtensibilityFormDataDecorator.js +43 -0
- package/lib/domain/model/item/ItemLineGiftIssueDecorator.d.ts +17 -0
- package/lib/domain/model/item/ItemLineGiftIssueDecorator.js +53 -0
- package/lib/domain/model/item/ItemLineGiftReceiptDecorator.d.ts +15 -0
- package/lib/domain/model/item/ItemLineGiftReceiptDecorator.js +37 -0
- package/lib/domain/model/item/ItemLineManualDiscountDecorator.d.ts +57 -0
- package/lib/domain/model/item/ItemLineManualDiscountDecorator.js +198 -0
- package/lib/domain/model/item/ItemLineNonFinancialRewardDecorator.d.ts +40 -0
- package/lib/domain/model/item/ItemLineNonFinancialRewardDecorator.js +116 -0
- package/lib/domain/model/item/ItemLineOriginalAdjustmentDecorator.d.ts +13 -0
- package/lib/domain/model/item/ItemLineOriginalAdjustmentDecorator.js +54 -0
- package/lib/domain/model/item/ItemLinePriceChangeDecorator.d.ts +18 -0
- package/lib/domain/model/item/ItemLinePriceChangeDecorator.js +47 -0
- package/lib/domain/model/item/ItemLinePromotionDecorator.d.ts +45 -0
- package/lib/domain/model/item/ItemLinePromotionDecorator.js +142 -0
- package/lib/domain/model/item/ItemLineQuantityChangeDecorator.d.ts +18 -0
- package/lib/domain/model/item/ItemLineQuantityChangeDecorator.js +57 -0
- package/lib/domain/model/item/ItemLineReasonCodeChangeDecorator.d.ts +16 -0
- package/lib/domain/model/item/ItemLineReasonCodeChangeDecorator.js +49 -0
- package/lib/domain/model/item/ItemLineRegularPriceDecorator.d.ts +21 -0
- package/lib/domain/model/item/ItemLineRegularPriceDecorator.js +58 -0
- package/lib/domain/model/item/ItemLineReserveInventoryDecorator.d.ts +17 -0
- package/lib/domain/model/item/ItemLineReserveInventoryDecorator.js +42 -0
- package/lib/domain/model/item/ItemLineRewardDecorator.d.ts +39 -0
- package/lib/domain/model/item/ItemLineRewardDecorator.js +115 -0
- package/lib/domain/model/item/ItemLineSalePriceDecorator.d.ts +19 -0
- package/lib/domain/model/item/ItemLineSalePriceDecorator.js +51 -0
- package/lib/domain/model/item/ItemLineSalespersonDecorator.d.ts +17 -0
- package/lib/domain/model/item/ItemLineSalespersonDecorator.js +44 -0
- package/lib/domain/model/item/ItemLineSendSaleDecorator.d.ts +16 -0
- package/lib/domain/model/item/ItemLineSendSaleDecorator.js +39 -0
- package/lib/domain/model/item/ItemLineSubscriptionDecorator.d.ts +17 -0
- package/lib/domain/model/item/ItemLineSubscriptionDecorator.js +40 -0
- package/lib/domain/model/item/ItemLineTaxExemptDecorator.d.ts +21 -0
- package/lib/domain/model/item/ItemLineTaxExemptDecorator.js +64 -0
- package/lib/domain/model/item/ItemLineTaxOverrideDecorator.d.ts +19 -0
- package/lib/domain/model/item/ItemLineTaxOverrideDecorator.js +59 -0
- package/lib/domain/model/item/ItemOrderCancellationLine.d.ts +27 -0
- package/lib/domain/model/item/ItemOrderCancellationLine.js +65 -0
- package/lib/domain/model/item/ItemPriceChangeLine.d.ts +44 -0
- package/lib/domain/model/item/ItemPriceChangeLine.js +131 -0
- package/lib/domain/model/item/ItemQuantityChangeLine.d.ts +31 -0
- package/lib/domain/model/item/ItemQuantityChangeLine.js +93 -0
- package/lib/domain/model/item/ReasonCodeChangeLine.d.ts +32 -0
- package/lib/domain/model/item/ReasonCodeChangeLine.js +83 -0
- package/lib/domain/model/item/ReservedOrderItemLineCancellationDecorator.d.ts +19 -0
- package/lib/domain/model/item/ReservedOrderItemLineCancellationDecorator.js +52 -0
- package/lib/domain/model/item/VoidedItemLineDecorator.d.ts +28 -0
- package/lib/domain/model/item/VoidedItemLineDecorator.js +65 -0
- package/lib/domain/model/item/VoidedPriceChangeLineDecorator.d.ts +15 -0
- package/lib/domain/model/item/VoidedPriceChangeLineDecorator.js +38 -0
- package/lib/domain/model/item/index.d.ts +37 -0
- package/lib/domain/model/item/index.js +41 -0
- package/lib/domain/model/lottery/TaxLotteryAddLine.d.ts +24 -0
- package/lib/domain/model/lottery/TaxLotteryAddLine.js +54 -0
- package/lib/domain/model/lottery/TaxLotteryModificationLine.d.ts +26 -0
- package/lib/domain/model/lottery/TaxLotteryModificationLine.js +61 -0
- package/lib/domain/model/lottery/TaxLotteryVoidLine.d.ts +28 -0
- package/lib/domain/model/lottery/TaxLotteryVoidLine.js +66 -0
- package/lib/domain/model/lottery/index.d.ts +3 -0
- package/lib/domain/model/lottery/index.js +9 -0
- package/lib/domain/model/loyaltyMembership/LoyaltyEnrollmentLine.d.ts +46 -0
- package/lib/domain/model/loyaltyMembership/LoyaltyEnrollmentLine.js +105 -0
- package/lib/domain/model/loyaltyMembership/LoyaltyMembershipLine.d.ts +34 -0
- package/lib/domain/model/loyaltyMembership/LoyaltyMembershipLine.js +117 -0
- package/lib/domain/model/loyaltyMembership/index.d.ts +2 -0
- package/lib/domain/model/loyaltyMembership/index.js +8 -0
- package/lib/domain/model/mixedBasket/IMixedBasket.d.ts +4 -0
- package/lib/domain/model/mixedBasket/IMixedBasket.js +3 -0
- package/lib/domain/model/mixedBasket/MixedBasketSession.d.ts +21 -0
- package/lib/domain/model/mixedBasket/MixedBasketSession.js +55 -0
- package/lib/domain/model/mixedBasket/index.d.ts +2 -0
- package/lib/domain/model/mixedBasket/index.js +7 -0
- package/lib/domain/model/noSale/NoSaleLine.d.ts +32 -0
- package/lib/domain/model/noSale/NoSaleLine.js +75 -0
- package/lib/domain/model/noSale/StartNoSaleLine.d.ts +33 -0
- package/lib/domain/model/noSale/StartNoSaleLine.js +75 -0
- package/lib/domain/model/noSale/index.d.ts +2 -0
- package/lib/domain/model/noSale/index.js +8 -0
- package/lib/domain/model/order/IOrderTotalsAccumulator.d.ts +23 -0
- package/lib/domain/model/order/IOrderTotalsAccumulator.js +3 -0
- package/lib/domain/model/order/OrderDeliveryAssignmentLine.d.ts +20 -0
- package/lib/domain/model/order/OrderDeliveryAssignmentLine.js +64 -0
- package/lib/domain/model/order/OrderItemReference.d.ts +5 -0
- package/lib/domain/model/order/OrderItemReference.js +3 -0
- package/lib/domain/model/order/OrderTotalsAccumulator.d.ts +39 -0
- package/lib/domain/model/order/OrderTotalsAccumulator.js +48 -0
- package/lib/domain/model/order/index.d.ts +4 -0
- package/lib/domain/model/order/index.js +8 -0
- package/lib/domain/model/paidOperation/PaidOperationLine.d.ts +23 -0
- package/lib/domain/model/paidOperation/PaidOperationLine.js +65 -0
- package/lib/domain/model/paidOperation/PaidOperationSignatureLine.d.ts +27 -0
- package/lib/domain/model/paidOperation/PaidOperationSignatureLine.js +58 -0
- package/lib/domain/model/paidOperation/StartPaidOperationLine.d.ts +34 -0
- package/lib/domain/model/paidOperation/StartPaidOperationLine.js +75 -0
- package/lib/domain/model/paidOperation/index.d.ts +3 -0
- package/lib/domain/model/paidOperation/index.js +9 -0
- package/lib/domain/model/paymentDevice/IUploadDeviceLogsLine.d.ts +6 -0
- package/lib/domain/model/paymentDevice/IUploadDeviceLogsLine.js +3 -0
- package/lib/domain/model/paymentDevice/UploadDeviceLogLine.d.ts +28 -0
- package/lib/domain/model/paymentDevice/UploadDeviceLogLine.js +57 -0
- package/lib/domain/model/paymentDevice/index.d.ts +1 -0
- package/lib/domain/model/paymentDevice/index.js +7 -0
- package/lib/domain/model/print/PrintStatusLine.d.ts +27 -0
- package/lib/domain/model/print/PrintStatusLine.js +55 -0
- package/lib/domain/model/print/index.d.ts +1 -0
- package/lib/domain/model/print/index.js +7 -0
- package/lib/domain/model/receipt/BaseReceiptLineDecorator.d.ts +49 -0
- package/lib/domain/model/receipt/BaseReceiptLineDecorator.js +115 -0
- package/lib/domain/model/receipt/FiscalReceiptLine.d.ts +63 -0
- package/lib/domain/model/receipt/FiscalReceiptLine.js +170 -0
- package/lib/domain/model/receipt/GiftReceiptLine.d.ts +17 -0
- package/lib/domain/model/receipt/GiftReceiptLine.js +51 -0
- package/lib/domain/model/receipt/IPrintRetryLine.d.ts +4 -0
- package/lib/domain/model/receipt/IPrintRetryLine.js +3 -0
- package/lib/domain/model/receipt/IReceiptLine.d.ts +37 -0
- package/lib/domain/model/receipt/IReceiptLine.js +3 -0
- package/lib/domain/model/receipt/IReceiptRefundMessage.d.ts +4 -0
- package/lib/domain/model/receipt/IReceiptRefundMessage.js +3 -0
- package/lib/domain/model/receipt/ItemCommentLine.d.ts +16 -0
- package/lib/domain/model/receipt/ItemCommentLine.js +50 -0
- package/lib/domain/model/receipt/PrintRetryLine.d.ts +14 -0
- package/lib/domain/model/receipt/PrintRetryLine.js +43 -0
- package/lib/domain/model/receipt/PrintRetryLineDecorator.d.ts +12 -0
- package/lib/domain/model/receipt/PrintRetryLineDecorator.js +28 -0
- package/lib/domain/model/receipt/PrinterStatusReceiptLineDecorator.d.ts +12 -0
- package/lib/domain/model/receipt/PrinterStatusReceiptLineDecorator.js +38 -0
- package/lib/domain/model/receipt/ReceiptDestinationReceiptLineDecorator.d.ts +18 -0
- package/lib/domain/model/receipt/ReceiptDestinationReceiptLineDecorator.js +44 -0
- package/lib/domain/model/receipt/ReceiptLine.d.ts +88 -0
- package/lib/domain/model/receipt/ReceiptLine.js +236 -0
- package/lib/domain/model/receipt/ReceiptOptionLine.d.ts +44 -0
- package/lib/domain/model/receipt/ReceiptOptionLine.js +107 -0
- package/lib/domain/model/receipt/index.d.ts +12 -0
- package/lib/domain/model/receipt/index.js +15 -0
- package/lib/domain/model/reprint/ReprintTransactionLine.d.ts +30 -0
- package/lib/domain/model/reprint/ReprintTransactionLine.js +64 -0
- package/lib/domain/model/reprint/index.d.ts +1 -0
- package/lib/domain/model/reprint/index.js +7 -0
- package/lib/domain/model/salesperson/SalespersonLine.d.ts +27 -0
- package/lib/domain/model/salesperson/SalespersonLine.js +60 -0
- package/lib/domain/model/salesperson/index.d.ts +1 -0
- package/lib/domain/model/salesperson/index.js +7 -0
- package/lib/domain/model/sendsale/SendSaleConversionLine.d.ts +25 -0
- package/lib/domain/model/sendsale/SendSaleConversionLine.js +50 -0
- package/lib/domain/model/sendsale/index.d.ts +1 -0
- package/lib/domain/model/sendsale/index.js +7 -0
- package/lib/domain/model/shipping/ShippingFeeChangeLine.d.ts +39 -0
- package/lib/domain/model/shipping/ShippingFeeChangeLine.js +95 -0
- package/lib/domain/model/shipping/ShippingFeeLineChangeDecorator.d.ts +26 -0
- package/lib/domain/model/shipping/ShippingFeeLineChangeDecorator.js +81 -0
- package/lib/domain/model/shipping/index.d.ts +2 -0
- package/lib/domain/model/shipping/index.js +8 -0
- package/lib/domain/model/subscription/AddSubscriptionLine.d.ts +31 -0
- package/lib/domain/model/subscription/AddSubscriptionLine.js +69 -0
- package/lib/domain/model/subscription/ModifySubscriptionLine.d.ts +31 -0
- package/lib/domain/model/subscription/ModifySubscriptionLine.js +69 -0
- package/lib/domain/model/subscription/RemoveSubscriptionLine.d.ts +25 -0
- package/lib/domain/model/subscription/RemoveSubscriptionLine.js +50 -0
- package/lib/domain/model/subscription/index.d.ts +3 -0
- package/lib/domain/model/subscription/index.js +9 -0
- package/lib/domain/model/supervisorOverride/ISupervisorCredentials.d.ts +4 -0
- package/lib/domain/model/supervisorOverride/ISupervisorCredentials.js +3 -0
- package/lib/domain/model/supervisorOverride/SupervisorOverrideLine.d.ts +24 -0
- package/lib/domain/model/supervisorOverride/SupervisorOverrideLine.js +51 -0
- package/lib/domain/model/supervisorOverride/index.d.ts +2 -0
- package/lib/domain/model/supervisorOverride/index.js +7 -0
- package/lib/domain/model/taxExempt/BaseTaxExemptLine.d.ts +53 -0
- package/lib/domain/model/taxExempt/BaseTaxExemptLine.js +187 -0
- package/lib/domain/model/taxExempt/BaseTaxExemptLineDecorator.d.ts +27 -0
- package/lib/domain/model/taxExempt/BaseTaxExemptLineDecorator.js +74 -0
- package/lib/domain/model/taxExempt/ITaxExemptLine.d.ts +22 -0
- package/lib/domain/model/taxExempt/ITaxExemptLine.js +3 -0
- package/lib/domain/model/taxExempt/ItemTaxExemptLine.d.ts +23 -0
- package/lib/domain/model/taxExempt/ItemTaxExemptLine.js +47 -0
- package/lib/domain/model/taxExempt/ItemTaxExemptLineModificationDecorator.d.ts +32 -0
- package/lib/domain/model/taxExempt/ItemTaxExemptLineModificationDecorator.js +91 -0
- package/lib/domain/model/taxExempt/ModifyItemTaxExemptLine.d.ts +28 -0
- package/lib/domain/model/taxExempt/ModifyItemTaxExemptLine.js +62 -0
- package/lib/domain/model/taxExempt/ModifyTransactionTaxExemptLine.d.ts +28 -0
- package/lib/domain/model/taxExempt/ModifyTransactionTaxExemptLine.js +62 -0
- package/lib/domain/model/taxExempt/TransactionTaxExemptLine.d.ts +23 -0
- package/lib/domain/model/taxExempt/TransactionTaxExemptLine.js +47 -0
- package/lib/domain/model/taxExempt/TransactionTaxExemptLineModificationDecorator.d.ts +32 -0
- package/lib/domain/model/taxExempt/TransactionTaxExemptLineModificationDecorator.js +93 -0
- package/lib/domain/model/taxExempt/VoidedItemTaxExemptLineDecorator.d.ts +15 -0
- package/lib/domain/model/taxExempt/VoidedItemTaxExemptLineDecorator.js +38 -0
- package/lib/domain/model/taxExempt/VoidedTransactionTaxExemptLineDecorator.d.ts +15 -0
- package/lib/domain/model/taxExempt/VoidedTransactionTaxExemptLineDecorator.js +38 -0
- package/lib/domain/model/taxExempt/index.d.ts +11 -0
- package/lib/domain/model/taxExempt/index.js +16 -0
- package/lib/domain/model/taxLottery/TaxLotteryLine.d.ts +24 -0
- package/lib/domain/model/taxLottery/TaxLotteryLine.js +49 -0
- package/lib/domain/model/taxLottery/index.d.ts +1 -0
- package/lib/domain/model/taxLottery/index.js +7 -0
- package/lib/domain/model/taxOverride/BaseTaxOverrideLine.d.ts +40 -0
- package/lib/domain/model/taxOverride/BaseTaxOverrideLine.js +153 -0
- package/lib/domain/model/taxOverride/BaseTaxOverrideLineDecorator.d.ts +21 -0
- package/lib/domain/model/taxOverride/BaseTaxOverrideLineDecorator.js +54 -0
- package/lib/domain/model/taxOverride/ITaxOverrideLine.d.ts +19 -0
- package/lib/domain/model/taxOverride/ITaxOverrideLine.js +3 -0
- package/lib/domain/model/taxOverride/ModifyTaxOverrideLine.d.ts +31 -0
- package/lib/domain/model/taxOverride/ModifyTaxOverrideLine.js +70 -0
- package/lib/domain/model/taxOverride/TaxOverrideLine.d.ts +15 -0
- package/lib/domain/model/taxOverride/TaxOverrideLine.js +49 -0
- package/lib/domain/model/taxOverride/TaxOverrideLineModificationDecorator.d.ts +14 -0
- package/lib/domain/model/taxOverride/TaxOverrideLineModificationDecorator.js +39 -0
- package/lib/domain/model/taxOverride/VoidedTaxOverrideLineDecorator.d.ts +15 -0
- package/lib/domain/model/taxOverride/VoidedTaxOverrideLineDecorator.js +38 -0
- package/lib/domain/model/taxOverride/index.d.ts +7 -0
- package/lib/domain/model/taxOverride/index.js +12 -0
- package/lib/domain/model/taxRecord/ITaxRecordLine.d.ts +90 -0
- package/lib/domain/model/taxRecord/ITaxRecordLine.js +3 -0
- package/lib/domain/model/taxRecord/TaxRecordLine.d.ts +67 -0
- package/lib/domain/model/taxRecord/TaxRecordLine.js +175 -0
- package/lib/domain/model/taxRecord/index.d.ts +2 -0
- package/lib/domain/model/taxRecord/index.js +7 -0
- package/lib/domain/model/taxRefund/ReprintTaxRefundLine.d.ts +30 -0
- package/lib/domain/model/taxRefund/ReprintTaxRefundLine.js +64 -0
- package/lib/domain/model/taxRefund/StartTaxRefundLine.d.ts +29 -0
- package/lib/domain/model/taxRefund/StartTaxRefundLine.js +62 -0
- package/lib/domain/model/taxRefund/TaxRefundInterfaces.d.ts +229 -0
- package/lib/domain/model/taxRefund/TaxRefundInterfaces.js +36 -0
- package/lib/domain/model/taxRefund/TaxRefundLine.d.ts +34 -0
- package/lib/domain/model/taxRefund/TaxRefundLine.js +73 -0
- package/lib/domain/model/taxRefund/TaxRefundSession.d.ts +84 -0
- package/lib/domain/model/taxRefund/TaxRefundSession.js +214 -0
- package/lib/domain/model/taxRefund/VoidTaxRefundLine.d.ts +30 -0
- package/lib/domain/model/taxRefund/VoidTaxRefundLine.js +71 -0
- package/lib/domain/model/taxRefund/index.d.ts +6 -0
- package/lib/domain/model/taxRefund/index.js +12 -0
- package/lib/domain/model/tender/BaseTenderLineDecorator.d.ts +47 -0
- package/lib/domain/model/tender/BaseTenderLineDecorator.js +110 -0
- package/lib/domain/model/tender/CancelSubscriptionTokenLine.d.ts +11 -0
- package/lib/domain/model/tender/CancelSubscriptionTokenLine.js +32 -0
- package/lib/domain/model/tender/ITenderLine.d.ts +45 -0
- package/lib/domain/model/tender/ITenderLine.js +3 -0
- package/lib/domain/model/tender/OfflineAuthorization.d.ts +17 -0
- package/lib/domain/model/tender/OfflineAuthorization.js +47 -0
- package/lib/domain/model/tender/RefundedTenderLineDecorator.d.ts +12 -0
- package/lib/domain/model/tender/RefundedTenderLineDecorator.js +42 -0
- package/lib/domain/model/tender/TenderAuthorizationStatusLine.d.ts +65 -0
- package/lib/domain/model/tender/TenderAuthorizationStatusLine.js +220 -0
- package/lib/domain/model/tender/TenderChangeCancelLine.d.ts +25 -0
- package/lib/domain/model/tender/TenderChangeCancelLine.js +51 -0
- package/lib/domain/model/tender/TenderLine.d.ts +113 -0
- package/lib/domain/model/tender/TenderLine.js +385 -0
- package/lib/domain/model/tender/TenderSignatureLine.d.ts +29 -0
- package/lib/domain/model/tender/TenderSignatureLine.js +66 -0
- package/lib/domain/model/tender/TenderTaxLineDecorator.d.ts +12 -0
- package/lib/domain/model/tender/TenderTaxLineDecorator.js +29 -0
- package/lib/domain/model/tender/TenderUtils.d.ts +9 -0
- package/lib/domain/model/tender/TenderUtils.js +43 -0
- package/lib/domain/model/tender/VoidedTenderLineDecorator.d.ts +13 -0
- package/lib/domain/model/tender/VoidedTenderLineDecorator.js +43 -0
- package/lib/domain/model/tender/exchange/StartTenderExchangeLine.d.ts +28 -0
- package/lib/domain/model/tender/exchange/StartTenderExchangeLine.js +56 -0
- package/lib/domain/model/tender/exchange/index.d.ts +1 -0
- package/lib/domain/model/tender/exchange/index.js +7 -0
- package/lib/domain/model/tender/index.d.ts +16 -0
- package/lib/domain/model/tender/index.js +21 -0
- package/lib/domain/model/tender/reversals/Interfaces.d.ts +25 -0
- package/lib/domain/model/tender/reversals/Interfaces.js +10 -0
- package/lib/domain/model/tender/reversals/index.d.ts +1 -0
- package/lib/domain/model/tender/reversals/index.js +7 -0
- package/lib/domain/model/tender/valueCard/Interfaces.d.ts +84 -0
- package/lib/domain/model/tender/valueCard/Interfaces.js +104 -0
- package/lib/domain/model/tender/valueCard/index.d.ts +1 -0
- package/lib/domain/model/tender/valueCard/index.js +7 -0
- package/lib/domain/model/tender/valueCertificate/Interfaces.d.ts +228 -0
- package/lib/domain/model/tender/valueCertificate/Interfaces.js +78 -0
- package/lib/domain/model/tender/valueCertificate/index.d.ts +1 -0
- package/lib/domain/model/tender/valueCertificate/index.js +7 -0
- package/lib/domain/model/terminal/FiscalPrinterAbortLineType.d.ts +21 -0
- package/lib/domain/model/terminal/FiscalPrinterAbortLineType.js +45 -0
- package/lib/domain/model/terminal/FiscalPrinterReportLineType.d.ts +34 -0
- package/lib/domain/model/terminal/FiscalPrinterReportLineType.js +85 -0
- package/lib/domain/model/terminal/FiscalPrinterStatusLineType.d.ts +24 -0
- package/lib/domain/model/terminal/FiscalPrinterStatusLineType.js +55 -0
- package/lib/domain/model/terminal/FiscalPrinterSyncLineType.d.ts +28 -0
- package/lib/domain/model/terminal/FiscalPrinterSyncLineType.js +67 -0
- package/lib/domain/model/terminal/TerminalStateChangeLine.d.ts +27 -0
- package/lib/domain/model/terminal/TerminalStateChangeLine.js +61 -0
- package/lib/domain/model/terminal/index.d.ts +5 -0
- package/lib/domain/model/terminal/index.js +11 -0
- package/lib/domain/model/till/StartTillLine.d.ts +58 -0
- package/lib/domain/model/till/StartTillLine.js +119 -0
- package/lib/domain/model/till/TenderTransferLine.d.ts +33 -0
- package/lib/domain/model/till/TenderTransferLine.js +140 -0
- package/lib/domain/model/till/TillAdjustmentLine.d.ts +21 -0
- package/lib/domain/model/till/TillAdjustmentLine.js +64 -0
- package/lib/domain/model/till/TillCountLine.d.ts +27 -0
- package/lib/domain/model/till/TillCountLine.js +96 -0
- package/lib/domain/model/till/TillFloatLine.d.ts +29 -0
- package/lib/domain/model/till/TillFloatLine.js +90 -0
- package/lib/domain/model/till/TillStateChangeLine.d.ts +26 -0
- package/lib/domain/model/till/TillStateChangeLine.js +78 -0
- package/lib/domain/model/till/index.d.ts +6 -0
- package/lib/domain/model/till/index.js +12 -0
- package/lib/domain/model/transaction/AttachmentLine.d.ts +17 -0
- package/lib/domain/model/transaction/AttachmentLine.js +45 -0
- package/lib/domain/model/transaction/CloseTransactionLine.d.ts +22 -0
- package/lib/domain/model/transaction/CloseTransactionLine.js +44 -0
- package/lib/domain/model/transaction/IPostVoidSearchResult.d.ts +7 -0
- package/lib/domain/model/transaction/IPostVoidSearchResult.js +4 -0
- package/lib/domain/model/transaction/RecordTransactionLine.d.ts +29 -0
- package/lib/domain/model/transaction/RecordTransactionLine.js +60 -0
- package/lib/domain/model/transaction/SignatureLine.d.ts +30 -0
- package/lib/domain/model/transaction/SignatureLine.js +67 -0
- package/lib/domain/model/transaction/SuspendTransactionLine.d.ts +24 -0
- package/lib/domain/model/transaction/SuspendTransactionLine.js +52 -0
- package/lib/domain/model/transaction/TotalTransactionLine.d.ts +26 -0
- package/lib/domain/model/transaction/TotalTransactionLine.js +55 -0
- package/lib/domain/model/transaction/TransactionResumeCompleteLine.d.ts +22 -0
- package/lib/domain/model/transaction/TransactionResumeCompleteLine.js +44 -0
- package/lib/domain/model/transaction/TransactionResumeStartLine.d.ts +25 -0
- package/lib/domain/model/transaction/TransactionResumeStartLine.js +55 -0
- package/lib/domain/model/transaction/TransactionReturnModeLine.d.ts +23 -0
- package/lib/domain/model/transaction/TransactionReturnModeLine.js +45 -0
- package/lib/domain/model/transaction/fiscal/FiscalTransactionLine.d.ts +27 -0
- package/lib/domain/model/transaction/fiscal/FiscalTransactionLine.js +61 -0
- package/lib/domain/model/transaction/fiscal/index.d.ts +1 -0
- package/lib/domain/model/transaction/fiscal/index.js +7 -0
- package/lib/domain/model/transaction/index.d.ts +12 -0
- package/lib/domain/model/transaction/index.js +18 -0
- package/lib/domain/model/transaction/order/ItemFulfillmentReferenceLine.d.ts +25 -0
- package/lib/domain/model/transaction/order/ItemFulfillmentReferenceLine.js +51 -0
- package/lib/domain/model/transaction/order/ItemPickupSignatureLine.d.ts +28 -0
- package/lib/domain/model/transaction/order/ItemPickupSignatureLine.js +63 -0
- package/lib/domain/model/transaction/order/OrderReferenceLine.d.ts +25 -0
- package/lib/domain/model/transaction/order/OrderReferenceLine.js +50 -0
- package/lib/domain/model/transaction/order/index.d.ts +3 -0
- package/lib/domain/model/transaction/order/index.js +9 -0
- package/lib/domain/model/user/AuthenticationFailedLine.d.ts +16 -0
- package/lib/domain/model/user/AuthenticationFailedLine.js +45 -0
- package/lib/domain/model/user/IPasswordExpiration.d.ts +4 -0
- package/lib/domain/model/user/IPasswordExpiration.js +3 -0
- package/lib/domain/model/user/PasswordExpiration.d.ts +10 -0
- package/lib/domain/model/user/PasswordExpiration.js +38 -0
- package/lib/domain/model/user/UserLine.d.ts +33 -0
- package/lib/domain/model/user/UserLine.js +84 -0
- package/lib/domain/model/user/index.d.ts +4 -0
- package/lib/domain/model/user/index.js +9 -0
- package/lib/domain/model/void/LineVoidLine.d.ts +50 -0
- package/lib/domain/model/void/LineVoidLine.js +158 -0
- package/lib/domain/model/void/TransactionVoidLine.d.ts +34 -0
- package/lib/domain/model/void/TransactionVoidLine.js +86 -0
- package/lib/domain/model/void/VoidedLineDecorator.d.ts +10 -0
- package/lib/domain/model/void/VoidedLineDecorator.js +40 -0
- package/lib/domain/model/void/index.d.ts +3 -0
- package/lib/domain/model/void/index.js +9 -0
- package/lib/domain/processing/PosBusinessAction.d.ts +9 -0
- package/lib/domain/processing/PosBusinessAction.js +55 -0
- package/lib/domain/processing/index.d.ts +1 -0
- package/lib/domain/processing/index.js +7 -0
- package/lib/domain/service/IReceiptFormattingService.d.ts +48 -0
- package/lib/domain/service/IReceiptFormattingService.js +3 -0
- package/lib/domain/service/ITransactionAccountingService.d.ts +6 -0
- package/lib/domain/service/ITransactionAccountingService.js +3 -0
- package/lib/domain/service/ITransactionReferenceFormatter.d.ts +4 -0
- package/lib/domain/service/ITransactionReferenceFormatter.js +3 -0
- package/lib/domain/service/index.d.ts +3 -0
- package/lib/domain/service/index.js +3 -0
- package/lib/domain/utility/index.d.ts +3 -0
- package/lib/domain/utility/index.js +9 -0
- package/lib/domain/utility/orderUtils.d.ts +6 -0
- package/lib/domain/utility/orderUtils.js +47 -0
- package/lib/domain/utility/supervisorOverride.d.ts +28 -0
- package/lib/domain/utility/supervisorOverride.js +298 -0
- package/lib/domain/utility/utils.d.ts +12 -0
- package/lib/domain/utility/utils.js +128 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -0
- package/package.json +194 -0
- package/types/es-symbol/index.d.ts +4 -0
|
@@ -0,0 +1,1317 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _ = require("lodash");
|
|
4
|
+
const I18n = require("i18n-js");
|
|
5
|
+
const scp_component_business_core_1 = require("@aptos-scp/scp-component-business-core");
|
|
6
|
+
const scp_component_logging_1 = require("@aptos-scp/scp-component-logging");
|
|
7
|
+
const scp_component_store_selling_core_1 = require("@aptos-scp/scp-component-store-selling-core");
|
|
8
|
+
const scp_types_commerce_devices_1 = require("@aptos-scp/scp-types-commerce-devices");
|
|
9
|
+
const scp_types_commerce_transaction_1 = require("@aptos-scp/scp-types-commerce-transaction");
|
|
10
|
+
const ITendersConfig_1 = require("./configuration/ITendersConfig");
|
|
11
|
+
const Constants_1 = require("./Constants");
|
|
12
|
+
const ItemLine_1 = require("./item/ItemLine");
|
|
13
|
+
const utility_1 = require("../utility");
|
|
14
|
+
const TenderHandlingSession_1 = require("./TenderHandlingSession");
|
|
15
|
+
const logger = scp_component_logging_1.LogManager.getLogger("com.aptos.storesellingfeatures.domain.model.tendertype");
|
|
16
|
+
const mapTenderTypeToI18nCode = new Map([
|
|
17
|
+
[scp_types_commerce_devices_1.TenderType.Credit, "tenderTypeCredit"],
|
|
18
|
+
[scp_types_commerce_devices_1.TenderType.Debit, "tenderTypeDebit"],
|
|
19
|
+
[scp_types_commerce_devices_1.TenderType.Cash, "tenderTypeCash"],
|
|
20
|
+
[scp_types_commerce_devices_1.TenderType.PaymentDevice, "tenderTypePaymentDevice"],
|
|
21
|
+
[scp_types_commerce_devices_1.TenderType.Gift, "tenderTypeGift"],
|
|
22
|
+
[scp_types_commerce_devices_1.TenderType.ValueCertificate, "tenderTypeValueCertificate"],
|
|
23
|
+
[scp_types_commerce_devices_1.TenderType.Wallet, "tenderTypeWallet"],
|
|
24
|
+
[scp_types_commerce_devices_1.TenderType.Unknown, "tenderTypeUnknown"],
|
|
25
|
+
]);
|
|
26
|
+
//
|
|
27
|
+
// Policies for each tender specifying when to capture a signature for the tender.
|
|
28
|
+
// Not meaningful for TenderAuthCategory.None
|
|
29
|
+
//
|
|
30
|
+
var TenderSignatureCapturePolicy;
|
|
31
|
+
(function (TenderSignatureCapturePolicy) {
|
|
32
|
+
TenderSignatureCapturePolicy["AuthResponseOnly"] = "AuthResponseOnly";
|
|
33
|
+
TenderSignatureCapturePolicy["ConfigurationOnly"] = "ConfigurationOnly";
|
|
34
|
+
TenderSignatureCapturePolicy["AuthResponseOrConfiguration"] = "AuthResponseOrConfiguration";
|
|
35
|
+
})(TenderSignatureCapturePolicy = exports.TenderSignatureCapturePolicy || (exports.TenderSignatureCapturePolicy = {}));
|
|
36
|
+
class TenderType {
|
|
37
|
+
constructor(id, tenderName, tenderTypeName, tenderAuthCategory, additionalTenderAuthCategories, cardType, signatureCapturePolicy, signatureCaptureFloorLimit, printDeclineTenderDetails, printDeclineTenderReceipt, printStoreTenderReceipt, allowPostVoid, allowCallForAuthorization, allowRefund, pluralTenderName, fiscalCode, fiscalType, tenderLabel, actions, overTenderRule, subType, customCardType, promptOnPartialApproval, pinRules, subscriptionEntryMethods, changeBehavior, isForeignTender, currencyCode, eligibleForTaxLottery, printVoidTenderDetails, printVoidTenderReceipt, cashoutThreshold) {
|
|
38
|
+
this._id = id;
|
|
39
|
+
this._tenderName = tenderName;
|
|
40
|
+
this._tenderTypeName = tenderTypeName;
|
|
41
|
+
this._tenderAuthCategory = tenderAuthCategory;
|
|
42
|
+
this._additionalTenderAuthCategories = additionalTenderAuthCategories;
|
|
43
|
+
this._cardType = cardType;
|
|
44
|
+
this._signatureCapturePolicy = signatureCapturePolicy;
|
|
45
|
+
this._signatureCaptureFloorLimit = signatureCaptureFloorLimit;
|
|
46
|
+
this._printDeclineTenderDetails = printDeclineTenderDetails;
|
|
47
|
+
this._printDeclineTenderReceipt = printDeclineTenderReceipt;
|
|
48
|
+
this._printStoreTenderReceipt = printStoreTenderReceipt;
|
|
49
|
+
this._allowPostVoid = allowPostVoid;
|
|
50
|
+
this._allowCallForAuthorization = allowCallForAuthorization;
|
|
51
|
+
this._allowRefund = allowRefund;
|
|
52
|
+
this._pluralTenderName = pluralTenderName;
|
|
53
|
+
this._fiscalCode = fiscalCode;
|
|
54
|
+
this._fiscalType = fiscalType;
|
|
55
|
+
this._tenderLabel = tenderLabel;
|
|
56
|
+
this._actions = actions;
|
|
57
|
+
this._overTenderRule = overTenderRule;
|
|
58
|
+
this._subType = subType;
|
|
59
|
+
this._customCardType = customCardType;
|
|
60
|
+
this._promptOnPartialApproval = promptOnPartialApproval;
|
|
61
|
+
this._pinRules = pinRules;
|
|
62
|
+
this._subscriptionEntryMethods = subscriptionEntryMethods;
|
|
63
|
+
this._changeBehavior = changeBehavior;
|
|
64
|
+
this._isForeignTender = isForeignTender;
|
|
65
|
+
this._currencyCode = currencyCode;
|
|
66
|
+
this._eligibleForTaxLottery = eligibleForTaxLottery;
|
|
67
|
+
this._printVoidTenderDetails = printVoidTenderDetails;
|
|
68
|
+
this._printVoidTenderReceipt = printVoidTenderReceipt;
|
|
69
|
+
this._cashoutThreshold = cashoutThreshold;
|
|
70
|
+
}
|
|
71
|
+
static getActiveConfiguredTenders(container, accountingCurrency) {
|
|
72
|
+
return TenderType.getActiveTenders(container, accountingCurrency, false, false, false, false);
|
|
73
|
+
}
|
|
74
|
+
static getActiveRefundConfiguredTenders(container, accountingCurrency, withTransaction, withOfflineTransaction) {
|
|
75
|
+
return TenderType.getActiveTenders(container, accountingCurrency, true, withTransaction, false, false, withOfflineTransaction);
|
|
76
|
+
}
|
|
77
|
+
static getActiveSuggestedRefundTenders(container, accountingCurrency, withMappedTender) {
|
|
78
|
+
return TenderType.getActiveTenders(container, accountingCurrency, true, true, true, withMappedTender);
|
|
79
|
+
}
|
|
80
|
+
static getActiveConfiguredTenderGroups(container, accountingCurrency, activeTenders) {
|
|
81
|
+
return TenderType.getActiveTenderGroupings(container, accountingCurrency, false, false, activeTenders);
|
|
82
|
+
}
|
|
83
|
+
static getActiveRefundConfiguredTenderGroups(container, accountingCurrency, withTransaction, activeTenders, originalTransactionsDetails, withOfflineTransaction) {
|
|
84
|
+
return TenderType.getActiveTenderGroupings(container, accountingCurrency, true, withTransaction, activeTenders, originalTransactionsDetails, withOfflineTransaction);
|
|
85
|
+
}
|
|
86
|
+
static getOriginalRefundableTenders(container, accountingCurrency, originalTransactionsDetails, balanceDue, itemTypes, orderTypes, isRefund, productAttributeTypes) {
|
|
87
|
+
var _a, _b, _c, _d;
|
|
88
|
+
const configurationManager = container.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
|
|
89
|
+
const suggestedRefundTenders = TenderType.getActiveSuggestedRefundTenders(container, accountingCurrency);
|
|
90
|
+
let originalRefundableTenders = [];
|
|
91
|
+
let originalReferencedTenders = [];
|
|
92
|
+
const originalUnreferencedAndMappedTenders = [];
|
|
93
|
+
(_a = originalTransactionsDetails) === null || _a === void 0 ? void 0 : _a.forEach((origTranDetail) => {
|
|
94
|
+
var _a;
|
|
95
|
+
if ((_a = origTranDetail.originalTenders) === null || _a === void 0 ? void 0 : _a.length) {
|
|
96
|
+
origTranDetail.originalTenders.forEach((originalTender) => {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
if (originalTender.refundAllowed) {
|
|
99
|
+
const configuredTransactionReferenceTender = (_a = suggestedRefundTenders) === null || _a === void 0 ? void 0 : _a.find((tender) => tender.id === originalTender.tenderId);
|
|
100
|
+
if (configuredTransactionReferenceTender) {
|
|
101
|
+
if (originalTender.showReference) {
|
|
102
|
+
originalReferencedTenders.push(originalTender);
|
|
103
|
+
}
|
|
104
|
+
else if (originalTender.tenderAuthCategory !== Constants_1.TenderAuthCategory.LoyaltyVoucherService) {
|
|
105
|
+
combineOriginalUnreferencedAndMappedTenders(originalTender, originalUnreferencedAndMappedTenders);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const configuredMappedTenders = getConfiguredMappedTenders(originalTender, configurationManager, origTranDetail.originalTransactionId, originalTransactionsDetails, balanceDue);
|
|
109
|
+
(_b = configuredMappedTenders) === null || _b === void 0 ? void 0 : _b.forEach((mappedTender) => {
|
|
110
|
+
combineOriginalUnreferencedAndMappedTenders(mappedTender, originalUnreferencedAndMappedTenders);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
originalReferencedTenders = sortOriginalTenders(originalReferencedTenders);
|
|
117
|
+
originalRefundableTenders = [...originalReferencedTenders, ...originalUnreferencedAndMappedTenders];
|
|
118
|
+
originalRefundableTenders.forEach((tender) => {
|
|
119
|
+
tender.refundableAmount = getOriginalTenderRefundableAmount(tender, balanceDue, originalTransactionsDetails);
|
|
120
|
+
});
|
|
121
|
+
//Check if original tender is restricted by item/order type
|
|
122
|
+
if ((((_b = itemTypes) === null || _b === void 0 ? void 0 : _b.length) > 0 || ((_c = orderTypes) === null || _c === void 0 ? void 0 : _c.length) > 0 || ((_d = productAttributeTypes) === null || _d === void 0 ? void 0 : _d.length) > 0) && !isRefund) {
|
|
123
|
+
originalRefundableTenders = getRefundableTendersByPaymentRestrictions(originalRefundableTenders, itemTypes, container, orderTypes, productAttributeTypes);
|
|
124
|
+
}
|
|
125
|
+
return originalRefundableTenders;
|
|
126
|
+
}
|
|
127
|
+
static getDefaultConfiguredTenderType(container, accountingCurrency) {
|
|
128
|
+
const configurationManager = container.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
|
|
129
|
+
const configuredTenders = configurationManager.getTendersValues().tenderDefinitions;
|
|
130
|
+
const defaultTenderId = configurationManager.getTendersValues().defaultTenderId;
|
|
131
|
+
const defaultConfiguredTender = configuredTenders.find((configuredTender) => configuredTender.tenderId === defaultTenderId);
|
|
132
|
+
return new TenderType(defaultConfiguredTender.tenderId, defaultConfiguredTender.tenderName, defaultConfiguredTender.tenderType, Constants_1.TenderAuthCategory[defaultConfiguredTender.tenderAuthCategory], scp_types_commerce_devices_1.CardType[defaultConfiguredTender.cardType], TenderSignatureCapturePolicy[defaultConfiguredTender.signatureCapturePolicy], defaultConfiguredTender.additionalTenderAuthCategories, defaultConfiguredTender.hasOwnProperty("signatureCaptureFloorLimit")
|
|
133
|
+
? new scp_component_business_core_1.Money(defaultConfiguredTender.signatureCaptureFloorLimit, accountingCurrency)
|
|
134
|
+
: undefined, defaultConfiguredTender.printDeclineTenderDetails, defaultConfiguredTender.printDeclineTenderReceipt, defaultConfiguredTender.printStoreTenderReceipt, defaultConfiguredTender.allowPostVoid, defaultConfiguredTender.allowCallForAuthorization !== false, defaultConfiguredTender.allowRefund, defaultConfiguredTender.pluralTenderName, defaultConfiguredTender.fiscalCode, defaultConfiguredTender.fiscalType, defaultConfiguredTender.tenderLabel, defaultConfiguredTender.actions, defaultConfiguredTender.overTenderRule, defaultConfiguredTender.subType, defaultConfiguredTender.pinRules, defaultConfiguredTender.subscriptionEntryMethods, defaultConfiguredTender.changeBehavior, defaultConfiguredTender.isForeignTender, defaultConfiguredTender.currencyCode, defaultConfiguredTender.eligibleForTaxLottery, defaultConfiguredTender.printVoidTenderDetails, defaultConfiguredTender.printVoidTenderReceipt);
|
|
135
|
+
}
|
|
136
|
+
static createFromJsonObject(tenderTypeFromJson) {
|
|
137
|
+
let tenderType = undefined;
|
|
138
|
+
if (tenderTypeFromJson) {
|
|
139
|
+
tenderType = new TenderType(tenderTypeFromJson._id, tenderTypeFromJson._tenderName, tenderTypeFromJson._tenderTypeName, Constants_1.TenderAuthCategory[tenderTypeFromJson._tenderAuthCategory], tenderTypeFromJson._additionalTenderAuthCategories, scp_types_commerce_devices_1.CardType[tenderTypeFromJson._cardType], TenderSignatureCapturePolicy[tenderTypeFromJson._signatureCapturePolicy], tenderTypeFromJson._signatureCaptureFloorLimit
|
|
140
|
+
? new scp_component_business_core_1.Money(tenderTypeFromJson._signatureCaptureFloorLimit)
|
|
141
|
+
: undefined, tenderTypeFromJson._printDeclineTenderDetails, tenderTypeFromJson._printDeclineTenderReceipt, tenderTypeFromJson._printStoreTenderReceipt, tenderTypeFromJson._allowPostVoid, tenderTypeFromJson._allowCallForAuthorization, tenderTypeFromJson._allowRefund, tenderTypeFromJson._pluralTenderName, tenderTypeFromJson._fiscalCode, tenderTypeFromJson._fiscalType, tenderTypeFromJson._tenderLabel, tenderTypeFromJson._actions, tenderTypeFromJson._overTenderRule, tenderTypeFromJson._subType, tenderTypeFromJson._customCardType, tenderTypeFromJson._promptOnPartialApproval, tenderTypeFromJson._pinRules, tenderTypeFromJson._subscriptionEntryMethods, tenderTypeFromJson._changeBehavior, tenderTypeFromJson._isForeignTender, tenderTypeFromJson._currencyCode, tenderTypeFromJson._eligibleForTaxLottery, tenderTypeFromJson._printVoidTenderDetails, tenderTypeFromJson._printVoidTenderReceipt, tenderTypeFromJson._cashoutThreshold ? new scp_component_business_core_1.Money(tenderTypeFromJson._cashoutThreshold) : undefined);
|
|
142
|
+
}
|
|
143
|
+
else if (tenderTypeFromJson === null) {
|
|
144
|
+
tenderType = null;
|
|
145
|
+
}
|
|
146
|
+
return tenderType;
|
|
147
|
+
}
|
|
148
|
+
signatureRequired(tenderAmount, authResponse) {
|
|
149
|
+
let sigRequired = false;
|
|
150
|
+
switch (this.signatureCapturePolicy) {
|
|
151
|
+
case TenderSignatureCapturePolicy.AuthResponseOnly:
|
|
152
|
+
sigRequired = authResponse.signatureRequired;
|
|
153
|
+
break;
|
|
154
|
+
case TenderSignatureCapturePolicy.ConfigurationOnly:
|
|
155
|
+
if (this.signatureCaptureFloorLimit) {
|
|
156
|
+
sigRequired = tenderAmount.gte(this.signatureCaptureFloorLimit);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
sigRequired = false;
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
case TenderSignatureCapturePolicy.AuthResponseOrConfiguration:
|
|
163
|
+
sigRequired =
|
|
164
|
+
authResponse.signatureRequired ||
|
|
165
|
+
!!(this.signatureCaptureFloorLimit && tenderAmount.gte(this.signatureCaptureFloorLimit));
|
|
166
|
+
break;
|
|
167
|
+
default:
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
return sigRequired;
|
|
171
|
+
}
|
|
172
|
+
getChangeTenderType(container, accountingCurrency, balanceDue, tenderAmount, authorizationFailed, changeDueAmount) {
|
|
173
|
+
var _a, _b, _c;
|
|
174
|
+
const validChangeTenderTypes = [];
|
|
175
|
+
if (this._changeBehavior) {
|
|
176
|
+
const changeDefinitions = getConfiguredChangeDefinitions(container);
|
|
177
|
+
const changeBehaviorDefinition = changeDefinitions && changeDefinitions[this._changeBehavior];
|
|
178
|
+
if ((_a = changeBehaviorDefinition) === null || _a === void 0 ? void 0 : _a.forfeitChange) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const changeTenderIds = getChangeTenderIdsByBehavior(this._changeBehavior, authorizationFailed, container, changeDueAmount || getChangeAmount(balanceDue, tenderAmount));
|
|
182
|
+
const activeTenders = TenderType.getActiveTenders(container, accountingCurrency, false, false, false, false);
|
|
183
|
+
if (changeTenderIds) {
|
|
184
|
+
(_b = _.uniq(changeTenderIds)) === null || _b === void 0 ? void 0 : _b.forEach((changeTenderId) => {
|
|
185
|
+
const changeTenderType = changeTenderId && activeTenders.find((aTender) => aTender.id === changeTenderId);
|
|
186
|
+
// We currently only support change to cash or store credit
|
|
187
|
+
// if other tenders were configured fallback on default behavior
|
|
188
|
+
if (changeTenderType &&
|
|
189
|
+
(changeTenderType.tenderTypeName === scp_types_commerce_devices_1.TenderType.Cash ||
|
|
190
|
+
(changeTenderType.tenderTypeName === scp_types_commerce_devices_1.TenderType.ValueCertificate &&
|
|
191
|
+
changeTenderType.tenderAuthCategory === Constants_1.TenderAuthCategory.StoredValueCertificateService) ||
|
|
192
|
+
changeTenderType.tenderTypeName === scp_types_commerce_devices_1.TenderType.Gift)) {
|
|
193
|
+
validChangeTenderTypes.push(changeTenderType);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (((_c = validChangeTenderTypes) === null || _c === void 0 ? void 0 : _c.length) === 0 && !authorizationFailed) {
|
|
199
|
+
if (this._tenderAuthCategory === Constants_1.TenderAuthCategory.None ||
|
|
200
|
+
this._tenderAuthCategory === Constants_1.TenderAuthCategory.GiftDevice ||
|
|
201
|
+
this._tenderAuthCategory === Constants_1.TenderAuthCategory.StoredValueCardService) {
|
|
202
|
+
const cashTenders = TenderType.getActiveCashTenders(TenderType.getActiveTenders(container, accountingCurrency, false, false, false, false));
|
|
203
|
+
return [(cashTenders && cashTenders[0]) || this];
|
|
204
|
+
}
|
|
205
|
+
return [this];
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
return validChangeTenderTypes;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
get id() {
|
|
212
|
+
return this._id;
|
|
213
|
+
}
|
|
214
|
+
get tenderName() {
|
|
215
|
+
return this._tenderName;
|
|
216
|
+
}
|
|
217
|
+
get eligibleForTaxLottery() {
|
|
218
|
+
return this._eligibleForTaxLottery;
|
|
219
|
+
}
|
|
220
|
+
get tenderTypeName() {
|
|
221
|
+
return this._tenderTypeName;
|
|
222
|
+
}
|
|
223
|
+
get tenderAuthCategory() {
|
|
224
|
+
return this._tenderAuthCategory;
|
|
225
|
+
}
|
|
226
|
+
get additionalTenderAuthCategories() {
|
|
227
|
+
return this._additionalTenderAuthCategories;
|
|
228
|
+
}
|
|
229
|
+
get cardType() {
|
|
230
|
+
return this._cardType;
|
|
231
|
+
}
|
|
232
|
+
get customCardType() {
|
|
233
|
+
return this._customCardType;
|
|
234
|
+
}
|
|
235
|
+
get tenderLabel() {
|
|
236
|
+
return this._tenderLabel;
|
|
237
|
+
}
|
|
238
|
+
get actions() {
|
|
239
|
+
return this._actions;
|
|
240
|
+
}
|
|
241
|
+
get printDeclineTenderDetails() {
|
|
242
|
+
return this._printDeclineTenderDetails;
|
|
243
|
+
}
|
|
244
|
+
get printDeclineTenderReceipt() {
|
|
245
|
+
return this._printDeclineTenderReceipt;
|
|
246
|
+
}
|
|
247
|
+
get printStoreTenderReceipt() {
|
|
248
|
+
return this._printStoreTenderReceipt;
|
|
249
|
+
}
|
|
250
|
+
get printVoidTenderDetails() {
|
|
251
|
+
return this._printVoidTenderDetails;
|
|
252
|
+
}
|
|
253
|
+
get printVoidTenderReceipt() {
|
|
254
|
+
return this._printVoidTenderReceipt;
|
|
255
|
+
}
|
|
256
|
+
get promptOnPartialApproval() {
|
|
257
|
+
return this._promptOnPartialApproval;
|
|
258
|
+
}
|
|
259
|
+
get signatureCaptureFloorLimit() {
|
|
260
|
+
return this._signatureCaptureFloorLimit;
|
|
261
|
+
}
|
|
262
|
+
get signatureCapturePolicy() {
|
|
263
|
+
return this._signatureCapturePolicy;
|
|
264
|
+
}
|
|
265
|
+
get requiresAuth() {
|
|
266
|
+
return this._tenderAuthCategory !== Constants_1.TenderAuthCategory.None;
|
|
267
|
+
}
|
|
268
|
+
get allowPostVoid() {
|
|
269
|
+
return this._allowPostVoid;
|
|
270
|
+
}
|
|
271
|
+
get overTenderRule() {
|
|
272
|
+
return this._overTenderRule;
|
|
273
|
+
}
|
|
274
|
+
get allowCallForAuthorization() {
|
|
275
|
+
return this._allowCallForAuthorization;
|
|
276
|
+
}
|
|
277
|
+
get allowRefund() {
|
|
278
|
+
return this._allowRefund;
|
|
279
|
+
}
|
|
280
|
+
get pluralTenderName() {
|
|
281
|
+
return this._pluralTenderName;
|
|
282
|
+
}
|
|
283
|
+
get fiscalCode() {
|
|
284
|
+
return this._fiscalCode;
|
|
285
|
+
}
|
|
286
|
+
get fiscalType() {
|
|
287
|
+
return this._fiscalType;
|
|
288
|
+
}
|
|
289
|
+
get subType() {
|
|
290
|
+
return this._subType;
|
|
291
|
+
}
|
|
292
|
+
get pinRules() {
|
|
293
|
+
return this._pinRules;
|
|
294
|
+
}
|
|
295
|
+
get changeBehavior() {
|
|
296
|
+
return this._changeBehavior;
|
|
297
|
+
}
|
|
298
|
+
get isForeignTender() {
|
|
299
|
+
return this._isForeignTender;
|
|
300
|
+
}
|
|
301
|
+
get currencyCode() {
|
|
302
|
+
return this._currencyCode;
|
|
303
|
+
}
|
|
304
|
+
get subscriptionEntryMethods() {
|
|
305
|
+
return this._subscriptionEntryMethods;
|
|
306
|
+
}
|
|
307
|
+
get cashoutThreshold() {
|
|
308
|
+
return this._cashoutThreshold;
|
|
309
|
+
}
|
|
310
|
+
static getActiveTenders(container, accountingCurrency, isRefund, withTransaction, withReference, withMappedTender, withOfflineTransaction) {
|
|
311
|
+
const configurationManager = container.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
|
|
312
|
+
const configuredTenders = configurationManager.getTendersValues().tenderDefinitions;
|
|
313
|
+
const activeTenders = configuredTenders
|
|
314
|
+
.filter((configuredTender) => tenderIsActive(configuredTender, isRefund, withTransaction, withReference, withMappedTender, withOfflineTransaction, accountingCurrency))
|
|
315
|
+
.map((configuredTender) => new TenderType(configuredTender.tenderId, configuredTender.tenderName, configuredTender.tenderType, Constants_1.TenderAuthCategory[configuredTender.tenderAuthCategory], configuredTender.additionalTenderAuthCategories, scp_types_commerce_devices_1.CardType[configuredTender.cardType], TenderSignatureCapturePolicy[configuredTender.signatureCapturePolicy], configuredTender.hasOwnProperty("signatureCaptureFloorLimit")
|
|
316
|
+
? new scp_component_business_core_1.Money(configuredTender.signatureCaptureFloorLimit, accountingCurrency)
|
|
317
|
+
: undefined, configuredTender.printDeclineTenderDetails, configuredTender.printDeclineTenderReceipt, configuredTender.printStoreTenderReceipt, configuredTender.allowPostVoid, configuredTender.allowCallForAuthorization !== false, configuredTender.allowRefund, configuredTender.pluralTenderName, configuredTender.fiscalCode, configuredTender.fiscalType, configuredTender.tenderLabel, configuredTender.actions, configuredTender.overTenderRule && Constants_1.OverTenderRule[configuredTender.overTenderRule], configuredTender.subType, configuredTender.customCardType, configuredTender.promptOnPartialApproval, configuredTender.pinRules, configuredTender.subscriptionEntryMethods, configuredTender.changeBehavior, configuredTender.isForeignTender, configuredTender.currencyCode, configuredTender.eligibleForTaxLottery, configuredTender.printVoidTenderDetails, configuredTender.printVoidTenderReceipt, configuredTender.hasOwnProperty("cashoutThreshold")
|
|
318
|
+
? new scp_component_business_core_1.Money(configuredTender.cashoutThreshold, accountingCurrency)
|
|
319
|
+
: undefined));
|
|
320
|
+
return activeTenders;
|
|
321
|
+
}
|
|
322
|
+
static filterActiveTenderIds(tenderIds, configuredTenders, isRefund, withTransaction, withOfflineTransaction, accountingCurrency) {
|
|
323
|
+
return (tenderIds &&
|
|
324
|
+
tenderIds.filter((tenderId) => {
|
|
325
|
+
const tenderDef = configuredTenders &&
|
|
326
|
+
configuredTenders.find((configuredTender) => {
|
|
327
|
+
return tenderId === configuredTender.tenderId;
|
|
328
|
+
});
|
|
329
|
+
return tenderIsActive(tenderDef, isRefund, withTransaction, false, false, withOfflineTransaction, accountingCurrency);
|
|
330
|
+
}));
|
|
331
|
+
}
|
|
332
|
+
static tenderAuthCategoryIsActive(tenderAuthCategory, configuredTenders, isRefund, withTransaction, withOfflineTransaction, accountingCurrency) {
|
|
333
|
+
//search configured tenders for tenderAuthCategory and check if active
|
|
334
|
+
const activeTenderDef = configuredTenders.find((configuredTender) => {
|
|
335
|
+
var _a;
|
|
336
|
+
return ((tenderAuthCategory === configuredTender.tenderAuthCategory || ((_a = configuredTender.additionalTenderAuthCategories) === null || _a === void 0 ? void 0 : _a.includes(tenderAuthCategory))) &&
|
|
337
|
+
tenderIsActive(configuredTender, isRefund, withTransaction, false, false, withOfflineTransaction, accountingCurrency));
|
|
338
|
+
});
|
|
339
|
+
return !!activeTenderDef;
|
|
340
|
+
}
|
|
341
|
+
static getActiveTenderGroupings(container, accountingCurrency, isRefund, withTransaction, activeTenders, originalTransactionsDetails, withOfflineTransaction) {
|
|
342
|
+
const configurationManager = container.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
|
|
343
|
+
const configuredTenderGroupings = configurationManager.getTendersUIValues().tenderGroupings;
|
|
344
|
+
return configuredTenderGroupings
|
|
345
|
+
? TenderType.getActiveTenderGroupsByTenderGroupingsConfig(container, accountingCurrency, isRefund, withTransaction, configuredTenderGroupings, originalTransactionsDetails, withOfflineTransaction)
|
|
346
|
+
: TenderType.getActiveTenderGroupsByTenders(filterOriginalTenders(activeTenders, originalTransactionsDetails), isRefund);
|
|
347
|
+
}
|
|
348
|
+
static getActiveTenderGroupsByTenderGroupingsConfig(container, accountingCurrency, isRefund, withTransaction, configuredTenderGroupings, originalTransactionsDetails, withOfflineTransaction) {
|
|
349
|
+
var _a;
|
|
350
|
+
const configurationManager = container.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
|
|
351
|
+
const configuredTenders = configurationManager.getTendersValues().tenderDefinitions;
|
|
352
|
+
const filteredConfiguredTenders = filterOriginalTenders(configuredTenders, originalTransactionsDetails);
|
|
353
|
+
const activeTendersGroups = (_a = configuredTenderGroupings) === null || _a === void 0 ? void 0 : _a.filter((configuredTenderGroup) => {
|
|
354
|
+
var _a;
|
|
355
|
+
if (configuredTenderGroup.hasOwnProperty("tenderIds")) {
|
|
356
|
+
//search configured tenders for id, filter out non active and return array if at least 1 is active
|
|
357
|
+
const activeTenders = TenderType.filterActiveTenderIds(configuredTenderGroup.tenderIds, filteredConfiguredTenders, isRefund, withTransaction, withOfflineTransaction, accountingCurrency);
|
|
358
|
+
return ((_a = activeTenders) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
359
|
+
}
|
|
360
|
+
else if (configuredTenderGroup.hasOwnProperty("tenderAuthCategory")) {
|
|
361
|
+
return TenderType.tenderAuthCategoryIsActive(configuredTenderGroup.tenderAuthCategory, filterOriginalTenders(configuredTenders, originalTransactionsDetails, true), isRefund, withTransaction, withOfflineTransaction, accountingCurrency);
|
|
362
|
+
}
|
|
363
|
+
}).map((configuredTenderGroup) => ({
|
|
364
|
+
tenderAuthCategory: configuredTenderGroup.tenderAuthCategory,
|
|
365
|
+
tenderIds: TenderType.filterActiveTenderIds(configuredTenderGroup.tenderIds, filteredConfiguredTenders, isRefund, withTransaction, withOfflineTransaction, accountingCurrency),
|
|
366
|
+
groupLabel: configuredTenderGroup.groupButtonText,
|
|
367
|
+
}));
|
|
368
|
+
return handleValueCertificateGroup(activeTendersGroups, filterOriginalTenders(configuredTenders, originalTransactionsDetails, true), isRefund, withTransaction, withOfflineTransaction, accountingCurrency);
|
|
369
|
+
}
|
|
370
|
+
static getActiveTenderGroupsByTenders(activeTenders, isRefund) {
|
|
371
|
+
var _a;
|
|
372
|
+
const cashTenders = TenderType.getActiveCashTenders(activeTenders);
|
|
373
|
+
const cashTenderId = cashTenders && cashTenders.length > 0 && cashTenders[0] && cashTenders[0].id;
|
|
374
|
+
const cashGroups = cashTenders
|
|
375
|
+
.filter((tender) => !tender.isForeignTender)
|
|
376
|
+
.map((cashTender) => TenderType.convertTenderTypeToGroup(cashTender));
|
|
377
|
+
const noneGroups = activeTenders
|
|
378
|
+
.filter((tender) => tender.tenderAuthCategory === Constants_1.TenderAuthCategory.None && tender.id !== cashTenderId)
|
|
379
|
+
.map((tender) => {
|
|
380
|
+
return TenderType.convertTenderTypeToGroup(tender);
|
|
381
|
+
});
|
|
382
|
+
const cardGroup = activeTenders.find((tender) => tender.tenderAuthCategory === Constants_1.TenderAuthCategory.PaymentDevice)
|
|
383
|
+
? [{ tenderAuthCategory: Constants_1.TenderAuthCategory.PaymentDevice }]
|
|
384
|
+
: [];
|
|
385
|
+
const ttpGroup = activeTenders.find((tender) => {
|
|
386
|
+
var _a;
|
|
387
|
+
return tender.tenderAuthCategory === Constants_1.TenderAuthCategory.TapToPayOnPOS || ((_a = tender.additionalTenderAuthCategories) === null || _a === void 0 ? void 0 : _a.includes(Constants_1.TenderAuthCategory.TapToPayOnPOS));
|
|
388
|
+
})
|
|
389
|
+
? [{ tenderAuthCategory: Constants_1.TenderAuthCategory.TapToPayOnPOS }]
|
|
390
|
+
: [];
|
|
391
|
+
const nonIntegratedGroup = activeTenders.find((tender) => tender.tenderAuthCategory === Constants_1.TenderAuthCategory.NonIntegratedDevice)
|
|
392
|
+
? [{ tenderAuthCategory: Constants_1.TenderAuthCategory.NonIntegratedDevice }]
|
|
393
|
+
: [];
|
|
394
|
+
let giftGroup = activeTenders.find((tender) => tender.tenderAuthCategory === Constants_1.TenderAuthCategory.GiftDevice)
|
|
395
|
+
? [{ tenderAuthCategory: Constants_1.TenderAuthCategory.GiftDevice }]
|
|
396
|
+
: [];
|
|
397
|
+
if (!(giftGroup && giftGroup.length > 0)) {
|
|
398
|
+
giftGroup = activeTenders.find((tender) => tender.tenderAuthCategory === Constants_1.TenderAuthCategory.StoredValueCardService)
|
|
399
|
+
? [{ tenderAuthCategory: Constants_1.TenderAuthCategory.StoredValueCardService }]
|
|
400
|
+
: [];
|
|
401
|
+
}
|
|
402
|
+
const valueCertificateGroup = ((_a = activeTenders
|
|
403
|
+
.filter((tender) => tender.tenderAuthCategory === Constants_1.TenderAuthCategory.StoredValueCertificateService)) === null || _a === void 0 ? void 0 : _a.map((certificateTender) => {
|
|
404
|
+
return {
|
|
405
|
+
tenderAuthCategory: Constants_1.TenderAuthCategory.StoredValueCertificateService,
|
|
406
|
+
groupLabel: { default: certificateTender.tenderName },
|
|
407
|
+
subType: certificateTender.subType,
|
|
408
|
+
tenderIds: [certificateTender.id],
|
|
409
|
+
};
|
|
410
|
+
})) || [];
|
|
411
|
+
const walletGroup = activeTenders.find((tender) => tender.tenderAuthCategory === Constants_1.TenderAuthCategory.Wallet)
|
|
412
|
+
? [{ tenderAuthCategory: Constants_1.TenderAuthCategory.Wallet }]
|
|
413
|
+
: [];
|
|
414
|
+
const loyaltyGroup = activeTenders.find((tender) => tender.tenderAuthCategory === Constants_1.TenderAuthCategory.LoyaltyVoucherService)
|
|
415
|
+
? [{ tenderAuthCategory: Constants_1.TenderAuthCategory.LoyaltyVoucherService }]
|
|
416
|
+
: [];
|
|
417
|
+
return [
|
|
418
|
+
...cashGroups,
|
|
419
|
+
...cardGroup,
|
|
420
|
+
...ttpGroup,
|
|
421
|
+
...nonIntegratedGroup,
|
|
422
|
+
...giftGroup,
|
|
423
|
+
...valueCertificateGroup,
|
|
424
|
+
...walletGroup,
|
|
425
|
+
...loyaltyGroup,
|
|
426
|
+
...noneGroups,
|
|
427
|
+
];
|
|
428
|
+
}
|
|
429
|
+
static convertTenderTypeToGroup(tender) {
|
|
430
|
+
return (tender && {
|
|
431
|
+
tenderAuthCategory: tender.tenderAuthCategory,
|
|
432
|
+
tenderIds: [tender.id],
|
|
433
|
+
groupLabel: tender.tenderLabel,
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
static getActiveCashTenders(activeTenders) {
|
|
437
|
+
return activeTenders.filter((aTender) => aTender.tenderTypeName === scp_types_commerce_devices_1.TenderType.Cash);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
exports.TenderType = TenderType;
|
|
441
|
+
function combineOriginalUnreferencedAndMappedTenders(tender, unreferencedAndMappedTenders) {
|
|
442
|
+
var _a;
|
|
443
|
+
const matchingUnreferencedTender = unreferencedAndMappedTenders.find((combinedTender) => (tender.tenderId && combinedTender.tenderId && combinedTender.tenderId === tender.tenderId) ||
|
|
444
|
+
//Cards and wallets will have different tenderIds
|
|
445
|
+
(tender.isMappedTender &&
|
|
446
|
+
combinedTender.isMappedTender &&
|
|
447
|
+
tender.tenderAuthCategory !== Constants_1.TenderAuthCategory.None &&
|
|
448
|
+
tender.tenderAuthCategory !== Constants_1.TenderAuthCategory.StoredValueCertificateService &&
|
|
449
|
+
tender.tenderType === combinedTender.tenderType));
|
|
450
|
+
if (matchingUnreferencedTender) {
|
|
451
|
+
if (tender.mappedOriginTenderId !== matchingUnreferencedTender.tenderId) {
|
|
452
|
+
matchingUnreferencedTender.refundedAmount = matchingUnreferencedTender.refundedAmount.plus(tender.refundedAmount);
|
|
453
|
+
matchingUnreferencedTender.previouslyRefundedAmount =
|
|
454
|
+
matchingUnreferencedTender.previouslyRefundedAmount.plus(tender.previouslyRefundedAmount);
|
|
455
|
+
matchingUnreferencedTender.originalTenderAmount = matchingUnreferencedTender.originalTenderAmount.plus(tender.originalTenderAmount);
|
|
456
|
+
}
|
|
457
|
+
if (matchingUnreferencedTender.adjustmentAmount &&
|
|
458
|
+
tender.adjustmentAmount &&
|
|
459
|
+
!_.isEqual(tender.originalTransactionReferences, matchingUnreferencedTender.originalTransactionReferences)) {
|
|
460
|
+
matchingUnreferencedTender.adjustmentAmount = matchingUnreferencedTender.adjustmentAmount.plus(tender.adjustmentAmount);
|
|
461
|
+
}
|
|
462
|
+
if (matchingUnreferencedTender.originalTransactionReferences) {
|
|
463
|
+
if (((_a = tender.originalTransactionReferences) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
464
|
+
tender.originalTransactionReferences.forEach((origTranRef) => {
|
|
465
|
+
const matchingTranReference = matchingUnreferencedTender.originalTransactionReferences.find((ref) => ref.transactionLineReference.transactionId ===
|
|
466
|
+
origTranRef.transactionLineReference.transactionId &&
|
|
467
|
+
ref.transactionLineReference.lineNumber === origTranRef.transactionLineReference.lineNumber);
|
|
468
|
+
if (matchingTranReference) {
|
|
469
|
+
matchingTranReference.refundableAmount = origTranRef.refundableAmount;
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
matchingUnreferencedTender.originalTransactionReferences.push(origTranRef);
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
matchingUnreferencedTender.originalTransactionReferences = tender.originalTransactionReferences;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
unreferencedAndMappedTenders.push(tender);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function getOriginalTenderRefundableAmount(originalTender, refundDue, originalTransactionDetails) {
|
|
486
|
+
var _a;
|
|
487
|
+
if (!originalTender) {
|
|
488
|
+
return undefined;
|
|
489
|
+
}
|
|
490
|
+
let refundableAmount = new scp_component_business_core_1.Money(0, refundDue.currency);
|
|
491
|
+
const mergedTransactionReferences = [];
|
|
492
|
+
if (((_a = originalTender.originalTransactionReferences) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
493
|
+
originalTender.originalTransactionReferences.forEach((ref) => {
|
|
494
|
+
const matchingRef = mergedTransactionReferences.find((matching) => matching.transactionLineReference.transactionId === ref.transactionLineReference.transactionId);
|
|
495
|
+
if (matchingRef) {
|
|
496
|
+
matchingRef.refundableAmount = matchingRef.refundableAmount.plus(ref.refundableAmount);
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
mergedTransactionReferences.push(Object.assign({}, ref));
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
mergedTransactionReferences.forEach((origTranRef) => {
|
|
503
|
+
var _a, _b;
|
|
504
|
+
const originalTenderReferenceTranId = (_a = origTranRef.transactionLineReference) === null || _a === void 0 ? void 0 : _a.transactionId;
|
|
505
|
+
const originalTran = (_b = originalTransactionDetails) === null || _b === void 0 ? void 0 : _b.find((origTran) => origTran.originalTransactionId === originalTenderReferenceTranId);
|
|
506
|
+
if (refundDue) {
|
|
507
|
+
const returnTotalAmount = getReturnOrCancelTotalAmount(originalTran);
|
|
508
|
+
// If transaction was partially returned, tranRef.refundableAmount will have the full original tender amount, default to the partial return total amount
|
|
509
|
+
const originalTenderAmount = getLowestRefundDue(undefined, returnTotalAmount, adjustAmount(origTranRef.refundableAmount, originalTender.adjustmentAmount));
|
|
510
|
+
// Mapped tenders will only use their transaction references for refund amount calculation, if they have been fully tendered,
|
|
511
|
+
// they will not have transaction references, do not subtract refunded amount
|
|
512
|
+
const currentTranRefundableAmount = calculateRefundableAmount(originalTenderAmount, originalTender.isMappedTender ? undefined : originalTender.refundedAmount, returnTotalAmount, refundDue);
|
|
513
|
+
// Multi receipt transactions with the same mapped tender will have have multiple transaction references, refundDue will be the total
|
|
514
|
+
// of the current transaction, returnTotal amount is the original total of the individual transactions. Do not allow refundable amount
|
|
515
|
+
// to be greater than the refundDue, do not account for the individual original totals here or the amounts won't be combined
|
|
516
|
+
refundableAmount = getLowestRefundDue(refundableAmount.plus(currentTranRefundableAmount), undefined, refundDue);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
return originalTender.isMappedTender
|
|
521
|
+
? refundableAmount
|
|
522
|
+
: (refundableAmount.ne(new scp_component_business_core_1.Money(0, refundDue.currency)) && refundableAmount) ||
|
|
523
|
+
originalTender.refundedAmount;
|
|
524
|
+
}
|
|
525
|
+
function getLowestRefundDue(refundDue, returnTotalAmount, remainingTenderAmount) {
|
|
526
|
+
const lowestRefundDue = returnTotalAmount && refundDue && returnTotalAmount.gt(refundDue)
|
|
527
|
+
? refundDue
|
|
528
|
+
: returnTotalAmount || refundDue;
|
|
529
|
+
return ((remainingTenderAmount && lowestRefundDue && remainingTenderAmount.gt(lowestRefundDue)
|
|
530
|
+
? lowestRefundDue
|
|
531
|
+
: remainingTenderAmount) || lowestRefundDue);
|
|
532
|
+
}
|
|
533
|
+
function calculateRefundableAmount(originalTenderAmount, refundedAmount, returnTotalAmount, refundDue) {
|
|
534
|
+
const remainingTenderAmount = (refundedAmount && originalTenderAmount && originalTenderAmount.minus(refundedAmount)) ||
|
|
535
|
+
originalTenderAmount;
|
|
536
|
+
return getLowestRefundDue(refundDue, returnTotalAmount, remainingTenderAmount);
|
|
537
|
+
}
|
|
538
|
+
function getConfiguredMappedTenders(originalTender, configurationManager, transactionId, originalTransactions, refundDue) {
|
|
539
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
540
|
+
const mappedTenders = [];
|
|
541
|
+
const tenderConfig = (_a = configurationManager) === null || _a === void 0 ? void 0 : _a.getTendersValues();
|
|
542
|
+
const tenderTypeBehaviors = (_c = (_b = tenderConfig) === null || _b === void 0 ? void 0 : _b.tenderBehaviors) === null || _c === void 0 ? void 0 : _c.tenderTypeBehaviors;
|
|
543
|
+
const tenderDefinitions = (_d = tenderConfig) === null || _d === void 0 ? void 0 : _d.tenderDefinitions;
|
|
544
|
+
const configuredTender = (_e = tenderDefinitions) === null || _e === void 0 ? void 0 : _e.find((tender) => tender.tenderId === originalTender.tenderId);
|
|
545
|
+
const tenderTypeBehavior = configuredTender && tenderTypeBehaviors && tenderTypeBehaviors[configuredTender.tenderType];
|
|
546
|
+
const refundTenderTypes = (_f = tenderTypeBehavior) === null || _f === void 0 ? void 0 : _f.refundTenderTypes;
|
|
547
|
+
const mappedTenderTypeNames = refundTenderTypes &&
|
|
548
|
+
Object.keys(refundTenderTypes).filter((tenderType) => {
|
|
549
|
+
const mappedRefundTenderType = refundTenderTypes[tenderType];
|
|
550
|
+
return (mappedRefundTenderType &&
|
|
551
|
+
(!mappedRefundTenderType.hasOwnProperty("allowed") || mappedRefundTenderType["allowed"] === true) &&
|
|
552
|
+
allowMappedTender(tenderType, tenderConfig) &&
|
|
553
|
+
isOriginalTenderAmountAllowed(originalTender, mappedRefundTenderType, originalTransactions, refundDue));
|
|
554
|
+
});
|
|
555
|
+
(_g = mappedTenderTypeNames) === null || _g === void 0 ? void 0 : _g.forEach((tenderType) => {
|
|
556
|
+
var _a;
|
|
557
|
+
// For TenderAuthCategory: None tenders and Value certificate tenders need to have a tenderId, so we'll have one mapped tender for each
|
|
558
|
+
// of those tenders.
|
|
559
|
+
const tenderDefs = tenderDefinitions.filter((tenderDef) => {
|
|
560
|
+
var _a;
|
|
561
|
+
return tenderDef.tenderType === tenderType &&
|
|
562
|
+
((_a = tenderDef.allowRefund) === null || _a === void 0 ? void 0 : _a.indexOf("WhenMapped")) > -1 &&
|
|
563
|
+
(tenderDef.tenderAuthCategory === Constants_1.TenderAuthCategory.None ||
|
|
564
|
+
tenderDef.tenderAuthCategory === Constants_1.TenderAuthCategory.StoredValueCertificateService ||
|
|
565
|
+
tenderDef.tenderAuthCategory === Constants_1.TenderAuthCategory.GiftDevice);
|
|
566
|
+
});
|
|
567
|
+
if ((_a = tenderDefs) === null || _a === void 0 ? void 0 : _a.length) {
|
|
568
|
+
tenderDefs.forEach((tenderDef) => {
|
|
569
|
+
const label = tenderDef.tenderType === scp_types_commerce_devices_1.TenderType.Cash
|
|
570
|
+
? I18n.t(mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderDef.tenderName })
|
|
571
|
+
: (tenderDef.tenderLabel &&
|
|
572
|
+
I18n.t(tenderDef.tenderLabel.i18nCode, {
|
|
573
|
+
defaultValue: tenderDef.tenderLabel.default,
|
|
574
|
+
})) ||
|
|
575
|
+
tenderDef.tenderName;
|
|
576
|
+
mappedTenders.push(buildMappedOriginalTender(originalTender, label, tenderDef.tenderType, tenderDef.tenderId, tenderDef.tenderAuthCategory, transactionId, originalTransactions, tenderDef.subType));
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
const tenderName = I18n.t(mapTenderTypeToI18nCode.get(tenderType), { defaultValue: tenderType });
|
|
581
|
+
mappedTenders.push(buildMappedOriginalTender(originalTender, tenderName, tenderType, undefined, getTenderAuthCategoryFromTenderType(tenderType), transactionId, originalTransactions, undefined));
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
return mappedTenders;
|
|
585
|
+
}
|
|
586
|
+
function getActiveTendersByConfiguredPaymentRestrictions(activeTenderTypes, saleItemTypes, diContainer, orderTypes, productAttributeTypes) {
|
|
587
|
+
let nonRestrictedTenderTypes = [];
|
|
588
|
+
let restrictedTenderTypes = [];
|
|
589
|
+
activeTenderTypes.forEach((activeTenderType) => {
|
|
590
|
+
var _a, _b, _c, _d, _e, _f;
|
|
591
|
+
if (!isRestrictedTenderType(restrictedTenderTypes, activeTenderType)) {
|
|
592
|
+
const paymentRestrictionBehaviors = getPaymentRestrictionBehaviors(diContainer, activeTenderType.tenderTypeName);
|
|
593
|
+
//ignore paymentRestrictions for credit/debit tenders
|
|
594
|
+
if (paymentRestrictionBehaviors && !isCreditDebitTenderType(activeTenderType.tenderTypeName)) {
|
|
595
|
+
const configuredItemTypePaymentRestrictions = paymentRestrictionBehaviors.itemType;
|
|
596
|
+
const configuredOrderTypePaymentRestrictions = paymentRestrictionBehaviors.orderType;
|
|
597
|
+
const configuredItemAttributePaymentRestrictions = paymentRestrictionBehaviors.itemAttribute;
|
|
598
|
+
if (((_a = configuredItemTypePaymentRestrictions) === null || _a === void 0 ? void 0 : _a.length) > 0 ||
|
|
599
|
+
((_b = configuredOrderTypePaymentRestrictions) === null || _b === void 0 ? void 0 : _b.length) > 0 ||
|
|
600
|
+
((_c = configuredItemAttributePaymentRestrictions) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
601
|
+
(_d = configuredItemTypePaymentRestrictions) === null || _d === void 0 ? void 0 : _d.map((itemType) => {
|
|
602
|
+
var _a;
|
|
603
|
+
const restrictedItemType = (_a = saleItemTypes) === null || _a === void 0 ? void 0 : _a.find((item) => item === itemType);
|
|
604
|
+
if (restrictedItemType && !isRestrictedTenderType(restrictedTenderTypes, activeTenderType)) {
|
|
605
|
+
restrictedTenderTypes.push(activeTenderType);
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
(_e = configuredOrderTypePaymentRestrictions) === null || _e === void 0 ? void 0 : _e.map((orderType) => {
|
|
609
|
+
var _a;
|
|
610
|
+
const restrictedOrderType = (_a = orderTypes) === null || _a === void 0 ? void 0 : _a.find((item) => item === orderType);
|
|
611
|
+
if (restrictedOrderType && !isRestrictedTenderType(restrictedTenderTypes, activeTenderType)) {
|
|
612
|
+
restrictedTenderTypes.push(activeTenderType);
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
(_f = configuredItemAttributePaymentRestrictions) === null || _f === void 0 ? void 0 : _f.map((itemAttribute) => {
|
|
616
|
+
var _a;
|
|
617
|
+
const restrictedItemAttribute = (_a = productAttributeTypes) === null || _a === void 0 ? void 0 : _a.find((item) => item === itemAttribute);
|
|
618
|
+
if (restrictedItemAttribute && !isRestrictedTenderType(restrictedTenderTypes, activeTenderType)) {
|
|
619
|
+
restrictedTenderTypes.push(activeTenderType);
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
if (!isRestrictedTenderType(restrictedTenderTypes, activeTenderType)) {
|
|
623
|
+
nonRestrictedTenderTypes.push(activeTenderType);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
nonRestrictedTenderTypes.push(activeTenderType);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
nonRestrictedTenderTypes.push(activeTenderType);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
if (nonRestrictedTenderTypes.length > 0) {
|
|
636
|
+
return nonRestrictedTenderTypes;
|
|
637
|
+
}
|
|
638
|
+
return activeTenderTypes;
|
|
639
|
+
}
|
|
640
|
+
exports.getActiveTendersByConfiguredPaymentRestrictions = getActiveTendersByConfiguredPaymentRestrictions;
|
|
641
|
+
function isCreditDebitTenderType(tenderTypeName) {
|
|
642
|
+
return tenderTypeName === "Credit" || tenderTypeName === "Debit";
|
|
643
|
+
}
|
|
644
|
+
function isRestrictedTenderType(restrictedTenderTypes, activeTenderType) {
|
|
645
|
+
var _a;
|
|
646
|
+
return !!(((_a = restrictedTenderTypes) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
647
|
+
restrictedTenderTypes.find((restrictedTenderType) => restrictedTenderType.tenderTypeName === activeTenderType.tenderTypeName));
|
|
648
|
+
}
|
|
649
|
+
function isOriginalRefundableTenderTypeRestricted(restrictedTenders, originalRefundableTender) {
|
|
650
|
+
var _a;
|
|
651
|
+
return !!(((_a = restrictedTenders) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
652
|
+
restrictedTenders.find((restrictedTender) => restrictedTender.tenderType === originalRefundableTender.tenderType));
|
|
653
|
+
}
|
|
654
|
+
function getRefundableTendersByPaymentRestrictions(originalRefundableTenders, saleItemTypes, diContainer, orderTypes, productAttributeTypes) {
|
|
655
|
+
let nonRestrictedTenders = [];
|
|
656
|
+
let restrictedTenders = [];
|
|
657
|
+
originalRefundableTenders.forEach((originalRefundableTender) => {
|
|
658
|
+
var _a, _b, _c, _d, _e, _f;
|
|
659
|
+
if (!isOriginalRefundableTenderTypeRestricted(restrictedTenders, originalRefundableTender)) {
|
|
660
|
+
const paymentRestrictionBehaviors = originalRefundableTender.tenderType &&
|
|
661
|
+
getPaymentRestrictionBehaviors(diContainer, originalRefundableTender.tenderType.toString());
|
|
662
|
+
if (paymentRestrictionBehaviors &&
|
|
663
|
+
!isCreditDebitTenderType(originalRefundableTender.tenderType.toString())) {
|
|
664
|
+
const configuredItemTypePaymentRestrictions = paymentRestrictionBehaviors.itemType;
|
|
665
|
+
const configuredOrderTypePaymentRestrictions = paymentRestrictionBehaviors.orderType;
|
|
666
|
+
const configuredItemAttributePaymentRestrictions = paymentRestrictionBehaviors.itemAttribute;
|
|
667
|
+
if (((_a = configuredItemTypePaymentRestrictions) === null || _a === void 0 ? void 0 : _a.length) > 0 ||
|
|
668
|
+
((_b = configuredOrderTypePaymentRestrictions) === null || _b === void 0 ? void 0 : _b.length) > 0 ||
|
|
669
|
+
((_c = configuredItemAttributePaymentRestrictions) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
670
|
+
(_d = configuredItemTypePaymentRestrictions) === null || _d === void 0 ? void 0 : _d.map((itemType) => {
|
|
671
|
+
var _a;
|
|
672
|
+
const restrictedItemType = (_a = saleItemTypes) === null || _a === void 0 ? void 0 : _a.find((item) => item === itemType);
|
|
673
|
+
if (restrictedItemType &&
|
|
674
|
+
!isOriginalRefundableTenderTypeRestricted(restrictedTenders, originalRefundableTender)) {
|
|
675
|
+
restrictedTenders.push(originalRefundableTender);
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
(_e = configuredOrderTypePaymentRestrictions) === null || _e === void 0 ? void 0 : _e.map((orderType) => {
|
|
679
|
+
var _a;
|
|
680
|
+
const restrictedOrderType = (_a = orderTypes) === null || _a === void 0 ? void 0 : _a.find((item) => item === orderType);
|
|
681
|
+
if (restrictedOrderType &&
|
|
682
|
+
!isOriginalRefundableTenderTypeRestricted(restrictedTenders, originalRefundableTender)) {
|
|
683
|
+
restrictedTenders.push(originalRefundableTender);
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
(_f = configuredItemAttributePaymentRestrictions) === null || _f === void 0 ? void 0 : _f.map((itemAttribute) => {
|
|
687
|
+
var _a;
|
|
688
|
+
const restrictedItemAttribute = (_a = productAttributeTypes) === null || _a === void 0 ? void 0 : _a.find((item) => item === itemAttribute);
|
|
689
|
+
if (restrictedItemAttribute &&
|
|
690
|
+
!isOriginalRefundableTenderTypeRestricted(restrictedTenders, originalRefundableTender)) {
|
|
691
|
+
restrictedTenders.push(originalRefundableTender);
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
if (!isOriginalRefundableTenderTypeRestricted(restrictedTenders, originalRefundableTender)) {
|
|
695
|
+
nonRestrictedTenders.push(originalRefundableTender);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
nonRestrictedTenders.push(originalRefundableTender);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
nonRestrictedTenders.push(originalRefundableTender);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
if (nonRestrictedTenders.length > 0) {
|
|
708
|
+
return nonRestrictedTenders;
|
|
709
|
+
}
|
|
710
|
+
return originalRefundableTenders;
|
|
711
|
+
}
|
|
712
|
+
exports.getRefundableTendersByPaymentRestrictions = getRefundableTendersByPaymentRestrictions;
|
|
713
|
+
function getSaleItemTypes(transaction) {
|
|
714
|
+
var _a;
|
|
715
|
+
const saleItemTypes = [];
|
|
716
|
+
(_a = transaction.lines) === null || _a === void 0 ? void 0 : _a.forEach((line) => {
|
|
717
|
+
if ((ItemLine_1.isItemLine(line) && !line.voided && line.lineType === scp_types_commerce_transaction_1.LineType.ItemSale) ||
|
|
718
|
+
line.lineType === scp_types_commerce_transaction_1.LineType.ItemOrder) {
|
|
719
|
+
switch (line.itemType) {
|
|
720
|
+
case scp_types_commerce_transaction_1.ItemType.NonMerch:
|
|
721
|
+
if (!saleItemTypes.includes("NonMerch")) {
|
|
722
|
+
saleItemTypes.push("NonMerch");
|
|
723
|
+
}
|
|
724
|
+
break;
|
|
725
|
+
case scp_types_commerce_transaction_1.ItemType.Merchandise:
|
|
726
|
+
if (!saleItemTypes.includes("Merchandise")) {
|
|
727
|
+
saleItemTypes.push("Merchandise");
|
|
728
|
+
}
|
|
729
|
+
break;
|
|
730
|
+
case scp_types_commerce_transaction_1.ItemType.ValueCard:
|
|
731
|
+
if (!saleItemTypes.includes("ValueCard")) {
|
|
732
|
+
saleItemTypes.push("ValueCard");
|
|
733
|
+
}
|
|
734
|
+
break;
|
|
735
|
+
case scp_types_commerce_transaction_1.ItemType.ValueCertificate:
|
|
736
|
+
if (!saleItemTypes.includes("ValueCertificate")) {
|
|
737
|
+
saleItemTypes.push("ValueCertificate");
|
|
738
|
+
}
|
|
739
|
+
break;
|
|
740
|
+
default:
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
return saleItemTypes;
|
|
746
|
+
}
|
|
747
|
+
exports.getSaleItemTypes = getSaleItemTypes;
|
|
748
|
+
function getOrderTypes(transaction) {
|
|
749
|
+
var _a;
|
|
750
|
+
const orderTypes = [];
|
|
751
|
+
let isPickup;
|
|
752
|
+
let isDelivery;
|
|
753
|
+
let isSendSale;
|
|
754
|
+
const order = transaction.order;
|
|
755
|
+
if (order) {
|
|
756
|
+
(_a = transaction.lines) === null || _a === void 0 ? void 0 : _a.forEach((line) => {
|
|
757
|
+
if (ItemLine_1.isItemLine(line) && !line.voided) {
|
|
758
|
+
if (line.lineType === scp_types_commerce_transaction_1.LineType.ItemOrder) {
|
|
759
|
+
const orderFulfillmentType = utility_1.getOrderFulfillmentType(transaction, line.fulfillmentGroupId);
|
|
760
|
+
if (orderFulfillmentType === scp_types_commerce_transaction_1.FulfillmentType.shipToStore && !isPickup) {
|
|
761
|
+
isPickup = true;
|
|
762
|
+
}
|
|
763
|
+
if (orderFulfillmentType === scp_types_commerce_transaction_1.FulfillmentType.shipToCustomer && !isDelivery) {
|
|
764
|
+
isDelivery = true;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
else if (line.lineType === scp_types_commerce_transaction_1.LineType.ItemSale) {
|
|
768
|
+
if (line.sendSale) {
|
|
769
|
+
isSendSale = true;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
if (isPickup && !orderTypes.includes("Pickup")) {
|
|
776
|
+
orderTypes.push("Pickup");
|
|
777
|
+
}
|
|
778
|
+
if (isDelivery && !orderTypes.includes("Delivery")) {
|
|
779
|
+
orderTypes.push("Delivery");
|
|
780
|
+
}
|
|
781
|
+
if (isSendSale && !orderTypes.includes("SendSale")) {
|
|
782
|
+
orderTypes.push("SendSale");
|
|
783
|
+
}
|
|
784
|
+
return orderTypes;
|
|
785
|
+
}
|
|
786
|
+
exports.getOrderTypes = getOrderTypes;
|
|
787
|
+
function getProductAttributeTypes(transaction) {
|
|
788
|
+
var _a;
|
|
789
|
+
const productAttributes = [];
|
|
790
|
+
(_a = transaction.lines) === null || _a === void 0 ? void 0 : _a.forEach((line) => {
|
|
791
|
+
var _a, _b, _c;
|
|
792
|
+
if (ItemLine_1.isItemLine(line) && !line.voided && ((_b = (_a = line.item) === null || _a === void 0 ? void 0 : _a.productAttributes) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
793
|
+
(_c = line.item) === null || _c === void 0 ? void 0 : _c.productAttributes.forEach((productAttribute) => {
|
|
794
|
+
if (!productAttributes.includes(productAttribute.attributeType)) {
|
|
795
|
+
productAttributes.push(productAttribute.attributeType);
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
return productAttributes;
|
|
801
|
+
}
|
|
802
|
+
exports.getProductAttributeTypes = getProductAttributeTypes;
|
|
803
|
+
function transactionHasPaymentRestrictionTypes(itemTypes, orderTypes, productAttributeTypes) {
|
|
804
|
+
var _a, _b, _c;
|
|
805
|
+
return ((_a = orderTypes) === null || _a === void 0 ? void 0 : _a.length) > 0 || ((_b = itemTypes) === null || _b === void 0 ? void 0 : _b.length) > 0 || ((_c = productAttributeTypes) === null || _c === void 0 ? void 0 : _c.length) > 0 ? true : false;
|
|
806
|
+
}
|
|
807
|
+
exports.transactionHasPaymentRestrictionTypes = transactionHasPaymentRestrictionTypes;
|
|
808
|
+
function getPaymentRestrictionBehaviors(diContainer, tenderType) {
|
|
809
|
+
const configurationManager = diContainer.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
|
|
810
|
+
const tenderConfig = configurationManager && configurationManager.getTendersValues();
|
|
811
|
+
const tenderTypeBehaviors = tenderConfig && tenderConfig.tenderBehaviors && tenderConfig.tenderBehaviors.tenderTypeBehaviors;
|
|
812
|
+
const tenderTypeBehavior = tenderTypeBehaviors && tenderTypeBehaviors[tenderType];
|
|
813
|
+
return tenderTypeBehavior && tenderTypeBehavior.paymentRestrictionBehaviors;
|
|
814
|
+
}
|
|
815
|
+
exports.getPaymentRestrictionBehaviors = getPaymentRestrictionBehaviors;
|
|
816
|
+
function isPaymentRestrictionBehaviorsConfigured(diContainer, activeTenderTypes) {
|
|
817
|
+
const configurationManager = diContainer.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
|
|
818
|
+
const tenderConfig = configurationManager && configurationManager.getTendersValues();
|
|
819
|
+
const tenderTypeBehaviors = tenderConfig && tenderConfig.tenderBehaviors && tenderConfig.tenderBehaviors.tenderTypeBehaviors;
|
|
820
|
+
if (!tenderTypeBehaviors) {
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
const tenderTypeHasPaymentRestrictionBehaviors = activeTenderTypes.some((activeTenderType) => {
|
|
824
|
+
const paymentRestrictionBehaviors = getPaymentRestrictionBehaviors(diContainer, activeTenderType.tenderTypeName);
|
|
825
|
+
return paymentRestrictionBehaviors;
|
|
826
|
+
});
|
|
827
|
+
return tenderTypeHasPaymentRestrictionBehaviors;
|
|
828
|
+
}
|
|
829
|
+
exports.isPaymentRestrictionBehaviorsConfigured = isPaymentRestrictionBehaviorsConfigured;
|
|
830
|
+
function sortOriginalTenders(originalTenders) {
|
|
831
|
+
var _a;
|
|
832
|
+
return (_a = originalTenders) === null || _a === void 0 ? void 0 : _a.sort((a, b) => {
|
|
833
|
+
return a.originalTenderAmount.gt(b.originalTenderAmount) ? -1 : 0;
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
function allowMappedTender(tenderType, tenderConfig) {
|
|
837
|
+
return tenderConfig.tenderDefinitions.some((tender) => { var _a; return tender.tenderType === tenderType && ((_a = tender.allowRefund) === null || _a === void 0 ? void 0 : _a.indexOf("WhenMapped")) > -1; });
|
|
838
|
+
}
|
|
839
|
+
function adjustAmount(amount, adjustmentAmount) {
|
|
840
|
+
var _a;
|
|
841
|
+
return (adjustmentAmount && ((_a = amount) === null || _a === void 0 ? void 0 : _a.plus(adjustmentAmount))) || amount;
|
|
842
|
+
}
|
|
843
|
+
function buildMappedOriginalTender(originalTender, tenderName, tenderType, tenderId, tenderAuthCategory, transactionId, originalTransactions, subType) {
|
|
844
|
+
var _a;
|
|
845
|
+
const originalTran = (_a = originalTransactions) === null || _a === void 0 ? void 0 : _a.find((origTran) => origTran.originalTransactionId === transactionId);
|
|
846
|
+
const returnTotalAmount = getReturnOrCancelTotalAmount(originalTran);
|
|
847
|
+
const tenderTypeName = tenderType;
|
|
848
|
+
return {
|
|
849
|
+
showReference: false,
|
|
850
|
+
isMappedTender: true,
|
|
851
|
+
tenderAuthCategory,
|
|
852
|
+
tenderId,
|
|
853
|
+
tenderName,
|
|
854
|
+
tenderType: tenderTypeName,
|
|
855
|
+
subType,
|
|
856
|
+
originalTransactionReferences: isOriginalTenderFullyRefunded(originalTender, returnTotalAmount)
|
|
857
|
+
? undefined
|
|
858
|
+
: TenderHandlingSession_1.getOriginalTransactionReferences(transactionId, originalTender.originalLineReferences),
|
|
859
|
+
originalTenderAmount: originalTender.originalTenderAmount,
|
|
860
|
+
refundedAmount: originalTender.refundedAmount,
|
|
861
|
+
previouslyRefundedAmount: originalTender.previouslyRefundedAmount,
|
|
862
|
+
adjustmentAmount: originalTender.adjustmentAmount,
|
|
863
|
+
adjustmentType: originalTender.adjustmentType,
|
|
864
|
+
refundAllowed: isOriginalTenderFullyRefunded(originalTender, returnTotalAmount),
|
|
865
|
+
originalLineReferences: undefined,
|
|
866
|
+
mappedOriginTenderId: originalTender.tenderId,
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
function isOriginalTenderFullyRefunded(originalTender, returnTotalAmount) {
|
|
870
|
+
const totalRefundedAmount = originalTender &&
|
|
871
|
+
calculateTotalRefundedAmount(originalTender.previouslyRefundedAmount, originalTender.refundedAmount);
|
|
872
|
+
const adjustedOriginalTenderAmount = adjustAmount(originalTender.originalTenderAmount, originalTender.adjustmentAmount);
|
|
873
|
+
return ((totalRefundedAmount && totalRefundedAmount.gte(adjustedOriginalTenderAmount)) ||
|
|
874
|
+
originalTender.refundedAmount.gte(returnTotalAmount));
|
|
875
|
+
}
|
|
876
|
+
function calculateTotalRefundedAmount(previouslyRefundedAmount, refundedAmount) {
|
|
877
|
+
if (previouslyRefundedAmount && refundedAmount) {
|
|
878
|
+
return previouslyRefundedAmount.plus(refundedAmount);
|
|
879
|
+
}
|
|
880
|
+
else {
|
|
881
|
+
return previouslyRefundedAmount || refundedAmount;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function isOriginalTenderAmountAllowed(originalTender, refundRules, originalTransactionDetailsInfo, refundDue) {
|
|
885
|
+
if (refundRules && (refundRules.minimumAmount || refundRules.maximumAmount)) {
|
|
886
|
+
const refundableAmount = getRefundableAmountByTenderType(originalTender.tenderType, originalTransactionDetailsInfo, refundDue);
|
|
887
|
+
const maximumAmount = refundRules.maximumAmount && new scp_component_business_core_1.Money(refundRules.maximumAmount, refundDue.currency);
|
|
888
|
+
const minimumAmount = refundRules.minimumAmount && new scp_component_business_core_1.Money(refundRules.minimumAmount, refundDue.currency);
|
|
889
|
+
return (refundableAmount &&
|
|
890
|
+
(!maximumAmount || refundableAmount.lte(maximumAmount)) &&
|
|
891
|
+
(!minimumAmount || refundableAmount.gte(minimumAmount)));
|
|
892
|
+
}
|
|
893
|
+
return true;
|
|
894
|
+
}
|
|
895
|
+
function getRefundableAmountByTenderType(tenderType, originalTransactionsDetails, refundDue) {
|
|
896
|
+
var _a, _b;
|
|
897
|
+
if (refundDue) {
|
|
898
|
+
let totalRefundableAmount = new scp_component_business_core_1.Money("0", (_a = refundDue) === null || _a === void 0 ? void 0 : _a.currency);
|
|
899
|
+
(_b = originalTransactionsDetails) === null || _b === void 0 ? void 0 : _b.forEach((originalTransaction) => {
|
|
900
|
+
var _a, _b;
|
|
901
|
+
const filteredOriginalTenders = (_a = originalTransaction.originalTenders) === null || _a === void 0 ? void 0 : _a.filter((originalTender) => originalTender.tenderType === tenderType);
|
|
902
|
+
(_b = filteredOriginalTenders) === null || _b === void 0 ? void 0 : _b.forEach((tenderDetails) => {
|
|
903
|
+
const returnTotalAmount = getReturnOrCancelTotalAmount(originalTransaction);
|
|
904
|
+
const tenderRefundableAmount = calculateRefundableAmount(tenderDetails.originalTenderAmount, tenderDetails.refundedAmount, returnTotalAmount, refundDue);
|
|
905
|
+
if (tenderRefundableAmount) {
|
|
906
|
+
totalRefundableAmount = totalRefundableAmount.plus(tenderRefundableAmount);
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
});
|
|
910
|
+
return totalRefundableAmount;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
function isReferencedRefundTender(tenderType) {
|
|
914
|
+
var _a, _b;
|
|
915
|
+
return (((_a = tenderType) === null || _a === void 0 ? void 0 : _a.tenderAuthCategory) === Constants_1.TenderAuthCategory.PaymentDevice ||
|
|
916
|
+
((_b = tenderType) === null || _b === void 0 ? void 0 : _b.tenderAuthCategory) === Constants_1.TenderAuthCategory.Wallet);
|
|
917
|
+
}
|
|
918
|
+
function handleValueCertificateGroup(tenderGroups, configuredTenders, isRefund, withTransaction, withOfflineTransaction, accountingCurrency) {
|
|
919
|
+
if (isRefund &&
|
|
920
|
+
tenderGroups.some((group) => group.tenderAuthCategory === Constants_1.TenderAuthCategory.StoredValueCertificateService)) {
|
|
921
|
+
const filteredGroups = tenderGroups.filter((group) => group.tenderAuthCategory !== Constants_1.TenderAuthCategory.StoredValueCertificateService) || [];
|
|
922
|
+
configuredTenders.forEach((tender) => {
|
|
923
|
+
if (tender.tenderAuthCategory === Constants_1.TenderAuthCategory.StoredValueCertificateService &&
|
|
924
|
+
tenderIsActive(tender, isRefund, withTransaction, false, false, withOfflineTransaction, accountingCurrency)) {
|
|
925
|
+
filteredGroups.push({
|
|
926
|
+
tenderAuthCategory: Constants_1.TenderAuthCategory.StoredValueCertificateService,
|
|
927
|
+
groupLabel: { default: tender.tenderName },
|
|
928
|
+
subType: tender.subType,
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
return filteredGroups;
|
|
933
|
+
}
|
|
934
|
+
else {
|
|
935
|
+
return tenderGroups;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
function filterOriginalTenders(activeTenders, originalTransactionsDetails, ignoreReferencedTenders) {
|
|
939
|
+
var _a;
|
|
940
|
+
if (activeTenders && ((_a = originalTransactionsDetails) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
941
|
+
originalTransactionsDetails.forEach((originalTransaction) => {
|
|
942
|
+
var _a;
|
|
943
|
+
if (((_a = originalTransaction.originalTenders) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
944
|
+
originalTransaction.originalTenders.forEach((tender) => {
|
|
945
|
+
var _a, _b;
|
|
946
|
+
const tenderConfig = activeTenders.find((configuredTender) => configuredTender.tenderId === tender.tenderId || configuredTender.id === tender.tenderId);
|
|
947
|
+
const allowRefund = (_a = tenderConfig) === null || _a === void 0 ? void 0 : _a.allowRefund;
|
|
948
|
+
if (((_b = allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithOriginalTenderReference)) !== -1) {
|
|
949
|
+
activeTenders = activeTenders.filter((tenderType) => (ignoreReferencedTenders && isReferencedRefundTender(tenderType)) ||
|
|
950
|
+
(tenderType.id !== tender.tenderId && tenderType.tenderId !== tender.tenderId));
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
return activeTenders;
|
|
957
|
+
}
|
|
958
|
+
function tenderIsActive(tenderDef, isRefund, withTransaction, withReference, mappedTender, offlineTransaction, accountingCurrency) {
|
|
959
|
+
if (tenderDef && (!tenderDef.hasOwnProperty("active") || tenderDef.active)) {
|
|
960
|
+
if (tenderDef.isForeignTender && tenderDef.currencyCode === accountingCurrency) {
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
if (isRefund) {
|
|
964
|
+
if (tenderDef.hasOwnProperty("allowRefund") && tenderDef.allowRefund.length > 0) {
|
|
965
|
+
return (tenderDef.allowRefund
|
|
966
|
+
.map((option) => {
|
|
967
|
+
switch (option) {
|
|
968
|
+
case ITendersConfig_1.AllowRefund.WithoutTransaction:
|
|
969
|
+
return !withTransaction && !offlineTransaction;
|
|
970
|
+
case ITendersConfig_1.AllowRefund.WithOriginalTenderReference:
|
|
971
|
+
return withReference;
|
|
972
|
+
case ITendersConfig_1.AllowRefund.WhenMapped:
|
|
973
|
+
return mappedTender;
|
|
974
|
+
case ITendersConfig_1.AllowRefund.WithTransaction:
|
|
975
|
+
return withTransaction && !withReference;
|
|
976
|
+
case ITendersConfig_1.AllowRefund.WithOfflineTransaction:
|
|
977
|
+
return offlineTransaction;
|
|
978
|
+
default:
|
|
979
|
+
return false;
|
|
980
|
+
}
|
|
981
|
+
})
|
|
982
|
+
.findIndex((result) => result) !== -1);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
else {
|
|
986
|
+
return true;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
return false;
|
|
990
|
+
}
|
|
991
|
+
exports.tenderIsActive = tenderIsActive;
|
|
992
|
+
//
|
|
993
|
+
// Find/return the single matching, active configured tender that is identified by the given IAuthorizationResponse.
|
|
994
|
+
// NOTE: This qualification must never reject (throw QualificationError) even if no matching tender can be found.
|
|
995
|
+
// This because the given IAuthorizationResponse may well represent an authorized, collected tender!
|
|
996
|
+
// If we cannot find a matching TenderType to return, we return instead a string containing a technical
|
|
997
|
+
// message suitable for logging.
|
|
998
|
+
// Matching rules:
|
|
999
|
+
// - Only consider active tenders.
|
|
1000
|
+
// - If there's exactly one configured tender with a "tenderType" === the authResponse, that's the match.
|
|
1001
|
+
// - If there's > 1 configured tender matching on "tenderType" above, narrow the match using "cardType":
|
|
1002
|
+
// - If there's exactly one configured tender with a "cardType" === the authResponse, that's the match.
|
|
1003
|
+
// Otherwise, if there's exactly one with no "cardType" configured, it can match any cardType for its tenderType,
|
|
1004
|
+
// so that's the match.
|
|
1005
|
+
// - If no match is made using the above criteria and a PaymentDevice card tender is configured, the tender will be
|
|
1006
|
+
// allowed and treated as the single payment device card tender
|
|
1007
|
+
// - If we cannot arrive at exactly one match and no PaymentDeviceCard tender is configured, the validation fails.
|
|
1008
|
+
//
|
|
1009
|
+
function findConfiguredTenderFor(activeTenders, responseData, tenderAuthCategory) {
|
|
1010
|
+
let matchFailedReasonCode = undefined;
|
|
1011
|
+
let matchingTender = undefined;
|
|
1012
|
+
if (shouldFindMatchingConfiguredTender(responseData)) {
|
|
1013
|
+
if (hasActiveTenders(activeTenders)) {
|
|
1014
|
+
const allowPaymentDeviceWallets = paymentDeviceCardExists(activeTenders) &&
|
|
1015
|
+
(tenderAuthCategory === Constants_1.TenderAuthCategory.Wallet ||
|
|
1016
|
+
tenderAuthCategory === Constants_1.TenderAuthCategory.PaymentDevice) &&
|
|
1017
|
+
responseData.tenderType === scp_types_commerce_devices_1.TenderType.Wallet;
|
|
1018
|
+
if (tenderAuthCategory && !allowPaymentDeviceWallets) {
|
|
1019
|
+
// Narrow down all configured tender to just those matching on tenderAuthCategory
|
|
1020
|
+
activeTenders = activeTenders.filter((aTender) => {
|
|
1021
|
+
var _a;
|
|
1022
|
+
return aTender.tenderAuthCategory === tenderAuthCategory || ((_a = aTender.additionalTenderAuthCategories) === null || _a === void 0 ? void 0 : _a.includes(tenderAuthCategory));
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
let activeTenderTypeMatches;
|
|
1026
|
+
// Need to match PaymentDevice wallets to both tenderType and cardType because there may be
|
|
1027
|
+
// a tender with tenderType:Wallet and tenderAuthCategory:PaymentDevice that matches but is the wrong cardType.
|
|
1028
|
+
// We don't want to match against that tender, but instead should match against the PaymentDeviceCard tender.
|
|
1029
|
+
if (responseData.tenderType === scp_types_commerce_devices_1.TenderType.Wallet &&
|
|
1030
|
+
(allowPaymentDeviceWallets || allowWalletSpecificTender(tenderAuthCategory, activeTenders))) {
|
|
1031
|
+
activeTenderTypeMatches = activeTenders.filter((aTender) => {
|
|
1032
|
+
var _a;
|
|
1033
|
+
return aTender.tenderTypeName === scp_types_commerce_devices_1.TenderType.Wallet &&
|
|
1034
|
+
(aTender.cardType === responseData.cardType ||
|
|
1035
|
+
(aTender.cardType === scp_types_commerce_devices_1.CardType.Custom &&
|
|
1036
|
+
aTender.customCardType === ((_a = responseData.paymentProviderSpecificInfo) === null || _a === void 0 ? void 0 : _a.PaymentMethodVariant))) &&
|
|
1037
|
+
(aTender.tenderAuthCategory === Constants_1.TenderAuthCategory.Wallet ||
|
|
1038
|
+
aTender.tenderAuthCategory === Constants_1.TenderAuthCategory.PaymentDevice ||
|
|
1039
|
+
aTender.tenderAuthCategory === Constants_1.TenderAuthCategory.TapToPayOnPOS);
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
else {
|
|
1043
|
+
// Narrow down all configured tenders to just those matching on "tenderType"
|
|
1044
|
+
// where having responseData implies that tenderAuthCategory is not None
|
|
1045
|
+
activeTenderTypeMatches = activeTenders.filter((aTender) => aTender.tenderTypeName === responseData.tenderType &&
|
|
1046
|
+
aTender.tenderAuthCategory !== Constants_1.TenderAuthCategory.None);
|
|
1047
|
+
}
|
|
1048
|
+
if (hasActiveTenders(activeTenderTypeMatches)) {
|
|
1049
|
+
if (activeTenderTypeMatches.length === 1) {
|
|
1050
|
+
matchingTender = activeTenderTypeMatches[0];
|
|
1051
|
+
}
|
|
1052
|
+
else {
|
|
1053
|
+
// Multiple configured tenders match on "tenderType". Narrow down using "cardType".
|
|
1054
|
+
if (responseData.cardType === scp_types_commerce_devices_1.CardType.Custom) {
|
|
1055
|
+
const result = findCustomCardType(activeTenderTypeMatches, responseData);
|
|
1056
|
+
matchingTender = result;
|
|
1057
|
+
matchFailedReasonCode = result;
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
let cardTypeMatches = activeTenderTypeMatches.filter((aTender) => aTender.cardType && aTender.cardType === responseData.cardType);
|
|
1061
|
+
if (!cardTypeMatches || cardTypeMatches.length === 0) {
|
|
1062
|
+
// No exact matches on "cardType". Any candidate tenders left that match ANY cardType
|
|
1063
|
+
// (that is, they have no significant cardType configured)?
|
|
1064
|
+
cardTypeMatches = activeTenderTypeMatches.filter((aTender) => !aTender.cardType);
|
|
1065
|
+
}
|
|
1066
|
+
if (hasActiveTenders(cardTypeMatches)) {
|
|
1067
|
+
if (cardTypeMatches.length === 1) {
|
|
1068
|
+
matchingTender = cardTypeMatches[0];
|
|
1069
|
+
}
|
|
1070
|
+
else {
|
|
1071
|
+
if (responseData.subType) {
|
|
1072
|
+
const subTypeMatches = activeTenderTypeMatches.filter((aTender) => aTender.subType && aTender.subType === responseData.subType);
|
|
1073
|
+
if (subTypeMatches && subTypeMatches.length === 1) {
|
|
1074
|
+
matchingTender = subTypeMatches[0];
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
matchFailedReasonCode = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1078
|
+
logger.info(`Cannot find configured tender matching auth response: ` +
|
|
1079
|
+
`Multiple active tender types configured that match auth response tenderType ` +
|
|
1080
|
+
`[${responseData.tenderType}] and auth response subType [${responseData.subType}]`);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
else {
|
|
1084
|
+
matchFailedReasonCode = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1085
|
+
logger.info(`Cannot find configured tender matching auth response: ` +
|
|
1086
|
+
`Multiple active tender types configured that match auth response tenderType ` +
|
|
1087
|
+
`[${responseData.tenderType}] and auth response cardType [${responseData.cardType}]`);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
else {
|
|
1092
|
+
matchFailedReasonCode = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1093
|
+
logger.info(`Cannot find configured tender matching auth response: ` +
|
|
1094
|
+
`Multiple active tender types configured match auth
|
|
1095
|
+
response tenderType [${responseData.tenderType}] ` +
|
|
1096
|
+
`and none match auth response cardType [${responseData.cardType}] to resolve to a single match`);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
matchFailedReasonCode = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1103
|
+
logger.info(`Cannot find configured tender matching auth response: No active tender type configured ` +
|
|
1104
|
+
`that matches auth response tenderType, [${responseData.tenderType}]`);
|
|
1105
|
+
}
|
|
1106
|
+
// If a Debit tender was used and not matched fallback on TenderType Debit
|
|
1107
|
+
// and CardType Debit if that tender exists
|
|
1108
|
+
if (!matchingTender && responseData.tenderType === scp_types_commerce_devices_1.TenderType.Debit) {
|
|
1109
|
+
const debitResult = findDebitCardType(activeTenderTypeMatches);
|
|
1110
|
+
matchingTender = debitResult;
|
|
1111
|
+
matchFailedReasonCode = debitResult;
|
|
1112
|
+
}
|
|
1113
|
+
// If a PaymentDevice tender is configured and no other matching tenders are configured,
|
|
1114
|
+
// use the PaymentDevice tender
|
|
1115
|
+
if (!matchingTender) {
|
|
1116
|
+
const paymentDeviceTender = activeTenders.filter((aTender) => aTender.cardType &&
|
|
1117
|
+
aTender.cardType === scp_types_commerce_devices_1.CardType.PaymentDeviceCard &&
|
|
1118
|
+
aTender.tenderTypeName === scp_types_commerce_devices_1.TenderType.PaymentDevice);
|
|
1119
|
+
if (paymentDeviceTender && paymentDeviceTender.length > 0) {
|
|
1120
|
+
logger.info("PaymentDevice tender is configured. The auth response tender will be allowed.");
|
|
1121
|
+
matchingTender = paymentDeviceTender[0];
|
|
1122
|
+
matchFailedReasonCode = undefined;
|
|
1123
|
+
}
|
|
1124
|
+
else {
|
|
1125
|
+
// no PaymentDevice tender configured; so log the error and return UnknownTender
|
|
1126
|
+
logger.error(`Cannot find configured tender matching auth response: tenderType [${responseData.tenderType}] ` +
|
|
1127
|
+
`and cardType [${responseData.cardType}] and no PaymentDevice tender configured.`);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
else {
|
|
1132
|
+
matchFailedReasonCode = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1133
|
+
logger.error(`Cannot find configured tender matching auth response: No active tender types configured`);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
else {
|
|
1137
|
+
matchFailedReasonCode = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1138
|
+
logger.debug(`Did not attempt to find configured tender with auth ` +
|
|
1139
|
+
`responseCode: [${responseData.responseCode}], ` +
|
|
1140
|
+
`cardType: [${responseData.cardType}] and tenderType, [${responseData.tenderType}]`);
|
|
1141
|
+
}
|
|
1142
|
+
return matchingTender || matchFailedReasonCode;
|
|
1143
|
+
}
|
|
1144
|
+
exports.findConfiguredTenderFor = findConfiguredTenderFor;
|
|
1145
|
+
function getReturnOrCancelTotalAmount(originalTran) {
|
|
1146
|
+
var _a, _b, _c, _d;
|
|
1147
|
+
// since return and cancel are mutually exclusive by design
|
|
1148
|
+
const isCancel = (_b = (_a = originalTran) === null || _a === void 0 ? void 0 : _a.cancelTotalAmount) === null || _b === void 0 ? void 0 : _b.isNotZero();
|
|
1149
|
+
const isReturn = (_d = (_c = originalTran) === null || _c === void 0 ? void 0 : _c.returnTotalAmount) === null || _d === void 0 ? void 0 : _d.isNotZero();
|
|
1150
|
+
if (isCancel && isReturn) {
|
|
1151
|
+
throw Error("Cancel and Return are not supported together.");
|
|
1152
|
+
}
|
|
1153
|
+
//This amount represents the item value being returned/cancelled.
|
|
1154
|
+
let refundTotalAmount;
|
|
1155
|
+
if (isCancel) {
|
|
1156
|
+
refundTotalAmount = originalTran.cancelTotalAmount.abs();
|
|
1157
|
+
}
|
|
1158
|
+
else if (isReturn) {
|
|
1159
|
+
refundTotalAmount = originalTran.returnTotalAmount.abs();
|
|
1160
|
+
}
|
|
1161
|
+
return refundTotalAmount;
|
|
1162
|
+
}
|
|
1163
|
+
exports.getReturnOrCancelTotalAmount = getReturnOrCancelTotalAmount;
|
|
1164
|
+
function isTenderCurrentlyRefunded(originalTender, refundableAmount) {
|
|
1165
|
+
var _a, _b, _c;
|
|
1166
|
+
const refundedAmount = adjustAmount((_a = originalTender) === null || _a === void 0 ? void 0 : _a.refundedAmount, (_b = originalTender) === null || _b === void 0 ? void 0 : _b.adjustmentAmount);
|
|
1167
|
+
return (refundableAmount &&
|
|
1168
|
+
(((_c = originalTender) === null || _c === void 0 ? void 0 : _c.isMappedTender) ? !refundableAmount.isPositive() : refundedAmount.gte(refundableAmount)));
|
|
1169
|
+
}
|
|
1170
|
+
exports.isTenderCurrentlyRefunded = isTenderCurrentlyRefunded;
|
|
1171
|
+
function allowWalletSpecificTender(tenderAuthCategory, tenders) {
|
|
1172
|
+
return tenderAuthCategory === Constants_1.TenderAuthCategory.PaymentDevice && walletSpecificTenderExists(tenders);
|
|
1173
|
+
}
|
|
1174
|
+
exports.allowWalletSpecificTender = allowWalletSpecificTender;
|
|
1175
|
+
function hasActiveTenders(activeTenderTypeMatches) {
|
|
1176
|
+
return activeTenderTypeMatches && activeTenderTypeMatches.length > 0;
|
|
1177
|
+
}
|
|
1178
|
+
function paymentDeviceCardExists(activeTenders) {
|
|
1179
|
+
return activeTenders.some((t) => t.cardType === scp_types_commerce_devices_1.CardType.PaymentDeviceCard);
|
|
1180
|
+
}
|
|
1181
|
+
exports.paymentDeviceCardExists = paymentDeviceCardExists;
|
|
1182
|
+
function walletSpecificTenderExists(activeTenders) {
|
|
1183
|
+
return activeTenders.some((t) => t.tenderAuthCategory === Constants_1.TenderAuthCategory.PaymentDevice &&
|
|
1184
|
+
t.tenderTypeName === scp_types_commerce_devices_1.TenderType.Wallet);
|
|
1185
|
+
}
|
|
1186
|
+
exports.walletSpecificTenderExists = walletSpecificTenderExists;
|
|
1187
|
+
function shouldFindMatchingConfiguredTender(responseData) {
|
|
1188
|
+
// If the response is not approved and we are not getting back a tender type and card type,
|
|
1189
|
+
// do not check for a matching configured tender. Gift card redeem defaults to card type gift
|
|
1190
|
+
return !(responseData.responseCode !== scp_types_commerce_devices_1.ResponseCodes.Approved &&
|
|
1191
|
+
!responseData.tenderType &&
|
|
1192
|
+
(!responseData.cardType ||
|
|
1193
|
+
(responseData.requestType === scp_types_commerce_devices_1.PaymentRequestType.GiftCardRedeem &&
|
|
1194
|
+
responseData.cardType === scp_types_commerce_devices_1.CardType.Gift)));
|
|
1195
|
+
}
|
|
1196
|
+
function findDebitCardType(activeTenderTypeMatches) {
|
|
1197
|
+
let response;
|
|
1198
|
+
const debitTenderMatches = activeTenderTypeMatches.filter((aTender) => aTender.cardType &&
|
|
1199
|
+
aTender.cardType === scp_types_commerce_devices_1.CardType.Debit &&
|
|
1200
|
+
aTender.tenderTypeName === scp_types_commerce_devices_1.TenderType.Debit);
|
|
1201
|
+
if (!debitTenderMatches || debitTenderMatches.length === 0) {
|
|
1202
|
+
response = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1203
|
+
logger.info(`Cannot find configured debit tender matching auth response: ` +
|
|
1204
|
+
`No tender types configured matching debit cardType`);
|
|
1205
|
+
}
|
|
1206
|
+
else if (debitTenderMatches && debitTenderMatches.length > 1) {
|
|
1207
|
+
response = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1208
|
+
logger.info(`Cannot find configured debit tender matching auth response: ` +
|
|
1209
|
+
`Multiple active tender types configured matching`);
|
|
1210
|
+
}
|
|
1211
|
+
else {
|
|
1212
|
+
response = debitTenderMatches[0];
|
|
1213
|
+
}
|
|
1214
|
+
return response;
|
|
1215
|
+
}
|
|
1216
|
+
function findCustomCardType(activeTenderTypeMatches, responseData) {
|
|
1217
|
+
let response;
|
|
1218
|
+
const cardTypeMatches = activeTenderTypeMatches.filter((aTender) => aTender.cardType &&
|
|
1219
|
+
aTender.cardType === scp_types_commerce_devices_1.CardType.Custom &&
|
|
1220
|
+
aTender.customCardType === responseData.customCardType);
|
|
1221
|
+
if (!cardTypeMatches || cardTypeMatches.length === 0) {
|
|
1222
|
+
response = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1223
|
+
logger.info(`Cannot find configured tender matching auth response: ` +
|
|
1224
|
+
`No tender types configured matching auth response tenderType [${responseData.tenderType}] ` +
|
|
1225
|
+
`and auth response cardType [${responseData.cardType}] ` +
|
|
1226
|
+
`and auth response customCardType [${responseData.customCardType}].`);
|
|
1227
|
+
}
|
|
1228
|
+
else if (cardTypeMatches && cardTypeMatches.length > 1) {
|
|
1229
|
+
response = scp_types_commerce_transaction_1.TenderAuthFailureReasonCode.UnknownTender;
|
|
1230
|
+
logger.info(`Cannot find configured tender matching auth response: ` +
|
|
1231
|
+
`Multiple active tender types configured matching auth response tenderType [${responseData.tenderType}] ` +
|
|
1232
|
+
`and auth response cardType [${responseData.cardType}] ` +
|
|
1233
|
+
`and auth response customCardType [${responseData.customCardType}].`);
|
|
1234
|
+
}
|
|
1235
|
+
else {
|
|
1236
|
+
response = cardTypeMatches[0];
|
|
1237
|
+
}
|
|
1238
|
+
return response;
|
|
1239
|
+
}
|
|
1240
|
+
function getTenderAuthCategoryFromTenderType(tenderType) {
|
|
1241
|
+
switch (tenderType) {
|
|
1242
|
+
case scp_types_commerce_devices_1.TenderType.Credit:
|
|
1243
|
+
case scp_types_commerce_devices_1.TenderType.Debit:
|
|
1244
|
+
case scp_types_commerce_devices_1.TenderType.PaymentDevice:
|
|
1245
|
+
return Constants_1.TenderAuthCategory.PaymentDevice;
|
|
1246
|
+
case scp_types_commerce_devices_1.TenderType.Wallet:
|
|
1247
|
+
return Constants_1.TenderAuthCategory.Wallet;
|
|
1248
|
+
case scp_types_commerce_devices_1.TenderType.Gift:
|
|
1249
|
+
return Constants_1.TenderAuthCategory.GiftDevice;
|
|
1250
|
+
default:
|
|
1251
|
+
return Constants_1.TenderAuthCategory.None;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
exports.getTenderAuthCategoryFromTenderType = getTenderAuthCategoryFromTenderType;
|
|
1255
|
+
function getChangeTenderIdsByBehavior(changeBehavior, authorizationFailed, diContainer, changeAmount) {
|
|
1256
|
+
var _a, _b;
|
|
1257
|
+
const changeDefinitions = getConfiguredChangeDefinitions(diContainer);
|
|
1258
|
+
try {
|
|
1259
|
+
let changeBehaviorDefinition = changeDefinitions && changeDefinitions[changeBehavior];
|
|
1260
|
+
if (changeBehaviorDefinition) {
|
|
1261
|
+
if (authorizationFailed) {
|
|
1262
|
+
if (changeBehaviorDefinition.exceptionScenarios &&
|
|
1263
|
+
changeBehaviorDefinition.exceptionScenarios.authorizationFailure &&
|
|
1264
|
+
changeBehaviorDefinition.exceptionScenarios.authorizationFailure.changeBehavior) {
|
|
1265
|
+
const authFailureChangeDefinition = changeDefinitions &&
|
|
1266
|
+
changeDefinitions[changeBehaviorDefinition.exceptionScenarios.authorizationFailure.changeBehavior];
|
|
1267
|
+
if (authFailureChangeDefinition) {
|
|
1268
|
+
changeBehaviorDefinition = authFailureChangeDefinition;
|
|
1269
|
+
}
|
|
1270
|
+
else {
|
|
1271
|
+
// authorization failure has no valid defined fallback change tender
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
else {
|
|
1276
|
+
// authorization failure has no defined fallback change tender
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
else if (changeAmount) {
|
|
1281
|
+
const changeDueUpToAmountConfig = (_a = changeBehaviorDefinition.exceptionScenarios) === null || _a === void 0 ? void 0 : _a.changeDueUpToAmount;
|
|
1282
|
+
if (changeDueUpToAmountConfig &&
|
|
1283
|
+
changeDueUpToAmountConfig.amount &&
|
|
1284
|
+
changeDueUpToAmountConfig.changeBehavior) {
|
|
1285
|
+
const changeDueUpToAmount = new scp_component_business_core_1.Money(changeDueUpToAmountConfig.amount, changeAmount.currency);
|
|
1286
|
+
if (changeAmount.lte(changeDueUpToAmount)) {
|
|
1287
|
+
const thresholdChangeDefinition = changeDefinitions && changeDefinitions[changeDueUpToAmountConfig.changeBehavior];
|
|
1288
|
+
if (thresholdChangeDefinition) {
|
|
1289
|
+
changeBehaviorDefinition = thresholdChangeDefinition;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
if ((_b = changeBehaviorDefinition) === null || _b === void 0 ? void 0 : _b.changeTenders) {
|
|
1296
|
+
const tenderIds = [];
|
|
1297
|
+
// tslint:disable-next-line: forin
|
|
1298
|
+
for (const changeTender in changeBehaviorDefinition.changeTenders) {
|
|
1299
|
+
tenderIds.push(changeBehaviorDefinition.changeTenders[changeTender].tenderId);
|
|
1300
|
+
}
|
|
1301
|
+
return tenderIds;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
catch (error) {
|
|
1305
|
+
logger.info(`Failed to find change tender type ${error.message}`);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
function getConfiguredChangeDefinitions(diContainer) {
|
|
1309
|
+
const configurationManager = diContainer.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
|
|
1310
|
+
return configurationManager.getTendersValues().changeBehaviorDefinitions;
|
|
1311
|
+
}
|
|
1312
|
+
function getChangeAmount(balanceDue, tenderAmount) {
|
|
1313
|
+
if (balanceDue && tenderAmount && balanceDue.lt(tenderAmount) && balanceDue.isPositive()) {
|
|
1314
|
+
return tenderAmount.minus(balanceDue);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
//# sourceMappingURL=TenderType.js.map
|