{"version":3,"sources":["webpack:///./obj/desktop/src/payment-method/util/credit-card-util.ts","webpack:///./obj/desktop/src/invoice/components/payment-method-modal/payment-method-modal.tsx","webpack:///./obj/desktop/src/invoice/components/payment-methods/desktop/saved-payment-item.tsx","webpack:///./obj/desktop/src/invoice/components/payment-method-modal/mobile/payment-method-modal.tsx","webpack:///./obj/desktop/src/invoice/components/payment-methods/desktop/saved-payment-method.tsx","webpack:///./obj/desktop/src/invoice/components/payment-methods/mobile/saved-payment-item.tsx","webpack:///./obj/desktop/src/invoice/components/payment-methods/mobile/saved-payment-method.tsx","webpack:///./obj/desktop/src/invoice/components/payment-methods/desktop/payment-method-container.tsx","webpack:///./obj/desktop/src/invoice/components/payment-amount/desktop/payment-amount.tsx","webpack:///./obj/desktop/src/invoice/components/payment-amount/payment-amount.tsx","webpack:///./node_modules/moment/locale sync ^\\.\\/.*$","webpack:///./obj/desktop/src/invoice/components/payment-amount/desktop/payment-amount.less","webpack:///./obj/desktop/src/invoice/components/payment-methods/desktop/payment-method-container.less","webpack:///./obj/desktop/src/payment/components/ach/desktop/confirmation-modal.less","webpack:///./obj/desktop/src/payment/components/ach/desktop/ach-info.less","webpack:///./obj/desktop/src/invoice/components/payment-methods/desktop/payment-methods.less","webpack:///./obj/desktop/src/invoice/components/connected-accounts/connected-accounts.less","webpack:///./obj/desktop/src/invoice/components/connected-accounts/connected-account.less","webpack:///./obj/desktop/src/invoice/components/card-info/card-info/desktop/card-info.less","webpack:///./obj/desktop/src/invoice/components/card-info/pg-card-info/desktop/pg-card-info.less","webpack:///./obj/desktop/src/payment-method/components/card-select-modal/desktop/card-select-modal.less","webpack:///./obj/desktop/src/invoice/components/payment-methods/desktop/saved-payment-method.less","webpack:///./obj/desktop/src/invoice/components/payment-method-modal/payment-method-modal.less","webpack:///./obj/desktop/src/invoice/components/payment-methods/desktop/saved-payment-item.less","webpack:///./obj/desktop/src/invoice/components/payment-methods/mobile/saved-payment-method.less","webpack:///./obj/desktop/src/invoice/components/payment-method-modal/mobile/payment-method-modal.less","webpack:///./obj/desktop/src/invoice/components/payment-methods/mobile/saved-payment-item.less","webpack:///./obj/desktop/src/util/formatters.ts","webpack:///./obj/desktop/src/core/components/mat-field.tsx","webpack:///./obj/desktop/src/api/model/plaidVerificationStatus.ts","webpack:///./obj/desktop/src/payment-method/stores/saved-payment-methods.store.ts","webpack:///./obj/desktop/src/invoice/types/types.ts","webpack:///./obj/desktop/src/statement/ioc.ts","webpack:///./obj/desktop/src/statement/stores/payment-gateway.store.ts","webpack:///./obj/desktop/src/payment-method/ioc.ts","webpack:///./obj/desktop/src/login/ioc.ts","webpack:///./obj/desktop/src/invoice/stores/invoice.store.ts","webpack:///./obj/desktop/src/statement/stores/charge.store.ts","webpack:///./obj/desktop/src/invoice/ioc.ts","webpack:///./obj/desktop/src/login/stores/login.store.ts","webpack:///./obj/desktop/src/invoice/components/ach-info/ach-info/ach-info.tsx","webpack:///./obj/desktop/src/statement/stores/statement.store.ts","webpack:///./obj/desktop/src/util/clone-deep.ts","webpack:///./obj/desktop/src/payment-method/stores/saved-credit-cards.store.ts","webpack:///./obj/desktop/src/invoice/components/card-info/cc-validators.ts","webpack:///./obj/desktop/src/invoice/components/card-info/card-info/card-info.tsx","webpack:///./obj/desktop/src/invoice/components/card-info/pg-card-info/pg-card-info.tsx","webpack:///./obj/desktop/src/payment/components/ach/ach-utils.ts","webpack:///./obj/desktop/src/payment/components/ach/desktop/confirmation-modal.tsx","webpack:///./obj/desktop/src/payment/components/ach/desktop/ach-info.tsx","webpack:///./obj/desktop/src/invoice/components/ach-info/ach-info.tsx","webpack:///./obj/desktop/src/invoice/components/connected-accounts/connected-account.tsx","webpack:///./obj/desktop/src/invoice/components/connected-accounts/connected-accounts.tsx","webpack:///./obj/desktop/src/invoice/components/card-info/cc-formatters.ts","webpack:///./obj/desktop/src/invoice/components/card-info/card-info/desktop/card-info.tsx","webpack:///./obj/desktop/src/payment-method/components/card-select-modal/desktop/card-select-modal.tsx","webpack:///./obj/desktop/src/invoice/components/card-info/pg-card-info/desktop/pg-card-info.tsx","webpack:///./obj/desktop/src/invoice/components/payment-methods/desktop/payment-methods.tsx","webpack:///./obj/desktop/src/core/components/view-more.tsx"],"names":["getCardType","cardNumber","match","Visa","AmericanExpress","Discover","MasterCard","Other","getCardIcon","cardType","getCardNameByIssuer","issuer","NUMBER_3","NUMBER_4","NUMBER_5","NUMBER_6","getIssuerByCardType","NUMBER_0","PaymentMethodViewType","SavedPaymentItem","paymentMethod","paymentMethodId","primary","icon","expires","bankName","customerName","paymentMethodType","displayText","selected","showDivider","onSelectPaymentMethod","className","savedItemContainer","Radio","checked","onChange","savedItemLogo","src","alt","savedItemDetails","savedItemText","savedItemSubText","CreditCard","savedItemChipHolder","savedItemChipContainer","savedItemChip","savedItemDivider","PaymentMethodModal","selectedPaymentMethodId","onPaymentMethodSelected","onClose","isOpen","usePaymentGateway","usePaymentsService","invoiceId","store","chargeType","splits","statementId","PayByBank","creditCardInfo","achInfo","pgCreditCardInfo","id","skipIFrameMessageHandler","savePaymentChecked","setSavePaymentChecked","useAsPrimaryPaymentChecked","setUseAsPrimaryPaymentChecked","paymentMethodDialogTitle","setPaymentMethodDialogTitle","addPaymentMethodButtonTitle","setAddPaymentMethodButtonTitle","SelectPaymentMethod","paymentMethodViewType","setPaymentMethodViewType","currentSelectedPaymentMethod","currentSelectedPaymentMethodId","setCurrentSelectedPaymentMethodId","initialSelectedPaymentMethodId","isCurrentSelectedPaymentInValid","setIsCurrentSelectedPaymentInValid","connectedAccounts","paymentMethodAction","undefined","handleSelect","current","paymentGateway","get","iframeMessageHandler","useEffect","window","addEventListener","removeEventListener","init","gotoSavedCardPage","isLoadingSavedPaymentMethods","setIsLoadingSavedPaymentMethods","preparePaymentOptions","savedPaymentMethods","forEach","isExpired","addPaymentMethod","setOnActionComplete","success","getLastSavedPaymentMethod","needToStoreAsPrimary","processGatewayAddNewCard","p","updateButtonTitleForPayByBank","length","currentInvoiceId","currentStatementId","currentSplits","setOnSelectedPaymentMethodChange","desktopPaymentGatewayUrl","getDesktopPaymentGatewayUrl","mobilePaymentGatewayUrl","getMobilePaymentGatewayUrl","AddPaymentMethod","size","S","open","initialPaymentMethod","find","closable","title","footer","onClick","disabled","connectedAccount","filter","account","payByBankPaymentMethod","connectedBankAccountToPaymentMethod","form","validate","hasError","cardInfoToPaymentMethod","ACH","achInfoToPaymentMethod","achPaymentMethod","color","map","index","key","cardInfoData","pgcardInfoData","achInfoData","showLoginLink","setPaymentMethodValid","setPaymentMethodAction","action","setConnectedAccounts","accounts","setPaymentMethodType","type","showPrimaryOption","getIsCPEnabled","showSavePaymentOption","paymentMethodStore","SavedPaymentMethod","setPaymentMethod","paymentAmountData","isModalOpen","setIsModalOpen","currentPaymentMethod","currentPaymentMethodId","setCurrentPaymentMethodId","amount","isFullBalance","value","fullBalance","parseFloat","customAmount","payment","invoiceNumber","amountRemaining","chargePaymentMethod","savedAccountContainer","savedAccountLogo","savedAccountText","disconnected","savedAccountChipHolder","Chip","label","primaryChipColor","disconnectedChipColor","savedAccountChangePayment","usesPaymentsService","savedItemContainerItem","theme","contentWrapperClass","savedAccountLogoAdjustment","savedAccountItem","PaymentMethodContainer","setPaymentButtonTextIcon","setPaymentMethodSubmit","cardView","getIsLoggedIn","savedPayment","setSavedPayment","isLoggedIn","isSavedPaymentOptionEnabled","getIsSavedPaymentOptionEnabled","errorMessage","setErrorMessage","isReady","setIsReady","setOnPbbErrorMessage","error","name","number","card","nonCardView","paymentMethodsPayByBankError","payByBankErrorHeader","payByBankErrorWarning","payByBankErrorHeaderTitle","payByBankErrorBody","spinner","loadingMessage","PaymentAmount","data","handleFullAmountTrue","rightLabel","partialPaymentEnabled","handleFullAmountFalse","fieldState","autoComplete","fullWidth","placeholder","onFocus","startAdornment","formatter","props","customAmountValidator","onStateChanged","Number","isNaN","minimumAmount","validators","this","clearError","handleSubmit","e","isSubcomponent","preventDefault","invoiceStore","$","history","push","params","onDidChange","getInvoice","then","invoice","balance","router","replace","partialPaymentDisabled","err","render","container","PaymentAmountContainer","webpackContext","req","webpackContextResolve","__webpack_require__","o","Error","code","keys","Object","resolve","module","exports","utcOptions","timeZone","localeDate","date","Date","toLocaleDateString","longDate","dateTime","getUTCMonth","getUTCDate","getUTCFullYear","currency","num","Intl","NumberFormat","style","format","address","isWrap","streetAddress","unit","city","state","zip","twoDigitsAmount","startsWith","numbers","split","slice","getDurationBillingString","duration","billingFrequency","getBillingFrequencyString","freq","toNumber","iosFocus","hadBlur","hasFocus","fixAdornment","handleFocus","readOnly","handleBlur","hadBlurTimeout","setTimeout","dirty","onBlur","handleAdornmentEnter","handleChange","validator","target","componentWillReceiveProps","nextProps","clearTimeout","componentWillUnmount","errorMap","endAdornmentOrig","endAdornmentFixed","errorColor","maxLength","errorText","endAdornment","onMouseEnter","FormHelperTextProps","helperText","InputProps","inputProps","MatField","PlaidVerificationStatus","savedCreditCardsApi","savedBankAccountsApi","statementApiService","payByBankApi","paymentGatewayService","chargeApi","analytics","invoicesApi","homeApi","customerInfos","postalCode","processing","isSavedCreditCardEnabled","isSavedCreditCardFeatureOn","isCreditCardEnabled","isPayByBankFeatureOn","isPayByBankEnabled","isSavedBankAccountFeatureOn","isBankAccountEnabled","isInSavedPaymentMethods","customerSelector","newValue","getSavedPaymentMethodsForCustomer","customerOptions","invoiceCache","paymentConfirmationCache","callback","initializeWithStatement","initializeWithInvoice","getHomeData","homeResponse","homeData","creditCardEnabled","creditCardDisabled","achEnabled","achDisabled","payByBankEnabled","payByBankDisabled","customerReference","customerExternalId","initialize","catch","paymentGatewayConfig","response","apiKey","baseUrl","paymentsServiceJwt","clientData","getShowLoginLink","getCardIssuer","isExpiringSoon","year","month","today","currentYear","getFullYear","currentMonth","getMonth","isPaymentMethodExpiringSoon","token","parseInt","convertToCardIssuer","toLowerCase","result","lastSavedPaymentMethod","resetLastSavedPaymentMethod","getLastPGResponse","lastPGResponse","lastSavedPaymentMethodId","accountName","accountMask","bankIcon","publicToken","accountId","bankId","verificationStatus","cardInfo","cardResult","cardDetail","ccNumber","cardName","ccName","cardNumberEnding","substring","ccExp","achResult","achDetail","achNumber","accountNumber","achNumberEnding","routingNumber","bankAccountType","accountType","trim","Business","Personal","creditCardToSavedPayment","creditCard","expMonth","expYear","cardholderName","customerId","membership","bankAccountToSavedPayment","bankAccount","routing","routingEnding","payByBankToSavedPayment","payByBankAccount","getInstitution","pbbInstitutionId","institution","logo","verificationStatusEnumToString","verificationStatusToEnum","sortCreditCard","cards","primaryCards","c","membershipCards","others","sort","a","b","gotoMembershipPage","getCustomerId","customerIds","callCompleteAction","onActionComplete","callPostError","onPbbErrorMessage","getLinkToken","getTime","institutionId","savedCreditCards","allCards","savedBankAccounts","allBankAccounts","savedPayByBanks","allPayByBanks","creditCards","achAccounts","payByBankAccounts","payByBankPaymentIdMapping","Map","pbb","paymentsServicePaymentMethodId","has","achs","ach","payByBanks","i","paymentMethods","primaryPaymentMethods","otherPaymentMethods","setDefaultSelectedPaymentMethodToPay","getCustomerIds","isEnabled","users","text","setSelectedPaymentMethodToPay","selectedPaymentMethod","availablePaymentMethods","onSelectedPaymentMethodChange","setPrimary","setPaymentMethodAsPrimary","assignCreditCard","assignBankAccount","assignPayByBank","deletePaymentMethod","resetErrorMessage","deleteCreditCard","deleteBankAccount","deletePayByBank","processAddNewCard","processNonGatewayCreditCard","processACH","processPayByBank","selectedCustomerId","expToken","businessUnitId","cvv","processCreditCard","selectedCustomer","pbbAccountId","savePayByBank","amountApplied","paymentInvoiceId","paymentInvoice","processBankAccountCharge","processCreditCardCharge","processPayByBankCharge","getInvoicesById","invoiceIds","getInvoiceById","forceRefresh","trimmedId","cachedInvoice","Promise","resp","isAnonymousPayments","request","method","notificationEmail","loginData","email","storePaymentMethod","isCreditCard","chargeStoredPaymentMethod","processChargeResponse","processChargeFailure","checkNumber","isBusinessPayment","chargeBankAccount","processCharge","pgResponse","Type","responseData","Data","Token","billingZip","CardholderName","ExpMonth","ExpYear","cvc","Cvc","issuerName","IssuerName","isStatementCharge","NUMBER_1","statementRequest","customer","chargeCreditCardMultiple","chargeCreditCard","transaction","message","Math","abs","hashCode","charge","s","reduce","charCodeAt","toString","confirmation","amountPaid","remainingBalance","addPaymentConfirmationToCache","paymentAttemptSuccess","confirmId","sessionStorage","setItem","JSON","stringify","paymentAttemptFail","getCachedConfirmation","confirmationNumber","item","getItem","parse","removeItem","bankAccountInfo","saveBankAccount","saveCreditCard","usesPaymentsServiceTokenizationStore","getCustomerStatementsById","statementData","customers","invoices","invoiceData","some","feature","creditResponse","initializeFlags","payByBankReponse","achFeature","achReponse","portalData","brandData","phone","membershipNameTypeStore","SavedPaymentMethodsStore","PaymentMethodType","BankAccountType","CreditCardType","statementContainer","createChild","bind","toSelf","inSingletonScope","PaymentGatewayResponseType","getPaymentGatewayUrl","view","url","location","origin","encodeURIComponent","event","postMessageEventIsValid","tokenizationCompleteCallback","iframe","document","getElementById","source","contentWindow","pgIframe","postMessage","PaymentGateway","paymentMethodsContainer","loginContainer","lazyInject","home","savedCreditCardsStore","getSavedCreditCardStore","submitAchPayment","reject","submitPaymentToUseStoredPaymentMethod","selectedCardToPay","submitPayment","needToSaveCard","getCachedInvoice","setCachedConfirmation","paymentConfirmation","getOpenInvoices","getInvoices","showStoreOption","InvoiceStore","chargeApiService","outstandingBalance","statementBalance","paymentAmount","paymentCompleted","authCode","paymentProcessing","multiplePaymentOptionsEnabled","needToStoreCreditCard","useNewCard","setDefaultSelectedCardToPay","initializeConfirmationPage","backToSelectionPage","initializeFromStatementModel","statementModel","processMultiBankAccount","businessPayment","updateStoreCreditCardOption","setUseNewCard","ChargeStore","invoiceContainer","loginWithReturn","loginApi","logOut","removeLoginCookie","from","pathname","checkTokenObservable","firstName","authenticate","updateLoginData","checkToken","pwFormToken","pwFormEmail","pwFormPassword","LoginStore","modalIsOpen","isProcessing","currentInputAccountNumber","required","valid","confirmAccountNumber","isBusy","changeAccountType","val","reset","closeConfirmationModal","showConfirmationModal","withBusy","officialName","InvoiceFilter","DEFAULT_FILTER","Statement","chargeInfoService","gridState","pageSize","selectedFilter","customerMap","searchTerm","onUpdate","customerDropdownState","onSearchChange","getCustomerStatements","initCustomerMap","initCustomerDropdownState","selectCustomer","initInvoiceFilter","clearSearch","setDataSource","All","isAnonymousStatement","PastDue","clear","extendedCustomer","sum","inv","set","options","dropdownDataSource","filteredInvoices","row","mapInvoiceColumns","serviceDate","serviceAddress","dueDate","invoiceDate","billingDate","invoiceTotal","total","paymentTotal","invoiceBalance","changeFilter","makePayment","paymentAmountTotal","toFixed","Array","selectedInvoices","isAfter","statementSentDate","isSameOrAfter","overdueInvoices","statementInvoices","x","selectedCount","Set","selectedIds","StatementStore","cloneDeep","isLoadingSavedCreditCards","isChangeCardDialogOpen","isAddNewCardDialogOpen","isDeleteCardDialogOpen","isSetPrimaryModalOpen","isDeleteModalOpen","isAddNewCardModalOpen","cardProcessing","isMobileCardSelectTakeoverOpen","isMobileCardDeleteTakeoverOpen","isMobileCardAddTakeoverOpen","isMobileSetPrimaryTakeoverOpen","getSavedCreditCardsForCustomer","isSelectedToUpdate","selectedCardToUpdate","availableCards","openSetPrimaryModal","currentEditingCard","closeSetPrimaryModal","openDeleteModal","closeDeleteModal","openAddNewCardModal","closeAddNewCardModal","openMobileCardSelectTakeover","closeMobileCardSelectTakeover","openMobileCardDeleteTakeover","closeMobileCardDeleteTakeover","openMobileSetPrimaryTakeover","closeMobileSetPrimaryTakeover","openMobileCardAddTakeover","closeMobileCardAddTakeover","setSelectedCardToPay","selectedCard","setSelectedCardToUpdate","setAsPrimary","handleDelete","handleAdd","SavedCreditCardsStore","ccNameValidator","test","ccNumberValidator","isValid","ccExpValidator","ccCscValidator","zipPostalCodeValidator","ccCsc","substr","existingCcExp","paymentGatewayBaseUrl","needToSelectAnotherCard","isSavedCreditCardFeatureEnabled","paymentGatewayResponseType","Submit","SearsCard","responseType","alert","needToChargeStoredCard","setNeedToSelectAnotherCard","setNeedToStoreCreditCard","toPrettyAmount","ConfirmationModal","companyName","companyPhoneNumber","onSubmit","prettyAmount","prettyDate","Dialog","DialogTitle","DialogContent","DialogContentText","achTable","DialogActions","Button","declineButton","AchInfo","containerStyles","isInvoicePayment","isEmbedded","maxAchPayment","amountError","Icon","warningIcon","fieldTitle","Tooltip","enterTouchDelay","classes","tooltip","infoTooltip","infoIcon","RadioGroup","FormControlLabel","control","firstRow","col","redirectToPayPage","AchInfoContainer","ConnectedAccount","borderColor","connectedAccountContainer","connectedAccountLogo","connectedAccountText","connectedAccountChipHolder","connectedAccountChipContainer","connectedAccountChip","ConnectedAccounts","setAccounts","connectedAccountsContainer","connectedAccountsHeader","idx","connectedAccountsItem","ccNumberFormatter","getHandler","lengths","max","apply","gaps","digitsValue","lastGap","gap","ccExpFormatter","func","element","handleEvent","isKeyUp","elem","currentTarget","selectionStart","selectionEnd","setSelectionRange","CardInfo","inputRef","ref","secondRow","agreement","href","rel","CardSelectModal","setSelectedCard","close","gotoNewCard","membershipNameType","replacedCard","setReplacedCard","Fragment","footerAlign","Divider","Item","alignItems","subdued","padStart","subtle","renderCard","formState","pgdata","loginStore","showSavePaymentInformation","isEmbeded","componentDidMount","loggedIn","renderStoredPaymentCard","cardItem","justifyContent","leftCard","expired","rightCard","membershipName","buttons","outline","fill","renderUseNewCard","scrolling","Checkbox","_","signin","embedded","backward","PGCardInfo","PlaidLinkView","linkToken","processPlaidSuccess","setFailedBankName","setReady","setOpen","config","onSuccess","metadata","onExit","_err","onEvent","ready","PaymentMethods","setPayByBankReady","useFeatureGate","setIsCreditCard","isAch","setIsAch","isPayByBank","setIsPayByBank","accountsRef","failedBankName","clientDataStore","paymentMethodTypeRef","paymentMethodLoadedRef","isACHModelOpen","setIsACHModelOpen","setLinkToken","setIsAchExceeded","isSavedPaymentChecked","isUseAsPrimaryPaymentChecked","isInitialized","onPayByBankSelected","onCreditCardSelected","onACHSelected","onPayByBankAction","connectAnotherAccount","onCreditCardAction","onACHAction","getPaymentAmount","resetSelectedStates","updatePaymentMethodType","setButtonTextIcon","updateConnectedAccounts","selectedAccount","acct","setPaymentButtonForPayByBank","onPaymentMethodSubmit","gatewayPaymentMethod","creditCardPaymentMethod","onAmountStateChanged","isAchAmountExceeded","institution_id","institutionLogo","updatedAccounts","console","log","verification_status","mask","subtype","paymentMethodsSpacing","paymentMethodsConnectBank","paymentMethodsCheckboxItem","paymentMethodsCheckbox","_value","signInMessage","createTenantURL","isExpanded","showViewMore","textDiv","setTextDiv","div","calculateShortHtml","toggleExpanded","fullHtml","dangerouslySetInnerHTML","shortHtml","componentWillUpdate","clientHeight","scrollHeight","innerHTML","lastIndexOf","Component","component","viewMore","ViewMore"],"mappings":"2FAAA,6JAIaA,EAAc,SAACC,GACxB,OAAIA,EAAWC,MAAM,gBACV,IAAeC,KACfF,EAAWC,MAAM,oBACjB,IAAeE,gBACfH,EAAWC,MAAM,iCACjB,IAAeG,SACfJ,EAAWC,MAAM,sGACjB,IAAeI,WAGnB,IAAeC,OAGbC,EAAc,SAACC,GACxB,OAAOA,IAAa,IAAeN,KAAO,yBACtCM,IAAa,IAAeL,gBAAkB,qCAC1CK,IAAa,IAAeJ,SAAW,kCACnCI,IAAa,IAAeH,WAAa,+BAAiC,IAG7EI,EAAsB,SAACC,GAChC,OAAOA,IAAW,IAAiBC,SAAW,IAAeR,gBACzDO,IAAW,IAAiBE,SAAW,IAAeV,KAClDQ,IAAW,IAAiBG,SAAW,IAAeR,WAClDK,IAAW,IAAiBI,SAAW,IAAeV,SAClD,IAAeE,OAGtBS,EAAsB,SAACP,GAChC,OAAOA,IAAa,IAAeL,gBAAkB,IAAiBQ,SAClEH,IAAa,IAAeN,KAAO,IAAiBU,SAChDJ,IAAa,IAAeH,WAAa,IAAiBQ,SACtDL,IAAa,IAAeJ,SAAW,IAAiBU,SACpD,IAAiBE,W,wECDhCC,E,0JCvBQC,EAA8C,SAAC,G,IACxD,IAAAC,cACIC,EAAe,kBACfC,EAAO,UACPC,EAAI,OACJC,EAAO,UACPC,EAAQ,WACRC,EAAY,eACZC,EAAi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,EAClB/wB,KAAKgxB,cAAe,EAChBhxB,KAAKixB,SACLnsB,YAAW,WAAM,SAAKssB,0BAW1B,YAAAA,mBAAR,WACI,IAAMD,EAAMnxB,KAAKixB,QACjB,GAAKE,EAAL,CAIA,KAAOA,EAAIO,aAAeP,EAAIQ,aAAe,GAAG,CAE5C,IAAM73B,EAAQq3B,EAAIS,UAAUC,YAAY,KACxC,KAAI/3B,GAAS,GAGT,MAFAq3B,EAAIS,UAAeT,EAAIS,UAAUpN,OAAO,EAAG1qB,GAAM,IAKzDkG,KAAKwxB,UAAYL,EAAIS,UACrB5xB,KAAKgxB,aAAehxB,KAAKwxB,YAAcxxB,KAAKsxB,WAOhD,YAAAlwB,OAAA,WACI,IAAM0wB,EAAY9xB,KAAKP,MAAMsyB,UAC7B,OAAO,gBAACD,EAAS,CAACE,SAAUhyB,QA3DpB,GAAX,a,wDACW,GAAX,a,yDACW,GAAX,a,0DACW,GAAX,a,4DACS,GAAT,W,mFAYD,GADC,S,iIAhBQiyB,EAAQ,GADpB,W,iCACYA,GAAb,CAA8B","file":"default.bundle.js?3fde2751e44115989e14","sourcesContent":["import { CreditCardIssuer } from \"src/api\";\nimport { CreditCardType } from \"src/invoice/types/types\";\n\n\nexport const getCardType = (cardNumber: string) => {\n if (cardNumber.match(/^4[0-9]{6,}$/)) {\n return CreditCardType.Visa;\n } else if (cardNumber.match(/^3[47][0-9]{5,}$/)) {\n return CreditCardType.AmericanExpress;\n } else if (cardNumber.match(/^6(?:011|5[0-9]{2})[0-9]{3,}$/)) {\n return CreditCardType.Discover;\n } else if (cardNumber.match(/^5[1-5][0-9]{5,}|222[1-9][0-9]{3,}|22[3-9][0-9]{4,}|2[3-6][0-9]{5,}|27[01][0-9]{4,}|2720[0-9]{3,}$/)) {\n return CreditCardType.MasterCard;\n }\n\n return CreditCardType.Other;\n};\n\nexport const getCardIcon = (cardType: string) => {\n return cardType === CreditCardType.Visa ? 'assets/images/visa.svg' :\n cardType === CreditCardType.AmericanExpress ? 'assets/images/american-express.svg' :\n cardType === CreditCardType.Discover ? 'assets/images/discover-card.svg' :\n cardType === CreditCardType.MasterCard ? 'assets/images/mastercard.svg' : '';\n};\n\nexport const getCardNameByIssuer = (issuer: CreditCardIssuer) => {\n return issuer === CreditCardIssuer.NUMBER_3 ? CreditCardType.AmericanExpress :\n issuer === CreditCardIssuer.NUMBER_4 ? CreditCardType.Visa :\n issuer === CreditCardIssuer.NUMBER_5 ? CreditCardType.MasterCard :\n issuer === CreditCardIssuer.NUMBER_6 ? CreditCardType.Discover :\n CreditCardType.Other;\n};\n\nexport const getIssuerByCardType = (cardType: string | undefined) => {\n return cardType === CreditCardType.AmericanExpress ? CreditCardIssuer.NUMBER_3 :\n cardType === CreditCardType.Visa ? CreditCardIssuer.NUMBER_4 :\n cardType === CreditCardType.MasterCard ? CreditCardIssuer.NUMBER_5 :\n cardType === CreditCardType.Discover ? CreditCardIssuer.NUMBER_6 :\n CreditCardIssuer.NUMBER_0;\n}","import React, { useState, useEffect, useRef } from 'react';\nimport {\n Modal,\n Button,\n ButtonGroup,\n Card,\n BodyText,\n Link,\n Spinner\n} from '@servicetitan/design-system';\nimport { ModalSizes } from '@servicetitan/design-system/dist/components/Modal/components';\nimport * as styles from './payment-method-modal.less';\nimport { paymentMethodsContainer } from 'src/payment-method/ioc';\nimport { ConnectedBankAccount, PaymentMethodType, PaymentMethodInfo } from 'src/invoice/types/types';\nimport { SavedPaymentItem } from '../payment-methods/desktop/saved-payment-item';\nimport { PaymentMethods } from '../payment-methods/desktop/payment-methods';\nimport { CardInfoFormState } from '../card-info/card-info/card-info';\nimport { PGCardInfoFormState } from '../card-info/pg-card-info/pg-card-info';\nimport { AchInfoFormState } from '../ach-info/ach-info/ach-info';\nimport { PaymentGateway } from 'src/statement/stores/payment-gateway.store';\nimport { SavedPaymentMethodsStore } from 'src/payment-method/stores/saved-payment-methods.store';\nimport { ChargeType, SplitInfo } from 'src/api';\n\ninterface PaymentMethodModalProps {\n selectedPaymentMethodId?: number;\n onPaymentMethodSelected: (paymentMethod: PaymentMethodInfo) => void;\n onClose: () => void;\n isOpen: boolean;\n usePaymentGateway: () => boolean;\n usePaymentsService: boolean | undefined;\n invoiceId?: string;\n store: SavedPaymentMethodsStore;\n chargeType: ChargeType;\n splits?: SplitInfo[];\n statementId?: string;\n}\n\nenum PaymentMethodViewType {\n SelectPaymentMethod = 'select-payment-method',\n AddPaymentMethod = 'add-payment-method'\n}\n\nexport const PaymentMethodModal: React.FC = ({\n selectedPaymentMethodId,\n onPaymentMethodSelected,\n onClose,\n isOpen,\n usePaymentGateway,\n usePaymentsService,\n invoiceId,\n store,\n chargeType,\n splits,\n statementId\n}) => {\n const paymentMethodType = useRef(PaymentMethodType.PayByBank);\n const creditCardInfo = useRef(new CardInfoFormState);\n const achInfo = useRef(new AchInfoFormState);\n const pgCreditCardInfo = useRef(new PGCardInfoFormState({ id: invoiceId || '', skipIFrameMessageHandler: true }));\n const [savePaymentChecked, setSavePaymentChecked] = useState(true);\n const [useAsPrimaryPaymentChecked, setUseAsPrimaryPaymentChecked] = useState(true);\n const [paymentMethodDialogTitle, setPaymentMethodDialogTitle] = useState('Select A Different Payment Method');\n const [addPaymentMethodButtonTitle, setAddPaymentMethodButtonTitle] = useState('Add Card');\n const [paymentMethodViewType, setPaymentMethodViewType] = useState(PaymentMethodViewType.SelectPaymentMethod);\n const currentSelectedPaymentMethod = useRef();\n const [currentSelectedPaymentMethodId, setCurrentSelectedPaymentMethodId] = useState(selectedPaymentMethodId);\n const initialSelectedPaymentMethodId = useRef(selectedPaymentMethodId);\n const [isCurrentSelectedPaymentInValid, setIsCurrentSelectedPaymentInValid] = useState(false)\n\n const connectedAccounts = useRef([]);\n const paymentMethodAction = useRef<(() => void) | undefined>(undefined);\n\n const handleSelect = () => {\n if (currentSelectedPaymentMethod.current) {\n // Update initial selected payment method if it is changed\n initialSelectedPaymentMethodId.current = currentSelectedPaymentMethod.current.paymentMethodId;\n onPaymentMethodSelected(currentSelectedPaymentMethod.current);\n }\n onClose();\n };\n\n\n const setPaymentMethodAction = (action: () => void) => {\n paymentMethodAction.current = action;\n };\n\n const paymentGateway = paymentMethodsContainer.get(PaymentGateway);\n const iframeMessageHandler = paymentGateway.iframeMessageHandler;\n React.useEffect(() => {\n window.addEventListener('message', iframeMessageHandler);\n return () => {\n window.removeEventListener('message', iframeMessageHandler);\n };\n });\n\n const handleAddPayment = () => {\n creditCardInfo.current = new CardInfoFormState;\n achInfo.current = new AchInfoFormState;\n pgCreditCardInfo.current = new PGCardInfoFormState({ id: invoiceId || '', skipIFrameMessageHandler: true });\n pgCreditCardInfo.current.desktopPaymentGatewayUrl = paymentGateway.getDesktopPaymentGatewayUrl(usePaymentsService);\n pgCreditCardInfo.current.iframeMessageHandler = iframeMessageHandler;\n setPaymentMethodViewType(PaymentMethodViewType.AddPaymentMethod);\n };\n\n const redirectToCardManagePage = () => {\n onClose();\n gotoSavedCardPage();\n }\n\n const {\n init,\n gotoSavedCardPage\n } = store;\n\n const [isLoadingSavedPaymentMethods, setIsLoadingSavedPaymentMethods] = useState(true);\n\n const preparePaymentOptions = (paymentMethodId: number | undefined) => {\n store.savedPaymentMethods?.forEach(paymentMethod => {\n paymentMethod.selected = paymentMethod.paymentMethodId === paymentMethodId;\n if (paymentMethod.selected) {\n currentSelectedPaymentMethod.current = paymentMethod;\n setIsCurrentSelectedPaymentInValid(store.isExpired(paymentMethod));\n }\n });\n };\n\n const updateDialogView = () => {\n setPaymentMethodDialogTitle(paymentMethodViewType === PaymentMethodViewType.AddPaymentMethod ?\n 'Add Payment Method' : 'Select A Different Payment Method');\n }\n\n const onBackForAddPaymentMethod = () => {\n setPaymentMethodViewType(PaymentMethodViewType.SelectPaymentMethod);\n }\n\n const onAddForAddPaymentMethod = async () => {\n if (!paymentMethodAction.current) {\n return;\n }\n\n // Pay-By-Bank after adding account action\n if (paymentMethodType.current === PaymentMethodType.PayByBank) {\n if (connectedAccounts.current.length > 0) {\n\n const connectedAccount = connectedAccounts.current\n .filter(account => account.selected)[0];\n\n const payByBankPaymentMethod = store.connectedBankAccountToPaymentMethod(connectedAccount,\n useAsPrimaryPaymentChecked && savePaymentChecked\n );\n\n addPaymentMethod(payByBankPaymentMethod);\n return;\n } else {\n paymentMethodAction.current();\n }\n }\n\n if (paymentMethodType.current === PaymentMethodType.CreditCard) {\n if (usePaymentGateway()) {\n const cardResult = await pgCreditCardInfo.current.form.validate();\n if (cardResult.hasError) {\n return;\n }\n\n const paymentMethod = { paymentMethodId: 0 } as PaymentMethodInfo;\n paymentMethod.paymentMethodType = PaymentMethodType.CreditCard;\n\n addPaymentMethod(paymentMethod);\n } else {\n const paymentMethod = await store.cardInfoToPaymentMethod(creditCardInfo.current,\n useAsPrimaryPaymentChecked && savePaymentChecked\n );\n\n if (!paymentMethod) {\n return;\n }\n\n addPaymentMethod(paymentMethod);\n }\n }\n\n if (paymentMethodType.current === PaymentMethodType.ACH) {\n const achPaymentMethod = await store.achInfoToPaymentMethod(achInfo.current,\n useAsPrimaryPaymentChecked && savePaymentChecked\n );\n\n if (!achPaymentMethod) {\n return;\n }\n\n addPaymentMethod(achPaymentMethod);\n }\n\n // paymentMethodAction.current();\n };\n\n const addPaymentMethod = (paymentMethod: PaymentMethodInfo) => {\n // reset selected if newly added payment is selected\n if (paymentMethod.selected) {\n store.savedPaymentMethods?.forEach(paymentMethod => { paymentMethod.selected = false; });\n }\n\n // reset primary if newly added payment is primary\n if (paymentMethod.primary) {\n store.savedPaymentMethods?.forEach(paymentMethod => { paymentMethod.primary = false; });\n }\n\n if (savePaymentChecked) {\n store.setOnActionComplete(success => {\n if (!success) {\n return;\n }\n\n currentSelectedPaymentMethod.current = store.getLastSavedPaymentMethod();\n setCurrentSelectedPaymentMethodId(currentSelectedPaymentMethod.current?.paymentMethodId);\n\n handleSelect();\n });\n\n store.needToStoreAsPrimary = useAsPrimaryPaymentChecked;\n store.addPaymentMethod(paymentMethod);\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.CreditCard && usePaymentGateway()) {\n store.processGatewayAddNewCard(p => {\n currentSelectedPaymentMethod.current = p;\n setCurrentSelectedPaymentMethodId(p!.paymentMethodId);\n handleSelect();\n });\n } else {\n currentSelectedPaymentMethod.current = paymentMethod;\n setCurrentSelectedPaymentMethodId(paymentMethod.paymentMethodId);\n handleSelect();\n }\n };\n\n const updateButtonTitleForPayByBank = () => {\n setAddPaymentMethodButtonTitle(connectedAccounts.current.length > 0 ?\n 'Add Bank Account' : 'Connect Bank Account'\n );\n }\n\n const setPaymentMethodType = (type: PaymentMethodType) => {\n paymentMethodType.current = type;\n if (type === PaymentMethodType.CreditCard) {\n setAddPaymentMethodButtonTitle('Add Card');\n } else if (type === PaymentMethodType.ACH) {\n setAddPaymentMethodButtonTitle('Add ACH');\n } else {\n updateButtonTitleForPayByBank();\n }\n };\n\n const updateConnectedAccounts = (accounts: ConnectedBankAccount[]) => {\n connectedAccounts.current = accounts;\n updateButtonTitleForPayByBank();\n };\n\n const onModalClose = () => {\n if (initialSelectedPaymentMethodId.current) {\n // Set original selected payment if closing dialog without selection\n const initialPaymentMethod = store.savedPaymentMethods?.find(p => p.paymentMethodId === initialSelectedPaymentMethodId.current);\n if (initialPaymentMethod) {\n onPaymentMethodSelected(initialPaymentMethod);\n }\n }\n\n onClose();\n }\n\n useEffect(() => {\n store.currentInvoiceId = invoiceId;\n store.currentStatementId = statementId;\n store.currentSplits = splits;\n store.setOnSelectedPaymentMethodChange(() => {\n setIsLoadingSavedPaymentMethods(false);\n });\n init();\n }, [init]);\n\n useEffect(() => {\n preparePaymentOptions(currentSelectedPaymentMethodId);\n }, [currentSelectedPaymentMethodId, store.savedPaymentMethods]);\n\n useEffect(() => {\n pgCreditCardInfo.current.desktopPaymentGatewayUrl = paymentGateway.getDesktopPaymentGatewayUrl(usePaymentsService);\n pgCreditCardInfo.current.mobilePaymentGatewayUrl = paymentGateway.getMobilePaymentGatewayUrl(usePaymentsService);\n pgCreditCardInfo.current.iframeMessageHandler = iframeMessageHandler;\n }, []);\n\n useEffect(() => {\n updateDialogView();\n }, [paymentMethodViewType]);\n\n return (\n \n \n \n ) :\n (\n \n \n )\n }\n >\n {paymentMethodViewType === PaymentMethodViewType.SelectPaymentMethod &&\n (\n You can also {' '}\n \n manage\n {' '} your saved payment methods.\n )}\n {isLoadingSavedPaymentMethods ? (\n
\n \n \n Loading saved payment methods...\n \n
\n ) : (paymentMethodViewType === PaymentMethodViewType.SelectPaymentMethod ?\n (\n {\n store.savedPaymentMethods?.map(\n (paymentMethod, index) =>\n {\n paymentMethod.selected = true;\n preparePaymentOptions(paymentMethod.paymentMethodId);\n setCurrentSelectedPaymentMethodId(paymentMethodId);\n }} />\n )}\n ) : (\n { }}\n setPaymentMethodAction={setPaymentMethodAction}\n setConnectedAccounts={updateConnectedAccounts}\n setPaymentMethodType={setPaymentMethodType}\n showPrimaryOption={store.getIsCPEnabled()}\n showSavePaymentOption={store.getIsCPEnabled()}\n savePaymentChecked={savePaymentChecked}\n setSavePaymentChecked={setSavePaymentChecked}\n useAsPrimaryPaymentChecked={useAsPrimaryPaymentChecked}\n setUseAsPrimaryPaymentChecked={setUseAsPrimaryPaymentChecked}\n paymentMethodStore={store}\n />\n )\n )}\n \n );\n}\n","import React, { FC } from 'react';\n\n\nimport styles from './saved-payment-item.less';\nimport { PaymentMethodType, PaymentMethodInfo } from 'src/invoice/types/types';\nimport { Radio } from '@material-ui/core';\n\ninterface SavedPaymentItemProps {\n paymentMethod: PaymentMethodInfo;\n showDivider: boolean;\n selected: boolean;\n onSelectPaymentMethod: (paymentMethodId: number) => void;\n}\n\nexport const SavedPaymentItem: FC = ({\n paymentMethod: {\n paymentMethodId,\n primary,\n icon,\n expires,\n bankName,\n customerName,\n paymentMethodType,\n displayText\n },\n selected,\n showDivider,\n onSelectPaymentMethod\n}) => (\n <>\n \n {showDivider && (\n
\n )}\n \n);","import React, { useState, useEffect, useRef } from 'react';\nimport {\n Button,\n ButtonGroup,\n BodyText,\n Link,\n Spinner,\n Takeover\n} from '@servicetitan/design-system';\nimport { ModalSizes } from '@servicetitan/design-system/dist/components/Modal/components';\nimport * as styles from './payment-method-modal.less';\nimport { paymentMethodsContainer } from 'src/payment-method/ioc';\nimport { ConnectedBankAccount, PaymentMethodType, PaymentMethodInfo } from 'src/invoice/types/types';\nimport { SavedPaymentItem } from '../../payment-methods/mobile/saved-payment-item';\nimport { PaymentMethods } from '../../payment-methods/desktop/payment-methods';\nimport { CardInfoFormState } from '../../card-info/card-info/card-info';\nimport { PGCardInfoFormState } from '../../card-info/pg-card-info/pg-card-info';\nimport { AchInfoFormState } from '../../ach-info/ach-info/ach-info';\nimport { PaymentGateway } from 'src/statement/stores/payment-gateway.store';\nimport { SavedPaymentMethodsStore } from 'src/payment-method/stores/saved-payment-methods.store';\nimport { ChargeType, SplitInfo } from 'src/api';\n\ninterface PaymentMethodModalProps {\n selectedPaymentMethodId?: number;\n onPaymentMethodSelected: (paymentMethod: PaymentMethodInfo) => void;\n onClose: () => void;\n isOpen: boolean;\n usePaymentGateway: () => boolean;\n usePaymentsService: boolean | undefined;\n invoiceId?: string;\n store: SavedPaymentMethodsStore;\n chargeType: ChargeType;\n splits?: SplitInfo[];\n statementId?: string;\n}\n\nenum PaymentMethodViewType {\n SelectPaymentMethod = 'select-payment-method',\n AddPaymentMethod = 'add-payment-method'\n}\n\nexport const PaymentMethodModal: React.FC = ({\n selectedPaymentMethodId,\n onPaymentMethodSelected,\n onClose,\n isOpen,\n usePaymentGateway,\n usePaymentsService,\n invoiceId,\n store,\n chargeType,\n splits,\n statementId\n}) => {\n const paymentMethodType = useRef(PaymentMethodType.PayByBank);\n const creditCardInfo = useRef(new CardInfoFormState);\n const achInfo = useRef(new AchInfoFormState);\n const pgCreditCardInfo = useRef(new PGCardInfoFormState({ id: invoiceId || '', skipIFrameMessageHandler: true }));\n const [savePaymentChecked, setSavePaymentChecked] = useState(true);\n const [useAsPrimaryPaymentChecked, setUseAsPrimaryPaymentChecked] = useState(true);\n const [paymentMethodDialogTitle, setPaymentMethodDialogTitle] = useState('Select Payment Method');\n const [addPaymentMethodButtonTitle, setAddPaymentMethodButtonTitle] = useState('Add Card');\n const [paymentMethodViewType, setPaymentMethodViewType] = useState(PaymentMethodViewType.SelectPaymentMethod);\n const currentSelectedPaymentMethod = useRef();\n const [currentSelectedPaymentMethodId, setCurrentSelectedPaymentMethodId] = useState(selectedPaymentMethodId);\n const initialSelectedPaymentMethodId = useRef(selectedPaymentMethodId);\n const [isCurrentSelectedPaymentInValid, setIsCurrentSelectedPaymentInValid] = useState(false);\n\n const connectedAccounts = useRef([]);\n const paymentMethodAction = useRef<(() => void) | undefined>(undefined);\n\n const handleSelect = () => {\n if (currentSelectedPaymentMethod.current) {\n // Update initial selected payment method if it is changed\n initialSelectedPaymentMethodId.current = currentSelectedPaymentMethod.current.paymentMethodId;\n onPaymentMethodSelected(currentSelectedPaymentMethod.current);\n }\n onClose();\n };\n\n\n const setPaymentMethodAction = (action: () => void) => {\n paymentMethodAction.current = action;\n };\n\n const paymentGateway = paymentMethodsContainer.get(PaymentGateway);\n const iframeMessageHandler = paymentGateway.iframeMessageHandler;\n React.useEffect(() => {\n window.addEventListener('message', iframeMessageHandler);\n return () => {\n window.removeEventListener('message', iframeMessageHandler);\n };\n });\n\n const handleAddPayment = () => {\n creditCardInfo.current = new CardInfoFormState;\n achInfo.current = new AchInfoFormState;\n pgCreditCardInfo.current = new PGCardInfoFormState({ id: invoiceId || '', skipIFrameMessageHandler: true });\n pgCreditCardInfo.current.desktopPaymentGatewayUrl = paymentGateway.getDesktopPaymentGatewayUrl(usePaymentsService);\n pgCreditCardInfo.current.iframeMessageHandler = iframeMessageHandler;\n setPaymentMethodViewType(PaymentMethodViewType.AddPaymentMethod);\n };\n\n const redirectToCardManagePage = () => {\n onClose();\n gotoSavedCardPage();\n }\n\n const {\n init,\n gotoSavedCardPage\n } = store;\n\n const [isLoadingSavedPaymentMethods, setIsLoadingSavedPaymentMethods] = useState(true);\n\n const preparePaymentOptions = (paymentMethodId: number | undefined) => {\n store.savedPaymentMethods?.forEach(paymentMethod => {\n paymentMethod.selected = paymentMethod.paymentMethodId === paymentMethodId;\n if (paymentMethod.selected) {\n currentSelectedPaymentMethod.current = paymentMethod;\n setIsCurrentSelectedPaymentInValid(store.isExpired(paymentMethod));\n }\n });\n };\n\n const updateDialogView = () => {\n setPaymentMethodDialogTitle(paymentMethodViewType === PaymentMethodViewType.AddPaymentMethod ?\n 'Add Payment Method' : 'Select Payment Method');\n }\n\n const onBackForAddPaymentMethod = () => {\n setPaymentMethodViewType(PaymentMethodViewType.SelectPaymentMethod);\n }\n\n const onAddForAddPaymentMethod = async () => {\n if (!paymentMethodAction.current) {\n return;\n }\n\n // Pay-By-Bank after adding account action\n if (paymentMethodType.current === PaymentMethodType.PayByBank) {\n if (connectedAccounts.current.length > 0) {\n\n const connectedAccount = connectedAccounts.current\n .filter(account => account.selected)[0];\n\n const payByBankPaymentMethod = store.connectedBankAccountToPaymentMethod(connectedAccount,\n useAsPrimaryPaymentChecked && savePaymentChecked\n );\n\n addPaymentMethod(payByBankPaymentMethod);\n return;\n } else {\n paymentMethodAction.current();\n }\n }\n\n if (paymentMethodType.current === PaymentMethodType.CreditCard) {\n if (usePaymentGateway()) {\n const cardResult = await pgCreditCardInfo.current.form.validate();\n if (cardResult.hasError) {\n return;\n }\n\n const paymentMethod = { paymentMethodId: 0 } as PaymentMethodInfo;\n paymentMethod.paymentMethodType = PaymentMethodType.CreditCard;\n\n addPaymentMethod(paymentMethod);\n } else {\n const paymentMethod = await store.cardInfoToPaymentMethod(creditCardInfo.current,\n useAsPrimaryPaymentChecked && savePaymentChecked\n );\n\n if (!paymentMethod) {\n return;\n }\n\n addPaymentMethod(paymentMethod);\n }\n }\n\n if (paymentMethodType.current === PaymentMethodType.ACH) {\n const achPaymentMethod = await store.achInfoToPaymentMethod(achInfo.current,\n useAsPrimaryPaymentChecked && savePaymentChecked\n );\n\n if (!achPaymentMethod) {\n return;\n }\n\n addPaymentMethod(achPaymentMethod);\n }\n\n // paymentMethodAction.current();\n };\n\n const addPaymentMethod = (paymentMethod: PaymentMethodInfo) => {\n // reset selected if newly added payment is selected\n if (paymentMethod.selected) {\n store.savedPaymentMethods?.forEach(paymentMethod => { paymentMethod.selected = false; });\n }\n\n // reset primary if newly added payment is primary\n if (paymentMethod.primary) {\n store.savedPaymentMethods?.forEach(paymentMethod => { paymentMethod.primary = false; });\n }\n\n if (savePaymentChecked) {\n store.setOnActionComplete(success => {\n if (!success) {\n return;\n }\n\n currentSelectedPaymentMethod.current = store.getLastSavedPaymentMethod();\n setCurrentSelectedPaymentMethodId(currentSelectedPaymentMethod.current?.paymentMethodId);\n\n handleSelect();\n });\n\n store.needToStoreAsPrimary = useAsPrimaryPaymentChecked;\n store.addPaymentMethod(paymentMethod);\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.CreditCard && usePaymentGateway()) {\n store.processGatewayAddNewCard(p => {\n currentSelectedPaymentMethod.current = p;\n setCurrentSelectedPaymentMethodId(p!.paymentMethodId);\n handleSelect();\n });\n } else {\n currentSelectedPaymentMethod.current = paymentMethod;\n setCurrentSelectedPaymentMethodId(paymentMethod.paymentMethodId);\n handleSelect();\n }\n };\n\n const updateButtonTitleForPayByBank = () => {\n setAddPaymentMethodButtonTitle(connectedAccounts.current.length > 0 ?\n 'Add Bank Account' : 'Connect Bank Account'\n );\n }\n\n const setPaymentMethodType = (type: PaymentMethodType) => {\n paymentMethodType.current = type;\n if (type === PaymentMethodType.CreditCard) {\n setAddPaymentMethodButtonTitle('Add Card');\n } else if (type === PaymentMethodType.ACH) {\n setAddPaymentMethodButtonTitle('Add ACH');\n } else {\n updateButtonTitleForPayByBank();\n }\n };\n\n const updateConnectedAccounts = (accounts: ConnectedBankAccount[]) => {\n connectedAccounts.current = accounts;\n updateButtonTitleForPayByBank();\n };\n\n const onModalClose = () => {\n if (initialSelectedPaymentMethodId.current) {\n // Set original selected payment if closing dialog without selection\n const initialPaymentMethod = store.savedPaymentMethods?.find(p => p.paymentMethodId === initialSelectedPaymentMethodId.current);\n if (initialPaymentMethod) {\n onPaymentMethodSelected(initialPaymentMethod);\n }\n }\n\n onClose();\n }\n\n useEffect(() => {\n store.currentInvoiceId = invoiceId;\n store.currentStatementId = statementId;\n store.currentSplits = splits;\n store.setOnSelectedPaymentMethodChange(() => {\n setIsLoadingSavedPaymentMethods(false);\n });\n init();\n }, [init]);\n\n useEffect(() => {\n preparePaymentOptions(currentSelectedPaymentMethodId);\n }, [currentSelectedPaymentMethodId, store.savedPaymentMethods]);\n\n useEffect(() => {\n pgCreditCardInfo.current.desktopPaymentGatewayUrl = paymentGateway.getDesktopPaymentGatewayUrl(usePaymentsService);\n pgCreditCardInfo.current.mobilePaymentGatewayUrl = paymentGateway.getMobilePaymentGatewayUrl(usePaymentsService);\n pgCreditCardInfo.current.iframeMessageHandler = iframeMessageHandler;\n }, []);\n\n useEffect(() => {\n updateDialogView();\n }, [paymentMethodViewType]);\n\n return (\n \n {paymentMethodDialogTitle}\n \n }\n footer={\n paymentMethodViewType === PaymentMethodViewType.SelectPaymentMethod ? (\n \n \n \n ) :\n (\n \n \n )\n }\n >\n {paymentMethodViewType === PaymentMethodViewType.SelectPaymentMethod &&\n (\n To manage your payment methods,{' '}\n \n click here\n .\n )}\n {isLoadingSavedPaymentMethods ? (\n
\n \n \n Loading saved payment methods...\n \n
\n ) : (paymentMethodViewType === PaymentMethodViewType.SelectPaymentMethod ?\n (
\n {\n store.savedPaymentMethods?.map(\n (paymentMethod, index) =>\n {\n paymentMethod.selected = true;\n preparePaymentOptions(paymentMethod.paymentMethodId);\n setCurrentSelectedPaymentMethodId(paymentMethodId);\n }} />\n )}\n
) : (\n { }}\n setPaymentMethodAction={setPaymentMethodAction}\n setConnectedAccounts={updateConnectedAccounts}\n setPaymentMethodType={setPaymentMethodType}\n showPrimaryOption={store.getIsCPEnabled()}\n showSavePaymentOption={store.getIsCPEnabled()}\n savePaymentChecked={savePaymentChecked}\n setSavePaymentChecked={setSavePaymentChecked}\n useAsPrimaryPaymentChecked={useAsPrimaryPaymentChecked}\n setUseAsPrimaryPaymentChecked={setUseAsPrimaryPaymentChecked}\n paymentMethodStore={store}\n />\n )\n )}\n \n );\n}\n","import classNames from 'classnames';\nimport React, { useRef, FC, useEffect, useState } from 'react';\n\n\nimport styles from './saved-payment-method.less';\nimport { PaymentMethodInfo } from 'src/invoice/types/types';\nimport { PaymentMethodModal } from '../../payment-method-modal/payment-method-modal';\nimport { Chip } from '@material-ui/core';\nimport { PaymentAmountFormState } from '../../payment-amount/payment-amount';\nimport { PendingInvoicePayment, SavedPaymentMethodsStore } from 'src/payment-method/stores/saved-payment-methods.store';\nimport { ChargeType, SplitInfo } from 'src/api';\n\ninterface SavedPaymentMethodProps {\n paymentMethod: PaymentMethodInfo;\n setPaymentMethod: (paymentMethod: PaymentMethodInfo) => void;\n setPaymentMethodAction: (action: () => void) => void;\n paymentAmountData: PaymentAmountFormState;\n usePaymentGateway: () => boolean;\n invoiceId?: string;\n splits?: SplitInfo[];\n store: SavedPaymentMethodsStore;\n chargeType: ChargeType;\n statementId?: string;\n}\n\nexport const SavedPaymentMethod: FC = ({\n paymentMethod,\n setPaymentMethod,\n usePaymentGateway,\n paymentAmountData,\n setPaymentMethodAction,\n invoiceId,\n store,\n chargeType,\n splits,\n statementId\n}) => {\n\n const [isModalOpen, setIsModalOpen] = useState(false);\n const currentPaymentMethod = useRef(paymentMethod);\n const [currentPaymentMethodId, setCurrentPaymentMethodId] = useState(paymentMethod.paymentMethodId);\n\n const onChangePaymentMethod = () => {\n setIsModalOpen(true);\n };\n\n const onModalClose = () => {\n setIsModalOpen(false);\n };\n\n const updateCurrentPaymentMethod = (paymentMethod: PaymentMethodInfo) => {\n setPaymentMethod(paymentMethod);\n currentPaymentMethod.current = paymentMethod;\n setCurrentPaymentMethodId(paymentMethod.paymentMethodId);\n };\n\n const paymentMethodAction = async () => {\n const paymentMethod = currentPaymentMethod.current;\n const amount = (!paymentAmountData.isFullBalance.value\n ? parseFloat(paymentAmountData.customAmount.value)\n : paymentAmountData.fullBalance) || 0;\n\n const payment: PendingInvoicePayment = {\n amount,\n invoiceNumber: invoiceId!,\n amountRemaining: paymentAmountData.fullBalance! - amount,\n chargeType,\n splits,\n statementId\n };\n\n await store.chargePaymentMethod(paymentMethod, payment);\n };\n\n useEffect(() => {\n setPaymentMethodAction(paymentMethodAction);\n }, []);\n\n return (\n <>\n
\n {paymentMethod.displayText}\n
\n {paymentMethod.displayText}\n
\n {(paymentMethod.primary || paymentMethod.disconnected) && (\n
\n {paymentMethod.primary && ()}\n {paymentMethod.disconnected && ()}\n
\n )}\n
\n \n Change payment method\n \n\n {isModalOpen && (\n \n )}\n \n )\n};","import React, { FC } from 'react';\n\n\nimport styles from './saved-payment-item.less';\nimport { PaymentMethodType, PaymentMethodInfo } from 'src/invoice/types/types';\nimport { Radio } from '@material-ui/core';\n\ninterface SavedPaymentItemProps {\n paymentMethod: PaymentMethodInfo;\n showDivider: boolean;\n selected: boolean;\n onSelectPaymentMethod: (paymentMethodId: number) => void;\n}\n\nexport const SavedPaymentItem: FC = ({\n paymentMethod: {\n paymentMethodId,\n primary,\n icon,\n expires,\n bankName,\n customerName,\n paymentMethodType,\n displayText\n },\n selected,\n showDivider,\n onSelectPaymentMethod\n}) => (\n <>\n \n {showDivider && (\n
\n )}\n \n);","import classNames from 'classnames';\nimport React, { useRef, FC, useEffect, useState } from 'react';\n\n\nimport styles from './saved-payment-method.less';\nimport { PaymentMethodInfo } from 'src/invoice/types/types';\nimport { PaymentMethodModal } from '../../payment-method-modal/mobile/payment-method-modal';\nimport { Chip } from '@material-ui/core';\nimport { PaymentAmountFormState } from '../../payment-amount/payment-amount';\nimport { PendingInvoicePayment, SavedPaymentMethodsStore } from 'src/payment-method/stores/saved-payment-methods.store';\nimport { ChargeType, SplitInfo } from 'src/api';\n\ninterface SavedPaymentMethodProps {\n paymentMethod: PaymentMethodInfo;\n setPaymentMethod: (paymentMethod: PaymentMethodInfo) => void;\n setPaymentMethodAction: (action: () => void) => void;\n paymentAmountData: PaymentAmountFormState;\n usePaymentGateway: () => boolean;\n invoiceId?: string;\n splits?: SplitInfo[];\n store: SavedPaymentMethodsStore;\n chargeType: ChargeType;\n statementId?: string;\n}\n\nexport const SavedPaymentMethod: FC = ({\n paymentMethod,\n setPaymentMethod,\n usePaymentGateway,\n paymentAmountData,\n setPaymentMethodAction,\n invoiceId,\n store,\n chargeType,\n splits,\n statementId\n}) => {\n\n const [isModalOpen, setIsModalOpen] = useState(false);\n const currentPaymentMethod = useRef(paymentMethod);\n const [currentPaymentMethodId, setCurrentPaymentMethodId] = useState(paymentMethod.paymentMethodId);\n\n const onChangePaymentMethod = () => {\n setIsModalOpen(true);\n };\n\n const onModalClose = () => {\n setIsModalOpen(false);\n };\n\n const updateCurrentPaymentMethod = (paymentMethod: PaymentMethodInfo) => {\n setPaymentMethod(paymentMethod);\n currentPaymentMethod.current = paymentMethod;\n setCurrentPaymentMethodId(paymentMethod.paymentMethodId);\n };\n\n const paymentMethodAction = async () => {\n const paymentMethod = currentPaymentMethod.current;\n const amount = (!paymentAmountData.isFullBalance.value\n ? parseFloat(paymentAmountData.customAmount.value)\n : paymentAmountData.fullBalance) || 0;\n\n const payment: PendingInvoicePayment = {\n amount,\n invoiceNumber: invoiceId!,\n amountRemaining: paymentAmountData.fullBalance! - amount,\n chargeType,\n splits,\n statementId\n };\n\n await store.chargePaymentMethod(paymentMethod, payment);\n };\n\n useEffect(() => {\n setPaymentMethodAction(paymentMethodAction);\n }, []);\n\n return (\n <>\n
\n {paymentMethod.displayText}\n
\n {(paymentMethod.primary || paymentMethod.disconnected) && (\n
\n {paymentMethod.primary && ()}\n {paymentMethod.disconnected && ()}\n
\n )}\n
\n {paymentMethod.displayText}\n
\n
\n
\n \n Change payment method\n \n\n {isModalOpen && (\n \n )}\n \n )\n};","import React, { FC, useEffect, useState } from 'react';\nimport { AchInfoFormState } from '../../ach-info/ach-info/ach-info';\nimport { CardInfoFormState } from '../../card-info/card-info/card-info';\nimport { PGCardInfoFormState } from '../../card-info/pg-card-info/pg-card-info';\nimport { PaymentAmountFormState } from '../../payment-amount/payment-amount';\nimport styles from './payment-method-container.less';\nimport classnames from 'classnames';\nimport { ConnectedBankAccount, PaymentMethodInfo, PaymentMethodType } from 'src/invoice/types/types';\n\nimport { PaymentMethods } from './payment-methods';\nimport { SavedPaymentMethod } from './saved-payment-method';\nimport { SavedPaymentMethod as MobileSavedPaymentMethod } from '../mobile/saved-payment-method';\nimport { BodyText, IconNameType, Spinner } from '@servicetitan/design-system';\nimport { paymentMethodsContainer } from 'src/payment-method/ioc';\nimport { SavedPaymentMethodsStore } from 'src/payment-method/stores/saved-payment-methods.store';\nimport { ChargeType, SplitInfo } from 'src/api';\n\ninterface PaymentMethodProps {\n paymentAmountData: PaymentAmountFormState;\n cardInfoData: CardInfoFormState;\n pgcardInfoData: PGCardInfoFormState;\n achInfoData: AchInfoFormState;\n usePaymentGateway: () => boolean;\n showLoginLink: boolean;\n setPaymentMethodValid: (isValid: boolean) => void;\n setPaymentMethodAction: (action: () => void) => void;\n setConnectedAccounts: (accounts: ConnectedBankAccount[]) => void;\n setPaymentButtonTextIcon: (text: string, icon?: IconNameType | undefined) => void;\n invoiceId?: string;\n splits?: SplitInfo[];\n setPaymentMethodSubmit?: (submit: () => void) => void;\n chargeType: ChargeType;\n statementId?: string;\n cardView?: boolean;\n setPaymentMethodType?: ((paymentMethodType: PaymentMethodType) => void) | undefined;\n};\n\n\nexport const PaymentMethodContainer: FC = ({\n paymentAmountData,\n cardInfoData,\n pgcardInfoData,\n achInfoData,\n usePaymentGateway,\n setPaymentMethodValid,\n setPaymentMethodAction,\n setConnectedAccounts,\n setPaymentButtonTextIcon,\n showLoginLink,\n invoiceId,\n setPaymentMethodSubmit,\n splits,\n chargeType,\n statementId,\n setPaymentMethodType, cardView = true\n}) => {\n const store = paymentMethodsContainer.get(SavedPaymentMethodsStore);\n\n const [savePaymentChecked, setSavePaymentChecked] = useState(store.getIsLoggedIn());\n const [useAsPrimaryPaymentChecked, setUseAsPrimaryPaymentChecked] = useState(store.getIsLoggedIn());\n const [savedPayment, setSavedPayment] = useState(undefined);\n\n const isLoggedIn = store.getIsLoggedIn();\n\n const isSavedPaymentOptionEnabled = store.getIsSavedPaymentOptionEnabled();\n\n const [errorMessage, setErrorMessage] = useState(undefined);\n\n const [isReady, setIsReady] = useState(false);\n\n const prepareSelectedPaymentMethod = async () => {\n if (savedPayment && isLoggedIn) {\n setPaymentMethodValid(!savedPayment.disconnected);\n setErrorMessage(savedPayment.disconnected ?\n 'Please update your payment method to continue.' : undefined);\n setPaymentButtonTextIcon(`Pay with ${savedPayment.name} Ending in *${savedPayment.number}`);\n if (setPaymentMethodType) {\n setPaymentMethodType(savedPayment.paymentMethodType);\n }\n }\n };\n\n useEffect(() => {\n store.setOnSelectedPaymentMethodChange(paymentMethod => {\n setSavedPayment(paymentMethod);\n setIsReady(true);\n });\n store.setOnPbbErrorMessage(error => {\n setErrorMessage(error);\n });\n store.currentInvoiceId = invoiceId;\n store.currentStatementId = statementId;\n store.currentSplits = splits;\n store.init(() => {\n if (!store.getIsLoggedIn() || !store.getIsSavedPaymentOptionEnabled()) {\n // Set ready when not signed-in or no saved payment option exists\n setIsReady(true);\n }\n });\n }, [store.init]);\n\n useEffect(() => {\n prepareSelectedPaymentMethod();\n }, [savedPayment]);\n\n return (isReady ?\n (
\n

Payment Method

\n\n {isLoggedIn && !savedPayment && (\n There are no saved payment methods associated with this account. When submitting a payment, you can choose to save the payment information for a faster checkout in the future.\n )}\n\n {errorMessage && (\n
\n
\n \n \n Payment Method Error\n \n
\n
\n {errorMessage}\n
\n
)}\n\n {isLoggedIn && savedPayment ?\n (cardView ? : ) :\n ()}\n
) :\n
\n \n \n Loading payment method options...\n \n
)\n}","import classnames from 'classnames';\nimport * as React from 'react';\nimport { observer } from 'mobx-react';\nimport { Radio } from '@material-ui/core';\n\nimport { PaymentAmountContainer } from '../payment-amount';\nimport { currency, twoDigitsAmount } from 'src/util/formatters';\nimport { MatField } from 'src/core/components/mat-field';\n\nimport styles from './payment-amount.less';\n\ninterface Props {\n container: PaymentAmountContainer;\n}\n\nexport const PaymentAmount = observer>(({ container: { data } }) => {\n if (data.errorMessage || !data.fullBalance) {\n return null;\n }\n\n return (\n
\n

Payment Amount

\n\n \n \n Full balance\n \n {currency(data.fullBalance)}\n \n \n {data.partialPaymentEnabled && (\n \n )}\n
\n );\n});\n","import { observable } from 'mobx';\nimport { observer } from 'mobx-react';\nimport { FormState, FieldState, Validator } from 'formstate';\nimport * as React from 'react';\nimport { RouteComponentProps } from 'react-router';\n\nimport { currency } from 'src/util/formatters';\nimport { lazyInject } from '../../ioc';\nimport { InvoiceStore } from '../../stores/invoice.store';\nimport { RouterStore } from 'src/core/stores/router.store';\n\nimport { PaymentAmount } from './desktop/payment-amount';\n\nexport class PaymentAmountFormState {\n @lazyInject(InvoiceStore) private invoiceStore!: InvoiceStore;\n @lazyInject(RouterStore) private router!: RouterStore;\n\n @observable errorMessage: string | undefined;\n @observable fullBalance: number | undefined;\n @observable partialPaymentEnabled: boolean | undefined;\n @observable onStateChanged?: () => void | undefined;\n\n customAmountValidator: Validator = (value) => {\n if (this.onStateChanged) {\n this.onStateChanged();\n }\n\n if (this.isFullBalance.value) {\n return false;\n }\n\n if (!value) {\n return 'This field is required.';\n }\n\n const amount = Number(value);\n if (isNaN(amount)) {\n return 'Amount must be a number.';\n }\n\n let minimumAmount = 1;\n if (this.fullBalance !== undefined && this.fullBalance < 1) {\n minimumAmount = this.fullBalance;\n }\n if (amount < minimumAmount) {\n return `Amount must be at least ${currency(minimumAmount)}.`;\n }\n\n if (this.fullBalance !== undefined && amount > this.fullBalance) {\n return 'Amount must be less than full balance.';\n }\n };\n\n isFullBalance = new FieldState(true);\n customAmount = new FieldState('').validators(this.customAmountValidator);\n\n form = new FormState({\n isFullBalance: this.isFullBalance,\n customAmount: this.customAmount,\n });\n\n constructor(private props?: RouteComponentProps,\n private amount?: number\n ) {\n // Initialize with fixed amount\n if (amount) {\n this.fullBalance = amount\n this.isFullBalance.value = true\n return;\n }\n\n this.form.validate();\n\n this.isFullBalance.onDidChange(() => {\n this.customAmount.validate();\n });\n\n const id = props?.match.params.id;\n if (!id) {\n return;\n }\n\n if (!this.invoiceStore.payment) {\n this.invoiceStore.payment = {\n invoiceNumber: id,\n };\n } else if (this.invoiceStore.payment.invoiceNumber !== id) {\n this.invoiceStore.payment.invoiceNumber = id;\n this.invoiceStore.payment.amount = undefined;\n }\n\n this.invoiceStore.getInvoice(id).then(\n (invoice) => {\n if (invoice.balance <= 0) {\n this.router.history.replace(`/invoice/${id}`);\n return;\n }\n\n this.fullBalance = invoice.balance;\n this.partialPaymentEnabled = !invoice.partialPaymentDisabled;\n },\n (err) => {\n this.errorMessage = err;\n }\n );\n }\n\n clearError = () => {\n this.errorMessage = undefined;\n };\n\n handleSubmit = (e?: React.FormEvent, isSubcomponent?: boolean) => {\n e && e.preventDefault();\n\n if (!this.props) {\n // Handle scenario where amount is hardcoded\n return true;\n }\n\n if (this.form.hasError || !this.fullBalance || !this.invoiceStore.payment) {\n return false;\n }\n\n this.invoiceStore.payment.amount = this.isFullBalance.$\n ? this.fullBalance\n : Number(this.customAmount.$);\n\n if (!isSubcomponent) {\n this.props.history.push(`/invoice/${this.props.match.params.id}/payment-info`);\n }\n\n return true;\n };\n\n handleFullAmountTrue = () => {\n this.isFullBalance.onChange(true);\n if (this.onStateChanged) {\n this.onStateChanged();\n }\n };\n\n handleFullAmountFalse = () => {\n this.isFullBalance.onChange(false);\n if (this.onStateChanged) {\n this.onStateChanged();\n }\n };\n}\n\ninterface RouteParams {\n id: string;\n}\n\ninterface Props extends RouteComponentProps {\n isSubcomponent?: boolean;\n data?: PaymentAmountFormState;\n}\n\n@observer\nexport class PaymentAmountContainer extends React.Component {\n @observable data: PaymentAmountFormState;\n\n constructor(props: Props) {\n super(props);\n\n this.data = this.props.data || new PaymentAmountFormState(props);\n }\n\n render() {\n return ;\n }\n}\n","var map = {\n\t\"./af\": 1051,\n\t\"./af.js\": 1051,\n\t\"./ar\": 1052,\n\t\"./ar-dz\": 1053,\n\t\"./ar-dz.js\": 1053,\n\t\"./ar-kw\": 1054,\n\t\"./ar-kw.js\": 1054,\n\t\"./ar-ly\": 1055,\n\t\"./ar-ly.js\": 1055,\n\t\"./ar-ma\": 1056,\n\t\"./ar-ma.js\": 1056,\n\t\"./ar-sa\": 1057,\n\t\"./ar-sa.js\": 1057,\n\t\"./ar-tn\": 1058,\n\t\"./ar-tn.js\": 1058,\n\t\"./ar.js\": 1052,\n\t\"./az\": 1059,\n\t\"./az.js\": 1059,\n\t\"./be\": 1060,\n\t\"./be.js\": 1060,\n\t\"./bg\": 1061,\n\t\"./bg.js\": 1061,\n\t\"./bm\": 1062,\n\t\"./bm.js\": 1062,\n\t\"./bn\": 1063,\n\t\"./bn.js\": 1063,\n\t\"./bo\": 1064,\n\t\"./bo.js\": 1064,\n\t\"./br\": 1065,\n\t\"./br.js\": 1065,\n\t\"./bs\": 1066,\n\t\"./bs.js\": 1066,\n\t\"./ca\": 1067,\n\t\"./ca.js\": 1067,\n\t\"./cs\": 1068,\n\t\"./cs.js\": 1068,\n\t\"./cv\": 1069,\n\t\"./cv.js\": 1069,\n\t\"./cy\": 1070,\n\t\"./cy.js\": 1070,\n\t\"./da\": 1071,\n\t\"./da.js\": 1071,\n\t\"./de\": 1072,\n\t\"./de-at\": 1073,\n\t\"./de-at.js\": 1073,\n\t\"./de-ch\": 1074,\n\t\"./de-ch.js\": 1074,\n\t\"./de.js\": 1072,\n\t\"./dv\": 1075,\n\t\"./dv.js\": 1075,\n\t\"./el\": 1076,\n\t\"./el.js\": 1076,\n\t\"./en-au\": 1077,\n\t\"./en-au.js\": 1077,\n\t\"./en-ca\": 1078,\n\t\"./en-ca.js\": 1078,\n\t\"./en-gb\": 1079,\n\t\"./en-gb.js\": 1079,\n\t\"./en-ie\": 1080,\n\t\"./en-ie.js\": 1080,\n\t\"./en-il\": 1081,\n\t\"./en-il.js\": 1081,\n\t\"./en-in\": 1082,\n\t\"./en-in.js\": 1082,\n\t\"./en-nz\": 1083,\n\t\"./en-nz.js\": 1083,\n\t\"./en-sg\": 1084,\n\t\"./en-sg.js\": 1084,\n\t\"./eo\": 1085,\n\t\"./eo.js\": 1085,\n\t\"./es\": 1086,\n\t\"./es-do\": 1087,\n\t\"./es-do.js\": 1087,\n\t\"./es-us\": 1088,\n\t\"./es-us.js\": 1088,\n\t\"./es.js\": 1086,\n\t\"./et\": 1089,\n\t\"./et.js\": 1089,\n\t\"./eu\": 1090,\n\t\"./eu.js\": 1090,\n\t\"./fa\": 1091,\n\t\"./fa.js\": 1091,\n\t\"./fi\": 1092,\n\t\"./fi.js\": 1092,\n\t\"./fil\": 1093,\n\t\"./fil.js\": 1093,\n\t\"./fo\": 1094,\n\t\"./fo.js\": 1094,\n\t\"./fr\": 1095,\n\t\"./fr-ca\": 1096,\n\t\"./fr-ca.js\": 1096,\n\t\"./fr-ch\": 1097,\n\t\"./fr-ch.js\": 1097,\n\t\"./fr.js\": 1095,\n\t\"./fy\": 1098,\n\t\"./fy.js\": 1098,\n\t\"./ga\": 1099,\n\t\"./ga.js\": 1099,\n\t\"./gd\": 1100,\n\t\"./gd.js\": 1100,\n\t\"./gl\": 1101,\n\t\"./gl.js\": 1101,\n\t\"./gom-deva\": 1102,\n\t\"./gom-deva.js\": 1102,\n\t\"./gom-latn\": 1103,\n\t\"./gom-latn.js\": 1103,\n\t\"./gu\": 1104,\n\t\"./gu.js\": 1104,\n\t\"./he\": 1105,\n\t\"./he.js\": 1105,\n\t\"./hi\": 1106,\n\t\"./hi.js\": 1106,\n\t\"./hr\": 1107,\n\t\"./hr.js\": 1107,\n\t\"./hu\": 1108,\n\t\"./hu.js\": 1108,\n\t\"./hy-am\": 1109,\n\t\"./hy-am.js\": 1109,\n\t\"./id\": 1110,\n\t\"./id.js\": 1110,\n\t\"./is\": 1111,\n\t\"./is.js\": 1111,\n\t\"./it\": 1112,\n\t\"./it-ch\": 1113,\n\t\"./it-ch.js\": 1113,\n\t\"./it.js\": 1112,\n\t\"./ja\": 1114,\n\t\"./ja.js\": 1114,\n\t\"./jv\": 1115,\n\t\"./jv.js\": 1115,\n\t\"./ka\": 1116,\n\t\"./ka.js\": 1116,\n\t\"./kk\": 1117,\n\t\"./kk.js\": 1117,\n\t\"./km\": 1118,\n\t\"./km.js\": 1118,\n\t\"./kn\": 1119,\n\t\"./kn.js\": 1119,\n\t\"./ko\": 1120,\n\t\"./ko.js\": 1120,\n\t\"./ku\": 1121,\n\t\"./ku.js\": 1121,\n\t\"./ky\": 1122,\n\t\"./ky.js\": 1122,\n\t\"./lb\": 1123,\n\t\"./lb.js\": 1123,\n\t\"./lo\": 1124,\n\t\"./lo.js\": 1124,\n\t\"./lt\": 1125,\n\t\"./lt.js\": 1125,\n\t\"./lv\": 1126,\n\t\"./lv.js\": 1126,\n\t\"./me\": 1127,\n\t\"./me.js\": 1127,\n\t\"./mi\": 1128,\n\t\"./mi.js\": 1128,\n\t\"./mk\": 1129,\n\t\"./mk.js\": 1129,\n\t\"./ml\": 1130,\n\t\"./ml.js\": 1130,\n\t\"./mn\": 1131,\n\t\"./mn.js\": 1131,\n\t\"./mr\": 1132,\n\t\"./mr.js\": 1132,\n\t\"./ms\": 1133,\n\t\"./ms-my\": 1134,\n\t\"./ms-my.js\": 1134,\n\t\"./ms.js\": 1133,\n\t\"./mt\": 1135,\n\t\"./mt.js\": 1135,\n\t\"./my\": 1136,\n\t\"./my.js\": 1136,\n\t\"./nb\": 1137,\n\t\"./nb.js\": 1137,\n\t\"./ne\": 1138,\n\t\"./ne.js\": 1138,\n\t\"./nl\": 1139,\n\t\"./nl-be\": 1140,\n\t\"./nl-be.js\": 1140,\n\t\"./nl.js\": 1139,\n\t\"./nn\": 1141,\n\t\"./nn.js\": 1141,\n\t\"./oc-lnc\": 1142,\n\t\"./oc-lnc.js\": 1142,\n\t\"./pa-in\": 1143,\n\t\"./pa-in.js\": 1143,\n\t\"./pl\": 1144,\n\t\"./pl.js\": 1144,\n\t\"./pt\": 1145,\n\t\"./pt-br\": 1146,\n\t\"./pt-br.js\": 1146,\n\t\"./pt.js\": 1145,\n\t\"./ro\": 1147,\n\t\"./ro.js\": 1147,\n\t\"./ru\": 1148,\n\t\"./ru.js\": 1148,\n\t\"./sd\": 1149,\n\t\"./sd.js\": 1149,\n\t\"./se\": 1150,\n\t\"./se.js\": 1150,\n\t\"./si\": 1151,\n\t\"./si.js\": 1151,\n\t\"./sk\": 1152,\n\t\"./sk.js\": 1152,\n\t\"./sl\": 1153,\n\t\"./sl.js\": 1153,\n\t\"./sq\": 1154,\n\t\"./sq.js\": 1154,\n\t\"./sr\": 1155,\n\t\"./sr-cyrl\": 1156,\n\t\"./sr-cyrl.js\": 1156,\n\t\"./sr.js\": 1155,\n\t\"./ss\": 1157,\n\t\"./ss.js\": 1157,\n\t\"./sv\": 1158,\n\t\"./sv.js\": 1158,\n\t\"./sw\": 1159,\n\t\"./sw.js\": 1159,\n\t\"./ta\": 1160,\n\t\"./ta.js\": 1160,\n\t\"./te\": 1161,\n\t\"./te.js\": 1161,\n\t\"./tet\": 1162,\n\t\"./tet.js\": 1162,\n\t\"./tg\": 1163,\n\t\"./tg.js\": 1163,\n\t\"./th\": 1164,\n\t\"./th.js\": 1164,\n\t\"./tk\": 1165,\n\t\"./tk.js\": 1165,\n\t\"./tl-ph\": 1166,\n\t\"./tl-ph.js\": 1166,\n\t\"./tlh\": 1167,\n\t\"./tlh.js\": 1167,\n\t\"./tr\": 1168,\n\t\"./tr.js\": 1168,\n\t\"./tzl\": 1169,\n\t\"./tzl.js\": 1169,\n\t\"./tzm\": 1170,\n\t\"./tzm-latn\": 1171,\n\t\"./tzm-latn.js\": 1171,\n\t\"./tzm.js\": 1170,\n\t\"./ug-cn\": 1172,\n\t\"./ug-cn.js\": 1172,\n\t\"./uk\": 1173,\n\t\"./uk.js\": 1173,\n\t\"./ur\": 1174,\n\t\"./ur.js\": 1174,\n\t\"./uz\": 1175,\n\t\"./uz-latn\": 1176,\n\t\"./uz-latn.js\": 1176,\n\t\"./uz.js\": 1175,\n\t\"./vi\": 1177,\n\t\"./vi.js\": 1177,\n\t\"./x-pseudo\": 1178,\n\t\"./x-pseudo.js\": 1178,\n\t\"./yo\": 1179,\n\t\"./yo.js\": 1179,\n\t\"./zh-cn\": 1180,\n\t\"./zh-cn.js\": 1180,\n\t\"./zh-hk\": 1181,\n\t\"./zh-hk.js\": 1181,\n\t\"./zh-mo\": 1182,\n\t\"./zh-mo.js\": 1182,\n\t\"./zh-tw\": 1183,\n\t\"./zh-tw.js\": 1183\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 1388;","// extracted by mini-css-extract-plugin\nmodule.exports = {\"card\":\"_1YCkU146QuoKePpadSztgb\",\"right-label\":\"_2bKvZG8-3aYXAdPjzQWYy2\",\"rightLabel\":\"_2bKvZG8-3aYXAdPjzQWYy2\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"card\":\"gsraSuOEB6H7VnzpMf1Rs\",\"payment-methods-pay-by-bank-error\":\"_1O9-b7d2L96fwAjULnHHwH\",\"paymentMethodsPayByBankError\":\"_1O9-b7d2L96fwAjULnHHwH\",\"pay-by-bank-error-header\":\"_5xGNMJ_qvwgHFONxqyTSm\",\"payByBankErrorHeader\":\"_5xGNMJ_qvwgHFONxqyTSm\",\"pay-by-bank-error-header-title\":\"reDb6aF_Z6QBJk45QAWaj\",\"payByBankErrorHeaderTitle\":\"reDb6aF_Z6QBJk45QAWaj\",\"pay-by-bank-error-body\":\"_Gfmdb-BcBDAhS_VPtfUa\",\"payByBankErrorBody\":\"_Gfmdb-BcBDAhS_VPtfUa\",\"pay-by-bank-error-warning\":\"_3TqC0TdYaVuDP1Fq4KJ7XY\",\"payByBankErrorWarning\":\"_3TqC0TdYaVuDP1Fq4KJ7XY\",\"loading-message\":\"_2xb3_wZrWkcMSqDAe8N_f5\",\"loadingMessage\":\"_2xb3_wZrWkcMSqDAe8N_f5\",\"spinner\":\"_38uDJO_aMn0kd0vw-bCFVt\",\"non-card-view\":\"_1iuzUkW8pAM2IAsfZ9m_ex\",\"nonCardView\":\"_1iuzUkW8pAM2IAsfZ9m_ex\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"decline-button\":\"_1AjHsFX1IvdZ8fXWFg-SJl\",\"declineButton\":\"_1AjHsFX1IvdZ8fXWFg-SJl\",\"ach-table\":\"_1JgpZMKLjKW-abrHixdV1Y\",\"achTable\":\"_1JgpZMKLjKW-abrHixdV1Y\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"ach\":\"_2BFbhU14pOg534rPDnxoHO\",\"card\":\"_29PTMimwJlr8dmO8sRid9-\",\"field-title\":\"Hdge2ets9ybCaYBeIoaUR\",\"fieldTitle\":\"Hdge2ets9ybCaYBeIoaUR\",\"amount-error\":\"_3BnUVoqzRnqOEm0EWy--U1\",\"amountError\":\"_3BnUVoqzRnqOEm0EWy--U1\",\"warning-icon\":\"_2dMbzz8XozOQqgohKZdwq5\",\"warningIcon\":\"_2dMbzz8XozOQqgohKZdwq5\",\"info-tooltip\":\"_1k8kbL4G_si0DKry02ENfj\",\"infoTooltip\":\"_1k8kbL4G_si0DKry02ENfj\",\"info-icon\":\"_1CMWIffBO030WKz4YyOgVH\",\"infoIcon\":\"_1CMWIffBO030WKz4YyOgVH\",\"row\":\"_1ghzFHB1JolPa9xm9q-ACT\",\"col\":\"_1BTiw8z_gC14q1fN_50LmQ\",\"first-row\":\"FICdZyVHjEVL2uxgiKrUm\",\"firstRow\":\"FICdZyVHjEVL2uxgiKrUm\",\"second-row\":\"_1vbJcvgIn_f0u2L_bg47kI\",\"secondRow\":\"_1vbJcvgIn_f0u2L_bg47kI\",\"agreement\":\"_1DDkfMMB5c5J11cbszxJry\",\"decline-button\":\"_1xBcCYy4SukxR6M5KtJL8\",\"declineButton\":\"_1xBcCYy4SukxR6M5KtJL8\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"card\":\"_21lurrJrBJGOe4PLFYx3GO\",\"right-label\":\"RIuK0Y2x-5HZviPlZHtm-\",\"rightLabel\":\"RIuK0Y2x-5HZviPlZHtm-\",\"sign-in-message\":\"_2JSAS2fsJZAbAs_6oIAFjX\",\"signInMessage\":\"_2JSAS2fsJZAbAs_6oIAFjX\",\"payment-methods-connect-bank\":\"jyXBo8BJWzGeS7YqIUBlk\",\"paymentMethodsConnectBank\":\"jyXBo8BJWzGeS7YqIUBlk\",\"payment-methods-spacing\":\"M56xyMGrKZqqAHSdVIaJ9\",\"paymentMethodsSpacing\":\"M56xyMGrKZqqAHSdVIaJ9\",\"payment-methods-container\":\"UKJGMK5rOCI8qPza_n_T\",\"paymentMethodsContainer\":\"UKJGMK5rOCI8qPza_n_T\",\"payment-methods-pay-by-bank-error\":\"_218mUtk87co1drYA8dYr-F\",\"paymentMethodsPayByBankError\":\"_218mUtk87co1drYA8dYr-F\",\"pay-by-bank-error-header\":\"_22xukEfiuRiPmpQeE3DlMM\",\"payByBankErrorHeader\":\"_22xukEfiuRiPmpQeE3DlMM\",\"pay-by-bank-error-header-title\":\"_1iQYZulyHtA0JpQHSxz4rh\",\"payByBankErrorHeaderTitle\":\"_1iQYZulyHtA0JpQHSxz4rh\",\"pay-by-bank-error-body\":\"_1DyKHzqu1QVgtYi0Rq2x1e\",\"payByBankErrorBody\":\"_1DyKHzqu1QVgtYi0Rq2x1e\",\"pay-by-bank-error-warning\":\"_iM8_e9ZGxQnfD38csM7e\",\"payByBankErrorWarning\":\"_iM8_e9ZGxQnfD38csM7e\",\"payment-methods-checkbox\":\"Vjb376kE6uT_oY7XjxGsk\",\"paymentMethodsCheckbox\":\"Vjb376kE6uT_oY7XjxGsk\",\"payment-methods-checkbox-item\":\"_2Na6niBQ9dStj92ckXggtC\",\"paymentMethodsCheckboxItem\":\"_2Na6niBQ9dStj92ckXggtC\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"connected-accounts-container\":\"_31zKV1Y6NtVFTzvHM8z8Pm\",\"connectedAccountsContainer\":\"_31zKV1Y6NtVFTzvHM8z8Pm\",\"connected-accounts-header\":\"kxcM5QqjtAHrnUzgdZPsx\",\"connectedAccountsHeader\":\"kxcM5QqjtAHrnUzgdZPsx\",\"connected-accounts-item\":\"_3d2HRQxchxjd5C35p07OQj\",\"connectedAccountsItem\":\"_3d2HRQxchxjd5C35p07OQj\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"connected-account-container\":\"_2PzBqQgsxjzK8_FWrlQpz_\",\"connectedAccountContainer\":\"_2PzBqQgsxjzK8_FWrlQpz_\",\"selected\":\"_268M-elR8JGKp_p0o64-it\",\"connected-account-container-selected\":\"_1JJpYyo3pg-D7KzL5EsDe_\",\"connectedAccountContainerSelected\":\"_1JJpYyo3pg-D7KzL5EsDe_\",\"connected-account-logo\":\"qZCmjKeEdnOWsTjFdAjok\",\"connectedAccountLogo\":\"qZCmjKeEdnOWsTjFdAjok\",\"connected-account-text\":\"_2ImW4Ux_nt0yl8DBSXHdHu\",\"connectedAccountText\":\"_2ImW4Ux_nt0yl8DBSXHdHu\",\"connected-account-chip-holder\":\"_3go0CMl2tZ2rZ8On6F4Yob\",\"connectedAccountChipHolder\":\"_3go0CMl2tZ2rZ8On6F4Yob\",\"connected-account-chip-container\":\"_150ZW-0WV0GNH9eajpv1V\",\"connectedAccountChipContainer\":\"_150ZW-0WV0GNH9eajpv1V\",\"connected-account-chip\":\"_17XAYBUeNTgLfW_ouQuU7n\",\"connectedAccountChip\":\"_17XAYBUeNTgLfW_ouQuU7n\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"card\":\"qhcv7wZpdkJIL_DEQ__Xr\",\"row\":\"_2xFvq4lx9LQVh53CtCzLbm\",\"col\":\"_3kpUCvr4ds39YaHE0XNdMY\",\"first-row\":\"_2wwUUNQArPu6yBJDh2Kje9\",\"firstRow\":\"_2wwUUNQArPu6yBJDh2Kje9\",\"second-row\":\"_3pPCoqgf_PLKtJ_an9Shfn\",\"secondRow\":\"_3pPCoqgf_PLKtJ_an9Shfn\",\"agreement\":\"_331HDrW5lhwEY5XelDYM4I\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"card\":\"_3dlBK3zJPOkcIUwAHl2VU4\",\"row\":\"_2SCe9O8EXslfDQIA4Qb9y3\",\"col\":\"_30dayEfolUaTmwFIoZuruW\",\"first-row\":\"_1dc7HpupzbrdxLijVF-OSj\",\"firstRow\":\"_1dc7HpupzbrdxLijVF-OSj\",\"second-row\":\"eMfhcEjVJFH3QfzZXFiRW\",\"secondRow\":\"eMfhcEjVJFH3QfzZXFiRW\",\"agreement\":\"_3UjQP65oxsmrYg8JlqLxxJ\",\"iframe\":\"_3wMDAF6Ngw5h4-43UaJmlY\",\"signin\":\"_25_lzCBbZWeCGevKYR8XeP\",\"tags\":\"dgA0hfOtQVOVSQtlXwFrg\",\"left-card\":\"_2fqoiTvHYHMLIoflOCCNJY\",\"leftCard\":\"_2fqoiTvHYHMLIoflOCCNJY\",\"right-card\":\"_16oyOhkz2qvfKUzElYe1RE\",\"rightCard\":\"_16oyOhkz2qvfKUzElYe1RE\",\"card-item\":\"_1kbDj0QTmkrh7SUkYZN2cz\",\"cardItem\":\"_1kbDj0QTmkrh7SUkYZN2cz\",\"buttons\":\"_3pTWIdi1jWxHYZ52Ca3WT_\",\"expired\":\"_3NH9bdTUkwg5l3o7uRHKfo\",\"backward\":\"_2gZRRFNt15WjM2cyPLSGM2\",\"embedded\":\"oi2fPFzpJUhXbjkE6Kf3U\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"divider\":\"_3dtHA6lfD9OiuWkTfHsVY9\",\"tags\":\"_1AwAgIlV_J1rtCURNkT6rM\",\"left-card\":\"_2PHfFjN68BVUs_W7eAJhey\",\"leftCard\":\"_2PHfFjN68BVUs_W7eAJhey\",\"right-card\":\"_1onyfQ4Hs8mZ4H0auHW9ln\",\"rightCard\":\"_1onyfQ4Hs8mZ4H0auHW9ln\",\"card-item\":\"_2EgLTdpHr1PEZFvsmLOPnF\",\"cardItem\":\"_2EgLTdpHr1PEZFvsmLOPnF\",\"radio-column\":\"_1LfpgWUx_3MfBG1wREE5jo\",\"radioColumn\":\"_1LfpgWUx_3MfBG1wREE5jo\",\"description\":\"_3PdeT8yzjcQftGSz-CcLj1\",\"expired\":\"_26So_JUGWa2AourJT5FiF1\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"saved-account-container\":\"_2gf3EIPlbYeXh7nMVI-uDg\",\"savedAccountContainer\":\"_2gf3EIPlbYeXh7nMVI-uDg\",\"selected\":\"_2cz_G9uryc3K_iL4kEVAyt\",\"saved-account-logo\":\"_1BlbE0npCMhcuJwbHFXZjz\",\"savedAccountLogo\":\"_1BlbE0npCMhcuJwbHFXZjz\",\"saved-account-text\":\"_1KaKW-VCNN6ohTxml5G9AD\",\"savedAccountText\":\"_1KaKW-VCNN6ohTxml5G9AD\",\"saved-account-chip-holder\":\"_2502TngMnsqKpQkKBQvKBO\",\"savedAccountChipHolder\":\"_2502TngMnsqKpQkKBQvKBO\",\"saved-account-change-payment\":\"_3sKkpna75M1Y6oUKCIV82B\",\"savedAccountChangePayment\":\"_3sKkpna75M1Y6oUKCIV82B\",\"primary-chip-color\":\"_2ABy-e8pjJWOh0WKq9VkKP\",\"primaryChipColor\":\"_2ABy-e8pjJWOh0WKq9VkKP\",\"disconnected-chip-color\":\"_1IMCVFlQO5P8NB3EVjjlgZ\",\"disconnectedChipColor\":\"_1IMCVFlQO5P8NB3EVjjlgZ\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"divider\":\"_21alaviSuMsR8My3qrkkoy\",\"tags\":\"_29mU4hmQw04pDqc7gDY1J-\",\"left-card\":\"jB36DmzCKSiBDYKARjzj7\",\"leftCard\":\"jB36DmzCKSiBDYKARjzj7\",\"right-card\":\"_2k3f42oaskbYkWj4YP7QEK\",\"rightCard\":\"_2k3f42oaskbYkWj4YP7QEK\",\"card-item\":\"_2zf2IwR1oD5cYq4xnMzDGK\",\"cardItem\":\"_2zf2IwR1oD5cYq4xnMzDGK\",\"radio-column\":\"_2K9xPlFZDlSoVixEurpzPT\",\"radioColumn\":\"_2K9xPlFZDlSoVixEurpzPT\",\"description\":\"_1hqNL3pVxgtjO4D3jqfdXv\",\"expired\":\"XwiNYv_o_-oj0TleVc28r\",\"loading-message\":\"poq8KpEoO-NntdmJPiTns\",\"loadingMessage\":\"poq8KpEoO-NntdmJPiTns\",\"spinner\":\"_2Hnj-JtmNdKl66qJcJTzkg\",\"full-height\":\"_1gzaYNejyuPuW-ct0jOMQ9\",\"fullHeight\":\"_1gzaYNejyuPuW-ct0jOMQ9\",\"payment-method-buttons\":\"_3Xs98lFRJffUnXhaojhtam\",\"paymentMethodButtons\":\"_3Xs98lFRJffUnXhaojhtam\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"right-label\":\"UsHOxiRfcAthje3JSP9x0\",\"rightLabel\":\"UsHOxiRfcAthje3JSP9x0\",\"saved-item-container\":\"NdIacHJA9uks6eamlXrsg\",\"savedItemContainer\":\"NdIacHJA9uks6eamlXrsg\",\"selected\":\"Mghvt1e0w8cQgV7OL_-p\",\"saved-item-divider\":\"_1O58L10-Ze21Cq1zm5ScWS\",\"savedItemDivider\":\"_1O58L10-Ze21Cq1zm5ScWS\",\"saved-item-logo\":\"_31yRYEyvlSHjEalNISRuLg\",\"savedItemLogo\":\"_31yRYEyvlSHjEalNISRuLg\",\"saved-item-text\":\"hlEMTM_s8qlV-74_jq007\",\"savedItemText\":\"hlEMTM_s8qlV-74_jq007\",\"saved-item-sub-text\":\"_1qtb4xnyPrNHfCHjwO0Hs7\",\"savedItemSubText\":\"_1qtb4xnyPrNHfCHjwO0Hs7\",\"saved-item-chip-holder\":\"kDHoyB3utYd6dRbXpzjbj\",\"savedItemChipHolder\":\"kDHoyB3utYd6dRbXpzjbj\",\"saved-item-change-payment\":\"_1Kwd2D1pNzRXZjjKsFalze\",\"savedItemChangePayment\":\"_1Kwd2D1pNzRXZjjKsFalze\",\"saved-item-chip-container\":\"_3U_hTRlXwChkmdUc5Xt42\",\"savedItemChipContainer\":\"_3U_hTRlXwChkmdUc5Xt42\",\"saved-item-chip\":\"_2f3HEONErNTPV9xlT_GvX6\",\"savedItemChip\":\"_2f3HEONErNTPV9xlT_GvX6\",\"saved-item-details\":\"HRwT-u1l6gm8K3oiy636J\",\"savedItemDetails\":\"HRwT-u1l6gm8K3oiy636J\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"saved-account-container\":\"_2gf3EIPlbYeXh7nMVI-uDg\",\"savedAccountContainer\":\"_2gf3EIPlbYeXh7nMVI-uDg\",\"selected\":\"_2cz_G9uryc3K_iL4kEVAyt\",\"saved-account-logo\":\"_1BlbE0npCMhcuJwbHFXZjz\",\"savedAccountLogo\":\"_1BlbE0npCMhcuJwbHFXZjz\",\"saved-account-logo-adjustment\":\"_10P54jQ9qUuALRBS7OLt41\",\"savedAccountLogoAdjustment\":\"_10P54jQ9qUuALRBS7OLt41\",\"saved-account-text\":\"_1KaKW-VCNN6ohTxml5G9AD\",\"savedAccountText\":\"_1KaKW-VCNN6ohTxml5G9AD\",\"saved-account-chip-holder\":\"_2502TngMnsqKpQkKBQvKBO\",\"savedAccountChipHolder\":\"_2502TngMnsqKpQkKBQvKBO\",\"saved-account-change-payment\":\"_3sKkpna75M1Y6oUKCIV82B\",\"savedAccountChangePayment\":\"_3sKkpna75M1Y6oUKCIV82B\",\"primary-chip-color\":\"_2ABy-e8pjJWOh0WKq9VkKP\",\"primaryChipColor\":\"_2ABy-e8pjJWOh0WKq9VkKP\",\"disconnected-chip-color\":\"_1IMCVFlQO5P8NB3EVjjlgZ\",\"disconnectedChipColor\":\"_1IMCVFlQO5P8NB3EVjjlgZ\",\"saved-account-item\":\"SiM4KEYGiFUSljdjZWBEg\",\"savedAccountItem\":\"SiM4KEYGiFUSljdjZWBEg\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"divider\":\"_21alaviSuMsR8My3qrkkoy\",\"tags\":\"_29mU4hmQw04pDqc7gDY1J-\",\"left-card\":\"jB36DmzCKSiBDYKARjzj7\",\"leftCard\":\"jB36DmzCKSiBDYKARjzj7\",\"right-card\":\"_2k3f42oaskbYkWj4YP7QEK\",\"rightCard\":\"_2k3f42oaskbYkWj4YP7QEK\",\"card-item\":\"_2zf2IwR1oD5cYq4xnMzDGK\",\"cardItem\":\"_2zf2IwR1oD5cYq4xnMzDGK\",\"radio-column\":\"_2K9xPlFZDlSoVixEurpzPT\",\"radioColumn\":\"_2K9xPlFZDlSoVixEurpzPT\",\"description\":\"_1hqNL3pVxgtjO4D3jqfdXv\",\"expired\":\"XwiNYv_o_-oj0TleVc28r\",\"loading-message\":\"poq8KpEoO-NntdmJPiTns\",\"loadingMessage\":\"poq8KpEoO-NntdmJPiTns\",\"spinner\":\"_2Hnj-JtmNdKl66qJcJTzkg\",\"full-height\":\"_1gzaYNejyuPuW-ct0jOMQ9\",\"fullHeight\":\"_1gzaYNejyuPuW-ct0jOMQ9\",\"payment-method-buttons\":\"_3Xs98lFRJffUnXhaojhtam\",\"paymentMethodButtons\":\"_3Xs98lFRJffUnXhaojhtam\",\"payment-method-takeover-header\":\"_1a1uKKuAbCeGVvadTZHU0Z\",\"paymentMethodTakeoverHeader\":\"_1a1uKKuAbCeGVvadTZHU0Z\",\"payment-method-takeover\":\"_3ycAOQPEdp5vFsscJ44Dvp\",\"paymentMethodTakeover\":\"_3ycAOQPEdp5vFsscJ44Dvp\",\"payment-method-card\":\"P5I1wwRQEkfrO8u-HlDVS\",\"paymentMethodCard\":\"P5I1wwRQEkfrO8u-HlDVS\",\"payment-method-left-button\":\"_1Rjsmuz-0Gjjr6jllQL4KH\",\"paymentMethodLeftButton\":\"_1Rjsmuz-0Gjjr6jllQL4KH\",\"payment-method-right-button\":\"_23UnXDq0N8TFFG2V6HG5HX\",\"paymentMethodRightButton\":\"_23UnXDq0N8TFFG2V6HG5HX\",\"payment-method-right-button-connect\":\"_2XR-AYW1AXrtOK2NlZN6ND\",\"paymentMethodRightButtonConnect\":\"_2XR-AYW1AXrtOK2NlZN6ND\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"right-label\":\"UsHOxiRfcAthje3JSP9x0\",\"rightLabel\":\"UsHOxiRfcAthje3JSP9x0\",\"saved-item-container\":\"NdIacHJA9uks6eamlXrsg\",\"savedItemContainer\":\"NdIacHJA9uks6eamlXrsg\",\"selected\":\"Mghvt1e0w8cQgV7OL_-p\",\"saved-item-container-item\":\"_2W_H-CkmYHrvIumRE1JtJ8\",\"savedItemContainerItem\":\"_2W_H-CkmYHrvIumRE1JtJ8\",\"saved-item-divider\":\"_1O58L10-Ze21Cq1zm5ScWS\",\"savedItemDivider\":\"_1O58L10-Ze21Cq1zm5ScWS\",\"saved-item-logo\":\"_31yRYEyvlSHjEalNISRuLg\",\"savedItemLogo\":\"_31yRYEyvlSHjEalNISRuLg\",\"saved-item-text\":\"hlEMTM_s8qlV-74_jq007\",\"savedItemText\":\"hlEMTM_s8qlV-74_jq007\",\"saved-item-sub-text\":\"_1qtb4xnyPrNHfCHjwO0Hs7\",\"savedItemSubText\":\"_1qtb4xnyPrNHfCHjwO0Hs7\",\"saved-item-chip-holder\":\"kDHoyB3utYd6dRbXpzjbj\",\"savedItemChipHolder\":\"kDHoyB3utYd6dRbXpzjbj\",\"saved-item-change-payment\":\"_1Kwd2D1pNzRXZjjKsFalze\",\"savedItemChangePayment\":\"_1Kwd2D1pNzRXZjjKsFalze\",\"saved-item-chip-container\":\"_3U_hTRlXwChkmdUc5Xt42\",\"savedItemChipContainer\":\"_3U_hTRlXwChkmdUc5Xt42\",\"saved-item-chip\":\"_2f3HEONErNTPV9xlT_GvX6\",\"savedItemChip\":\"_2f3HEONErNTPV9xlT_GvX6\",\"saved-item-details\":\"HRwT-u1l6gm8K3oiy636J\",\"savedItemDetails\":\"HRwT-u1l6gm8K3oiy636J\"};","import { Address } from 'src/api';\n\nconst utcOptions: Intl.DateTimeFormatOptions = { timeZone: 'UTC' };\n\nexport function localeDate(date: string | undefined): string {\n if (!date) return '';\n return new Date(date).toLocaleDateString(undefined, utcOptions);\n}\n\nexport function longDate(date: string | undefined): string {\n if (!date) return '';\n const dateTime = new Date(date);\n const monthNames = [\n 'JAN',\n 'FEB',\n 'MAR',\n 'APR',\n 'MAY',\n 'JUN',\n 'JUL',\n 'AUG',\n 'SEP',\n 'OCT',\n 'NOV',\n 'DEC',\n ];\n const monthNumber = dateTime.getUTCMonth();\n const month = monthNames[monthNumber];\n const dateOfMonth = dateTime.getUTCDate();\n const year = dateTime.getUTCFullYear();\n\n return `${month}\\xa0${dateOfMonth}\\n${year}`;\n}\n\nexport function currency(num: number): string {\n return new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: 'USD',\n }).format(num);\n}\n\nexport function address(address: Address | undefined, isWrap?: boolean): string {\n if (!address) {\n return 'Unknown Address';\n }\n if (isWrap) {\n return `${address.streetAddress}${address.unit ? (' #' + address.unit) : ''}
${address.city}, ${address.state} ${address.zip}`;\n }\n return `${address.streetAddress}${address.unit ? (' #' + address.unit) : ''}, ${address.city}, ${address.state} ${address.zip}`;\n}\n\nexport function addressNoZip(address: Address | undefined): string {\n if (!address) {\n return 'Unknown Address';\n }\n if (address.unit) {\n return `${address.streetAddress} #${address.unit}, ${address.city}, ${address.state}`;\n }\n return `${address.streetAddress}, ${address.city}, ${address.state}`;\n}\n\nexport const twoDigitsAmount = (amount: string) => {\n let value: string = amount.replace(/[^\\d.]/gi, '');\n if (value.length === 0) {\n return value;\n }\n value = value.replace(/^0+/g, '');\n if (value.length === 0) {\n return '0';\n }\n if (value.startsWith('.')) {\n value = `0${value}`;\n }\n const numbers = value.split('.');\n if (numbers.length > 1) {\n return `${numbers[0]}.${numbers[1].slice(0, 2)}`;\n }\n return value;\n};\n\nexport const getDurationBillingString = (duration?: number, billingFrequency?: number) => {\n let result = '';\n if (duration === 1) {\n result = '1 month';\n } else if (duration) {\n result = `${duration} months`;\n } else {\n result = 'Ongoing';\n }\n return `${result} - ${getBillingFrequencyString(billingFrequency)}`;\n};\n\nexport const getBillingFrequencyString = (freq: number | undefined) => {\n switch (freq) {\n case 0:\n return 'One Time';\n case 1:\n return 'Monthly';\n case 2:\n return 'Every other month';\n case 3:\n return 'Quarterly';\n case 6:\n return 'Bi-Annual';\n case 12:\n return 'Annual';\n default:\n return 'Unknown';\n }\n};\n\nexport const toNumber = (value: string) => value.replace(/[^\\d]/gi, '');\n","import classnames from 'classnames';\nimport { FieldState } from 'formstate';\nimport { observable } from 'mobx';\nimport { observer } from 'mobx-react';\nimport * as React from 'react';\nimport { StandardTextFieldProps } from '@material-ui/core/TextField';\nimport { TextField } from '@material-ui/core';\n\nimport { rootContainer } from 'src/ioc';\nimport { IosFocusStore } from '../stores/ios-focus.store';\n\ninterface FieldProps extends StandardTextFieldProps {\n fieldState: FieldState;\n errorMap?: { [error: string]: string | null };\n startAdornment?: React.ReactNode;\n endAdornment?: React.ReactNode;\n endAdornmentFixed?: boolean;\n errorColor?: boolean;\n formatter?: (value: string) => string;\n validator?: (value: string) => boolean;\n maxLength?: number;\n readOnly?: boolean;\n}\n\nconst iosFocus = rootContainer.get(IosFocusStore);\n\n@observer\nexport class MatField extends React.Component {\n @observable private hadBlur = false;\n private hadBlurTimeout: any;\n private hasFocus = false;\n @observable private fixAdornment = false;\n\n componentWillReceiveProps(nextProps: Readonly) {\n const props = this.props;\n if (props.label !== nextProps.label || props.placeholder !== nextProps.placeholder) {\n // If label or placeholder changes, treat this as a new field.\n // (Useful for create / confirm password, for example.)\n clearTimeout(this.hadBlurTimeout);\n this.hadBlur = false;\n props.fieldState.dirty = false;\n }\n }\n\n private handleFocus = (e: React.FocusEvent) => {\n this.hasFocus = true;\n if (!this.props.readOnly) {\n iosFocus.handleFocus();\n }\n if (this.props.onFocus) {\n this.props.onFocus(e);\n }\n };\n\n private handleBlur = (e: React.FocusEvent) => {\n this.hasFocus = false;\n this.fixAdornment = false;\n if (!this.props.readOnly) {\n iosFocus.handleBlur();\n }\n this.hadBlurTimeout = setTimeout(\n () => {\n this.hadBlur = true;\n this.props.fieldState.dirty = true;\n },\n 200 // 200ms from FieldState default validation delay\n );\n if (this.props.onBlur) {\n this.props.onBlur(e);\n }\n };\n\n componentWillUnmount() {\n if (this.hasFocus) {\n iosFocus.handleBlur();\n }\n }\n\n private handleAdornmentEnter = () => {\n if (!this.hasFocus) {\n this.fixAdornment = true;\n }\n };\n\n private handleChange = (e: React.ChangeEvent) => {\n const { fieldState, formatter, validator } = this.props;\n if (!validator || validator(e.target.value)) {\n fieldState.onChange(formatter ? formatter(e.target.value) : e.target.value);\n }\n if (fieldState.dirty && !this.hadBlur) {\n fieldState.dirty = false;\n }\n };\n\n render() {\n const {\n fieldState,\n errorMap,\n startAdornment,\n endAdornment: endAdornmentOrig,\n endAdornmentFixed,\n errorColor,\n maxLength,\n readOnly,\n ...props\n } = this.props;\n const errorText =\n fieldState.dirty &&\n fieldState.error &&\n (!errorMap || errorMap[fieldState.error] !== null)\n ? (errorMap && errorMap[fieldState.error]) || fieldState.error\n : null;\n const endAdornment = endAdornmentOrig ? (\n \n {endAdornmentOrig}\n
\n ) : null;\n\n // 200ms delay from https://github.com/formstate/formstate/blob/master/src/core/fieldState.ts#L65\n return (\n \n );\n }\n}\n","/**\n * Portal API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)\n *\n * OpenAPI spec version: v1\n * \n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\n\nexport type PlaidVerificationStatus = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;\n\nexport const PlaidVerificationStatus = {\n NUMBER_0: 0 as PlaidVerificationStatus,\n NUMBER_1: 1 as PlaidVerificationStatus,\n NUMBER_2: 2 as PlaidVerificationStatus,\n NUMBER_3: 3 as PlaidVerificationStatus,\n NUMBER_4: 4 as PlaidVerificationStatus,\n NUMBER_5: 5 as PlaidVerificationStatus,\n NUMBER_6: 6 as PlaidVerificationStatus,\n NUMBER_7: 7 as PlaidVerificationStatus,\n NUMBER_8: 8 as PlaidVerificationStatus,\n NUMBER_9: 9 as PlaidVerificationStatus,\n NUMBER_10: 10 as PlaidVerificationStatus\n}","import { inject, injectable } from \"inversify\";\nimport { BankAccountInfo, ChargeApiService, ChargeCreditCardRequest, ChargeCustomerACHRequest, ChargeCustomerCreditCardRequest, ChargeCustomerStoredPaymentMethodRequest, ChargeResponse, ChargeType, CreditCard, CreditCardInfo, CreditCardIssuer, EditCreditCard, HomeApiService, Invoice, InvoicesApiService, PortalUser, SavedCreditCardsApiService, SplitInfo, StatementsApiService } from \"src/api\";\nimport { ClientDataStore } from \"src/core/stores/client-data.store\";\nimport { MembershipNameTypeStore } from \"src/core/stores/membership-name-type.store\";\nimport { RouterStore } from \"src/core/stores/router.store\";\nimport { lazyInject } from \"src/ioc\";\nimport { PGResponse, PaymentGateway, PaymentGatewayResponseType } from \"src/statement/stores/payment-gateway.store\";\n\nimport * as Validators from 'src/invoice/components/card-info/cc-validators';\nimport { FieldState, FormState } from \"formstate\";\nimport { action, computed, observable, runInAction } from \"mobx\";\nimport { AnvilSelectOptionsProps } from \"@servicetitan/design-system\";\nimport { getCardIcon, getCardNameByIssuer, getCardType, getIssuerByCardType } from \"../util/credit-card-util\";\nimport { BankAccountType, ConnectedBankAccount, PaymentMethodType, PaymentMethodInfo } from \"src/invoice/types/types\";\nimport { EditBankAccount } from \"src/api/model/editBankAccount\";\nimport { BankAccount } from \"src/api/model/bankAccount\";\nimport { PayByBankApiService } from \"src/api/api/payByBankApi.service\";\nimport { SavedBankAccountApiService } from \"src/api/api/savedBankAccountApi.service\";\nimport { PayByBankAccount } from \"src/api/model/payByBankAccount\";\nimport { EditPayByBankAccount } from \"src/api/model/editPayByBankAccount\";\nimport { PlaidVerificationStatus } from \"src/api/model/plaidVerificationStatus\";\nimport { AnalyticsStore } from \"src/core/stores/analytics.store\";\nimport { PaymentConfirmation } from \"src/invoice/stores/invoice.store\";\nimport { AchInfoFormState } from \"src/invoice/components/ach-info/ach-info/ach-info\";\nimport { CardInfoFormState } from \"src/invoice/components/card-info/card-info/card-info\";\n\nexport interface PendingInvoicePayment {\n statementId?: string;\n invoiceNumber: string;\n amount: number;\n splits?: SplitInfo[];\n amountRemaining: number;\n chargeType: ChargeType;\n}\n\n@injectable()\nexport class SavedPaymentMethodsStore {\n\n private usesPaymentsServiceTokenizationStore: boolean | undefined;\n constructor(\n private savedCreditCardsApi: SavedCreditCardsApiService,\n private savedBankAccountsApi: SavedBankAccountApiService,\n private statementApiService: StatementsApiService,\n private payByBankApi: PayByBankApiService,\n private readonly paymentGatewayService: PaymentGateway,\n private readonly chargeApi: ChargeApiService,\n private readonly analytics: AnalyticsStore,\n private readonly invoicesApi: InvoicesApiService,\n private readonly homeApi: HomeApiService\n ) {\n this.usesPaymentsServiceTokenizationStore = undefined;\n }\n\n @lazyInject(RouterStore) router!: RouterStore;\n @lazyInject(ClientDataStore) private clientData!: ClientDataStore;\n @inject(MembershipNameTypeStore) private membershipNameTypeStore!: MembershipNameTypeStore;\n\n public get usesPaymentsService() {\n return this.usesPaymentsServiceTokenizationStore;\n }\n\n // Variables\n customerIds: number[] | undefined;\n\n customerInfos: PortalUser[] = [];\n\n postalCode = new FieldState('').validators(Validators.zipPostalCodeValidator);\n\n form = new FormState({ postalCode: this.postalCode });\n\n // Observable variables\n @observable\n onActionComplete?: (success: boolean) => void;\n\n @observable\n onSelectedPaymentMethodChange?: (paymentMethod: PaymentMethodInfo | undefined) => void;\n\n @observable\n savedPaymentMethods: PaymentMethodInfo[] | undefined;\n\n @observable\n isLoadingSavedPaymentMethods = true;\n\n @observable\n selectedPaymentMethod: PaymentMethodInfo | undefined;\n\n @observable\n lastSavedPaymentMethodId: number | undefined;\n\n @observable\n lastSavedPaymentMethod: PaymentMethodInfo | undefined;\n\n @observable\n lastPGResponse: PGResponse | undefined;\n\n @observable errorMessage?: string | any;\n\n @observable\n onPbbErrorMessage?: (errorMessage: string | any) => void;\n\n @observable processing: boolean = false;\n\n @observable\n needToStoreAsPrimary = false;\n\n @observable\n isSavedCreditCardEnabled = false;\n\n @observable\n isSavedCreditCardFeatureOn = false;\n\n @observable\n isCreditCardEnabled = false;\n\n @observable\n isPayByBankFeatureOn = false;\n\n @observable\n isPayByBankEnabled = false;\n\n @observable\n isSavedBankAccountFeatureOn = false;\n\n @observable\n isBankAccountEnabled = false;\n\n @observable\n isInSavedPaymentMethods = false;\n\n @observable\n currentInvoiceId?: string | undefined;\n\n @observable\n currentStatementId?: string | undefined;\n\n @observable\n currentSplits?: SplitInfo[] | undefined;\n\n @observable\n customerReference?: string | undefined;\n\n customerSelector = new FieldState(undefined).onDidChange(({ newValue }) =>\n this.getSavedPaymentMethodsForCustomer(newValue));\n\n\n @observable\n customerOptions: AnvilSelectOptionsProps = [];\n\n private invoiceCache: { [id: string]: Invoice } = {};\n\n private paymentConfirmationCache: { [id: string]: PaymentConfirmation } = {};\n\n // Methods\n init = (callback?: () => void) => {\n const invoiceId = this.currentInvoiceId;\n const statementId = this.currentStatementId;\n\n if (statementId) {\n this.initializeWithStatement(statementId, callback);\n }\n else if (invoiceId) {\n this.initializeWithInvoice(invoiceId, callback);\n } else {\n this.homeApi.getHomeData().then((homeResponse) => {\n const homeData = homeResponse.data;\n const creditCardEnabled = !homeData?.creditCardDisabled;\n const achEnabled = !homeData?.achDisabled;\n const payByBankEnabled = !homeData?.payByBankDisabled;\n this.customerReference = homeData.customerExternalId;\n this.initialize(creditCardEnabled, payByBankEnabled, achEnabled, callback);\n }).catch(() => {\n // Handle scenario where it is a non-logged in user using their invoiceId\n if (invoiceId) {\n this.initializeWithInvoice(invoiceId, callback);\n } else if (statementId) {\n this.initializeWithStatement(statementId, callback);\n }\n });\n }\n\n this.chargeApi.paymentGatewayConfig().then((response) => {\n this.paymentGatewayService.apiKey = response.data.apiKey || '';\n this.paymentGatewayService.baseUrl = response.data.baseUrl || '';\n this.paymentGatewayService.paymentsServiceJwt = response.data.paymentsServiceJwt || '';\n });\n };\n\n private initializeWithStatement(statementId: string, callback?: () => void) {\n if (!statementId) {\n if (callback) {\n callback();\n }\n return;\n }\n if (statementId) {\n this.statementApiService.getCustomerStatementsById(statementId, true).then((response) => {\n const statementData = response.data;\n const customer = statementData.customers && statementData.customers.length > 0\n ? statementData.customers[0] : undefined;\n\n if (customer) {\n let customerReference = '00000000-0000-0000-0000-000000000000';\n // Select customer reference from available invoice\n for (let i = 0; i < customer.invoices.length; i++) {\n const invoice = customer.invoices[i];\n if (invoice && invoice.customerExternalId) {\n customerReference = invoice.customerExternalId;\n // If not set try to retrieve via invoice API\n if (customerReference === '00000000-0000-0000-0000-000000000000') {\n this.getInvoice(invoice.id).then(invoiceData => {\n this.customerReference = invoiceData.customerExternalId || customerReference;\n });\n } else {\n this.customerReference = customerReference;\n }\n break;\n }\n }\n\n this.usesPaymentsServiceTokenizationStore = this.currentSplits?.some(split => split.usesPaymentsService) || false;\n const creditCardEnabled = !customer?.creditCardDisabled;\n const achEnabled = !customer?.achDisabled;\n const payByBankEnabled = !customer?.payByBankDisabled;\n this.initialize(creditCardEnabled, payByBankEnabled, achEnabled, callback);\n } else {\n // Complete the callback to allow ui to fail if necessary\n if (callback) {\n callback();\n }\n }\n });\n }\n }\n\n private initializeWithInvoice(invoiceId: string, callback?: () => void) {\n if (!invoiceId) {\n if (callback) {\n callback();\n }\n return;\n }\n if (invoiceId) {\n this.invoicesApi.getInvoiceById(invoiceId, true).then((response) => {\n const invoiceData = response.data;\n const creditCardEnabled = !invoiceData?.creditCardDisabled;\n const achEnabled = !invoiceData?.achDisabled;\n const payByBankEnabled = !invoiceData?.payByBankDisabled;\n this.usesPaymentsServiceTokenizationStore = response.data.usesPaymentsService;\n this.customerReference = invoiceData.customerExternalId;\n this.initialize(creditCardEnabled, payByBankEnabled, achEnabled, callback);\n });\n }\n }\n\n private initialize(creditCardEnabled: boolean, payByBankEnabled: boolean, achEnabled: boolean, callback: (() => void) | undefined) {\n this.savedCreditCardsApi.feature().then((response) => {\n this.isSavedCreditCardFeatureOn = response.data;\n this.isCreditCardEnabled = creditCardEnabled;\n\n if (this.getIsLoggedIn()) {\n this.savedCreditCardsApi.isEnabled().then((creditResponse) => {\n let users = creditResponse.data;\n this.isSavedCreditCardEnabled = !!users.length;\n this.initializeFlags(payByBankEnabled, achEnabled, callback, creditCardEnabled);\n });\n } else {\n this.initializeFlags(payByBankEnabled, achEnabled, callback, creditCardEnabled);\n }\n });\n }\n\n private initializeFlags(payByBankEnabled: boolean, achEnabled: boolean, callback: (() => void) | undefined, creditCardEnabled: boolean) {\n this.payByBankApi.feature().then((payByBankReponse) => {\n this.isPayByBankFeatureOn = payByBankReponse.data;\n this.isPayByBankEnabled = payByBankEnabled;\n this.savedBankAccountsApi.achFeature().then((achReponse) => {\n this.isSavedBankAccountFeatureOn = achReponse.data;\n this.isBankAccountEnabled = achEnabled;\n if (callback) {\n callback();\n }\n if ((creditCardEnabled || achEnabled || payByBankEnabled || this.isSavedCreditCardFeatureOn || this.isPayByBankFeatureOn || this.isSavedBankAccountFeatureOn)\n && this.clientData.isLoggedIn) {\n this.getCustomerIds();\n }\n });\n });\n }\n\n getIsLoggedIn = () => {\n return this.clientData.isLoggedIn;\n };\n\n getShowLoginLink = () => {\n return this.getIsCPEnabled() && !this.getIsLoggedIn();\n };\n\n getIsCPEnabled = () => {\n return this.isSavedBankAccountFeatureOn || this.isSavedCreditCardFeatureOn || this.isPayByBankFeatureOn;\n };\n\n getIsSavedPaymentOptionEnabled = () => {\n return this.getIsLoggedIn() && (this.isSavedCreditCardEnabled || this.isSavedBankAccountFeatureOn || this.isPayByBankFeatureOn);\n }\n\n getCardIssuer = (issuer: CreditCardIssuer) => {\n switch (issuer) {\n case CreditCardIssuer.NUMBER_3:\n return 'AMEX';\n case CreditCardIssuer.NUMBER_4:\n return 'VISA';\n case CreditCardIssuer.NUMBER_5:\n return 'MC';\n case CreditCardIssuer.NUMBER_6:\n return 'Discover';\n default:\n return 'Card';\n }\n };\n\n isExpiringSoon = (year: number, month: number) => {\n const today = new Date();\n const currentYear = today.getFullYear();\n const currentMonth = today.getMonth() + 1;\n if (currentYear === year) {\n if (currentMonth === month || currentMonth + 1 === month) {\n return true;\n }\n } else if (currentYear + 1 === year && currentMonth === 12 && month === 1) {\n return true;\n }\n return false;\n };\n\n isPaymentMethodExpiringSoon = (paymentMethod: PaymentMethodInfo) => {\n if (paymentMethod.paymentMethodType !== PaymentMethodType.CreditCard || !paymentMethod.expires) {\n return false;\n }\n\n const token = paymentMethod.expires?.split('/');\n const month = parseInt(token[0]);\n const year = parseInt(token[1]);\n\n return this.isExpiringSoon(year, month);\n };\n\n convertToCardIssuer = (name: string | undefined): CreditCardIssuer => {\n if (name === undefined) {\n return CreditCardIssuer.NUMBER_0;\n }\n switch (name.toLowerCase()) {\n case 'americanexpress':\n return CreditCardIssuer.NUMBER_3;\n case 'visa':\n return CreditCardIssuer.NUMBER_4;\n case 'mastercard':\n return CreditCardIssuer.NUMBER_5;\n case 'discover':\n return CreditCardIssuer.NUMBER_6;\n default:\n return CreditCardIssuer.NUMBER_0;\n }\n };\n\n getLastSavedPaymentMethod = () => {\n const result = this.lastSavedPaymentMethod;\n this.resetLastSavedPaymentMethod();\n return result;\n };\n\n getLastPGResponse = () => {\n const result = this.lastPGResponse;\n this.lastPGResponse = undefined;\n return result;\n }\n\n private resetLastSavedPaymentMethod = () => {\n this.lastSavedPaymentMethod = undefined;\n this.lastSavedPaymentMethodId = undefined;\n };\n\n connectedBankAccountToPaymentMethod = (connectedAccount: ConnectedBankAccount, primary: boolean) => {\n const payByBankPaymentMethod: PaymentMethodInfo = {\n paymentMethodId: 0,\n primary: primary,\n displayText: `${connectedAccount.accountName} Ending in *${connectedAccount.accountMask}`,\n name: connectedAccount.accountName,\n selected: true,\n icon: connectedAccount.bankIcon,\n bankName: connectedAccount.bankName,\n number: connectedAccount.accountMask,\n token: connectedAccount.publicToken,\n accountId: connectedAccount.accountId,\n bankId: connectedAccount.bankId,\n paymentMethodType: PaymentMethodType.PayByBank,\n verificationStatus: connectedAccount.verificationStatus\n };\n\n return payByBankPaymentMethod;\n };\n\n cardInfoToPaymentMethod = async (cardInfo: CardInfoFormState, primary: boolean) => {\n const cardResult = await cardInfo.form.validate();\n if (cardResult.hasError) {\n return undefined;\n }\n\n const cardDetail = cardResult.value;\n const cardNumber = cardDetail.ccNumber.value;\n const cardName = getCardType(cardNumber);\n const customerName = cardDetail.ccName.value;\n const cardNumberEnding = cardNumber.substring(cardNumber.length - 4, cardNumber.length);\n const paymentMethod: PaymentMethodInfo = {\n paymentMethodId: 0,\n primary: primary,\n displayText: `${cardName} ending in *${cardNumberEnding}`,\n name: cardName,\n selected: true,\n icon: getCardIcon(cardName),\n expires: cardDetail.ccExp.value,\n customerName: customerName,\n bankName: cardName,\n number: cardNumber,\n paymentMethodType: PaymentMethodType.CreditCard\n };\n\n return paymentMethod;\n };\n\n achInfoToPaymentMethod = async (achInfo: AchInfoFormState, primary: boolean) => {\n const achResult = await achInfo.form.validate();\n if (achResult.hasError) {\n return undefined;\n }\n\n const achDetail = achResult.value;\n const achNumber = achDetail.accountNumber.value;\n const achNumberEnding = achNumber.substring(achNumber.length - 4, achNumber.length);\n const achPaymentMethod: PaymentMethodInfo = {\n paymentMethodId: 0,\n primary: primary,\n name: 'Bank Account',\n selected: true,\n icon: 'assets/images/ach-account.svg',\n displayText: `Account Number Ending in *${achNumberEnding}`,\n number: achNumber,\n customerName: achDetail.accountName.value,\n routingNumber: achDetail.routingNumber.value,\n paymentMethodType: PaymentMethodType.ACH,\n bankAccountType: achDetail.accountType.$.trim() === BankAccountType.Business ? BankAccountType.Business :\n BankAccountType.Personal\n };\n\n return achPaymentMethod;\n };\n\n creditCardToSavedPayment = (creditCard: CreditCard): PaymentMethodInfo => {\n const cardName = getCardNameByIssuer(creditCard.issuer);\n return {\n paymentMethodId: creditCard.id,\n primary: creditCard.primary,\n displayText: `${cardName} ending in *${creditCard.number}`,\n name: cardName,\n selected: creditCard.primary,\n icon: getCardIcon(cardName),\n expires: `${creditCard?.expMonth}/${creditCard?.expYear}`,\n customerName: creditCard.cardholderName,\n bankName: cardName,\n number: creditCard.number,\n paymentMethodType: PaymentMethodType.CreditCard,\n customerId: creditCard.customerId,\n membership: creditCard.membership\n }\n };\n\n bankAccountToSavedPayment = (bankAccount: BankAccount): PaymentMethodInfo => {\n const routing = bankAccount.routing;\n const routingEnding = routing && routing.length >= 4 ? routing.substring(routing.length - 4, routing.length) : routing;\n return {\n paymentMethodId: bankAccount.id,\n primary: bankAccount.primary,\n displayText: `Bank Account ending in *${bankAccount.number}`,\n name: 'Bank Account',\n selected: bankAccount.primary,\n icon: 'assets/images/ach-account.svg',\n customerName: bankAccount.customerName,\n bankName: 'Bank Account',\n routingNumber: routingEnding ? `Ending in *${routingEnding}` : routingEnding,\n number: bankAccount.number,\n paymentMethodType: PaymentMethodType.ACH,\n customerId: bankAccount.customerId,\n membership: bankAccount.membership\n }\n };\n\n payByBankToSavedPayment = async (bankAccount: BankAccount, payByBankAccount: PayByBankAccount) => {\n const institution = (await this.payByBankApi.getInstitution(payByBankAccount.pbbInstitutionId!)).data;\n const bankIcon = institution.logo ? `data:image/png;base64,${institution.logo}` : 'assets/images/ach-account.svg';\n return {\n paymentMethodId: bankAccount.id,\n primary: bankAccount.primary,\n displayText: `${payByBankAccount.accountName} Ending in *${bankAccount.number}`,\n name: payByBankAccount.accountName || '',\n selected: bankAccount.primary,\n icon: bankIcon,\n bankName: institution.name,\n number: bankAccount.number,\n customerId: bankAccount.customerId,\n membership: bankAccount.membership,\n paymentMethodType: PaymentMethodType.PayByBank,\n accountName: payByBankAccount.accountName,\n verificationStatus: this.verificationStatusEnumToString(payByBankAccount.verificationStatus),\n disconnected: (payByBankAccount.verificationStatus !== PlaidVerificationStatus.NUMBER_1 &&\n payByBankAccount.verificationStatus !== PlaidVerificationStatus.NUMBER_4)\n };\n };\n\n private verificationStatusEnumToString = (verificationStatus?: PlaidVerificationStatus | undefined) => {\n return verificationStatus === PlaidVerificationStatus.NUMBER_1 ? 'AutomaticallyVerified' :\n verificationStatus === PlaidVerificationStatus.NUMBER_2 ? 'PendingAutomaticVerification' :\n verificationStatus === PlaidVerificationStatus.NUMBER_3 ? 'PendingManualVerification' :\n verificationStatus === PlaidVerificationStatus.NUMBER_4 ? 'ManuallyVerified' :\n verificationStatus === PlaidVerificationStatus.NUMBER_5 ? 'VerificationExpired' :\n verificationStatus === PlaidVerificationStatus.NUMBER_6 ? 'VerificationFailed' :\n verificationStatus === PlaidVerificationStatus.NUMBER_7 ? 'DatabaseMatched' :\n verificationStatus === PlaidVerificationStatus.NUMBER_8 ? 'DatabaseInsightsPass' :\n verificationStatus === PlaidVerificationStatus.NUMBER_9 ? 'DatabaseInsightsPass' :\n verificationStatus === PlaidVerificationStatus.NUMBER_10 ? 'DatabaseInsightsFail' :\n 'Unknown';\n };\n\n private verificationStatusToEnum = (verificationStatus?: string | undefined) => {\n return verificationStatus === 'AutomaticallyVerified' ? PlaidVerificationStatus.NUMBER_1 :\n verificationStatus === 'PendingAutomaticVerification' ? PlaidVerificationStatus.NUMBER_2 :\n verificationStatus === 'PendingManualVerification' ? PlaidVerificationStatus.NUMBER_3 :\n verificationStatus === 'ManuallyVerified' ? PlaidVerificationStatus.NUMBER_4 :\n verificationStatus === 'VerificationExpired' ? PlaidVerificationStatus.NUMBER_5 :\n verificationStatus === 'VerificationFailed' ? PlaidVerificationStatus.NUMBER_6 :\n verificationStatus === 'DatabaseMatched' ? PlaidVerificationStatus.NUMBER_7 :\n verificationStatus === 'DatabaseInsightsPass' ? PlaidVerificationStatus.NUMBER_8 :\n verificationStatus === 'DatabaseInsightsPass' ? PlaidVerificationStatus.NUMBER_9 :\n verificationStatus === 'DatabaseInsightsFail' ? PlaidVerificationStatus.NUMBER_10 :\n PlaidVerificationStatus.NUMBER_0;\n };\n\n sortCreditCard = (cards: CreditCard[]) => {\n if (cards.length === 0) {\n return [];\n }\n const primaryCards = cards.filter(c => c.primary && !c.isExpired);\n const membershipCards = cards.filter(c => !c.primary && c.membership && !c.isExpired);\n const others = cards\n .filter(c => c.isExpired || (!c.primary && !c.membership))\n .sort((a, b) => b.expYear + b.expMonth - (a.expYear + a.expMonth));\n return [...primaryCards, ...membershipCards, ...others];\n };\n\n gotoSavedCardPage = () => {\n this.router.history.push('/savedpaymentmethod/paymentmethod');\n };\n\n gotoMembershipPage = () => {\n this.router.history.push('/memberships');\n }\n\n usePaymentGateway = () => {\n return this.paymentGatewayService && !!this.paymentGatewayService.baseUrl;\n };\n\n getCustomerId = () => {\n return this.customerIds && this.customerIds.length > 0 ?\n this.customerIds[0] : 0;\n };\n\n isExpired = (paymentMethod: PaymentMethodInfo): boolean => {\n if (paymentMethod.paymentMethodType !== PaymentMethodType.CreditCard || !paymentMethod.expires) {\n return false;\n }\n\n const today = new Date();\n const currentYear = today.getFullYear();\n const currentMonth = today.getMonth() + 1;\n\n const token = paymentMethod.expires?.split('/');\n const month = parseInt(token[0]);\n const year = parseInt(token[1]);\n\n if (currentYear > year) {\n return true;\n }\n\n if (currentYear === year && currentMonth > month) {\n return true;\n }\n\n return false;\n };\n\n private callCompleteAction = (success: boolean) => {\n if (this.onActionComplete) {\n this.onActionComplete(success);\n }\n\n this.onActionComplete = undefined;\n };\n\n @action\n private callPostError = (errorMessage: string | any) => {\n if (this.onPbbErrorMessage) {\n this.onPbbErrorMessage(errorMessage);\n }\n }\n\n // Action Methods\n\n @action\n getLinkToken = async () => {\n if (!this.isPayByBankEnabled && !this.isPayByBankFeatureOn) {\n return '';\n }\n const response = (await this.payByBankApi.getLinkToken(this.customerSelector.value || new Date().getTime())).data;\n return response.token;\n }\n\n @action\n getInstitution = async (institutionId: string) => {\n const response = (await this.payByBankApi.getInstitution(institutionId)).data;\n if (!response || !response.logo) {\n return response.logo;\n }\n return `data:image/png;base64,${response.logo}`;\n }\n\n @action\n getSavedPaymentMethodsForCustomer = async (id?: number) => {\n this.isLoadingSavedPaymentMethods = true;\n if (!id) {\n this.isLoadingSavedPaymentMethods = false;\n return;\n }\n\n const allCards = this.isSavedCreditCardFeatureOn && (this.isInSavedPaymentMethods || this.isCreditCardEnabled) ? (await this.savedCreditCardsApi.savedCreditCards(id)).data : [];\n const allBankAccounts = (this.isSavedBankAccountFeatureOn && (this.isInSavedPaymentMethods || this.isBankAccountEnabled)) || (this.isPayByBankFeatureOn && (this.isInSavedPaymentMethods || this.isPayByBankEnabled)) ? (await this.savedBankAccountsApi.savedBankAccounts(id)).data : [];\n const allPayByBanks = (this.isPayByBankFeatureOn && (this.isInSavedPaymentMethods || this.isPayByBankEnabled)) ? (await this.payByBankApi.savedPayByBanks(id, this.customerReference || ''/*Should never be null*/)).data : [];\n\n await runInAction(async () => {\n const creditCards = this.sortCreditCard(allCards).map(creditCard => this.creditCardToSavedPayment(creditCard));\n\n const achAccounts: BankAccount[] = [];\n const payByBankAccounts: BankAccount[] = [];\n const payByBankPaymentIdMapping =\n new Map(allPayByBanks.map(pbb => [pbb.paymentsServicePaymentMethodId, pbb] as const));\n\n allBankAccounts.forEach(bankAccount => {\n if (payByBankPaymentIdMapping.has(bankAccount.paymentsServicePaymentMethodId)) {\n if (this.isPayByBankFeatureOn && (this.isInSavedPaymentMethods || this.isPayByBankEnabled)) {\n payByBankAccounts.push(bankAccount);\n }\n } else {\n if (this.isSavedBankAccountFeatureOn && (this.isInSavedPaymentMethods || this.isBankAccountEnabled)) {\n //TODO: Figure a better way to distinguish between paybybank vs regular ach\n if (!bankAccount.paymentsServicePaymentMethodId) {\n achAccounts.push(bankAccount);\n }\n }\n }\n });\n\n const achs = achAccounts.map(ach => this.bankAccountToSavedPayment(ach));\n const payByBanks: PaymentMethodInfo[] = [];\n\n for (let i = 0; i < payByBankAccounts.length; i++) {\n const payByBankAccount = payByBankAccounts[i];\n const payByBankPaymentMethod = await this.payByBankToSavedPayment(payByBankAccount,\n payByBankPaymentIdMapping.get(payByBankAccount.paymentsServicePaymentMethodId)!\n );\n payByBanks.push(payByBankPaymentMethod);\n }\n\n const paymentMethods = [...payByBanks, ...creditCards, ...achs];\n const primaryPaymentMethods = paymentMethods.filter(paymentMethod => paymentMethod.primary);\n const otherPaymentMethods = paymentMethods.filter(paymentMethod => !paymentMethod.primary);\n\n // Add payment methods\n this.savedPaymentMethods = [...primaryPaymentMethods, ...otherPaymentMethods];\n\n if (this.lastSavedPaymentMethodId) {\n this.lastSavedPaymentMethod = this.savedPaymentMethods.find(p => p.paymentMethodId === this.lastSavedPaymentMethodId);\n }\n\n this.isLoadingSavedPaymentMethods = false;\n\n this.setDefaultSelectedPaymentMethodToPay();\n });\n };\n\n @action\n getCustomerIds = async () => {\n const response = await this.savedCreditCardsApi.isEnabled();\n let users = response.data;\n this.isSavedCreditCardEnabled = !!users.length;\n\n if (!this.isSavedCreditCardEnabled) {\n users = (await this.homeApi.getHomeData()).data.users || [];\n }\n\n runInAction(() => {\n this.customerIds = users.map(i => i.id);\n this.customerInfos = users.map(i => ({ id: i.id, name: i.name }));\n this.customerOptions = this.customerInfos.map(i => ({ value: i.id, text: i.name }));\n if (this.customerIds.length) {\n this.customerSelector.onChange(this.customerIds[0]);\n }\n });\n };\n\n @action\n setSelectedPaymentMethodToPay = (selectedPaymentMethod: PaymentMethodInfo | undefined) => {\n this.selectedPaymentMethod = selectedPaymentMethod;\n };\n\n @action\n setDefaultSelectedPaymentMethodToPay = () => {\n if (!this.savedPaymentMethods || this.savedPaymentMethods.length === 0) {\n if (this.onSelectedPaymentMethodChange) {\n this.onSelectedPaymentMethodChange(undefined);\n }\n return;\n }\n\n const availablePaymentMethods = this.savedPaymentMethods.filter(paymentMethod => !this.isExpired(paymentMethod));\n this.selectedPaymentMethod =\n availablePaymentMethods.length > 0\n ? availablePaymentMethods.find(c => c.primary) ||\n availablePaymentMethods[0]\n : undefined;\n\n if (this.onSelectedPaymentMethodChange) {\n this.onSelectedPaymentMethodChange(this.selectedPaymentMethod);\n }\n };\n\n @action\n setPrimary = (value: boolean) => (this.needToStoreAsPrimary = value);\n\n @action\n setOnActionComplete = (value: (success: boolean) => void) => (this.onActionComplete = value);\n\n @action\n setOnPbbErrorMessage = (value: (errorMessage: string | any) => void) => (this.onPbbErrorMessage = value);\n\n @action\n setOnSelectedPaymentMethodChange = (value: (paymentMethod: PaymentMethodInfo | undefined) => void) => (this.onSelectedPaymentMethodChange = value);\n\n @action\n setPaymentMethodAsPrimary = async (paymentMethod: PaymentMethodInfo) => {\n if (paymentMethod.paymentMethodType === PaymentMethodType.CreditCard) {\n await this.savedCreditCardsApi.assignCreditCard(\n paymentMethod.customerId!,\n paymentMethod.paymentMethodId,\n true);\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.ACH) {\n await this.savedBankAccountsApi.assignBankAccount(paymentMethod.customerId!, paymentMethod.paymentMethodId, {\n primary: true,\n membership: paymentMethod.membership || false\n });\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.PayByBank) {\n await this.payByBankApi.assignPayByBank(paymentMethod.customerId!, paymentMethod.paymentMethodId, {\n primary: true,\n membership: paymentMethod.membership || false\n });\n }\n\n await this.getSavedPaymentMethodsForCustomer(this.customerSelector.value);\n this.callCompleteAction(true);\n };\n\n @action\n deletePaymentMethod = async (paymentMethod: PaymentMethodInfo) => {\n this.processing = true;\n this.resetErrorMessage();\n try {\n if (paymentMethod.paymentMethodType === PaymentMethodType.CreditCard) {\n await this.savedCreditCardsApi.deleteCreditCard(\n paymentMethod.customerId!,\n paymentMethod.paymentMethodId\n );\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.ACH) {\n await this.savedBankAccountsApi.deleteBankAccount(paymentMethod.customerId!, paymentMethod.paymentMethodId);\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.PayByBank) {\n await this.payByBankApi.deletePayByBank(paymentMethod.customerId!, paymentMethod.paymentMethodId);\n }\n } catch (e) {\n runInAction(() => {\n this.errorMessage = e;\n this.callCompleteAction(false);\n });\n } finally {\n runInAction(() => {\n this.processing = false;\n });\n\n await this.getSavedPaymentMethodsForCustomer(this.customerSelector.value);\n this.callCompleteAction(true);\n }\n };\n\n @action\n addPaymentMethod = async (paymentMethod: PaymentMethodInfo) => {\n this.resetErrorMessage();\n this.processing = true;\n if (paymentMethod.paymentMethodType === PaymentMethodType.CreditCard) {\n if (this.usePaymentGateway()) {\n await this.form.validate();\n this.paymentGatewayService.handleSubmit(this.processAddNewCard);\n } else {\n this.processNonGatewayCreditCard(paymentMethod);\n }\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.ACH) {\n await this.processACH(paymentMethod);\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.PayByBank) {\n await this.processPayByBank(paymentMethod);\n }\n };\n\n @action\n processNonGatewayCreditCard = async (paymentMethod: PaymentMethodInfo) => {\n const selectedCustomerId = this.customerSelector.value || 0;\n const expToken = paymentMethod.expires!.split('/');\n const cardInfo: EditCreditCard = {\n id: 0,\n customerId: selectedCustomerId,\n primary: this.needToStoreAsPrimary,\n membership: true,\n businessUnitId: 0,\n isExpired: false,\n issuer: getIssuerByCardType(paymentMethod.bankName),\n expYear: parseInt(expToken[1], 10),\n expMonth: parseInt(expToken[0], 10),\n cvv: paymentMethod.cvv,\n number: paymentMethod.number,\n cardholderName: paymentMethod.customerName,\n zip: paymentMethod.postalCode,\n token: paymentMethod.token,\n };\n\n await this.processCreditCard(cardInfo);\n }\n\n @action\n processPayByBank = async (paymentMethod: PaymentMethodInfo) => {\n const selectedCustomerId = this.customerSelector.value!;\n const selectedCustomer = this.customerInfos.find(c => c.id === selectedCustomerId);\n try {\n const payByBankAccount: EditPayByBankAccount = {\n id: 0,\n customerId: selectedCustomerId,\n primary: this.needToStoreAsPrimary,\n membership: true,\n businessUnitId: 0,\n number: paymentMethod.number,\n routing: paymentMethod.routingNumber,\n bankName: paymentMethod.bankName,\n accountName: paymentMethod.name,\n customerReference: this.customerReference,\n customerName: paymentMethod.customerName || selectedCustomer?.name,\n publicToken: paymentMethod.token,\n pbbAccountId: paymentMethod.accountId,\n pbbInstitutionId: paymentMethod.bankId,\n verificationStatus: this.verificationStatusToEnum(paymentMethod.verificationStatus)\n };\n\n const result = await this.payByBankApi.savePayByBank(selectedCustomerId, payByBankAccount);\n this.lastSavedPaymentMethodId = result.data.id;\n await this.getSavedPaymentMethodsForCustomer(selectedCustomerId);\n } catch (e) {\n runInAction(() => {\n this.errorMessage = e;\n this.callCompleteAction(false);\n });\n } finally {\n runInAction(() => {\n this.processing = false;\n this.callCompleteAction(true);\n });\n }\n };\n\n @action\n chargePaymentMethod = async (paymentMethod: PaymentMethodInfo, payment: PendingInvoicePayment) => {\n this.resetErrorMessage();\n\n if (!payment.invoiceNumber && payment.splits && payment.splits.length > 0) {\n // Pick first invoice in splits as invoice Id to handle scenario where statement is been paid\n payment.invoiceNumber = payment.splits[0].invoiceId!;\n }\n\n const invoice = await this.getInvoice(payment.invoiceNumber);\n const splits: SplitInfo[] = [\n {\n invoiceId: invoice.id,\n amountApplied: payment.amount,\n usesPaymentsService: invoice.usesPaymentsService\n }\n ];\n\n // Only replace split if not statement\n payment.splits = payment.splits || splits;\n\n // Retrieve invoice number for each invoice in split\n for (let i = 0; i < payment.splits.length; i++) {\n const paymentInvoiceId = payment.splits[i].invoiceId;\n if (!paymentInvoiceId) {\n continue;\n }\n\n const paymentInvoice = await this.getInvoice(paymentInvoiceId);\n payment.splits[i].invoiceNumber = paymentInvoice.number;\n }\n\n if (paymentMethod.paymentMethodType === PaymentMethodType.ACH) {\n await this.processBankAccountCharge(paymentMethod, payment, invoice);\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.CreditCard) {\n await this.processCreditCardCharge(paymentMethod, payment, invoice);\n } else if (paymentMethod.paymentMethodType === PaymentMethodType.PayByBank) {\n await this.processPayByBankCharge(paymentMethod, payment, invoice);\n }\n };\n\n @action\n getInvoicesById = async (invoiceIds: string[]) => {\n const result: Invoice[] = [];\n\n // TODO: Create API to retrieve invoices by Ids in one call (the statement api already does this)\n for (let i = 0; i < invoiceIds.length; i++) {\n const invoiceId = invoiceIds[i];\n const invoice = (await this.invoicesApi.getInvoiceById(invoiceId)).data;\n result.push(invoice);\n }\n\n return result;\n }\n\n @action\n getInvoice = async (id: string, forceRefresh?: boolean): Promise => {\n const trimmedId = id.trim();\n\n if (!forceRefresh) {\n const cachedInvoice = this.invoiceCache[trimmedId];\n if (cachedInvoice) {\n return Promise.resolve(cachedInvoice);\n }\n }\n\n return this.invoicesApi.getInvoiceById(trimmedId, true).then(\n (resp) => {\n if (\n resp.data.creditCardDisabled &&\n resp.data.achDisabled &&\n resp.data.payByBankDisabled &&\n this.clientData.isAnonymousPayments\n ) {\n this.router.history.replace('/invoice/expired-link');\n return new Promise(() => { });\n }\n\n this.invoiceCache[trimmedId] = resp.data;\n return Promise.resolve(resp.data);\n },\n (err) => {\n if (this.clientData.isAnonymousPayments) {\n this.router.history.replace('/invoice/expired-link');\n return new Promise(() => { });\n }\n\n throw err;\n }\n );\n };\n\n @action\n private processBankAccountCharge = async (paymentMethod: PaymentMethodInfo, payment: PendingInvoicePayment, invoice: Invoice) => {\n this.processing = true;\n const amount = payment.amount;\n\n const invoiceId = payment.chargeType === ChargeType.NUMBER_0 ? invoice.id : undefined;\n\n if (this.clientData.isLoggedIn && paymentMethod.paymentMethodId) {\n const request: ChargeCustomerStoredPaymentMethodRequest = {\n method: { id: paymentMethod.paymentMethodId },\n amount: amount,\n invoice: invoiceId,\n notificationEmail: this.clientData.loginData.email,\n splits: payment.splits,\n chargeType: payment.chargeType,\n storePaymentMethod: false,\n isCreditCard: false\n };\n try {\n const response = await this.chargeApi.chargeStoredPaymentMethod(request, true, {\n 400: 'Failed to charge bank account. Verify the information you’ve entered or try a different bank account.',\n });\n this.processChargeResponse(invoice, payment, response.data);\n }\n catch (e) {\n const errorMessage = e as string;\n this.callPostError(errorMessage);\n this.processChargeFailure(errorMessage, invoice, payment)\n }\n finally {\n runInAction(() => {\n this.processing = false;\n });\n }\n } else {\n const bankAccount: BankAccountInfo = {\n name: paymentMethod.customerName!,\n routing: (paymentMethod.routingNumber || '').replace(/[^0-9]/g, ''),\n number: (paymentMethod.number || '').replace(/[^0-9]/g, ''),\n checkNumber: '',\n };\n\n const request: ChargeCustomerACHRequest = {\n isBusinessPayment: paymentMethod.bankAccountType == BankAccountType.Business,\n chargeType: payment.chargeType,\n method: bankAccount,\n amount: amount,\n invoice: invoiceId,\n notificationEmail: this.clientData.loginData.email,\n splits: payment.splits,\n storePaymentMethod: false\n };\n\n try {\n const response = await this.chargeApi.chargeBankAccount(request, true, {\n 400: 'Failed to charge bank account. Verify the information you’ve entered or try a different bank account.',\n });\n this.processChargeResponse(invoice, payment, response.data);\n } catch (e) {\n const errorMessage = e as string;\n this.callPostError(errorMessage);\n this.processChargeFailure(errorMessage, invoice, payment)\n } finally {\n runInAction(() => {\n this.processing = false;\n });\n }\n }\n }\n\n @action\n private processCreditCardCharge = async (paymentMethod: PaymentMethodInfo, payment: PendingInvoicePayment, invoice: Invoice) => {\n this.processing = true;\n const amount = payment.amount;\n const invoiceId = payment.chargeType === ChargeType.NUMBER_0 ? invoice.id : undefined;\n\n if (this.clientData.isLoggedIn && paymentMethod.paymentMethodId) {\n const request: ChargeCustomerStoredPaymentMethodRequest = {\n method: { id: paymentMethod.paymentMethodId },\n amount: amount,\n invoice: invoiceId,\n notificationEmail: this.clientData.loginData.email,\n splits: payment.splits,\n chargeType: payment.chargeType,\n storePaymentMethod: false,\n isCreditCard: true\n };\n try {\n const response = await this.chargeApi.chargeStoredPaymentMethod(request, true, {\n 400: 'Failed to charge card. Verify the information you’ve entered or try a different card.',\n 500: 'Insufficient funds'\n });\n this.processChargeResponse(invoice, payment, response.data);\n }\n catch (e) {\n const errorMessage = e as string;\n this.callPostError(errorMessage);\n this.processChargeFailure(errorMessage, invoice, payment)\n }\n finally {\n runInAction(() => {\n this.processing = false;\n });\n }\n } else {\n const lastPGResponse = this.getLastPGResponse();\n if (lastPGResponse) {\n // Used for handling scenario where iframe is closed after selection\n await this.processCharge(lastPGResponse, payment, invoice, paymentMethod.storePaymentMethod || false);\n } else {\n this.paymentGatewayService.handleSubmit(async (pgResponse: PGResponse) => {\n await this.processCharge(pgResponse, payment, invoice, paymentMethod.storePaymentMethod || false);\n });\n }\n }\n };\n\n @action\n processCharge = async (pgResponse: PGResponse, payment: PendingInvoicePayment, invoice: Invoice, storePaymentMethod: boolean) => {\n if (pgResponse.Type === PaymentGatewayResponseType.Error) {\n this.processing = false;\n return;\n }\n\n const invoiceId = payment.chargeType === ChargeType.NUMBER_0 ? invoice.id : undefined;\n\n const responseData = pgResponse.Data;\n const card: CreditCardInfo = {\n token: responseData.Token,\n billingZip: this.postalCode.$.trim(),\n number: responseData.Number,\n name: responseData.CardholderName,\n expMonth: responseData.ExpMonth,\n expYear: responseData.ExpYear,\n cvc: responseData.Cvc,\n issuerName: this.convertToCardIssuer(responseData.IssuerName),\n };\n\n const request: ChargeCreditCardRequest = {\n method: card,\n amount: payment.amount,\n notificationEmail: this.clientData.loginData.email,\n invoice: invoiceId || '',\n storePaymentMethod: storePaymentMethod,\n };\n\n const isStatementCharge = payment.chargeType === ChargeType.NUMBER_1;\n const statementRequest = isStatementCharge ? request as unknown as ChargeCustomerCreditCardRequest : undefined;\n\n if (statementRequest) {\n statementRequest.splits = payment.splits;\n statementRequest.customer = payment.statementId;\n }\n\n try {\n const response = statementRequest ?\n await this.chargeApi.chargeCreditCardMultiple(statementRequest, true,\n {\n 400: 'Failed to charge card. Verify the information you’ve entered or try a different card.',\n 500: 'Insufficient funds'\n })\n : await this.chargeApi.chargeCreditCard(request, true,\n {\n 400: 'Failed to charge card. Verify the information you’ve entered or try a different card.',\n 500: 'Insufficient funds'\n });\n this.processChargeResponse(invoice, payment, response.data);\n } catch (e) {\n const errorMessage = e as string;\n this.callPostError(errorMessage);\n this.processChargeFailure(errorMessage, invoice, payment)\n } finally {\n runInAction(() => {\n this.processing = false;\n });\n }\n };\n\n @action\n private processPayByBankCharge = async (paymentMethod: PaymentMethodInfo, payment: PendingInvoicePayment, invoice: Invoice) => {\n this.processing = true;\n const amount = payment.amount;\n const selectedCustomerId = this.customerSelector.value!;\n this.callPostError(undefined);\n\n const invoiceId = payment.chargeType === ChargeType.NUMBER_0 ? invoice.id : undefined;\n\n if (this.clientData.isLoggedIn && paymentMethod.paymentMethodId) {\n const request: ChargeCustomerStoredPaymentMethodRequest = {\n method: { id: paymentMethod.paymentMethodId },\n amount: amount,\n invoice: invoiceId,\n customerId: selectedCustomerId,\n customerExternalId: invoice.customerExternalId,\n notificationEmail: this.clientData.loginData.email,\n splits: payment.splits,\n chargeType: payment.chargeType,\n storePaymentMethod: false,\n isCreditCard: false,\n };\n try {\n const response = await this.payByBankApi.chargeStoredPaymentMethod(request);\n if (!response.data.transaction) {\n // Show error if no transaction is set\n this.callPostError(response.data.message || 'Failed to charge bank account. Verify your bank account or try a different bank account.');\n } else {\n this.processChargeResponse(invoice, payment, response.data);\n }\n }\n catch (e) {\n runInAction(() => {\n this.callPostError('Failed to charge bank account. Verify your bank account or try a different bank account.');\n this.processChargeFailure(e as string, invoice, payment);\n this.errorMessage = undefined;\n });\n }\n finally {\n runInAction(() => {\n this.processing = false;\n });\n }\n } else {\n const selectedCustomerId = this.customerSelector.value!;\n const selectedCustomer = this.customerInfos.find(c => c.id === selectedCustomerId);\n const bankAccount: BankAccountInfo = {\n name: invoice.customerName || selectedCustomer?.name || this.clientData.loginData.customerName || '',\n routing: (paymentMethod.routingNumber || '').replace(/[^0-9]/g, ''),\n number: (paymentMethod.number || '').replace(/[^0-9]/g, ''),\n checkNumber: '',\n publicToken: paymentMethod.token,\n accountId: paymentMethod.accountId\n };\n\n const request: ChargeCustomerACHRequest = {\n isBusinessPayment: paymentMethod.bankAccountType == BankAccountType.Business,\n chargeType: payment.chargeType,\n method: bankAccount,\n amount: amount,\n customerId: selectedCustomerId || invoice.customerId || Math.abs(this.hashCode(invoice.id)),\n customerExternalId: invoice.customerExternalId,\n invoice: invoiceId,\n notificationEmail: this.clientData.loginData.email,\n splits: payment.splits,\n storePaymentMethod: false\n };\n\n try {\n const response = await this.payByBankApi.charge(request, true);\n\n if (!response.data.transaction) {\n // Show error if no transaction is set\n this.callPostError(response.data.message || 'Failed to charge bank account. Verify your bank account or try a different bank account.');\n } else {\n this.processChargeResponse(invoice, payment, response.data);\n }\n } catch (e) {\n runInAction(() => {\n this.callPostError('Failed to charge bank account. Verify your bank account or try a different bank account.');\n this.processChargeFailure(e as string, invoice, payment);\n this.errorMessage = undefined;\n });\n } finally {\n runInAction(() => {\n this.processing = false;\n });\n }\n }\n };\n\n @action\n private hashCode = (s: string) => {\n return s.split(\"\").reduce(function (a, b) {\n a = ((a << 5) - a) + b.charCodeAt(0);\n return a & a;\n }, 0);\n };\n\n @action\n private processChargeResponse = (invoice: Invoice, payment: PendingInvoicePayment, response: ChargeResponse) => {\n const data = response;\n const amount = payment.amount;\n runInAction(() => {\n const invoiceNumber = invoice.number || invoice.id.toString();\n const confirmation: PaymentConfirmation = {\n number: data.payment,\n amountPaid: amount,\n remainingBalance: data.remainingBalance || payment.amountRemaining,\n notificationEmail: data.notificationEmail,\n transaction: data.transaction,\n invoiceNumber: invoiceNumber,\n customerId: invoice.customerId,\n };\n\n // invalidate cached invoice after successful payment is made\n if (payment.invoiceNumber) {\n delete this.invoiceCache[payment.invoiceNumber];\n }\n\n const isStatement = payment.chargeType === ChargeType.NUMBER_1;\n\n if (isStatement) {\n this.addPaymentConfirmationToCache(payment.statementId!!, confirmation);\n this.router.history.replace(\n `/statement/${payment.statementId}/confirm-payment/${confirmation.transaction}`\n );\n } else {\n this.addPaymentConfirmationToCache(confirmation.number, confirmation);\n\n this.analytics.paymentAttemptSuccess(\n invoiceNumber,\n invoice.customerId,\n amount\n );\n\n this.router.history.replace(\n `/invoice/${invoice.id}/confirm-payment/${confirmation.number}`\n );\n }\n });\n };\n\n @action\n private addPaymentConfirmationToCache = (confirmId: string, confirmation: PaymentConfirmation) => {\n sessionStorage.setItem(confirmId, JSON.stringify(confirmation));\n this.paymentConfirmationCache[confirmation.number] = confirmation;\n };\n\n @action\n private processChargeFailure = (error: string, invoice: Invoice, payment: PendingInvoicePayment) => {\n runInAction(() => {\n if (invoice) {\n this.analytics.paymentAttemptFail(\n invoice.number || invoice.id.toString(),\n invoice.customerId,\n payment.amount,\n error\n );\n }\n });\n };\n\n @action\n getCachedConfirmation = (confirmationNumber: string): PaymentConfirmation | undefined => {\n let confirmation: PaymentConfirmation | undefined = this.paymentConfirmationCache[confirmationNumber];\n if (!confirmation) {\n // Backup for cache failure\n var item = sessionStorage.getItem(confirmationNumber);\n confirmation = item ? JSON.parse(item) as PaymentConfirmation : undefined;\n sessionStorage.removeItem(confirmationNumber);\n }\n return confirmation;\n }\n\n @action\n processACH = async (paymentMethod: PaymentMethodInfo) => {\n const selectedCustomerId = this.customerSelector.value!;\n try {\n const bankAccountInfo: EditBankAccount = {\n id: 0,\n customerId: selectedCustomerId,\n primary: this.needToStoreAsPrimary,\n membership: true,\n businessUnitId: 0,\n customerName: paymentMethod.customerName,\n number: paymentMethod.number,\n routing: paymentMethod.routingNumber,\n zip: this.postalCode.$.trim()\n };\n\n const result = await this.savedBankAccountsApi.saveBankAccount(selectedCustomerId, bankAccountInfo, true,\n {\n 500: 'Failed to store bank account. Verify the information you’ve entered or try a different bank account.',\n }\n );\n this.lastSavedPaymentMethodId = result.data.id;\n await this.getSavedPaymentMethodsForCustomer(selectedCustomerId);\n } catch (e) {\n runInAction(() => {\n this.errorMessage = e;\n this.callCompleteAction(false);\n });\n } finally {\n runInAction(() => {\n this.processing = false;\n this.callCompleteAction(true);\n });\n }\n };\n\n @action\n processGatewayAddNewCard = async (callback: (paymentMethod: PaymentMethodInfo | undefined) => void) => {\n this.paymentGatewayService.handleSubmit(async (pgResponse: PGResponse) => {\n if (pgResponse.Type === PaymentGatewayResponseType.Error) {\n this.processing = false;\n callback(undefined);\n return;\n }\n\n this.lastPGResponse = pgResponse;\n\n const responseData = pgResponse.Data;\n\n const cardNumber = responseData.Number;\n const cardName = getCardNameByIssuer(this.convertToCardIssuer(responseData.IssuerName));\n const customerName = responseData.CardholderName;\n const cardNumberEnding = cardNumber.substring(cardNumber.length - 4, cardNumber.length);\n\n const paymentMethod: PaymentMethodInfo = {\n paymentMethodId: 0,\n primary: this.needToStoreAsPrimary,\n displayText: `${cardName} ending in *${cardNumberEnding}`,\n name: cardName,\n selected: true,\n icon: getCardIcon(cardName),\n expires: `${parseInt(responseData.ExpMonth, 10)}/${parseInt(responseData.ExpYear, 10)}`,\n customerName: customerName,\n bankName: cardName,\n number: cardNumber,\n paymentMethodType: PaymentMethodType.CreditCard\n };\n\n callback(paymentMethod);\n });\n }\n\n @action\n processAddNewCard = async (pgResponse: PGResponse) => {\n if (pgResponse.Type === PaymentGatewayResponseType.Error) {\n this.processing = false;\n this.callCompleteAction(false);\n return;\n }\n\n const responseData = pgResponse.Data;\n const selectedCustomerId = this.customerSelector.value!;\n\n const cardInfo: EditCreditCard = {\n id: 0,\n customerId: selectedCustomerId,\n primary: this.needToStoreAsPrimary,\n membership: true,\n businessUnitId: 0,\n isExpired: false,\n issuer: this.convertToCardIssuer(responseData.IssuerName),\n expYear: parseInt(responseData.ExpYear, 10),\n expMonth: parseInt(responseData.ExpMonth, 10),\n cvv: responseData.Cvc,\n number: responseData.Number,\n cardholderName: responseData.CardholderName,\n zip: this.postalCode.$.trim(),\n token: responseData.Token,\n };\n\n await this.processCreditCard(cardInfo);\n };\n\n @action\n processCreditCard = async (cardInfo: EditCreditCard) => {\n const selectedCustomerId = this.customerSelector.value!;\n try {\n const result = await this.savedCreditCardsApi.saveCreditCard(selectedCustomerId, cardInfo);\n this.lastSavedPaymentMethodId = result.data.id;\n await this.getSavedPaymentMethodsForCustomer(selectedCustomerId);\n } catch (e) {\n runInAction(() => {\n this.errorMessage = e;\n this.callCompleteAction(false);\n });\n } finally {\n runInAction(() => {\n this.processing = false;\n this.callCompleteAction(true);\n });\n }\n };\n\n @action\n resetErrorMessage() {\n this.errorMessage = undefined;\n };\n\n // Computed\n @computed get phone() {\n return this.clientData.portalData ? this.clientData.portalData.brandData.phone : undefined;\n };\n\n @computed get membershipName() {\n return this.membershipNameTypeStore.name || 'Membership';\n };\n\n @computed get availablePaymentMethodsCount() {\n return this.savedPaymentMethods?.filter(paymentMethod => !this.isExpired(paymentMethod)).length || 0;\n };\n}\n","\nexport enum PaymentMethodType {\n CreditCard = \"credit-card\",\n ACH = \"ach\",\n PayByBank = \"pay-by-bank\"\n};\n\nexport enum BankAccountType {\n Personal = \"personal\",\n Business = \"business\"\n}\n\nexport enum CreditCardType {\n Visa = \"Visa\",\n AmericanExpress = \"American Express\",\n Discover = \"Discover\",\n MasterCard = \"MasterCard\",\n Other = \"Card\"\n};\n\nexport interface ConnectedBankAccount {\n bankIcon: string;\n bankName?: string | undefined;\n accountName: string;\n accountMask: string;\n selected: boolean;\n accountType: string;\n bankId?: string | undefined;\n accountId?: string | undefined;\n publicToken?: string | undefined;\n verificationStatus?: string | undefined;\n}\n\nexport interface PaymentMethodInfo {\n paymentMethodId: number;\n primary: boolean;\n name: string;\n selected: boolean;\n icon: string;\n expires?: string | undefined;\n customerName?: string | undefined;\n bankName?: string | undefined;\n bankId?: string | undefined;\n number?: string | undefined;\n paymentMethodType: PaymentMethodType,\n displayText?: string | undefined;\n customerId?: number;\n membership?: boolean;\n disconnected?: boolean | undefined;\n routingNumber?: string | undefined;\n token?: string | undefined;\n accountId?: string | undefined;\n bankAccountType?: BankAccountType | undefined;\n postalCode?: string | undefined;\n cvv?: string | undefined;\n verificationStatus?: string | undefined;\n storePaymentMethod?: boolean | undefined; /* Only used for credit card to save and charge at same time */\n}","import getDecorators from 'inversify-inject-decorators';\n\nimport { rootContainer } from '../ioc';\n\nimport { StatementStore } from './stores/statement.store';\nimport { ChargeStore } from './stores/charge.store';\nimport { PaymentGateway } from './stores/payment-gateway.store';\nimport { SavedCreditCardsStore } from 'src/payment-method/stores/saved-credit-cards.store';\nimport { SavedPaymentMethodsStore } from 'src/payment-method/stores/saved-payment-methods.store';\n\nexport const statementContainer = rootContainer.createChild();\nexport const { lazyInject } = getDecorators(statementContainer);\n\nstatementContainer.bind(StatementStore).toSelf().inSingletonScope();\nstatementContainer.bind(ChargeStore).toSelf().inSingletonScope();\nstatementContainer.bind(PaymentGateway).toSelf().inSingletonScope();\nstatementContainer.bind(SavedCreditCardsStore).toSelf().inSingletonScope();\nstatementContainer.bind(SavedPaymentMethodsStore).toSelf().inSingletonScope();","import { injectable } from '@servicetitan/react-ioc';\nimport { observable, computed } from 'mobx';\n\nexport interface PGResponse {\n Type: PaymentGatewayResponseType;\n Data: ResponseData;\n}\n\ninterface ResponseData {\n Token: string;\n Number: string;\n CardholderName: string;\n ExpMonth: string;\n ExpYear: string;\n Cvc: string;\n IssuerName: string | undefined;\n}\n\nexport enum PaymentGatewayResponseType {\n Error = 0,\n Submit = 1,\n SearsCard = 2,\n}\n\n@injectable()\nexport class PaymentGateway {\n @observable baseUrl: string = '';\n @observable apiKey: string = '';\n @observable paymentsServiceJwt: string = '';\n\n private tokenizationCompleteCallback?: (response: PGResponse) => void;\n\n getDesktopPaymentGatewayUrl(usePaymentsService: boolean | undefined = undefined): string {\n return this.getPaymentGatewayUrl('PortalDesktop', usePaymentsService);\n }\n\n getMobilePaymentGatewayUrl(usePaymentsService: boolean | undefined = undefined): string {\n return this.getPaymentGatewayUrl('PortalMobile', usePaymentsService);\n }\n\n getPaymentGatewayUrl = (view: string, usePaymentsService: boolean | undefined = undefined) => {\n // tslint:disable-next-line: prefer-template\n let url = `${this.baseUrl}/Forms/CreditCard?view=${view}&key=${this.apiKey}&origin=${window.location.origin}`;\n\n if (usePaymentsService === true || (usePaymentsService !== false && this.paymentsServiceJwt?.length)) {\n url +=\n `&paymentsServiceJwt=${encodeURIComponent(this.paymentsServiceJwt)}` +\n '&processor=PaymentsService';\n }\n\n return url;\n }\n iframeMessageHandler = (event: MessageEvent) => {\n if (!this.postMessageEventIsValid(event)) {\n return;\n }\n\n if (this.tokenizationCompleteCallback) {\n this.tokenizationCompleteCallback!(event.data);\n // reset the callback after every execution.\n this.tokenizationCompleteCallback = undefined;\n }\n };\n\n postMessageEventIsValid = (event: MessageEvent) => {\n const iframe = document.getElementById('payment-gateway') as HTMLIFrameElement;\n return event.origin === this.baseUrl && event.source === iframe.contentWindow;\n };\n\n handleSubmit = (\n callback: (response: PGResponse) => void,\n e?: React.FormEvent\n ) => {\n e && e.preventDefault();\n\n const pgIframe = document.getElementById('payment-gateway') as HTMLIFrameElement | null;\n if (!pgIframe || !pgIframe.contentWindow) {\n return;\n }\n\n pgIframe.contentWindow.postMessage({ key: 'st.paymentgateway.submit' }, this.baseUrl);\n this.tokenizationCompleteCallback = callback;\n };\n}\n","import getDecorators from 'inversify-inject-decorators';\nimport { rootContainer } from '../ioc';\n\nimport { SavedCreditCardsStore } from './stores/saved-credit-cards.store';\nimport { PaymentGateway } from 'src/statement/stores/payment-gateway.store';\nimport { SavedPaymentMethodsStore } from './stores/saved-payment-methods.store';\nimport { ClientDataStore } from 'src/core/stores/client-data.store';\n\nexport const paymentMethodsContainer = rootContainer.createChild();\nexport const { lazyInject } = getDecorators(paymentMethodsContainer);\n\npaymentMethodsContainer.bind(SavedCreditCardsStore).toSelf().inSingletonScope();\npaymentMethodsContainer.bind(PaymentGateway).toSelf().inSingletonScope();\npaymentMethodsContainer.bind(SavedPaymentMethodsStore).toSelf().inSingletonScope();\npaymentMethodsContainer.bind(ClientDataStore).toSelf().inSingletonScope();\n","import getDecorators from 'inversify-inject-decorators';\n\nimport { rootContainer } from '../ioc';\n\nimport { LoginStore } from './stores/login.store';\n\nexport const loginContainer = rootContainer.createChild();\nexport const { lazyInject } = getDecorators(loginContainer);\n\nloginContainer.bind(LoginStore).toSelf().inSingletonScope();\n","import { injectable } from 'inversify';\nimport { computed } from 'mobx';\nimport {\n CreditCardInfo,\n Invoice,\n InvoicesApiService,\n ChargeApiService,\n ChargeCustomerACHRequest,\n BankAccountInfo,\n ChargeType,\n ChargeCustomerStoredPaymentMethodRequest,\n} from 'src/api';\nimport { AnalyticsStore } from 'src/core/stores/analytics.store';\nimport { ClientDataStore } from 'src/core/stores/client-data.store';\nimport { HomeStore } from 'src/core/stores/home.store';\nimport { RouterStore } from 'src/core/stores/router.store';\nimport { SavedCreditCardsStore } from 'src/payment-method/stores/saved-credit-cards.store';\n\nexport interface PendingPayment {\n invoiceNumber: string;\n amount?: number;\n card?: Partial;\n bankAccount?: Partial;\n needToSaveCard?: boolean;\n}\n\nexport interface PaymentConfirmation {\n number: string;\n amountPaid: number;\n remainingBalance: number;\n notificationEmail: string;\n transaction: string;\n invoiceNumber: string;\n customerId: number;\n}\n\n@injectable()\nexport class InvoiceStore {\n payment: PendingPayment | undefined;\n\n private invoiceCache: { [id: string]: Invoice } = {};\n private paymentConfirmationCache: { [id: string]: PaymentConfirmation } = {};\n\n constructor(\n private invoicesApi: InvoicesApiService,\n private chargeApi: ChargeApiService,\n private analytics: AnalyticsStore,\n private clientData: ClientDataStore,\n private router: RouterStore,\n private readonly home: HomeStore,\n private savedCreditCardsStore: SavedCreditCardsStore\n ) { }\n\n getInvoice(id: string, forceRefresh?: boolean): Promise {\n const trimmedId = id.trim();\n\n if (!forceRefresh) {\n const cachedInvoice = this.invoiceCache[trimmedId];\n if (cachedInvoice) {\n return Promise.resolve(cachedInvoice);\n }\n }\n\n return this.invoicesApi.getInvoiceById(trimmedId, true).then(\n (resp) => {\n if (\n resp.data.creditCardDisabled &&\n resp.data.achDisabled &&\n resp.data.payByBankDisabled &&\n this.clientData.isAnonymousPayments\n ) {\n this.router.history.replace('/invoice/expired-link');\n return new Promise(() => { });\n }\n\n this.invoiceCache[trimmedId] = resp.data;\n return Promise.resolve(resp.data);\n },\n (err) => {\n if (this.clientData.isAnonymousPayments) {\n this.router.history.replace('/invoice/expired-link');\n return new Promise(() => { });\n }\n\n throw err;\n }\n );\n }\n\n submitAchPayment(\n payment: PendingPayment,\n isBusinessPayment: boolean\n ): Promise {\n if (!payment || !payment.amount || !payment.bankAccount) {\n return Promise.reject('Invalid input');\n }\n\n const invoice = this.invoiceCache[payment.invoiceNumber];\n if (!invoice) {\n return Promise.reject('Missing invoice');\n }\n const amount = payment.amount;\n const bankAccount: BankAccountInfo = {\n name: payment.bankAccount!.name!,\n routing: payment.bankAccount!.routing!,\n number: payment.bankAccount!.number!,\n checkNumber: '',\n };\n\n const request: ChargeCustomerACHRequest = {\n isBusinessPayment,\n amount,\n invoice: payment.invoiceNumber,\n chargeType: ChargeType.NUMBER_0,\n method: bankAccount,\n notificationEmail: this.clientData.loginData.email,\n splits: [\n {\n invoiceId: payment.invoiceNumber,\n amountApplied: payment.amount,\n usesPaymentsService: false,\n },\n ],\n storePaymentMethod: false,\n };\n return this.chargeApi\n .chargeBankAccount(request, true, {\n 400: 'Failed to charge bank account. Verify the information you’ve entered or try a different bank account.',\n })\n .then(\n (resp) => {\n // payment has been submitted, do not reuse\n this.payment = undefined;\n // invalidate cached invoice because there's a new payment\n delete this.invoiceCache[payment.invoiceNumber];\n\n const { data } = resp;\n const confirmation: PaymentConfirmation = {\n number: data.payment,\n amountPaid: amount,\n remainingBalance: invoice.balance - amount,\n notificationEmail: data.notificationEmail,\n transaction: data.transaction,\n invoiceNumber: invoice.number || invoice.id.toString(),\n customerId: invoice.customerId,\n };\n\n this.paymentConfirmationCache[confirmation.number] = confirmation;\n this.analytics.paymentAttemptSuccess(\n invoice.number || invoice.id.toString(),\n invoice.customerId,\n amount\n );\n\n return confirmation;\n },\n (err) => {\n this.analytics.paymentAttemptFail(\n invoice.number || invoice.id.toString(),\n invoice.customerId,\n amount,\n err.message\n );\n throw err;\n }\n );\n }\n\n submitPaymentToUseStoredPaymentMethod(\n payment: PendingPayment | undefined\n ): Promise {\n if (!payment || !payment.amount || !(payment.card || payment.bankAccount)) {\n return Promise.reject('Invalid input');\n }\n const amount = payment.amount;\n const invoice = this.invoiceCache[payment.invoiceNumber];\n if (!invoice) {\n return Promise.reject('Missing invoice');\n }\n\n if (!this.savedCreditCardsStore.selectedCardToPay) {\n return Promise.reject('Need to selected a stored payment method');\n }\n\n const request: ChargeCustomerStoredPaymentMethodRequest = {\n amount,\n method: { id: this.savedCreditCardsStore.selectedCardToPay.id },\n notificationEmail: this.clientData.loginData.email,\n chargeType: ChargeType.NUMBER_0,\n splits: [\n {\n invoiceId: payment.invoiceNumber,\n amountApplied: payment.amount,\n usesPaymentsService: false, // this doesn't matter because it's a stored payment method so no need for gateway\n },\n ],\n invoice: payment.invoiceNumber,\n storePaymentMethod: false,\n isCreditCard: true\n };\n\n return this.chargeApi\n .chargeStoredPaymentMethod(request, true, {\n 400: 'Failed to charge card. Verify the stored card you’ve selected or try a different card.',\n })\n .then(\n (resp) => {\n // payment has been submitted, do not reuse\n this.payment = undefined;\n // invalidate cached invoice because there's a new payment\n delete this.invoiceCache[payment.invoiceNumber];\n\n const { data } = resp;\n const confirmation: PaymentConfirmation = {\n number: data.payment,\n amountPaid: amount,\n remainingBalance: invoice.balance - amount,\n notificationEmail: data.notificationEmail,\n transaction: data.transaction,\n invoiceNumber: invoice.number || invoice.id.toString(),\n customerId: invoice.customerId,\n };\n\n this.paymentConfirmationCache[confirmation.number] = confirmation;\n this.analytics.paymentAttemptSuccess(\n invoice.number || invoice.id.toString(),\n invoice.customerId,\n amount\n );\n\n return confirmation;\n },\n (err) => {\n this.analytics.paymentAttemptFail(\n invoice.number || invoice.id.toString(),\n invoice.customerId,\n amount,\n err.message\n );\n throw err;\n }\n );\n }\n\n submitPayment(payment: PendingPayment): Promise {\n if (!payment || !payment.amount || !(payment.card || payment.bankAccount)) {\n return Promise.reject('Invalid input');\n }\n\n const invoice = this.invoiceCache[payment.invoiceNumber];\n if (!invoice) {\n return Promise.reject('Missing invoice');\n }\n\n const amount = payment.amount;\n\n return this.chargeApi\n .chargeCreditCard(\n {\n amount,\n storePaymentMethod: payment.needToSaveCard || false,\n invoice: payment.invoiceNumber,\n method: payment.card as CreditCardInfo,\n notificationEmail: this.clientData.loginData.email,\n },\n true,\n {\n 400: 'Failed to charge card. Verify the information you’ve entered or try a different card.',\n }\n )\n .then(\n (resp) => {\n // payment has been submitted, do not reuse\n this.payment = undefined;\n // invalidate cached invoice because there's a new payment\n delete this.invoiceCache[payment.invoiceNumber];\n\n const { data } = resp;\n const confirmation: PaymentConfirmation = {\n number: data.payment,\n amountPaid: amount,\n remainingBalance: invoice.balance - amount,\n notificationEmail: data.notificationEmail,\n transaction: data.transaction,\n invoiceNumber: invoice.number || invoice.id.toString(),\n customerId: invoice.customerId,\n };\n\n this.paymentConfirmationCache[confirmation.number] = confirmation;\n this.analytics.paymentAttemptSuccess(\n invoice.number || invoice.id.toString(),\n invoice.customerId,\n amount\n );\n\n return confirmation;\n },\n (err) => {\n this.analytics.paymentAttemptFail(\n invoice.number || invoice.id.toString(),\n invoice.customerId,\n amount,\n err.message\n );\n throw err;\n }\n );\n }\n\n getCachedConfirmation(confirmationNumber: string): PaymentConfirmation | undefined {\n return this.paymentConfirmationCache[confirmationNumber];\n }\n\n getCachedInvoice(id: string): Invoice | undefined {\n return this.invoiceCache[id];\n }\n\n setCachedConfirmation(confirmationNumber: string, paymentConfirmation: PaymentConfirmation) {\n this.paymentConfirmationCache[confirmationNumber] = paymentConfirmation;\n }\n\n getOpenInvoices(): Promise {\n return this.invoicesApi.getInvoices(true).then((resp) => {\n const invoices = resp.data;\n invoices.forEach((invoice) => {\n return (this.invoiceCache[invoice.id] = invoice);\n });\n return invoices;\n });\n }\n\n getSavedCreditCardStore = () => this.savedCreditCardsStore;\n\n @computed get showLoginLink() {\n return !this.clientData.isLoggedIn && this.savedCreditCardsStore.isSavedCreditCardFeatureOn;\n }\n\n @computed get needToChargeStoredCard() {\n return this.showStoreOption && this.savedCreditCardsStore.selectedCardToPay;\n }\n\n @computed get showStoreOption() {\n return this.clientData.isLoggedIn && this.savedCreditCardsStore.isSavedCreditCardFeatureOn;\n }\n}\n","import { injectable } from '@servicetitan/react-ioc';\nimport { observable, runInAction, action, computed } from 'mobx';\nimport {\n SplitInfo,\n CreditCardInfo,\n ChargeCustomerCreditCardRequest,\n ChargeApiService,\n CustomerStatementModel,\n BankAccountInfo,\n ChargeCustomerACHRequest,\n ChargeType,\n CreditCardIssuer,\n} from 'src/api';\nimport { FormState, FieldState } from 'formstate';\nimport * as Validators from 'src/invoice/components/card-info/cc-validators';\nimport { RouterStore } from 'src/core/stores/router.store';\nimport { ClientDataStore } from 'src/core/stores/client-data.store';\nimport { PaymentGateway, PGResponse, PaymentGatewayResponseType } from './payment-gateway.store';\nimport { HomeStore } from 'src/core/stores/home.store';\nimport { SavedCreditCardsStore } from 'src/payment-method/stores/saved-credit-cards.store';\nimport { ChargeCustomerStoredPaymentMethodRequest } from 'src/api/model/chargeCustomerStoredPaymentMethodRequest';\n\n@injectable()\nexport class ChargeStore {\n @observable splits: SplitInfo[] = [];\n @observable outstandingBalance: number = 0;\n @observable statementBalance: number = 0;\n @observable paymentAmount: number = 0;\n @observable errorMessage?: string | any;\n @observable id?: string;\n @observable paymentCompleted: boolean = false;\n @observable authCode: string = '';\n @observable paymentProcessing: boolean = false;\n @observable remainingBalance: number = 0;\n @observable creditCardDisabled: boolean = false;\n @observable achDisabled: boolean = false;\n @observable multiplePaymentOptionsEnabled: boolean = false;\n @observable needToStoreCreditCard: boolean = false;\n @observable useNewCard: boolean = false;\n\n constructor(\n private readonly chargeApiService: ChargeApiService,\n private readonly router: RouterStore,\n private readonly clientData: ClientDataStore,\n private readonly paymentGatewayService: PaymentGateway,\n private readonly savedCreditCardsStore: SavedCreditCardsStore\n ) { }\n\n postalCode = new FieldState('').validators(Validators.zipPostalCodeValidator);\n\n form = new FormState({\n postalCode: this.postalCode,\n });\n\n @action\n initialize = (id: string) => {\n // if statement invoices have not been selected, redirect.\n if (this.paymentAmount <= 0) {\n this.router.history.replace(`/statement/${id}`);\n }\n\n this.id = id;\n this.postalCode.dirty = true;\n this.useNewCard = false;\n this.savedCreditCardsStore.setDefaultSelectedCardToPay();\n };\n\n initializeConfirmationPage = (id: string) => {\n if (this.paymentAmount <= 0) {\n this.router.history.replace(`/statement/${id}`);\n }\n this.id = id;\n };\n\n backToSelectionPage = (id: string) => {\n this.router.history.replace(`/statement/${id}`);\n };\n\n initializeFromStatementModel = (statementModel: CustomerStatementModel) => {\n if (statementModel.customers && statementModel.customers.length > 0) {\n this.creditCardDisabled = statementModel.customers[0].creditCardDisabled;\n this.achDisabled = statementModel.customers[0].achDisabled;\n this.multiplePaymentOptionsEnabled =\n statementModel.customers[0].multiplePaymentOptionsEnabled;\n }\n };\n\n @action\n clearError = () => {\n this.errorMessage = undefined;\n };\n\n convertToCardIssuer = (name: string | undefined): CreditCardIssuer => {\n if (name === undefined) {\n return CreditCardIssuer.NUMBER_0;\n }\n switch (name.toLowerCase()) {\n case 'americanexpress':\n return CreditCardIssuer.NUMBER_3;\n case 'visa':\n return CreditCardIssuer.NUMBER_4;\n case 'mastercard':\n return CreditCardIssuer.NUMBER_5;\n case 'discover':\n return CreditCardIssuer.NUMBER_6;\n default:\n return CreditCardIssuer.NUMBER_0;\n }\n };\n\n @action\n handleSubmit = async () => {\n this.paymentProcessing = true;\n if (this.isLoggedIn && this.savedCreditCardsStore.selectedCardToPay) {\n const request: ChargeCustomerStoredPaymentMethodRequest = {\n method: { id: this.savedCreditCardsStore.selectedCardToPay.id },\n amount: this.paymentAmount,\n customer: this.id!,\n chargeType: ChargeType.NUMBER_1,\n notificationEmail: this.clientData.loginData.email,\n splits: this.splits,\n storePaymentMethod: this.needToStoreCreditCard,\n isCreditCard: true\n };\n const response = await this.chargeApiService.chargeStoredPaymentMethod(request);\n runInAction(() => {\n this.paymentProcessing = false;\n this.remainingBalance = response.data.remainingBalance;\n this.authCode = response.data.transaction;\n this.paymentCompleted = true;\n this.router.history.replace(\n `/statement/${this.id}/confirm-payment/${response.data.transaction}`\n );\n });\n } else {\n await this.form.validate();\n this.paymentGatewayService.handleSubmit(this.processCharge);\n }\n };\n\n @action\n processCharge = async (pgResponse: PGResponse) => {\n if (pgResponse.Type === PaymentGatewayResponseType.Error || this.form.hasError) {\n this.paymentProcessing = false;\n return;\n }\n const responseData = pgResponse.Data;\n const card: CreditCardInfo = {\n token: responseData.Token,\n billingZip: this.postalCode.$.trim(),\n number: responseData.Number,\n name: responseData.CardholderName,\n expMonth: responseData.ExpMonth,\n expYear: responseData.ExpYear,\n cvc: responseData.Cvc,\n issuerName: this.convertToCardIssuer(responseData.IssuerName),\n };\n\n const request: ChargeCustomerCreditCardRequest = {\n method: card,\n amount: this.paymentAmount,\n customer: this.id!,\n notificationEmail: this.clientData.loginData.email,\n splits: this.splits,\n storePaymentMethod: this.needToStoreCreditCard,\n };\n try {\n const response = await this.chargeApiService.chargeCreditCardMultiple(request);\n runInAction(() => {\n this.remainingBalance = response.data.remainingBalance;\n this.authCode = response.data.transaction;\n this.paymentCompleted = true;\n this.router.history.replace(\n `/statement/${this.id}/confirm-payment/${response.data.transaction}`\n );\n });\n } catch (e) {\n runInAction(() => {\n this.errorMessage = e;\n });\n } finally {\n runInAction(() => {\n this.paymentProcessing = false;\n });\n }\n };\n\n @action\n processMultiBankAccount = async (bankAccount: BankAccountInfo, businessPayment: boolean) => {\n const request: ChargeCustomerACHRequest = {\n isBusinessPayment: businessPayment,\n chargeType: ChargeType.NUMBER_1,\n method: bankAccount,\n amount: this.paymentAmount,\n customer: this.id!,\n notificationEmail: this.clientData.loginData.email,\n splits: this.splits,\n storePaymentMethod: false,\n };\n try {\n const response = await this.chargeApiService.chargeBankAccount(request);\n runInAction(() => {\n this.remainingBalance = response.data.remainingBalance;\n this.authCode = response.data.transaction;\n this.paymentCompleted = true;\n this.router.history.replace(\n `/statement/${this.id}/confirm-payment/${response.data.transaction}`\n );\n });\n } catch (e) {\n runInAction(() => {\n this.errorMessage = e;\n });\n } finally {\n runInAction(() => {\n this.paymentProcessing = false;\n });\n }\n };\n\n @action\n updateStoreCreditCardOption = (checked: boolean) => (this.needToStoreCreditCard = checked);\n\n @action\n setUseNewCard = (value: boolean) => (this.useNewCard = value);\n\n @computed\n get isLoggedIn() {\n return this.clientData.isLoggedIn && this.savedCreditCardsStore.isSavedCreditCardFeatureOn;\n }\n\n @computed get showLoginLink() {\n return !this.clientData.isLoggedIn && this.savedCreditCardsStore.isSavedCreditCardFeatureOn;\n }\n}\n","import getDecorators from 'inversify-inject-decorators';\n\nimport { rootContainer } from '../ioc';\n\nimport { InvoiceStore } from './stores/invoice.store';\nimport { SavedCreditCardsStore } from 'src/payment-method/stores/saved-credit-cards.store';\nimport { PaymentGateway } from 'src/statement/stores/payment-gateway.store';\nimport { SavedPaymentMethodsStore } from 'src/payment-method/stores/saved-payment-methods.store';\n\nexport const invoiceContainer = rootContainer.createChild();\nexport const { lazyInject } = getDecorators(invoiceContainer);\n\ninvoiceContainer.bind(InvoiceStore).toSelf().inSingletonScope();\ninvoiceContainer.bind(SavedCreditCardsStore).toSelf().inSingletonScope();\ninvoiceContainer.bind(PaymentGateway).toSelf().inSingletonScope();\ninvoiceContainer.bind(SavedPaymentMethodsStore).toSelf().inSingletonScope();","import { injectable } from 'inversify';\nimport { observable, computed } from 'mobx';\n\nimport { AuthenticateRequest, LoginApiService } from 'src/api';\nimport { ClientDataStore } from 'src/core/stores/client-data.store';\nimport { RouterStore } from 'src/core/stores/router.store';\nimport { lazyInject } from '../../ioc';\n\n@injectable()\nexport class LoginStore {\n @lazyInject(ClientDataStore) clientData!: ClientDataStore;\n @lazyInject(LoginApiService) loginApi!: LoginApiService;\n @lazyInject(RouterStore) router!: RouterStore;\n\n @observable pwFormEmail: string | undefined;\n @observable pwFormPassword: string | undefined;\n @observable pwFormToken: string | undefined;\n @computed get pwFormFirstName() {\n return this.loginApi.checkTokenObservable\n ? this.loginApi.checkTokenObservable.firstName\n : undefined;\n }\n\n authenticate(req: AuthenticateRequest): Promise {\n return this.loginApi.authenticate(req).then((resp) => {\n if (resp.data.success) {\n this.clientData.updateLoginData();\n } else {\n throw 'Those credentials don’t look right. Please try again.';\n }\n });\n }\n\n checkToken(token: string): Promise {\n if (this.pwFormToken === token && this.pwFormEmail) {\n return Promise.resolve(this.pwFormEmail);\n }\n\n this.pwFormToken = undefined;\n this.pwFormEmail = undefined;\n this.pwFormPassword = undefined;\n return this.loginApi.checkToken({ token }, true).then(\n (result) => {\n if (!result.data.success) {\n throw 'Invalid token';\n }\n if (!result.data.email) {\n throw 'Invalid email for token';\n }\n this.pwFormToken = token;\n this.pwFormEmail = result.data.email;\n return this.pwFormEmail;\n },\n (err) => {\n throw 'Failed to validate token';\n }\n );\n }\n\n loginWithReturn = () => {\n this.loginApi.logOut();\n this.clientData.removeLoginCookie();\n this.router.history.push('/login/', { from: { pathname: this.router.location.pathname } });\n }\n}\n","import * as React from 'react';\nimport { observable, computed } from 'mobx';\nimport { FormState, FieldState } from 'formstate';\nimport { lazyInject } from 'src/invoice/ioc';\nimport { InvoiceStore } from 'src/invoice/stores/invoice.store';\nimport { RouterStore } from 'src/core/stores/router.store';\nimport { FormValidators } from '@servicetitan/form';\nimport { BusyFormState } from 'src/util/busy-form';\nimport { ClientDataStore } from '../../../../core/stores/client-data.store';\nimport { statementContainer } from '../../../../statement/ioc';\nimport { ChargeStore } from '../../../../statement/stores/charge.store';\nimport { BankAccountInfo } from 'src/api';\n\nexport const BankAccountType = {\n Business: 'business',\n Personal: 'personal',\n};\n\nexport class AchInfoFormState extends BusyFormState {\n @lazyInject(InvoiceStore) private invoiceStore!: InvoiceStore;\n @lazyInject(RouterStore) private router!: RouterStore;\n @lazyInject(ClientDataStore) private clientData!: ClientDataStore;\n\n @observable errorMessage: string | undefined;\n\n @observable modalIsOpen = false;\n @observable isProcessing = false;\n\n currentInputAccountNumber: string = '';\n accountType = new FieldState('').validators(FormValidators.required);\n accountName = new FieldState('').validators(FormValidators.required);\n\n routingNumber = new FieldState('').validators((value) => {\n if (!value) {\n return 'Field is required.';\n }\n const valid = value.length === 9 && value.replace(/\\D/g, '').length === value.length;\n return valid ? null : 'Routing number is 9 digits.';\n });\n\n accountNumber = new FieldState('').validators((value) => {\n if (!value) {\n return 'Field is required.';\n }\n const valid =\n value.length > 3 &&\n value.length < 18 &&\n value.replace(/\\D/g, '').length === value.length;\n // Here the value hasn't been assigned to accountNumber, so need the intermediate value to validate the confirmAccountNumber.\n this.currentInputAccountNumber = value;\n this.form.$.confirmAccountNumber.validate();\n return valid ? null : 'Account number is between 4 and 17 digits.';\n });\n\n confirmAccountNumber = new FieldState('').validators((value) => {\n if (!value) {\n return 'Field is required.';\n }\n const valid = value === this.currentInputAccountNumber;\n return valid ? null : 'Must match account number.';\n });\n\n @computed get phone() {\n return this.clientData.portalData ? this.clientData.portalData.brandData.phone : undefined;\n }\n\n @computed get companyName() {\n return this.clientData.portalData\n ? this.clientData.portalData.brandData.officialName\n : undefined;\n }\n\n form = new FormState({\n accountType: this.accountType,\n accountName: this.accountName,\n routingNumber: this.routingNumber,\n accountNumber: this.accountNumber,\n confirmAccountNumber: this.confirmAccountNumber,\n isBusy: this.isBusy,\n });\n\n constructor() {\n super();\n const payment = this.invoiceStore.payment;\n this.form.validate();\n if (!payment) {\n return;\n }\n\n if (!payment.bankAccount) {\n payment.bankAccount = {};\n }\n\n const bankAccount = payment.bankAccount;\n\n this.accountType.reset('');\n this.accountName.reset(bankAccount.name || '');\n this.routingNumber.reset(bankAccount.routing || '');\n this.accountNumber.reset(bankAccount.number || '');\n this.confirmAccountNumber.reset('');\n }\n\n clearError = () => {\n this.errorMessage = undefined;\n };\n\n changeAccountType = (e: any, val: string) => {\n this.accountType.reset(val);\n };\n\n closeConfirmationModal = () => {\n this.modalIsOpen = false;\n };\n\n showConfirmationModal = () => {\n this.modalIsOpen = true;\n };\n\n handleSubmit = async (e?: React.FormEvent) => {\n e && e.preventDefault();\n this.closeConfirmationModal();\n const payment = this.invoiceStore.payment;\n await this.form.validate();\n if (this.form.hasError) {\n return;\n }\n const bankAccount: BankAccountInfo = {\n name: this.accountName.$.trim(),\n routing: this.routingNumber.$.replace(/[^0-9]/g, ''),\n number: this.accountNumber.$.replace(/[^0-9]/g, ''),\n checkNumber: '',\n };\n if (payment) {\n payment.bankAccount = bankAccount;\n this.withBusy(\n this.invoiceStore.submitAchPayment(\n payment,\n this.accountType.$.trim() === BankAccountType.Business\n )\n ).then(\n (confirmation) => {\n this.router.history.push(\n `/invoice/${payment.invoiceNumber}/confirm-payment/${confirmation.number}`\n );\n },\n (err) => {\n this.errorMessage = err;\n }\n );\n } else {\n this.isProcessing = true;\n const { processMultiBankAccount } = statementContainer.get(ChargeStore);\n await processMultiBankAccount(\n bankAccount,\n this.accountType.$.trim() === BankAccountType.Business\n );\n this.isProcessing = false;\n }\n };\n}\n","import { injectable } from 'inversify';\nimport { AnvilSelectOptionsProps } from '@servicetitan/design-system';\nimport { TableState, InMemoryDataSource as InMemoryGridDataSource } from '@servicetitan/table';\nimport { DropdownState, IDropdownState, InMemoryDataSource } from '@servicetitan/form';\nimport { FieldState } from 'formstate';\nimport { computed, observable, runInAction, action } from 'mobx';\nimport { StatementsApiService } from '../../api/api/statementsApi.service';\nimport { CustomerModel } from 'src/api';\nimport { address } from 'src/util/formatters';\nimport { ChargeStore } from './charge.store';\nimport moment from 'moment';\nimport { Invoice } from 'src/api/model/invoice';\nimport { RouterStore } from 'src/core/stores/router.store';\nimport { ClientDataStore } from 'src/core/stores/client-data.store';\n\nexport interface InvoiceRowModel {\n invoiceId: string;\n invoiceNumber?: string;\n serviceDate?: Date;\n serviceAddress?: string;\n dueDate?: Date;\n invoiceDate?: Date;\n invoiceTotal: number;\n paymentTotal: number;\n invoiceBalance: number;\n usesPaymentsService: boolean;\n}\n\nexport enum InvoiceFilter {\n All = 1,\n PastDue = 2,\n Statement = 3,\n}\n\nexport interface ExtendedCustomerModel extends CustomerModel {\n balance: number;\n}\n\nexport interface CustomerAnvilSelectOptionsProps extends AnvilSelectOptionsProps {\n text: string;\n value: string;\n}\n\nconst DEFAULT_FILTER = InvoiceFilter.Statement;\n\n@injectable()\nexport class StatementStore {\n public gridState = new TableState({\n pageSize: 20,\n });\n @observable selectedCustomer?: CustomerModel;\n @observable selectedFilter: InvoiceFilter = DEFAULT_FILTER;\n @observable customerDropdownState!: IDropdownState;\n @observable customerMap: Map = new Map<\n string,\n ExtendedCustomerModel\n >();\n searchTerm: FieldState = new FieldState('').onUpdate(\n async (state) => await this.customerDropdownState.onSearchChange(state.value)\n );\n\n constructor(\n private readonly statementApiService: StatementsApiService,\n private readonly chargeInfoService: ChargeStore,\n private readonly router: RouterStore,\n private readonly clientData: ClientDataStore\n ) { }\n\n initialize = async (statementId?: string) => {\n try {\n if (!this.selectedCustomer || this.chargeInfoService.paymentCompleted) {\n const response = statementId\n ? await this.statementApiService.getCustomerStatementsById(statementId, true)\n : await this.statementApiService.getCustomerStatements(true);\n\n const preSelectedCustomerId =\n statementId || response.data.customers!.length === 1\n ? response.data.customers![0].id\n : undefined;\n\n await runInAction(async () => {\n this.chargeInfoService.paymentCompleted = false;\n this.chargeInfoService.initializeFromStatementModel(response.data!);\n this.initCustomerMap(response.data.customers);\n this.initCustomerDropdownState(response.data.customers);\n this.selectCustomer(preSelectedCustomerId);\n });\n }\n } catch (e) {\n await runInAction(() => {\n this.router.history.replace('/statement/not-found');\n });\n }\n };\n\n @action selectCustomer = async (customerId?: string) => {\n !customerId\n ? (this.selectedCustomer = undefined)\n : (this.selectedCustomer = this.customerMap.get(customerId!));\n this.initInvoiceFilter();\n this.clearSearch();\n await this.setDataSource();\n };\n\n initInvoiceFilter = () => {\n this.selectedFilter = this.clientData.isLoggedIn\n ? InvoiceFilter.All\n : this.clientData.isAnonymousStatement\n ? InvoiceFilter.Statement\n : InvoiceFilter.PastDue;\n };\n\n @action reset = () => {\n this.selectedCustomer = undefined;\n this.selectedFilter = DEFAULT_FILTER;\n };\n\n @action clearSearch = async () => {\n this.searchTerm.reset();\n };\n\n private initCustomerMap = (customers?: CustomerModel[]) => {\n this.customerMap.clear();\n customers?.forEach((customer) => {\n const extendedCustomer = customer as ExtendedCustomerModel;\n extendedCustomer.balance = customer.invoices.reduce((sum, inv) => sum + inv.balance, 0);\n this.customerMap.set(customer.id, extendedCustomer);\n });\n };\n\n private initCustomerDropdownState = (customers?: CustomerModel[]) => {\n if (!customers) return;\n const options = customers.map(\n (customer: CustomerModel) =>\n ({\n value: customer.id,\n text: `${customer.name} ${customer.address.streetAddress} ${customer.address.city}, ${customer.address.state} ${customer.address.city}`,\n } as CustomerAnvilSelectOptionsProps)\n );\n const dropdownDataSource = new InMemoryDataSource(\n options\n );\n this.customerDropdownState = new DropdownState(dropdownDataSource);\n };\n\n private setDataSource = async () => {\n this.gridState.reset();\n await this.gridState.setDataSource(\n new InMemoryGridDataSource(\n this.filteredInvoices,\n (row) => row.invoiceId\n )\n );\n };\n\n private mapInvoiceColumns = (invoices: Invoice[]): InvoiceRowModel[] => {\n if (!invoices) return [];\n return invoices.map((invoice) => {\n return {\n invoiceId: invoice.id,\n invoiceNumber: invoice.number,\n serviceDate: invoice.serviceDate ? Date.parse(invoice.serviceDate) : undefined,\n serviceAddress: address(invoice.address),\n dueDate: invoice.dueDate ? Date.parse(invoice.dueDate) : undefined,\n invoiceDate: invoice.billingDate ? Date.parse(invoice.billingDate) : undefined,\n invoiceTotal: invoice.total,\n paymentTotal: invoice.paymentTotal,\n invoiceBalance: invoice.balance,\n usesPaymentsService: invoice.usesPaymentsService,\n };\n });\n };\n\n @action changeFilter = async (filter: InvoiceFilter) => {\n this.selectedFilter = filter;\n await this.setDataSource();\n };\n\n @action makePayment = () => {\n this.chargeInfoService.paymentAmount = parseFloat(this.paymentAmountTotal.toFixed(2));\n this.chargeInfoService.statementBalance = this.statementBalance;\n this.chargeInfoService.outstandingBalance = this.outstandingBalance;\n this.chargeInfoService.splits = Array.from(this.selectedInvoices).map((invoice) => {\n return { invoiceId: invoice.invoiceId, amountApplied: invoice.invoiceBalance, usesPaymentsService: invoice.usesPaymentsService };\n });\n };\n\n @computed get isMultipleCustomers(): boolean {\n return this.customerMap.size > 1;\n }\n\n @computed get isPaymentAllowed(): boolean {\n if (!this.selectedCustomer) return false;\n return !this.selectedCustomer!.creditCardDisabled || !this.selectedCustomer!.achDisabled || !this.selectedCustomer!.payByBankDisabled;\n }\n\n @computed get overdueInvoices(): Invoice[] {\n if (!this.selectedCustomer) return [];\n const overdue =\n this.selectedCustomer!.invoices.filter(\n (inv) => !!inv.dueDate && moment().isAfter(inv.dueDate, 'd')\n ) || [];\n return overdue;\n }\n\n @computed get statementInvoices(): Invoice[] {\n if (!this.selectedCustomer) return [];\n const statementInvoices =\n this.selectedCustomer!.invoices.filter(\n (inv) =>\n !!inv.dueDate &&\n moment(this.selectedCustomer!.statementSentDate).isSameOrAfter(\n inv.invoiceDate,\n 'd'\n )\n ) || [];\n return statementInvoices;\n }\n\n @computed get filteredInvoices(): InvoiceRowModel[] {\n switch (this.selectedFilter) {\n case InvoiceFilter.PastDue:\n return this.mapInvoiceColumns(this.overdueInvoices);\n case InvoiceFilter.Statement:\n return this.mapInvoiceColumns(this.statementInvoices);\n case InvoiceFilter.All:\n if (!this.selectedCustomer) return [];\n return this.mapInvoiceColumns(this.selectedCustomer!.invoices);\n }\n }\n\n @computed get shouldShowDueDate(): boolean {\n return this.filteredInvoices.some(x => !!x.dueDate);\n }\n\n @computed get selectedInvoices(): Set {\n if (this.gridState.selectedCount > 0) {\n return new Set(\n this.filteredInvoices.filter((inv) => this.gridState.selectedIds.has(inv.invoiceId))\n );\n }\n return new Set(this.filteredInvoices);\n }\n\n @computed get selectedInvoiceCount(): number {\n return this.selectedInvoices.size;\n }\n\n @computed get filteredInvoiceCount(): number {\n return this.filteredInvoices.length;\n }\n\n @computed get overdueInvoiceCount(): number {\n return this.overdueInvoices.length;\n }\n\n @computed get invoiceAmountTotal(): number {\n return this.filteredInvoices.reduce((sum, inv) => sum + inv.invoiceTotal, 0);\n }\n\n @computed get previousPaymentTotal(): number {\n return this.filteredInvoices.reduce((sum, inv) => sum + inv.paymentTotal, 0);\n }\n\n @computed get invoiceBalanceTotal(): number {\n return this.filteredInvoices.reduce((sum, inv) => sum + inv.invoiceBalance, 0);\n }\n\n @computed get paymentAmountTotal(): number {\n return Array.from(this.selectedInvoices).reduce((sum, inv) => sum + inv.invoiceBalance, 0);\n }\n\n @computed get statementBalance(): number {\n return this.statementInvoices.reduce((sum, inv) => sum + inv.balance, 0);\n }\n\n @computed get outstandingBalance(): number {\n if (!this.selectedCustomer) return 0;\n return this.selectedCustomer.invoices.reduce((sum, inv) => sum + inv.balance, 0);\n }\n}\n","export const cloneDeep = require('lodash/cloneDeep') as (value: T) => T;\n","import { inject, injectable } from '@servicetitan/react-ioc';\nimport {\n SavedCreditCardsApiService,\n CreditCard,\n CreditCardIssuer,\n EditCreditCard,\n ChargeApiService,\n PortalUser,\n} from 'src/api';\nimport { computed, observable, action, runInAction } from 'mobx';\nimport { cloneDeep } from 'src/util/clone-deep';\nimport { RouterStore } from 'src/core/stores/router.store';\nimport { lazyInject } from 'src/ioc';\nimport { ClientDataStore } from 'src/core/stores/client-data.store';\nimport {\n PaymentGateway,\n PGResponse,\n PaymentGatewayResponseType,\n} from 'src/statement/stores/payment-gateway.store';\nimport { FieldState, FormState } from 'formstate';\nimport * as Validators from 'src/invoice/components/card-info/cc-validators';\nimport { MembershipNameTypeStore } from 'src/core/stores/membership-name-type.store';\nimport { DropdownFieldState } from '@servicetitan/form';\nimport { AnvilSelectOptionsProps } from '@servicetitan/design-system';\n\n// Interfaces\n\n@injectable()\nexport class SavedCreditCardsStore {\n constructor(\n private savedCreditCardsApi: SavedCreditCardsApiService,\n private readonly paymentGatewayService: PaymentGateway,\n private readonly chargeApi: ChargeApiService\n ) {\n this.init();\n }\n\n @lazyInject(RouterStore) router!: RouterStore;\n @lazyInject(ClientDataStore) private clientData!: ClientDataStore;\n @inject(MembershipNameTypeStore) private membershipNameTypeStore!: MembershipNameTypeStore;\n\n // Variables\n customerIds: number[] | undefined;\n\n customerInfos: PortalUser[] = [];\n\n postalCode = new FieldState('').validators(Validators.zipPostalCodeValidator);\n\n form = new FormState({ postalCode: this.postalCode });\n\n // Observable variables\n @observable\n savedCreditCards: CreditCard[] | undefined;\n\n @observable\n isLoadingSavedCreditCards = true;\n\n @observable\n isChangeCardDialogOpen = false;\n\n @observable\n isAddNewCardDialogOpen = false;\n\n @observable\n isDeleteCardDialogOpen = false;\n\n @observable\n isSetPrimaryModalOpen = false;\n\n @observable\n isDeleteModalOpen = false;\n\n @observable\n isAddNewCardModalOpen = false;\n\n @observable\n currentEditingCard: CreditCard | undefined;\n\n @observable\n selectedCardToPay: CreditCard | undefined;\n\n @observable\n selectedCardToUpdate: CreditCard | undefined;\n\n @observable errorMessage?: string;\n\n @observable cardProcessing: boolean = false;\n\n @observable\n isMobileCardSelectTakeoverOpen = false;\n\n @observable\n isMobileCardDeleteTakeoverOpen = false;\n\n @observable\n isMobileCardAddTakeoverOpen = false;\n\n @observable\n isMobileSetPrimaryTakeoverOpen = false;\n\n @observable\n needToStoreAsPrimary = false;\n\n @observable\n isSavedCreditCardEnabled = false;\n\n @observable\n isSavedCreditCardFeatureOn = false;\n\n\n customerSelector = new FieldState(undefined).onDidChange(({ newValue }) =>\n this.getSavedCreditCardsForCustomer(newValue));\n\n @observable\n customerOptions: AnvilSelectOptionsProps = [];\n\n // Methods\n init = () => {\n this.savedCreditCardsApi.feature().then((response) => {\n this.isSavedCreditCardFeatureOn = response.data;\n if (this.isSavedCreditCardFeatureOn && this.clientData.isLoggedIn) {\n this.getCustomerIds();\n }\n });\n this.chargeApi.paymentGatewayConfig().then((response) => {\n this.paymentGatewayService.apiKey = response.data.apiKey || '';\n this.paymentGatewayService.baseUrl = response.data.baseUrl || '';\n this.paymentGatewayService.paymentsServiceJwt = response.data.paymentsServiceJwt || '';\n });\n }\n\n getCardIssuer = (issuer: CreditCardIssuer) => {\n switch (issuer) {\n case CreditCardIssuer.NUMBER_3:\n return 'AMEX';\n case CreditCardIssuer.NUMBER_4:\n return 'VISA';\n case CreditCardIssuer.NUMBER_5:\n return 'MC';\n case CreditCardIssuer.NUMBER_6:\n return 'Discover';\n default:\n return 'Card';\n }\n }\n\n isExpiringSoon = (year: number, month: number) => {\n const today = new Date();\n const currentYear = today.getFullYear();\n const currentMonth = today.getMonth() + 1;\n if (currentYear === year) {\n if (currentMonth === month || currentMonth + 1 === month) {\n return true;\n }\n } else if (currentYear + 1 === year && currentMonth === 12 && month === 1) {\n return true;\n }\n return false;\n }\n\n convertToCardIssuer = (name: string | undefined): CreditCardIssuer => {\n if (name === undefined) {\n return CreditCardIssuer.NUMBER_0;\n }\n switch (name.toLowerCase()) {\n case 'americanexpress':\n return CreditCardIssuer.NUMBER_3;\n case 'visa':\n return CreditCardIssuer.NUMBER_4;\n case 'mastercard':\n return CreditCardIssuer.NUMBER_5;\n case 'discover':\n return CreditCardIssuer.NUMBER_6;\n default:\n return CreditCardIssuer.NUMBER_0;\n }\n }\n\n sortCreditCard = (cards: CreditCard[]) => {\n if (cards.length === 0) {\n return [];\n }\n const primaryCards = cards.filter(c => c.primary && !c.isExpired);\n const membershipCards = cards.filter(c => !c.primary && c.membership && !c.isExpired);\n const others = cards\n .filter(c => c.isExpired || (!c.primary && !c.membership))\n .sort((a, b) => b.expYear + b.expMonth - (a.expYear + a.expMonth));\n return [...primaryCards, ...membershipCards, ...others];\n }\n\n gotoSavedCardPage = () => {\n this.router.history.push('/savedpaymentmethod/paymentmethod');\n }\n\n isSelectedToUpdate = (card: CreditCard) => {\n if (this.selectedCardToUpdate) {\n return card.id === this.selectedCardToUpdate.id;\n }\n return undefined;\n }\n\n usePaymentGateway = () => {\n return this.paymentGatewayService && !!this.paymentGatewayService.baseUrl;\n }\n\n getCustomerId = () => {\n return this.customerIds && this.customerIds.length > 0 ?\n this.customerIds[0] : 0;\n }\n\n // Action Methods\n\n @action\n getSavedCreditCardsForCustomer = async (id?: number) => {\n this.isLoadingSavedCreditCards = true;\n if (!id) {\n this.isLoadingSavedCreditCards = false;\n return;\n }\n const allCards = (await this.savedCreditCardsApi.savedCreditCards(id)).data;\n const availableCards = allCards.filter(c => !c.isExpired);\n\n runInAction(() => {\n this.savedCreditCards = this.sortCreditCard(allCards);\n this.isLoadingSavedCreditCards = false;\n this.selectedCardToPay =\n availableCards.length > 0\n ? availableCards.find(c => c.primary) || availableCards[0]\n : undefined;\n });\n }\n\n @action\n openSetPrimaryModal = (card: CreditCard) => {\n this.currentEditingCard = cloneDeep(card);\n this.isSetPrimaryModalOpen = true;\n }\n\n @action\n closeSetPrimaryModal = () => {\n this.currentEditingCard = undefined;\n this.isSetPrimaryModalOpen = false;\n }\n\n @action\n openDeleteModal = (card: CreditCard) => {\n this.resetErrorMessage();\n this.currentEditingCard = cloneDeep(card);\n this.isDeleteModalOpen = true;\n }\n\n @action\n closeDeleteModal = () => {\n this.currentEditingCard = undefined;\n this.isDeleteModalOpen = false;\n this.selectedCardToUpdate = undefined;\n this.form.$.postalCode.onChange('');\n this.form.$.postalCode.dirty = false;\n }\n\n @action\n openAddNewCardModal = () => {\n this.resetErrorMessage();\n this.isAddNewCardModalOpen = true;\n this.needToStoreAsPrimary = false;\n }\n\n @action\n closeAddNewCardModal = () => {\n this.isAddNewCardModalOpen = false;\n this.form.$.postalCode.onChange('');\n this.form.$.postalCode.dirty = false;\n }\n\n @action\n openMobileCardSelectTakeover = () => {\n this.resetErrorMessage();\n this.isMobileCardSelectTakeoverOpen = true;\n }\n\n @action\n closeMobileCardSelectTakeover = () => {\n this.isMobileCardSelectTakeoverOpen = false;\n }\n\n @action\n openMobileCardDeleteTakeover = (card: CreditCard) => {\n this.resetErrorMessage();\n this.currentEditingCard = cloneDeep(card);\n this.isMobileCardDeleteTakeoverOpen = true;\n }\n\n @action\n closeMobileCardDeleteTakeover = () => {\n this.isMobileCardDeleteTakeoverOpen = false;\n }\n\n @action\n openMobileSetPrimaryTakeover = (card: CreditCard) => {\n this.currentEditingCard = cloneDeep(card);\n this.isMobileSetPrimaryTakeoverOpen = true;\n }\n\n @action\n closeMobileSetPrimaryTakeover = () => {\n this.isMobileSetPrimaryTakeoverOpen = false;\n }\n\n @action\n openMobileCardAddTakeover = () => {\n this.resetErrorMessage();\n this.needToStoreAsPrimary = false;\n this.isMobileCardAddTakeoverOpen = true;\n }\n\n @action\n closeMobileCardAddTakeover = () => {\n this.isMobileCardAddTakeoverOpen = false;\n this.form.$.postalCode.onChange('');\n this.form.$.postalCode.dirty = false;\n }\n\n @action\n getCustomerIds = async () => {\n const response = await this.savedCreditCardsApi.isEnabled();\n runInAction(() => {\n this.isSavedCreditCardEnabled = !!response.data.length;\n this.customerIds = response.data.map(i => i.id);\n this.customerInfos = response.data.map(i => ({ id: i.id, name: i.name }));\n this.customerOptions = this.customerInfos.map(i => ({ value: i.id, text: i.name }));\n if (this.customerIds.length) {\n this.customerSelector.onChange(this.customerIds[0]);\n }\n });\n }\n\n /// If user choose to use a new card instead of the default primary card, reset the value to undefined.\n @action\n setSelectedCardToPay = (selectedCard: CreditCard | undefined) => {\n this.selectedCardToPay = selectedCard;\n }\n\n @action\n setSelectedCardToUpdate = (selectedCard: CreditCard | undefined) => {\n this.selectedCardToUpdate = selectedCard;\n }\n\n @action\n setDefaultSelectedCardToPay = () => {\n if (!this.savedCreditCards || this.savedCreditCards.length === 0) {\n return undefined;\n }\n const availableCards = this.savedCreditCards.filter(c => !c.isExpired);\n this.selectedCardToPay =\n availableCards.length > 0\n ? availableCards.find(c => c.primary) || availableCards[0]\n : undefined;\n }\n\n @action\n setPrimary = (value: boolean) => (this.needToStoreAsPrimary = value)\n\n @action\n setAsPrimary = async (card: CreditCard) => {\n await this.savedCreditCardsApi.assignCreditCard(\n card.customerId,\n card.id,\n true,\n card.membership\n );\n runInAction(() => {\n this.currentEditingCard = undefined;\n this.isSetPrimaryModalOpen = false;\n this.isMobileSetPrimaryTakeoverOpen = false;\n });\n await this.getSavedCreditCardsForCustomer(this.customerSelector.value);\n }\n\n @action\n handleDelete = async () => {\n this.cardProcessing = true;\n this.resetErrorMessage();\n try {\n await this.savedCreditCardsApi.deleteCreditCard(\n this.currentEditingCard!.customerId,\n this.currentEditingCard!.id\n );\n } catch (e) {\n runInAction(() => {\n this.errorMessage = e;\n });\n } finally {\n runInAction(() => {\n this.cardProcessing = false;\n this.closeDeleteModal();\n });\n await this.getSavedCreditCardsForCustomer(this.customerSelector.value);\n }\n }\n\n @action\n handleAdd = async () => {\n this.resetErrorMessage();\n this.cardProcessing = true;\n await this.form.validate();\n this.paymentGatewayService.handleSubmit(this.processAddNewCard);\n }\n\n @action\n processAddNewCard = async (pgResponse: PGResponse) => {\n if (pgResponse.Type === PaymentGatewayResponseType.Error || this.form.hasError) {\n this.cardProcessing = false;\n return;\n }\n const responseData = pgResponse.Data;\n const selectedCustomerId = this.customerSelector.value!;\n try {\n const cardInfo: EditCreditCard = {\n id: 0,\n customerId: selectedCustomerId,\n primary: this.needToStoreAsPrimary,\n membership: true,\n businessUnitId: 0,\n isExpired: false,\n issuer: this.convertToCardIssuer(responseData.IssuerName),\n expYear: parseInt(responseData.ExpYear, 10),\n expMonth: parseInt(responseData.ExpMonth, 10),\n cvv: responseData.Cvc,\n number: responseData.Number,\n cardholderName: responseData.CardholderName,\n zip: this.postalCode.$.trim(),\n token: responseData.Token,\n };\n\n await this.savedCreditCardsApi.saveCreditCard(selectedCustomerId, cardInfo);\n await this.getSavedCreditCardsForCustomer(selectedCustomerId);\n } catch (e) {\n runInAction(() => {\n this.errorMessage = e;\n });\n } finally {\n runInAction(() => {\n this.cardProcessing = false;\n if (this.isAddNewCardModalOpen) {\n this.closeAddNewCardModal();\n }\n if (this.isMobileCardAddTakeoverOpen) {\n this.closeMobileCardAddTakeover();\n }\n });\n }\n }\n\n @action\n resetErrorMessage() {\n this.errorMessage = undefined\n }\n\n // Computed\n @computed get phone() {\n return this.clientData.portalData ? this.clientData.portalData.brandData.phone : undefined;\n }\n\n @computed get membershipName() {\n return this.membershipNameTypeStore.name || 'Membership';\n }\n\n @computed get availableCardsCount() {\n return this.savedCreditCards?.filter(c => !c.isExpired).length || 0;\n }\n}\n","import * as CardValidator from 'card-validator';\nimport { Validator } from 'formstate';\n\nexport const ccNameValidator: Validator = (value) => {\n if (!value) {\n return \"You can't leave this field empty\";\n }\n const valid = /^\\s*[\\u0020-\\u005f]{1,26}\\s*$/i.test(value);\n return valid ? null : 'Invalid characters';\n};\n\nexport const ccNumberValidator: Validator = (value) => {\n if (!value) {\n return \"You can't leave this field empty\";\n }\n return CardValidator.number(value).isValid ? null : 'Invalid card number';\n};\n\nexport const ccExpValidator: Validator = (value) => {\n if (!value) {\n return \"You can't leave this field empty\";\n }\n return /^[01]\\d\\/?\\d\\d$/.test(value) && CardValidator.expirationDate(value).isValid\n ? null\n : 'Invalid expiration date';\n};\n\nexport const ccCscValidator: Validator = (value) => {\n if (!value) {\n return \"You can't leave this field empty\";\n }\n const valid = /^\\d{3,4}$/.test(value);\n return valid ? null : 'Invalid security code';\n};\n\n/**\n * Checks for a valid US or Canadian or Australian zip/postal code\n */\nexport const zipPostalCodeValidator: Validator = (value) => {\n if (!value) {\n return \"You can't leave this field empty\";\n }\n const valid = /^(\\d{4}|\\d{5}(-\\d{4})?|[a-z]\\d[a-z] ?\\d[a-z]\\d)$/i.test(value);\n return valid ? null : 'Invalid postal code';\n};\n","import * as React from 'react';\nimport { observable } from 'mobx';\nimport { FormState, FieldState } from 'formstate';\nimport * as Validators from '../cc-validators';\nimport { lazyInject } from 'src/invoice/ioc';\nimport { InvoiceStore } from 'src/invoice/stores/invoice.store';\nimport { RouterStore } from 'src/core/stores/router.store';\nimport { BusyFormState } from 'src/util/busy-form';\n\nexport class CardInfoFormState extends BusyFormState {\n @lazyInject(InvoiceStore) private invoiceStore!: InvoiceStore;\n @lazyInject(RouterStore) private router!: RouterStore;\n\n @observable errorMessage: string | undefined;\n\n ccName = new FieldState('').validators(Validators.ccNameValidator);\n ccNumber = new FieldState('').validators(Validators.ccNumberValidator);\n ccExp = new FieldState('').validators(Validators.ccExpValidator);\n ccCsc = new FieldState('').validators(Validators.ccCscValidator);\n postalCode = new FieldState('').validators(Validators.zipPostalCodeValidator);\n\n form = new FormState({\n ccName: this.ccName,\n ccNumber: this.ccNumber,\n ccExp: this.ccExp,\n ccCsc: this.ccCsc,\n postalCode: this.postalCode,\n isBusy: this.isBusy\n });\n\n constructor() {\n super();\n const payment = this.invoiceStore.payment;\n if (!payment) {\n return;\n }\n\n if (!payment.card) {\n payment.card = {};\n }\n\n const card = payment.card;\n\n const existingCcExp = card.expMonth && card.expYear ? card.expMonth + card.expYear : '';\n this.ccName.reset(card.name || '');\n this.ccNumber.reset(card.number || '');\n this.ccExp.reset(existingCcExp || '');\n this.ccCsc.reset(card.cvc || '');\n this.postalCode.reset(card.billingZip || '');\n\n this.form.validate();\n }\n\n clearError = () => {\n this.errorMessage = undefined;\n };\n\n handleSubmit = (e?: React.FormEvent) => {\n e && e.preventDefault();\n\n const payment = this.invoiceStore.payment;\n if (!payment || this.form.hasError) {\n return;\n }\n\n payment.card = {\n name: this.ccName.$.trim(),\n number: this.ccNumber.$.replace(/[^0-9]/g, ''),\n expMonth: this.ccExp.$.replace(/[^0-9]/g, '').substr(0, 2),\n expYear: this.ccExp.$.replace(/[^0-9]/g, '').substr(2, 2),\n cvc: this.ccCsc.$.trim(),\n billingZip: this.postalCode.$.trim(),\n };\n\n this.withBusy(this.invoiceStore.submitPayment(payment)).then(\n (confirmation) => {\n this.router.history.push(\n `/invoice/${payment.invoiceNumber}/confirm-payment/${confirmation.number}`\n );\n },\n (err) => {\n this.errorMessage = err;\n }\n );\n };\n}\n","import { FormState, FieldState } from 'formstate';\nimport { observable, computed, action } from 'mobx';\nimport * as React from 'react';\n\nimport * as Validators from '../cc-validators';\nimport { lazyInject } from '../../../ioc';\nimport { InvoiceStore } from '../../../stores/invoice.store';\nimport { RouterStore } from 'src/core/stores/router.store';\nimport { BusyFormState } from 'src/util/busy-form';\nimport { CreditCardIssuer } from 'src/api';\nimport { PaymentGateway } from 'src/statement/stores/payment-gateway.store';\n\ninterface Props {\n id: string;\n skipIFrameMessageHandler?: boolean;\n}\n\nexport class PGCardInfoFormState extends BusyFormState {\n @lazyInject(InvoiceStore) private invoiceStore!: InvoiceStore;\n @lazyInject(RouterStore) private router!: RouterStore;\n @lazyInject(PaymentGateway) private paymentGateway!: PaymentGateway;\n\n paymentGatewayBaseUrl = '';\n @observable errorMessage?: string;\n @observable mobilePaymentGatewayUrl?: string;\n @observable desktopPaymentGatewayUrl?: string;\n @observable useNewCard: boolean = false;\n @observable needToSelectAnotherCard: boolean = false;\n @observable needToStoreCreditCard: boolean = false;\n @observable isSavedCreditCardFeatureEnabled: boolean = false;\n @observable skipIFrameMessageHandler: boolean = false;\n\n paymentGatewayResponseType = {\n Error: 0,\n Submit: 1,\n SearsCard: 2,\n };\n\n postalCode = new FieldState('').validators(Validators.zipPostalCodeValidator);\n\n form = new FormState({\n postalCode: this.postalCode,\n isBusy: this.isBusy,\n });\n\n constructor(props: Props) {\n super();\n const payment = this.invoiceStore.payment;\n this.skipIFrameMessageHandler = props.skipIFrameMessageHandler || false;\n if (!payment) {\n return;\n }\n\n if (!payment.card) {\n payment.card = {};\n }\n\n const card = payment.card;\n this.postalCode.reset(card.billingZip || '');\n\n this.form.validate();\n\n this.invoiceStore.getInvoice(props.id).then((invoice) => {\n this.paymentGatewayBaseUrl = invoice.paymentGatewayBaseUrl || '';\n this.mobilePaymentGatewayUrl = this.paymentGateway.getMobilePaymentGatewayUrl(invoice.usesPaymentsService);\n this.desktopPaymentGatewayUrl = this.paymentGateway.getDesktopPaymentGatewayUrl(invoice.usesPaymentsService);\n });\n }\n\n convertToCardIssuer = (name: string | undefined): CreditCardIssuer => {\n if (name === undefined) {\n return CreditCardIssuer.NUMBER_0;\n }\n switch (name.toLowerCase()) {\n case 'americanexpress':\n return CreditCardIssuer.NUMBER_3;\n case 'visa':\n return CreditCardIssuer.NUMBER_4;\n case 'mastercard':\n return CreditCardIssuer.NUMBER_5;\n case 'discover':\n return CreditCardIssuer.NUMBER_6;\n default:\n return CreditCardIssuer.NUMBER_0;\n }\n }\n\n iframeMessageHandler = (event: MessageEvent) => {\n if (this.skipIFrameMessageHandler || !this.postMessageEventIsValid(event)) {\n return;\n }\n\n const responseType = event.data.Type;\n const responseData = event.data.Data;\n if (responseType === this.paymentGatewayResponseType.Error) {\n // eslint-disable-next-line no-alert\n alert(responseData);\n return;\n }\n\n if (responseType !== this.paymentGatewayResponseType.Submit) {\n return;\n }\n\n const payment = this.invoiceStore.payment;\n if (!payment || this.form.hasError || !responseData.Token) {\n return;\n }\n\n payment.card = {\n token: responseData.Token,\n billingZip: this.postalCode.$.trim(),\n number: responseData.Number,\n name: responseData.CardholderName,\n expMonth: responseData.ExpMonth,\n expYear: responseData.ExpYear,\n issuerName: this.convertToCardIssuer(responseData.IssuerName)\n };\n\n payment.needToSaveCard = this.needToStoreCreditCard;\n this.withBusy(this.invoiceStore.submitPayment(payment)).then(\n (confirmation) => {\n this.router.history.push(\n `/invoice/${payment.invoiceNumber}/confirm-payment/${confirmation.number}`\n );\n },\n (err) => {\n this.errorMessage = err;\n }\n );\n };\n\n postMessageEventIsValid = (event: MessageEvent) => {\n const iframe = document.getElementById('payment-gateway') as HTMLIFrameElement;\n return event.origin === this.paymentGatewayBaseUrl && event.source === iframe.contentWindow;\n };\n\n clearError = () => {\n this.errorMessage = undefined;\n };\n\n handleSubmit = (e?: React.FormEvent) => {\n e && e.preventDefault();\n if (this.invoiceStore.needToChargeStoredCard) {\n const payment = this.invoiceStore.payment;\n if (!payment) { return; }\n this.invoiceStore.submitPaymentToUseStoredPaymentMethod(payment).then(\n (confirmation) => {\n this.router.history.push(`/invoice/${payment.invoiceNumber}/confirm-payment/${confirmation.number}`);\n },\n (err) => {\n this.errorMessage = err;\n }\n );\n } else {\n const pgIframe = document.getElementById('payment-gateway') as HTMLIFrameElement | null;\n if (!pgIframe || !pgIframe.contentWindow) { return; }\n pgIframe.contentWindow.postMessage({ key: 'st.paymentgateway.submit' }, this.paymentGatewayBaseUrl);\n }\n }\n\n @action\n setUseNewCard = (value: boolean) => { this.useNewCard = value; }\n\n @action\n setNeedToSelectAnotherCard = (value: boolean) => { this.needToSelectAnotherCard = value; }\n\n @action\n setNeedToStoreCreditCard = (value: boolean) => { this.needToStoreCreditCard = value; }\n\n @computed\n get showLoginLink() {\n return this.invoiceStore.showLoginLink;\n }\n\n @computed\n get loggedIn() {\n return this.invoiceStore.showStoreOption;\n }\n\n @computed\n get cardInfo() {\n return this.invoiceStore.payment?.card;\n }\n}\n","import { currency } from 'src/util/formatters';\nimport moment from 'moment';\n\nexport const toPrettyAmount = (amount: number) => currency(amount);\n\nexport const getPrettyDate = () => moment().format('L');\n\nexport const last4AccountNumber = (accountNumber: string) =>\n accountNumber.length > 0 ? accountNumber.substr(accountNumber.length - 4) : '';\n\nexport const getLimitText = (isInvoicePayment: boolean, amount: number): string => {\n return isInvoicePayment\n ? `ACH Payments are limited to ${toPrettyAmount(\n amount\n )}. The amount you've selected to pay is greater than this amount.`\n : `ACH Payments are limited to ${toPrettyAmount(\n amount\n )} per transaction. The amount you've selected to pay is greater than this amount. Please go back and select individual invoices to pay or choose a different payment option.`;\n};\n","import * as React from 'react';\nimport { observer } from 'mobx-react';\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n} from '@material-ui/core';\nimport { currency } from 'src/util/formatters';\nimport moment from 'moment';\nimport styles from './confirmation-modal.less';\n\ninterface Props {\n companyName: string;\n companyPhoneNumber: string;\n amount: number;\n accountNumber: string;\n onClose: () => void;\n onSubmit: () => void;\n}\n\nexport const ConfirmationModal = observer>(\n ({ amount, accountNumber, companyName, companyPhoneNumber, onClose, onSubmit }) => {\n const prettyAmount = currency(amount);\n const prettyDate = moment().format('L');\n return (\n \n ACH Payment Authorization\n \n \n I authorize {companyName}, herein called COMPANY, to debit my bank account\n for {prettyAmount} according to the following details:\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Amount Authorized{prettyAmount}
Date of Authorization{prettyDate}
Date of Debit{prettyDate}
Bank Account Number\n Ending in{' '}\n {accountNumber.length > 0\n ? accountNumber.substr(accountNumber.length - 4)\n : ''}\n
\n \n I understand that this authorization will remain in full force and effect\n until I cancel this transaction by contacting COMPANY at{' '}\n {companyPhoneNumber}. To complete this transaction, click the \"Authorize\"\n button.\n \n
\n \n \n \n \n \n );\n }\n);\n","import classnames from 'classnames';\nimport * as React from 'react';\nimport { observer } from 'mobx-react';\nimport { Radio, FormControlLabel, RadioGroup, Tooltip, Icon } from '@material-ui/core';\n\nimport { AchInfoContainer } from '../../../../invoice/components/ach-info/ach-info';\nimport { BankAccountType } from '../../../../invoice/components/ach-info/ach-info/ach-info';\nimport * as Utils from '../ach-utils';\nimport { ConfirmationModal } from './confirmation-modal';\nimport { toNumber } from 'src/util/formatters';\nimport { MatField } from 'src/core/components/mat-field';\n\nimport styles from './ach-info.less';\n\ninterface Props {\n container: AchInfoContainer;\n amount?: number;\n containerStyles?: object;\n isInvoicePayment: boolean;\n redirectToPayPage?: () => void;\n isEmbedded?: boolean\n}\n\nexport const AchInfo = observer>(\n ({ amount, containerStyles, container: { data }, isInvoicePayment, isEmbedded }) => {\n const maxAchPayment = 250000;\n const paymentAmount = amount || 0;\n return (\n
\n {paymentAmount > maxAchPayment ? (\n
\n warning\n {Utils.getLimitText(isInvoicePayment, maxAchPayment)}\n
\n ) : (\n <>\n
\n Bank Account Type\n \n info\n \n
\n \n }\n label=\"Personal Account\"\n />\n }\n label=\"Business Account\"\n />\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n {data.modalIsOpen ? (\n \n ) : null}\n \n )}\n
\n );\n }\n);\n","import { observable } from 'mobx';\nimport { observer } from 'mobx-react';\nimport * as React from 'react';\n\nimport { AchInfo } from './ach-info/desktop/ach-info';\nimport { AchInfoFormState } from './ach-info/ach-info';\n\ninterface Props {\n data?: AchInfoFormState;\n amount?: number;\n isInvoicePayment: boolean;\n redirectToPayPage?: () => void;\n isEmbedded?: boolean;\n}\n\n@observer\nexport class AchInfoContainer extends React.Component {\n @observable data!: AchInfoFormState;\n\n constructor(props: Props) {\n super(props);\n this.data = this.props.data || new AchInfoFormState();\n }\n\n render() {\n return this.data ? (\n \n ) : null;\n }\n}\n","import classNames from 'classnames';\nimport React, { FC } from 'react';\n\n\nimport styles from './connected-account.less';\nimport { ConnectedBankAccount } from 'src/invoice/types/types';\n\ninterface ConnectedAccountProps {\n account: ConnectedBankAccount;\n\n}\n\nexport const ConnectedAccount: FC = ({\n account: {\n bankIcon,\n bankName,\n accountName,\n accountMask,\n selected\n },\n}) => (\n
\n {bankName}\n
\n {bankName}{' '}{accountName} •••• {accountMask}\n
\n {selected && (\n
\n
\n
\n Selected\n
\n
\n
)}\n
\n);","import classnames from 'classnames';\nimport React, { FC, useState } from 'react';\nimport { ConnectedBankAccount } from 'src/invoice/types/types';\n\nimport styles from './connected-accounts.less';\nimport { ConnectedAccount } from './connected-account';\n\ninterface ConnectedAccountsProps {\n accounts: ConnectedBankAccount[];\n setAccounts: (accounts: ConnectedBankAccount[]) => void;\n}\n\nexport const ConnectedAccounts: FC = ({\n accounts,\n setAccounts\n}) => {\n\n const [, setConnectedAccounts] = useState(accounts);\n\n const onSelectConnectedAccount = (index: number) => {\n accounts.forEach(account => { account.selected = false; });\n accounts[index].selected = true;\n setConnectedAccounts([...accounts]);\n setAccounts(accounts);\n }\n\n return (\n <>\n {accounts.length > 0 && (\n
\n
Connected Account(s)
\n {accounts.map((account, idx) => (\n
onSelectConnectedAccount(idx)}>\n \n
\n ))}\n
\n )}\n \n );\n}","import * as CardValidator from 'card-validator';\n\nexport const ccNumberFormatter = getHandler((value) => {\n const result = CardValidator.number(value);\n const maxLength =\n result.card && result.card.lengths ? Math.max.apply(null, result.card.lengths) : 19;\n const gaps = result.card && result.card.gaps ? result.card.gaps : [4, 8, 12];\n const digitsValue = value.replace(/[^\\d]/g, '').substr(0, maxLength);\n let newValue = '';\n let lastGap = 0;\n for (let i = 0; i <= gaps.length; i += 1) {\n const gap = gaps[i] || digitsValue.length;\n newValue += digitsValue.substring(lastGap, gap);\n if (gap < digitsValue.length) {\n newValue += ' ';\n }\n lastGap = gap;\n }\n return newValue;\n});\n\nexport const ccExpFormatter = getHandler((value) => {\n if (/\\d\\d\\//.test(value)) {\n // Skip if current input is `MM/` to preserve slash\n return null;\n }\n\n const digitsValue = value.replace(/[^\\d]/g, '');\n if (digitsValue.length <= 2) {\n return digitsValue;\n }\n return `${digitsValue.substring(0, 2)}/${digitsValue.substring(2, 4)}`;\n});\n\ntype TransformFunc = (value: string) => string | null;\n\nfunction getHandler(func: TransformFunc) {\n return (element?: HTMLInputElement) => {\n if (element) {\n element.addEventListener('keyup', (event) => handleEvent(event, true, func));\n element.addEventListener('blur', (event) => handleEvent(event, true, func));\n }\n };\n}\n\nfunction handleEvent(event: Event, isKeyUp: boolean, formatter: TransformFunc) {\n const elem = event.currentTarget as HTMLInputElement;\n const value = elem.value;\n\n if (\n isKeyUp &&\n (elem.selectionStart !== elem.selectionEnd || elem.selectionEnd !== elem.value.length)\n ) {\n // Skip if cursor is not at end of text\n return;\n }\n\n const newValue = formatter(value);\n\n if (newValue != null && newValue !== value) {\n elem.value = newValue;\n elem.setSelectionRange(newValue.length, newValue.length);\n }\n}\n","import classnames from 'classnames';\nimport * as React from 'react';\nimport { observer } from 'mobx-react';\n\nimport { ccNumberFormatter, ccExpFormatter } from '../../cc-formatters';\nimport { MatField } from 'src/core/components/mat-field';\n\nimport styles from './card-info.less';\nimport { CardInfoFormState } from '../card-info';\n\ninterface Props {\n data: CardInfoFormState;\n isAnonymousPayments: boolean;\n}\n\nexport const CardInfo = observer>(\n ({ data, isAnonymousPayments }) => (\n <>\n
\n
\n
\n \n
\n
\n ccNumberFormatter(ref)}\n />\n
\n
\n\n
\n
\n ccExpFormatter(ref)}\n />\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n\n {isAnonymousPayments && (\n
\n

\n I agree to pay the above amount in accordance with my cardholder agreement.\n By clicking “Submit Payment,” you confirm that you accept the{' '}\n \n Terms of Service\n {' '}\n &{' '}\n \n Privacy Policy\n \n .\n

\n
\n )}\n \n )\n);\n","import React, { useState } from 'react';\nimport classnames from 'classnames';\nimport * as styles from './card-select-modal.less';\nimport { CreditCard, CreditCardIssuer } from 'src/api';\nimport {\n Modal,\n Button,\n ButtonGroup,\n Card,\n Stack,\n BodyText,\n Tag,\n Radio,\n Link,\n} from '@servicetitan/design-system';\nimport { ModalSizes } from '@servicetitan/design-system/dist/components/Modal/components';\nimport { Divider } from '@material-ui/core';\n\ninterface CardSelectModalProps {\n cards: CreditCard[] | undefined;\n selectedCard: CreditCard;\n setSelectedCard: (selectedCard: CreditCard) => void;\n close: () => void;\n gotoNewCard: () => void;\n getCardIssuer: (issuer: CreditCardIssuer) => string;\n isOpen: boolean;\n gotoSavedCardPage: () => void;\n membershipNameType: string;\n isExpiringSoon: (year: number, month: number) => boolean;\n}\n\nexport const CardSelectModal: React.FC = ({\n cards,\n selectedCard,\n setSelectedCard,\n close,\n gotoNewCard,\n getCardIssuer,\n isOpen,\n gotoSavedCardPage,\n membershipNameType,\n isExpiringSoon,\n}) => {\n const [replacedCard, setReplacedCard] = useState(selectedCard);\n const handleSave = () => {\n setSelectedCard(replacedCard);\n close();\n };\n const renderCard = (card: CreditCard, index: number) => (\n
\n {index > 0 && }\n \n \n {!card.isExpired && (\n {\n setReplacedCard(card);\n }}\n checked={replacedCard?.id === card.id}\n />\n )}\n \n \n \n \n \n {getCardIssuer(card.issuer)} ending in {card.number}\n \n \n Expires {card.expMonth.toString().padStart(2, '0')}/{card.expYear}\n \n \n {card.cardholderName}\n \n \n \n {card.primary && (\n \n Primary Card\n \n )}\n {card.membership && (\n \n {membershipNameType}\n \n )}\n {card.isExpired && (\n \n Expired\n \n )}\n {!card.isExpired && isExpiringSoon(card.expYear, card.expMonth) && (\n \n Expiring Soon\n \n )}\n \n \n \n \n
\n );\n\n return (\n \n \n \n \n \n \n \n }\n footerAlign=\"space-between\"\n >\n \n \n To manage your saved cards,{' '}\n \n click here.\n \n \n {cards?.map((card, index) => renderCard(card, index))}\n \n \n );\n};\n","import classnames from 'classnames';\nimport * as React from 'react';\nimport { observer } from 'mobx-react';\n\nimport { loginContainer } from 'src/login/ioc';\nimport { MatField } from 'src/core/components/mat-field';\nimport { invoiceContainer } from '../../../../ioc';\n\nimport styles from './pg-card-info.less';\nimport { LoginStore } from 'src/login/stores/login.store';\nimport { InvoiceStore } from 'src/invoice/stores/invoice.store';\nimport { CreditCard } from 'src/api';\nimport {\n Card,\n Stack,\n BodyText,\n ButtonGroup,\n Button,\n Tag,\n Form,\n Icon,\n} from '@servicetitan/design-system';\nimport { SavedCreditCardsStore } from 'src/payment-method/stores/saved-credit-cards.store';\nimport { PGCardInfoFormState } from '../pg-card-info';\nimport { CardSelectModal } from 'src/payment-method/components/card-select-modal/card-select-modal';\n\ninterface Props {\n pgdata: PGCardInfoFormState;\n isAnonymousPayments: boolean;\n showSavePaymentInformation?: boolean | undefined;\n isEmbedded?: boolean | undefined;\n}\n\n@observer\nexport class PGCardInfo extends React.Component {\n private formState: PGCardInfoFormState;\n private isAnonymousPayments: boolean;\n private loginStore: LoginStore;\n private savedCreditCardsStore: SavedCreditCardsStore;\n private invoiceStore: InvoiceStore;\n private showSavePaymentInformation: boolean;\n private isEmbeded: boolean;\n\n constructor(props: Props) {\n super(props);\n this.formState = this.props.pgdata;\n this.isAnonymousPayments = this.props.isAnonymousPayments;\n this.loginStore = loginContainer.get(LoginStore);\n this.invoiceStore = invoiceContainer.get(InvoiceStore);\n this.savedCreditCardsStore = this.invoiceStore.getSavedCreditCardStore();\n this.showSavePaymentInformation =\n this.props.showSavePaymentInformation === undefined ? true :\n this.props.showSavePaymentInformation;\n this.isEmbeded = this.props.isEmbedded === undefined ? false :\n this.props.isEmbedded;\n }\n\n componentDidMount() {\n window.addEventListener('message', this.props.pgdata.iframeMessageHandler);\n if (this.formState.loggedIn) {\n this.savedCreditCardsStore.init();\n }\n }\n\n componentWillUnmount() {\n window.removeEventListener('message', this.props.pgdata.iframeMessageHandler);\n }\n\n renderStoredPaymentCard(card: CreditCard) {\n const goToNewCard = () => {\n this.formState.setUseNewCard(true);\n this.formState.setNeedToSelectAnotherCard(false);\n this.savedCreditCardsStore.setSelectedCardToPay(undefined);\n };\n const openCardSelect = () => {\n this.formState.setNeedToSelectAnotherCard(true);\n };\n return card && this.showSavePaymentInformation ? (\n
\n \n \n \n \n {this.savedCreditCardsStore.getCardIssuer(card.issuer)} ending in{' '}\n {card.number}\n \n \n Expires {card.expMonth.toString().padStart(2, '0')}/{card.expYear}\n \n \n {card.cardholderName}\n \n \n \n {card.primary && (\n \n Primary Card\n \n )}\n {card.membership && (\n \n {this.savedCreditCardsStore.membershipName}\n \n )}\n {card.isExpired && (\n \n Expired\n \n )}\n {!card.isExpired &&\n this.savedCreditCardsStore.isExpiringSoon(\n card.expYear,\n card.expMonth\n ) && (\n \n Expiring Soon{' '}\n \n )}\n \n \n \n \n \n \n \n \n \n
\n ) : null;\n }\n\n renderUseNewCard() {\n return (\n
\n
\n
\n \n
\n
\n \n
\n {this.formState.loggedIn &&\n this.savedCreditCardsStore.isSavedCreditCardEnabled &&\n this.showSavePaymentInformation && (\n \n Save payment information\n \n }\n checked={this.formState.needToStoreCreditCard}\n onChange={(_, checked) => {\n this.formState.setNeedToStoreCreditCard(checked);\n }}\n />\n )}\n {this.formState.showLoginLink && this.showSavePaymentInformation && (\n
\n \n Sign in\n \n {' to access your saved credit card information.'}\n
\n )}\n
\n
\n );\n }\n\n render() {\n const goToNewCard = () => {\n this.formState.setUseNewCard(true);\n this.formState.setNeedToSelectAnotherCard(false);\n this.savedCreditCardsStore.setSelectedCardToPay(undefined);\n };\n\n const needToDisplayBackwardIcon = () =>\n !!this.savedCreditCardsStore.savedCreditCards?.length &&\n this.formState.useNewCard &&\n this.formState.loggedIn &&\n !this.savedCreditCardsStore.selectedCardToPay;\n\n const goBackToNewCard = () => {\n this.formState.setUseNewCard(false);\n this.savedCreditCardsStore.setDefaultSelectedCardToPay();\n };\n\n return (\n <>\n
\n {needToDisplayBackwardIcon() && (\n \n )}\n {!this.isEmbeded && (

Card Information

)}\n {this.formState.loggedIn &&\n this.savedCreditCardsStore.selectedCardToPay &&\n !this.formState.useNewCard && this.showSavePaymentInformation\n ? this.renderStoredPaymentCard(this.savedCreditCardsStore.selectedCardToPay)\n : this.renderUseNewCard()}\n
\n\n {this.isAnonymousPayments && (\n
\n

\n I agree to pay the above amount in accordance with my cardholder\n agreement. By clicking “Submit Payment,” you confirm that you accept the{' '}\n \n Terms of Service\n {' '}\n &{' '}\n \n Privacy Policy\n \n .\n

\n
\n )}\n {this.formState.needToSelectAnotherCard &&\n this.savedCreditCardsStore.selectedCardToPay && this.showSavePaymentInformation && (\n this.formState.setNeedToSelectAnotherCard(false)}\n gotoNewCard={goToNewCard}\n isOpen={this.formState.needToSelectAnotherCard}\n getCardIssuer={this.savedCreditCardsStore.getCardIssuer}\n gotoSavedCardPage={this.savedCreditCardsStore.gotoSavedCardPage}\n membershipNameType={this.savedCreditCardsStore.membershipName}\n isExpiringSoon={this.savedCreditCardsStore.isExpiringSoon}\n />\n )}\n \n );\n }\n}\n","import React, { FC, useEffect, useRef, useState } from 'react';\nimport { AchInfoFormState } from '../../ach-info/ach-info/ach-info';\nimport { CardInfoFormState } from '../../card-info/card-info/card-info';\nimport { PGCardInfoFormState } from '../../card-info/pg-card-info/pg-card-info';\nimport { PaymentAmountFormState } from '../../payment-amount/payment-amount';\nimport { AchInfoContainer } from '../../ach-info/ach-info';\n\nimport styles from './payment-methods.less';\nimport classnames from 'classnames';\nimport { Radio } from '@material-ui/core';\n\nimport {\n usePlaidLink,\n PlaidLinkOptions,\n PlaidLinkOnSuccessMetadata,\n} from 'react-plaid-link';\nimport { ConnectedBankAccount, PaymentMethodType, PaymentMethodInfo } from 'src/invoice/types/types';\n\nimport { ConnectedAccounts } from '../../connected-accounts/connected-accounts';\nimport { Checkbox, IconNameType } from '@servicetitan/design-system';\nimport { CardInfo } from '../../card-info/card-info/desktop/card-info';\nimport { PGCardInfo } from '../../card-info/pg-card-info/desktop/pg-card-info';\nimport { paymentMethodsContainer } from 'src/payment-method/ioc';\nimport { PaymentGateway } from 'src/statement/stores/payment-gateway.store';\nimport { PendingInvoicePayment, SavedPaymentMethodsStore } from 'src/payment-method/stores/saved-payment-methods.store';\nimport { ChargeType, SplitInfo } from 'src/api';\nimport { ConfirmationModal } from 'src/payment/components/ach/desktop/confirmation-modal';\nimport { ClientDataStore } from 'src/core/stores/client-data.store';\n\ninterface PaymentMethodProps {\n paymentAmountData?: PaymentAmountFormState | undefined;\n cardInfoData: CardInfoFormState;\n pgcardInfoData: PGCardInfoFormState;\n achInfoData: AchInfoFormState;\n usePaymentGateway: () => boolean;\n showLoginLink: boolean;\n setPaymentMethodType?: ((paymentMethodType: PaymentMethodType) => void) | undefined;\n setPaymentMethodValid: (isValid: boolean) => void;\n setPaymentMethodAction: (action: () => void) => void;\n setPaymentMethodSubmit?: (submit: () => void) => void;\n setConnectedAccounts: (accounts: ConnectedBankAccount[]) => void;\n setPaymentButtonTextIcon?: (text: string, icon?: IconNameType | undefined) => void;\n showPrimaryOption?: boolean;\n showSavePaymentOption?: boolean;\n savePaymentChecked?: boolean;\n setSavePaymentChecked?: (checked: boolean) => void;\n useAsPrimaryPaymentChecked?: boolean;\n setUseAsPrimaryPaymentChecked?: (checked: boolean) => void;\n invoiceId?: string | undefined;\n statementId?: string;\n splits?: SplitInfo[];\n paymentMethodStore?: SavedPaymentMethodsStore;\n chargeType: ChargeType;\n setPayByBankReady?: (ready: boolean) => void;\n useFeatureGate?: boolean;\n};\n\ninterface PlaidLinkViewProps {\n linkToken: string | null;\n processPlaidSuccess: (publicToken: string, metadata: PlaidLinkOnSuccessMetadata) => void;\n setFailedBankName: (name: string | undefined) => void;\n setReady: (ready: boolean) => void;\n setOpen: (calback: Function) => void;\n}\n\nconst PlaidLinkView: FC = ({\n linkToken,\n processPlaidSuccess,\n setFailedBankName,\n setReady,\n setOpen\n}) => {\n\n const config: PlaidLinkOptions = {\n onSuccess: (publicToken, metadata) => {\n processPlaidSuccess(publicToken, metadata);\n },\n onExit: (_err, metadata) => {\n setFailedBankName(metadata.institution?.name);\n },\n onEvent: () => {\n },\n token: linkToken\n };\n\n const { open, ready } = usePlaidLink(config);\n\n useEffect(() => {\n setOpen(open);\n setReady(ready);\n }, [ready, open]);\n\n return (\n <>\n );\n}\n\nexport const PaymentMethods: FC = ({\n paymentAmountData,\n cardInfoData,\n pgcardInfoData,\n achInfoData,\n usePaymentGateway,\n showLoginLink,\n setPaymentMethodValid,\n setPaymentMethodAction,\n setConnectedAccounts,\n setPaymentButtonTextIcon,\n setPaymentMethodType,\n showPrimaryOption,\n showSavePaymentOption,\n savePaymentChecked,\n useAsPrimaryPaymentChecked,\n setSavePaymentChecked,\n setUseAsPrimaryPaymentChecked,\n invoiceId,\n statementId,\n paymentMethodStore,\n setPaymentMethodSubmit,\n splits,\n chargeType,\n setPayByBankReady,\n useFeatureGate\n}) => {\n\n const [isCreditCard, setIsCreditCard] = useState(false);\n const [isAch, setIsAch] = useState(false);\n const [isPayByBank, setIsPayByBank] = useState(true);\n const accountsRef = useRef([]);\n const [accounts, setAccounts] = useState([]);\n const [failedBankName, setFailedBankName] = useState(undefined);\n const store = paymentMethodStore || paymentMethodsContainer.get(SavedPaymentMethodsStore);\n const clientDataStore = paymentMethodsContainer.get(ClientDataStore);\n const paymentMethodTypeRef = useRef(PaymentMethodType.PayByBank);\n const paymentMethodLoadedRef = useRef(false);\n const [isACHModelOpen, setIsACHModelOpen] = useState(false);\n const [linkToken, setLinkToken] = useState(undefined);\n const [ready, setReady] = useState(false);\n const open = useRef(() => { });\n const [, setIsAchExceeded] = useState(null);\n const isSavedPaymentChecked = useRef(savePaymentChecked);\n const isUseAsPrimaryPaymentChecked = useRef(useAsPrimaryPaymentChecked);\n\n const paymentGateway = paymentMethodsContainer.get(PaymentGateway);\n const iframeMessageHandler = paymentGateway.iframeMessageHandler;\n\n useEffect(() => {\n if(!clientDataStore.isInitialized) clientDataStore.init();\n }, [clientDataStore.init]);\n\n useEffect(() => {\n window.addEventListener('message', iframeMessageHandler);\n return () => {\n window.removeEventListener('message', iframeMessageHandler);\n };\n }, []);\n\n const setOpen = (callback: Function) => {\n open.current = callback;\n }\n\n const fetchLinkToken = async () => {\n // Only set token once\n if (linkToken) {\n return;\n }\n\n const token = await store.getLinkToken();\n // Update link token\n setLinkToken(token);\n };\n\n useEffect(() => {\n store.currentInvoiceId = invoiceId;\n store.currentSplits = splits;\n store.currentStatementId = statementId;\n store.init(() => {\n fetchLinkToken();\n if ((!useFeatureGate && store.isPayByBankEnabled) || (useFeatureGate && store.isPayByBankFeatureOn)) {\n onPayByBankSelected();\n } else if ((!useFeatureGate && store.isCreditCardEnabled) || (useFeatureGate && store.isSavedCreditCardEnabled)) {\n onCreditCardSelected();\n } else if ((!useFeatureGate && store.isBankAccountEnabled) || (useFeatureGate && store.isSavedBankAccountFeatureOn)) {\n onACHSelected();\n }\n });\n }, [store.init]);\n\n\n const processPlaidSuccess = (publicToken: string, metadata: PlaidLinkOnSuccessMetadata) => {\n const connectedAccounts = metadata.accounts;\n const institution = metadata.institution;\n const institutionId = institution?.institution_id || '';\n if (!connectedAccounts) {\n return;\n }\n\n store.getInstitution(institutionId).then((institutionLogo) => {\n const updatedAccounts = accountsRef.current.filter(account => account.bankId !== institutionId);\n connectedAccounts.forEach(account => {\n // TODO: Switch to account.verification_status\n const verificationStatus = 'AutomaticallyVerified';\n console.log(account.verification_status);\n\n updatedAccounts.push({\n bankIcon: institutionLogo || 'assets/images/ach-account.svg',\n bankName: institution?.name,\n accountName: account.name,\n accountMask: account.mask,\n verificationStatus,\n selected: false,\n bankId: institutionId,\n accountType: account.subtype,\n accountId: account.id,\n publicToken\n });\n });\n\n const selectedAccount = updatedAccounts.find(account => account.selected);\n\n if (!selectedAccount && updatedAccounts.length > 0) {\n // Default first connected account to selected if previous account was replaced\n updatedAccounts[0].selected = true;\n }\n\n updateConnectedAccounts(updatedAccounts);\n });\n }\n\n const onPayByBankAction = () => {\n if (accountsRef.current.length > 0) {\n return;\n }\n\n if (ready) {\n setFailedBankName(undefined);\n connectAnotherAccount();\n }\n };\n\n const onCreditCardAction = async () => {\n usePaymentGateway()\n ? await pgcardInfoData.form.validate()\n : await cardInfoData.form.validate();\n };\n\n const onACHAction = async () => {\n await achInfoData.form.validate();\n };\n\n const getPaymentAmount = (): number => {\n if (!paymentAmountData) {\n return 0;\n }\n\n return (!paymentAmountData.isFullBalance.value\n ? parseFloat(paymentAmountData.customAmount.value)\n : paymentAmountData.fullBalance) || 0;\n };\n\n const resetSelectedStates = () => {\n setIsAch(false);\n setIsCreditCard(false);\n setIsPayByBank(false);\n }\n\n const onCreditCardSelected = () => {\n resetSelectedStates();\n setIsCreditCard(true);\n updatePaymentMethodType(PaymentMethodType.CreditCard);\n setButtonTextIcon('Pay');\n setPaymentMethodValid(true);\n setPaymentMethodAction(onCreditCardAction);\n };\n\n const onPayByBankSelected = () => {\n resetSelectedStates();\n setIsPayByBank(true);\n updatePaymentMethodType(PaymentMethodType.PayByBank);\n updateConnectedAccounts(accounts);\n setPaymentMethodValid(true);\n setPaymentMethodAction(onPayByBankAction);\n };\n\n const updatePaymentMethodType = (paymentMethodType: PaymentMethodType) => {\n if (setPaymentMethodType) {\n setPaymentMethodType(paymentMethodType);\n }\n paymentMethodTypeRef.current = paymentMethodType;\n }\n\n const setPaymentButtonForPayByBank = () => {\n let icon: IconNameType | undefined = 'lock';\n let text = 'Connect Bank Account';\n if (accountsRef.current.length > 0) {\n const selectedAccount = accountsRef.current.filter(acct => acct.selected)[0];\n icon = undefined;\n text = `Pay with ${selectedAccount.accountName} Ending *${selectedAccount.accountMask}`;\n }\n\n setButtonTextIcon(text, icon);\n };\n\n const onACHSelected = () => {\n resetSelectedStates();\n setIsAch(true);\n updatePaymentMethodType(PaymentMethodType.ACH);\n setButtonTextIcon('Pay');\n setPaymentMethodValid(true);\n setPaymentMethodAction(onACHAction);\n };\n\n const setButtonTextIcon = (text: string, icon?: IconNameType | undefined) => {\n if (setPaymentButtonTextIcon) {\n setPaymentButtonTextIcon(text, icon);\n }\n };\n\n const updateConnectedAccounts = (connectedAccounts: ConnectedBankAccount[]) => {\n setAccounts(connectedAccounts);\n setConnectedAccounts(connectedAccounts);\n accountsRef.current = connectedAccounts;\n setPaymentButtonForPayByBank();\n };\n\n const connectAnotherAccount = () => {\n setFailedBankName(undefined);\n open.current();\n };\n\n const onConfirmACHPaymentMethod = async () => {\n const amount = getPaymentAmount();\n const payment: PendingInvoicePayment = {\n amount,\n invoiceNumber: invoiceId!,\n amountRemaining: paymentAmountData?.fullBalance! - amount,\n chargeType,\n splits,\n statementId\n };\n const achPaymentMethod = await store.achInfoToPaymentMethod(achInfoData, false);\n if (!achPaymentMethod) {\n return;\n }\n\n setIsACHModelOpen(false);\n\n if (showPrimaryOption && isUseAsPrimaryPaymentChecked.current) {\n store.needToStoreAsPrimary = true;\n achPaymentMethod.primary = true;\n }\n\n if (showSavePaymentOption && isSavedPaymentChecked.current) {\n await store.addPaymentMethod(achPaymentMethod!);\n }\n\n await store.chargePaymentMethod(achPaymentMethod, payment);\n\n }\n\n const onPaymentMethodSubmit = async () => {\n const amount = getPaymentAmount();\n const type = paymentMethodTypeRef.current;\n\n const payment: PendingInvoicePayment = {\n amount,\n invoiceNumber: invoiceId!,\n amountRemaining: paymentAmountData?.fullBalance! - amount,\n chargeType,\n splits,\n statementId\n };\n\n if (type === PaymentMethodType.ACH) {\n const achPaymentMethod = await store.achInfoToPaymentMethod(achInfoData, false);\n if (!achPaymentMethod) {\n return;\n }\n\n setIsACHModelOpen(true);\n } else if (type === PaymentMethodType.CreditCard) {\n if (usePaymentGateway()) {\n const result = await pgcardInfoData.form.validate();\n\n if (result.hasError) {\n return;\n }\n\n const paymentMethod = { paymentMethodId: 0 } as PaymentMethodInfo;\n paymentMethod.paymentMethodType = PaymentMethodType.CreditCard;\n\n await store.processGatewayAddNewCard(async (gatewayPaymentMethod) => {\n if (gatewayPaymentMethod) {\n if (showPrimaryOption && isUseAsPrimaryPaymentChecked.current && isSavedPaymentChecked.current) {\n gatewayPaymentMethod!.primary = true;\n store.needToStoreAsPrimary = true;\n }\n\n if (showSavePaymentOption && isSavedPaymentChecked.current) {\n gatewayPaymentMethod!.storePaymentMethod = true;\n }\n store.chargePaymentMethod(gatewayPaymentMethod!, payment);\n }\n });\n\n } else {\n const creditCardPaymentMethod = await store.cardInfoToPaymentMethod(cardInfoData, false);\n if (!creditCardPaymentMethod) {\n return;\n }\n\n if (showPrimaryOption && isUseAsPrimaryPaymentChecked.current) {\n creditCardPaymentMethod.primary = true;\n store.needToStoreAsPrimary = true;\n }\n\n if (showSavePaymentOption && isSavedPaymentChecked.current) {\n creditCardPaymentMethod.storePaymentMethod = true;\n }\n\n await store.chargePaymentMethod(creditCardPaymentMethod, payment);\n }\n } else if (type === PaymentMethodType.PayByBank) {\n if (accountsRef.current.length < 1) {\n return;\n }\n\n const connectedAccount = accountsRef.current.filter(account => account.selected)[0];\n\n const payByBankPaymentMethod = store.connectedBankAccountToPaymentMethod(connectedAccount,\n false);\n\n if (showPrimaryOption && isUseAsPrimaryPaymentChecked.current) {\n payByBankPaymentMethod.primary = true;\n store.needToStoreAsPrimary = true;\n }\n\n if (showSavePaymentOption && isSavedPaymentChecked.current) {\n await store.addPaymentMethod(payByBankPaymentMethod!);\n }\n\n await store.chargePaymentMethod(payByBankPaymentMethod, payment);\n }\n };\n\n const onAmountStateChanged = () => {\n // Use for triggering refresh for amount change with regards to ACH amount\n setIsAchExceeded(isAchAmountExceeded);\n };\n\n const isAchAmountExceeded = () => {\n const maxAmount = 250000;\n return paymentMethodTypeRef.current === PaymentMethodType.ACH && getPaymentAmount() > maxAmount;\n }\n\n useEffect(() => {\n store.postalCode = store.usePaymentGateway() ? pgcardInfoData.postalCode : cardInfoData.postalCode;\n\n if (paymentAmountData) {\n paymentAmountData.onStateChanged = onAmountStateChanged;\n }\n\n if (!paymentMethodLoadedRef.current) {\n paymentMethodLoadedRef.current = true;\n\n if (setPaymentMethodSubmit) {\n setPaymentMethodSubmit(onPaymentMethodSubmit);\n }\n\n if (isCreditCard) {\n onCreditCardSelected()\n }\n\n if (isAch) {\n onACHSelected();\n }\n\n if (isPayByBank) {\n onPayByBankSelected();\n }\n\n pgcardInfoData.desktopPaymentGatewayUrl = paymentGateway.getDesktopPaymentGatewayUrl(store.usesPaymentsService);\n pgcardInfoData.mobilePaymentGatewayUrl = paymentGateway.getMobilePaymentGatewayUrl(store.usesPaymentsService);\n pgcardInfoData.iframeMessageHandler =\n pgcardInfoData.iframeMessageHandler || iframeMessageHandler;\n }\n }, []);\n\n useEffect(() => {\n if (ready && paymentMethodTypeRef.current === PaymentMethodType.PayByBank) {\n setPaymentMethodAction(onPayByBankAction);\n }\n if (ready && setPayByBankReady) {\n setPayByBankReady(ready);\n }\n }, [ready, open]);\n\n return (\n <>\n {linkToken && ()}\n {((!useFeatureGate && store.isCreditCardEnabled) || (useFeatureGate && store.isSavedCreditCardEnabled)) && \n
\n onCreditCardSelected()} />\n Credit Card\n
\n {isCreditCard && (usePaymentGateway() ? (\n pgcardInfoData ? (\n \n ) : null\n ) : cardInfoData ? (\n \n ) : null)}\n
\n
\n\n }\n\n {((!useFeatureGate && store.isPayByBankEnabled) || (useFeatureGate && store.isPayByBankFeatureOn)) && \n
\n onPayByBankSelected()} />\n Pay By Bank\n
\n \n Securely connect to your bank for faster payments and easier refund.\n \n {isPayByBank && (\n <>\n \n {accounts.length > 0 && (\n \n {accounts.length > 1 ? 'Connect a Different Account' : 'Connect Another Account'}\n \n )}\n\n {failedBankName && (\n
\n
\n \n \n Plaid had an issue connecting to your bank ({failedBankName})\n \n
\n
\n You can try connecting to the bank again later, try connecting to another bank, or use a different payment method.\n
\n
)}\n \n )}\n
\n
\n }\n\n {((!useFeatureGate && store.isBankAccountEnabled) || (useFeatureGate && store.isSavedBankAccountFeatureOn)) && (\n
\n onACHSelected()} />\n ACH\n
\n {(isAch && \n )}\n
\n
\n )}\n\n {showSavePaymentOption && (\n
\n {\n isSavedPaymentChecked.current = checked;\n if (setSavePaymentChecked) {\n setSavePaymentChecked(checked)\n }\n }} />\n Save Payment Information\n
\n )}\n\n {showPrimaryOption && (\n
\n {\n isUseAsPrimaryPaymentChecked.current = checked;\n if (setUseAsPrimaryPaymentChecked) {\n setUseAsPrimaryPaymentChecked!(checked);\n }\n }} />\n Use as Primary Payment Method\n
\n )}\n\n {showLoginLink && (\n Sign in to access your saved payment information.)}\n\n {isACHModelOpen && (\n setIsACHModelOpen(false)}\n onSubmit={onConfirmACHPaymentMethod}\n accountNumber={achInfoData.accountNumber.value || ''}\n />\n )}\n \n )\n};\n","import * as React from 'react';\nimport { observable, computed, action } from 'mobx';\nimport { observer } from 'mobx-react';\n\nexport interface IViewMore {\n currentHtml: string;\n isExpanded: boolean;\n showViewMore: boolean;\n toggleExpanded: () => void;\n setTextDiv: (div: HTMLDivElement | null) => IViewMore;\n}\n\ninterface ChildProps {\n viewMore: IViewMore;\n}\n\ninterface Props {\n dangerouslySetInnerHTML: string;\n component: React.ComponentType;\n}\n\n@observer\nexport class ViewMore extends React.Component implements IViewMore {\n @observable private fullHtml: string;\n @observable private shortHtml: string;\n @observable isExpanded = false;\n @observable showViewMore = false;\n @computed get currentHtml() {\n return this.isExpanded ? this.fullHtml : this.shortHtml;\n }\n private textDiv: HTMLDivElement | null = null;\n\n constructor(props: Props) {\n super(props);\n this.fullHtml = this.props.dangerouslySetInnerHTML;\n this.shortHtml = this.fullHtml;\n }\n\n @action\n componentWillUpdate(nextProps: Props) {\n if (this.fullHtml !== nextProps.dangerouslySetInnerHTML) {\n this.fullHtml = nextProps.dangerouslySetInnerHTML;\n this.shortHtml = this.fullHtml;\n this.isExpanded = false;\n this.showViewMore = false;\n if (this.textDiv) {\n setTimeout(() => this.calculateShortHtml());\n }\n }\n }\n\n setTextDiv = (div: HTMLDivElement | null) => {\n this.textDiv = div;\n this.calculateShortHtml();\n return this;\n };\n\n private calculateShortHtml() {\n const div = this.textDiv;\n if (!div) {\n return;\n }\n\n while (div.clientHeight < div.scrollHeight - 1) {\n // 1px allowance for Edge\n const index = div.innerHTML.lastIndexOf(' ');\n if (index >= 0) {\n div.innerHTML = `${div.innerHTML.substr(0, index)}…`;\n } else {\n break;\n }\n }\n this.shortHtml = div.innerHTML;\n this.showViewMore = this.shortHtml !== this.fullHtml;\n }\n\n toggleExpanded = () => {\n this.isExpanded = !this.isExpanded;\n };\n\n render() {\n const Component = this.props.component;\n return ;\n }\n}\n"],"sourceRoot":""}