1import{c as ae}from"./chunk-IXWSU3C7.js";import{d as ne,e as P,o as ce}from"./chunk-RCUDUYYY.js";import{A as oe,b as re}from"./chunk-QBKSJLGR.js";import{Dd as A,Hc as Q,Ic as T,Lc as R,Pc as V,Ub as W,Vc as X,Wb as J,Wc as Z,Xc as ee,Yc as ie,ja as K,md as te,x as G,ya as H}from"./chunk-CQ5D4WCL.js";import{B as h,Bc as N,Cc as Y,Dc as q,Fa as M,G as b,Gb as x,M as U,Mb as L,Oa as $,Qc as C,Sc as w,ec as j,ed as D,fc as B,id as k,jd as I,ka as _,kc as v,lc as f,mc as y,nc as E,ta as S,tb as O,xb as d,ya as o,zc as z}from"./chunk-G2MBAB6T.js";var le=(()=>{class r{constructor(e){this.redirectTaskService=e}gotoThankYouPage(){this.redirectTaskService.isRedirectToCheckInNeeded()?this.redirectTaskService.gotoToAppointmentCheckIn():this.redirectTaskService.isBaseUrlTypeCommon()?this.redirectTaskService.navigate([this.redirectTaskService.getBaseUrl()+"/copay-thank-you"],{queryParamsHandling:"preserve"}):this.redirectTaskService.gotoNextUndoneTaskOrCheckIn()}static{this.\u0275fac=function(t){return new(t||r)(o(ne))}}static{this.\u0275prov=S({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var Ke=(()=>{class r{constructor(e,t,i,c,s,u,a,m,n,p,l,g,F,ge){this.sanitizer=e,this.currentUserService=t,this.appointmentApiService=i,this.demographicsApiService=c,this.paymentApiService=s,this.checkInFlowService=u,this.onFlyTasksFlowService=a,this.copayService=m,this.errorService=n,this.loggingService=p,this.configService=l,this.deviceService=g,this.storageService=F,this.router=ge}prepareUrl(e,t,i={includeWallets:!0}){let c=t.url,s=t.trxCustId,u=t.trxCustIdLicenseKey,a=t.aggregatorId,m=this.sanitizer.sanitize(M.URL,window.location.href),n={amount:e,aggregators:a,trxcustid:s,trxcustid_licensekey:u,ticketno:H(),pre_auth:"y",display_logo:"y",hide_ticket:"y",wcag:"y",is_redirect:"y",response_url:m};i.includeWallets&&!this.checkInFlowService.isSelfCheckIn()&&(n.applepay="y",n.googlepay="y");let p=Object.entries(n).map(([l,g])=>`${l}=${encodeURIComponent(g)}`).join("&");return this.loggingService.log({message:"Prepared Trust Commerce URL",tcUrl:`${c}?${p}`,loggingApplication:this.configService.getAppName(),flow:this.storageService.get("appFlow"),page:window.location.href,os:this.deviceService.getOS()}),`${c}?${p}`}handleTrustCommerceRedirect(e,t){this.loggingService.log({message:"Checking url for trustCommerce params",tcUrl:window.location.href,loggingApplication:this.configService.getAppName(),flow:this.storageService.get("appFlow"),page:window.location.href,os:this.deviceService.getOS()});let i=this.parseParams(e.snapshot.queryParamMap);this.router.navigate([],{relativeTo:e,queryParams:{},replaceUrl:!0}),i.result&&this.postTrustCommercePayment(t,i)}parseParams(e){let t=["transaction[amount]","transaction[transid]","transaction[authcode]","transaction[status_name]","transaction[name]","transaction[ccBrand]"],i={amount:"transactionAmount",transid:"transactionId",authcode:"authCode",status_name:"result",name:"cardHolderName",ccBrand:"cardType"},c={};try{t.forEach(s=>{let u=e.get(s);if(u){let a=s.replace("transaction[","").replace("]","");c[i[a]]=u}}),Object.keys(c).length>0&&this.loggingService.log({message:`Parsed trust commerce redirect parameters: ${JSON.stringify(c)}`,loggingApplication:this.configService.getAppName(),flow:this.storageService.get("appFlow"),page:window.location.href,os:this.deviceService.getOS()})}catch(s){this.loggingService.log({message:`Error parsing Trust Commerce redirect parameters: ${s}`,loggingApplication:this.configService.getAppName(),flow:this.storageService.get("appFlow"),page:window.location.href,os:this.deviceService.getOS()})}return c}postTrustCommercePayment(e,t,i){try{let c;e.valueType===T.OUTSTANDING_BALANCE&&(c={amount:e.outstandingBalance.amount,departmentId:e.outstandingBalance.departmentUuid,financialGroupId:e.outstandingBalance.financialGroupId});let s=e?.todo?.source?.appointment_id??void 0;(()=>{if(i?.clinicUuid&&i?.patientId&&i?.userId)return h({clinicUuid:i.clinicUuid,patientId:i.patientId,userId:i.userId});let a="userId"in e?h(e.userId):this.currentUserService.getModel().pipe(b(n=>n.id)),m=s?this.appointmentApiService.get(s):h({clinicUuid:e?.clinicUuid,patientId:null});return U([a,m]).pipe(_(([n,p])=>{let l=i?.clinicUuid??p?.clinicUuid??e?.clinicUuid,g=i?.patientId??p?.patientId??null;return g?h({clinicUuid:l,patientId:g,userId:n}):this.demographicsApiService.getClinicUserDetails(l,n).pipe(b(F=>({clinicUuid:l,patientId:F.patientId,userId:n})))}
1))})().pipe(_(({clinicUuid:a,patientId:m,userId:n})=>{let p,l=this.checkInFlowService.isCheckInAppFlow()?R.CHECK_IN:R.MANUAL_FAST_PAY;this.onFlyTasksFlowService.isOnFlyTasksFlow()&&(p=this.onFlyTasksFlowService.getFlowResultUuid(a,String(n)),l=this.onFlyTasksFlowService.getPaymentSource(a,String(n))),this.loggingService.log({message:`Posting payment from Trust Commerce, patientId: ${m}, flowResultUuid: ${p}, paymentSource: ${l}`,loggingApplication:this.configService.getAppName(),clinicId:a,userId:n,flow:this.storageService.get("appFlow"),page:window.location.href,os:this.deviceService.getOS()});let g=e.valueType===T.COPAY?"copay":e.valueType===T.SELF_PAY?"selfpay":"balance";return this.paymentApiService.postTrustCommercePayment(a,m,g,{appointmentId:s,balanceData:c,transactionInfo:t,paymentSource:l,flowResultUuid:p})})).subscribe({next:()=>{this.checkInFlowService.isCheckInAppFlow()?this.markCheckInTaskAsCompleted(e):this.onFlyTasksFlowService.isOnFlyTasksFlow()?this.onFlyTasksFlowService.markTaskAsDoneAndMoveForward(e):this.copayService.gotoThankYouPage()},error:a=>{if(i?.errorCallback){i.errorCallback(a);return}this.errorService.displayNotification("We couldn't process your payment. Please try again or use a different method."),this.loggingService.log({message:"Error posting payment from Trust Commerce",loggingApplication:this.configService.getAppName(),flow:this.storageService.get("appFlow"),page:window.location.href,os:this.deviceService.getOS()})}})}catch(c){this.loggingService.log({message:"Error in postTrustCommercePayment",loggingApplication:this.configService.getAppName(),flow:this.storageService.get("appFlow"),page:window.location.href,os:this.deviceService.getOS()})}}markCheckInTaskAsCompleted(e){let t=e.copayTaskList.map(i=>this.checkInFlowService.markCheckInFlowTask(Q.DONE,i.source.appointment.id,i.settingId));U(t).subscribe({next:()=>{this.checkInFlowService.moveForwardFromCompletedTask(e)},error:()=>{this.loggingService.log({message:"Error marking check-in tasks as done",loggingApplication:this.configService.getAppName(),flow:this.storageService.get("appFlow"),page:window.location.href,os:this.deviceService.getOS()})}})}static{this.\u0275fac=function(t){return new(t||r)(o(G),o(ae),o(ee),o(ie),o(V),o(P),o(ce),o(le),o(Z),o(te),o(oe),o(A),o(W),o(K))}}static{this.\u0275prov=S({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var he=["*"],ve=()=>({name:"apple-pay"}),Se=()=>({name:"google-pay"});function fe(r,me){if(r&1&&(f(0,"a",1),C(1),k(2,"translate"),E(3,"lib-svg-icon",3),y()),r&2){let e=N();v("href",e.trustCommerceUrl,O),d(),w(" ",I(2,3,"Pay with")," "),d(2),v("params",D(5,ve))}}function ye(r,me){if(r&1&&(f(0,"a",2),C(1),k(2,"translate"),E(3,"lib-svg-icon",3),y()),r&2){let e=N();v("href",e.trustCommerceUrl,O),d(),w(" ",I(2,3,"Pay with")," "),d(2),v("params",D(5,Se))}}var oi=(()=>{class r{constructor(e,t){this.checkInFlowService=e,this.deviceService=t,this.cardPaymentTriggered=new $,this.isApplePayAvailable=!!window.ApplePaySession,this.isGooglePayAvailable=!(this.deviceService.isCordovaApp()&&this.deviceService.isIOSPlatform()),this.isSelfCheckIn=this.checkInFlowService.isSelfCheckIn()}static{this.\u0275fac=function(t){return new(t||r)(x(P),x(A))}}static{this.\u0275cmp=L({type:r,selectors:[["app-payment-buttons"]],inputs:{trustCommerceUrl:"trustCommerceUrl"},outputs:{cardPaymentTriggered:"cardPaymentTriggered"},ngContentSelectors:he,decls:6,vars:5,consts:[["libButton","","type","button",1,"button",3,"click"],["libButton","",1,"button","apple-pay",3,"href"],["libButton","",1,"button","google-pay",3,"href"],[3,"params"]],template:function(t,i){t&1&&(Y(),f(0,"button",0),z("click",function(){return i.cardPaymentTriggered.emit()}),C(1),k(2,"translate"),y(),j(3,fe,4,6,"a",1),j(4,ye,4,6,"a",2),q(5)),t&2&&(d(),w(" ",I(2,3,"PAY BY CARD"),` 2`),d(2),B(!i.isSelfCheckIn&&i.isApplePayAvailable&&i.trustCommerceUrl?3:-1),d(),B(!i.isSelfCheckIn&&i.isGooglePayAvailable&&i.trustCommerceUrl?4:-1))},dependencies:[re,X,J],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:.5rem}.button[_ngcontent-%COMP%]{width:15rem}.button.apple-pay[_ngcontent-%COMP%], .button.google-pay[_ngcontent-%COMP%]{background-color:#fff;color:#000;border:1px solid #000;font-family:Roboto-medium,sans-serif;padding:0;height:2.5rem;font-size:1rem;text-transform:none;gap:.25rem}.button.apple-pay[_ngcontent-%COMP%] lib-svg-icon[_ngcontent-%COMP%], .button.google-pay[_ngcontent-%COMP%] lib-svg-icon[_ngcontent-%COMP%]{--svg-width: 2.875rem;--svg-height: auto}.button.google-pay[_ngcontent-%COMP%]{color:#3c4043}"],changeDetection:0})}}return r})();export{le as a,Ke as b,oi as c};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.