1"use strict";(self.webpackChunkkarti_store=self.webpackChunkkarti_store||[]).push([[493],{2493:(Z,U,c)=>{c.r(U),c.d(U,{VerifyPaymentModule:()=>K});var G=c(6895),m=c(5115),r=c(4650),u=c(536),g=c(3192),p=c(3068),v=c(2203),f=c(1303),V=c(262),B=c(9646),E=c(8746),I=c(3615),T=c(529),Y=c(3087),O=c(1926),F=c(1514),S=c(2445),W=c(2471);let A=(()=>{class i{constructor(s,a,e,t,o,n,d,y,C,w){this.transactionService=s,this.cardService=a,this.router=e,this.utilService=t,this.storageService=o,this.localstorageSer=n,this.userService=d,this.gtmTagAnalyticsService=y,this.paymentFlowGuard=C,this.hyperpayUserDetailsService=w,this.isHomeOpended=!1,this.isJordanMode=this.utilService.isJordanMode,this.isPurchaseFlow=!0}navigateToHome(){this.isHomeOpended||(this.isHomeOpended=!0,setTimeout(()=>this.router.navigate(["/"]),0))}saveUserDetailsFromPaymentResponse(s){if(!s?.userProfile)return;const a=s.userProfile,e=a.userName||"",t=e.includes("@")?e:a.emailId||"";if(!t)return;const o=this.storageService.getSavedUserDetails();this.storageService.saveUserDetails(a.firstName||o?.firstName||"",a.lastName||o?.lastName||"",t)}completeSuccessfulPurchase(s,a){const e=s.purchasedCard,t=s.userDetailsDto,o=this.hyperpayUserDetailsService.getDetailsFromStoredPaymentRequest();this.storageService.setItem(m.BU.purchasedCardDetails,e),this.cardService.successPurchaseCard=e,this.handleUserProfileStorage(s),this.hyperpayUserDetailsService.handlePostPurchaseSuccess(o).subscribe(()=>{!this.hyperpayUserDetailsService.isLoggedInUser()&&!o&&this.saveUserDetailsFromPaymentResponse(t);const n=this.utilService.isBrowser&&sessionStorage.getItem("brand_checkout_data");this.paymentFlowGuard.markCompletedPurchase(),this.isJordanMode?this.router.navigate([e.cardDecreptedCode?"/payment-done":"/cards"]):n?(this.utilService.isBrowser&&(sessionStorage.setItem("purchased_card_details",JSON.stringify({purchasedCard:e,response:a})),sessionStorage.removeItem("brand_checkout_data")),this.router.navigate(["/payment/success"],{state:{purchasedCard:e,response:a}})):(this.router.navigate([e.cardDecreptedCode?"/":"/cards"]),this.utilService.showModal(I.z,{modalIndicator:this.isPurchaseFlow,response:s})),this.userService.refreshUserData$.next(!0)})}handleUserProfileStorage(s){if(!s.userDetailsDto||!s.token)return void console.log("User details or token missing, skipping profile storage");const e={token:s.token};this.storageService.setItem(m.BU.guestToken,e),this.localstorageSer.setItem(m.BU.guestToken,e),this.storageService.setItem(m.BU.purchaseToken,e),this.localstorageSer.setItem(m.BU.purchaseToken,e),console.log("Payment verification: User profile stored successfully")}getPaymentFailedData(s,a,e){return{error_code:a.toString()||"500",error_message:s||"Payment Verification Failed",failure_stage:e,payment_date:null}}getCardDetails(s){if(s){const a={checkOutId:s};this.utilService.isSecondaryLoading=!0,this.transactionService.paymentVerify(a).pipe((0,V.K)(e=>{console.error("Payment verification error:",e);let t=501;return e instanceof T.UA&&(t=e.status),this.cardService.payErrorCode=t,this.utilService.payErrorCodeError$.next(t),this.isHomeOpended||this.navigateToHome(),(0,B.of)({error:e.message||"Payment verification failed",status:t})}),(0,E.x)(()=>{this.utilService.isSecondaryLoading=!1})).subscribe({next:e=>{if(this.utilService.isSecondaryLoading=!1,e.purchasedCard&&e.purchasedCard.cardDecreptedCode)this.completeSuccessfulPurchase(e,e);else{sessionStorage.removeItem("brand_checkout_data");const t=e;this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData(t.message,t.status,"payment_processor")),this.utilService.payErrorCodeError$.next(t.status),this.cardService.payErrorCode=t.status,this.isHomeOpended||this.navigateToHome()}},error:({error:e,status:t})=>{console.error("Unexpected error in subscribe:",e,t),sessionStorage.removeItem("brand_checkout_data"),this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData("General Verify Payment Error",t,"payment_processor")),this.cardService.payErrorCode=t,this.utilService.payErrorCodeError$.next(t),this.isHomeOpended||this.navigateToHome(),this.utilService.isSecondaryLoading=!1}})}}}return i.\u0275fac=function(s){return new(s||i)(r.LFG(g.p),r.LFG(p.J),r.LFG(u.F0),r.LFG(v.f),r.LFG(f.V),r.LFG(Y.g),r.LFG(O.K),r.LFG(F.j),r.LFG(S.G),r.LFG(W.k))},i.\u0275prov=r.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})();var P=c(3450);let x=(()=>{class i{constructor(s,a,e,t,o,n,d,y,C,w){this.route=s,this.transactionService=a,this.cardService=e,this.router=t,this.utilService=o,this.storageService=n,this.verifyPaymentService=d,this.gtmTagAnalyticsService=y,this.paymentFlowGuard=C,this.utmPersistenceService=w,console.log("queryParams",this.route.
1snapshot.queryParams),this.utilService.isBrowser&&(this.utmPersistenceService.preserveSessionUtmsOnPaymentReturn(),this.utmPersistenceService.ensureUtmInCurrentUrl(this.router),this.verifyPaymentService.getCardDetails(this.route.snapshot.queryParams.id))}ngOnInit(){}getCardDetails(s){s&&this.transactionService.paymentVerify({checkOutId:s}).subscribe({next:e=>{if(e.purchasedCard&&e.purchasedCard.cardDecreptedCode){const o=e.purchasedCard;this.storageService.setItem(m.BU.purchasedCardDetails,o),this.cardService.successPurchaseCard=o,this.paymentFlowGuard.markCompletedPurchase(),this.router.navigate([o.cardDecreptedCode?"/payment-done":"/"])}else{const t=e;this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData(t.message,t.status,"payment_processor")),this.cardService.payErrorCode=t.status,this.router.navigate(["/"])}},error:({error:e,status:t})=>{this.cardService.payErrorCode=t,this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData(e.message,t,"payment_processor")),this.router.navigate(["/"])}})}getPaymentFailedData(s,a,e){return{error_code:a.toString()||"500",error_message:s||"Payment Verification Failed",failure_stage:e,payment_date:null}}}return i.\u0275fac=function(s){return new(s||i)(r.Y36(u.gz),r.Y36(g.p),r.Y36(p.J),r.Y36(u.F0),r.Y36(v.f),r.Y36(f.V),r.Y36(A),r.Y36(F.j),r.Y36(S.G),r.Y36(P.eH))},i.\u0275cmp=r.Xpm({type:i,selectors:[["app-verify-payment"]],decls:0,vars:0,template:function(s,a){}}),i})();var h=c(653),M=c(8618);let L=(()=>{class i{constructor(s,a,e,t,o,n,d,y,C){this.route=s,this.transactionService=a,this.cardService=e,this.router=t,this.utilService=o,this.storageService=n,this.paymentFlowGuard=d,this.utmPersistenceService=y,this.gtmTagAnalyticsService=C,this.mfaisaaPaymentQuery=new h.zM,this.isJordanMode=this.utilService.isJordanMode,this.utilService.isBrowser&&(this.utmPersistenceService.preserveSessionUtmsOnPaymentReturn(),this.utmPersistenceService.ensureUtmInCurrentUrl(this.router),this.mfaisaaPaymentQuery=new h.zM(this.route.snapshot.queryParams),this.getCardDetails(this.mfaisaaPaymentQuery))}ngOnInit(){this.isPurchaseFlow=!0}getCardDetails(s=new h.zM){if(s?.transactionID){const a=new h.Bg(this.mfaisaaPaymentQuery);a.userMsisdn=this.storageService.getItem(m.BU.mFaisaaUserMsisdn)||"",this.transactionService.paymentVerifyMfaisaa(a).subscribe({next:e=>{if(e.cardDecreptedCode){const t=e;this.storageService.setItem(m.BU.purchasedCardDetails,t),this.cardService.successPurchaseCard=t;const o=this.utilService.isBrowser&&sessionStorage.getItem("brand_checkout_data");this.paymentFlowGuard.markCompletedPurchase(),this.isJordanMode?this.router.navigate([t.cardDecreptedCode?"/payment-done":"/"]):o?(this.utilService.isBrowser&&(sessionStorage.setItem("purchased_card_details",JSON.stringify({purchasedCard:t,response:e})),sessionStorage.removeItem("brand_checkout_data")),this.router.navigate(["/payment/success"],{state:{purchasedCard:t,response:e}})):(this.router.navigate([t.cardDecreptedCode?"/":"/cards"]),this.utilService.showModal(I.z,{modalIndicator:this.isPurchaseFlow,response:e}))}else{sessionStorage.removeItem("brand_checkout_data");const t=e;this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData(t.message,t.status,"payment_processor")),this.cardService.payErrorCode=t.status,this.router.navigate(["/"])}},error:e=>{sessionStorage.removeItem("brand_checkout_data"),this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData(e.message,e.status,"payment_processor"));const t=e;this.router.navigate(["/"]),this.utilService.showModal(M.r,{customCode:"ERRORS."+t.status})}})}}getPaymentFailedData(s,a,e){return{error_code:a.toString()||"500",error_message:s||"General MFasiaa Payment Verify Error",failure_stage:e,payment_date:null}}}return i.\u0275fac=function(s){return new(s||i)(r.Y36(u.gz),r.Y36(g.p),r.Y36(p.J),r.Y36(u.F0),r.Y36(v.f),r.Y36(f.V),r.Y36(S.G),r.Y36(P.eH),r.Y36(F.j))},i.\u0275cmp=r.Xpm({type:i,selectors:[["app-m-fasiaa-vertify-payment"]],decls:0,vars:0,template:function(s,a){}}),i})(),R=(()=>{class i{constructor(s,a,e,t,o,n,d,y){this.route=s,this.transactionService=a,this.cardService=e,this.router=t,this.utilService=o,this.storageService=n,this.paymentFlowGuard=d,this.utmPersistenceService=y,this.WalletPaymentQuery=new h.s3,this.isHomeOpened=!1,this.isJordanMode=this.utilService.isJordanMode,this.utilService.isBrowser&&(this.utmPersistenceService.preserveSessionUtmsOnPaymentReturn(),this.utmPersistenceService.ensureUtmInCurrentUrl(this.router),this.WalletPaymentQuery=new h.s3(this.route.
1snapshot.queryParams),console.log("MFasiaaVertifyPaymentComponent queryParams",this.route.snapshot.queryParams),console.log("MFasiaaVertifyPaymentComponent.mfaisaaPaymentQuery",this.WalletPaymentQuery),this.getCardDetails(this.WalletPaymentQuery))}ngOnInit(){this.isPurchaseFlow=!0}navigateToHome(){this.isHomeOpened||(this.isHomeOpened=!0,setTimeout(()=>this.router.navigate(["/"]),0))}isPayloadEmpty(s){return!s||[s.partnerTxId,s.serviceId,s.signature,s.opId,s.dotTxId,s.userMsisdn].every(e=>!e||""===e.trim())}getCardDetails(s=new h.s3){if(!s||this.isPayloadEmpty(s))return console.warn("Dana eWallet payment verification: Empty or invalid payload, navigating to home"),void this.navigateToHome();new h.s3(this.WalletPaymentQuery),this.transactionService.paymentVerifyDanaEWallet(s).subscribe({next:e=>{if(e.cardDecreptedCode){const t=e;this.storageService.setItem(m.BU.purchasedCardDetails,t),this.cardService.successPurchaseCard=t;const o=this.utilService.isBrowser&&sessionStorage.getItem("brand_checkout_data");this.paymentFlowGuard.markCompletedPurchase(),this.isJordanMode?this.router.navigate([t.cardDecreptedCode?"/payment-done":"/"]):o?(this.utilService.isBrowser&&(sessionStorage.setItem("purchased_card_details",JSON.stringify({purchasedCard:t,response:e})),sessionStorage.removeItem("brand_checkout_data")),this.router.navigate(["/payment/success"],{state:{purchasedCard:t,response:e}})):this.router.navigate([t.cardDecreptedCode?"/":"/cards"])}else sessionStorage.removeItem("brand_checkout_data"),this.cardService.payErrorCode=e.status,this.router.navigate(["/"])},error:e=>{sessionStorage.removeItem("brand_checkout_data");const t=e;this.router.navigate(["/"]),this.utilService.showModal(M.r,{customCode:"ERRORS."+t.status})}})}}return i.\u0275fac=function(s){return new(s||i)(r.Y36(u.gz),r.Y36(g.p),r.Y36(p.J),r.Y36(u.F0),r.Y36(v.f),r.Y36(f.V),r.Y36(S.G),r.Y36(P.eH))},i.\u0275cmp=r.Xpm({type:i,selectors:[["app-dana-ewallet-vertify-payment"]],decls:0,vars:0,template:function(s,a){}}),i})();var J=c(4004),Q=c(7579),b=c(4482),H=c(5403),k=c(5577),N=c(2843),$=c(5963),D=c(8540);let j=(()=>{class i{constructor(s,a,e,t,o,n,d,y){this.transactionService=s,this.storageService=a,this.cardService=e,this.router=t,this.utilService=o,this.gtmTagAnalyticsService=n,this.paymentFlowGuard=d,this.utmPersistenceService=y,this.isHomeOpended=!1,this.isJordanMode=this.utilService.isJordanMode,this.maxRetries=4,this.retryDelayMs=1e4,this.isPurchaseFlow=!0}navigateToHome(){this.isHomeOpended||(this.isHomeOpended=!0,setTimeout(()=>this.router.navigate(["/"]),0))}isPayloadEmpty(s){return!s||[s.partnerTxId,s.serviceId,s.signature,s.opId,s.dotTxId,s.userMsisdn].every(e=>!e||""===e.trim())}getPaymentFailedData(s,a,e){return{error_code:a.toString()||"500",error_message:s||"Payment Verification Failed",failure_stage:e,payment_date:null}}getCardDetails(s){s&&!this.isPayloadEmpty(s)?(new h.s3(s),this.utilService.isSecondaryLoading=!0,this.transactionService.paymentVerifyEWallet(s).pipe((0,J.U)(e=>{if(e.status===h.YH.waitingWebhook)throw this.isHomeOpended||this.navigateToHome(),this.utilService.isSecondaryLoading=!0,new Error("Retrying after a delay due to webhook waiting");return e}),function z(i){return(0,b.e)((l,s)=>{let a,t,e=!1;const o=()=>{a=l.subscribe(new H.Q(s,void 0,void 0,n=>{t||(t=new Q.x,i(t).subscribe(new H.Q(s,()=>a?o():e=!0))),t&&t.next(n)})),e&&(a.unsubscribe(),a=null,e=!1,o())};o()})}(e=>e.pipe((0,k.z)((t,o)=>{const n=o+1;return n===this.maxRetries?(this.cleanWalletParamsFromUrl(),(0,N._)(()=>t)):(t instanceof T.UA?500===t.status&&(this.isHomeOpended||(this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData(t.message,t.status,"payment_processor")),this.navigateToHome())):console.log(`Non-HTTP error (${t.message}), retry attempt: ${n}/${this.maxRetries}`),(0,$.H)(this.retryDelayMs))}))),(0,V.K)(e=>{console.error("All retries failed or unrecoverable error:",e);let t=501;return e instanceof T.UA&&(t=e.status),this.cardService.payErrorCode=t,this.utilService.payErrorCodeError$.next(t),this.isHomeOpended||this.navigateToHome(),this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData(e.message||"Wallet Payment verification
1Error",t,"payment_processor")),(0,B.of)({error:e.message||"Payment verification failed",status:t})}),(0,E.x)(()=>{this.utilService.isSecondaryLoading=!1,this.cleanWalletParamsFromUrl()})).subscribe({next:e=>{if(this.utilService.isSecondaryLoading=!1,e.cardDecreptedCode){const t=e;this.storageService.setItem(m.BU.purchasedCardDetails,t),this.storageService.setItem(m.BU.wallet,(0,D.DB)(m.BU.temporrayWallet,this.utilService.isBrowser)),(0,D.SB)(m.BU.temporrayWallet,this.utilService.isBrowser),this.cardService.successPurchaseCard=t;const o=this.utilService.isBrowser&&sessionStorage.getItem("brand_checkout_data");this.paymentFlowGuard.markCompletedPurchase(),this.isJordanMode?this.router.navigate([t.cardDecreptedCode?"/payment-done":"/cards"]):o?(this.utilService.isBrowser&&(sessionStorage.setItem("purchased_card_details",JSON.stringify({purchasedCard:t,response:e})),sessionStorage.removeItem("brand_checkout_data")),this.router.navigate(["/payment/success"],{state:{purchasedCard:t,response:e}})):(this.router.navigate([t.cardDecreptedCode?"/":"/cards"]),this.utilService.showModal(I.z,{modalIndicator:this.isPurchaseFlow,response:e}))}else{sessionStorage.removeItem("brand_checkout_data"),(0,D.SB)(m.BU.temporrayWallet,this.utilService.isBrowser);const t=e;this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData(t.message,t.status,"payment_processor")),this.utilService.payErrorCodeError$.next(t.status),this.cardService.payErrorCode=t.status,this.isHomeOpended||this.navigateToHome()}},error:({error:e,status:t})=>{(0,D.SB)(m.BU.temporrayWallet,this.utilService.isBrowser),this.cardService.payErrorCode=t,this.utilService.payErrorCodeError$.next(t),this.gtmTagAnalyticsService.googleTagAnalyticsPaymentFailed(this.getPaymentFailedData(e.message||"Wallet Payment verification Error",t,"payment_processor")),this.isHomeOpended||this.navigateToHome(),this.utilService.isSecondaryLoading=!1}})):this.navigateToHome()}cleanWalletParamsFromUrl(){const s={...this.router.parseUrl(this.router.url).queryParams},a=this.utmPersistenceService.buildQueryParamsAfterStrip(s,m.nU);this.utmPersistenceService.applyQueryParamsWithoutNavigation(this.router,a)}}return i.\u0275fac=function(s){return new(s||i)(r.LFG(g.p),r.LFG(f.V),r.LFG(p.J),r.LFG(u.F0),r.LFG(v.f),r.LFG(F.j),r.LFG(S.G),r.LFG(P.eH))},i.\u0275prov=r.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})(),X=(()=>{class i{constructor(s,a,e,t,o){this.route=s,this.utilService=a,this.walletVerifyPaymentSer=e,this.router=t,this.utmPersistenceService=o,this.walletPaymentQuery=new h.s3,this.utilService.isBrowser&&(this.utmPersistenceService.preserveSessionUtmsOnPaymentReturn(),this.utmPersistenceService.ensureUtmInCurrentUrl(this.router),this.walletPaymentQuery=new h.s3(this.route.snapshot.queryParams),console.log("MFasiaaVertifyPaymentComponent queryParams",this.route.snapshot.queryParams),console.log("MFasiaaVertifyPaymentComponent.mfaisaaPaymentQuery",this.walletPaymentQuery),this.walletVerifyPaymentSer.getCardDetails(this.walletPaymentQuery))}ngOnInit(){}}return i.\u0275fac=function(s){return new(s||i)(r.Y36(u.gz),r.Y36(v.f),r.Y36(j),r.Y36(u.F0),r.Y36(P.eH))},i.\u0275cmp=r.Xpm({type:i,selectors:[["app-wallet-vertify-payment"]],decls:0,vars:0,template:function(s,a){}}),i})(),K=(()=>{class i{}return i.\u0275fac=function(s){return new(s||i)},i.\u0275mod=r.oAB({type:i}),i.\u0275inj=r.cJS({imports:[G.ez,u.Bz.forChild([{path:"",component:x,pathMatch:"full"},{path:"m-fasiaa",component:L},{path:"dana",component:R},{path:"wallet",component:X}])]}),i})()}}]);
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.