File tree Expand file tree Collapse file tree
apps/web/components/apps/hitpay Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,13 +37,20 @@ export const HitpayPaymentComponent = (props: IPaymentComponentProps) => {
3737
3838 const parsedData = PaymentHitpayDataSchema . safeParse ( data ) ;
3939
40+ const getDomainFromCheckoutUrl = ( urlString : string ) => {
41+ const { hostname } = new URL ( urlString ) ;
42+
43+ return hostname
44+ . replace ( / ^ s e c u r e c h e c k o u t \. / , "" )
45+ . replace ( / ^ c h e c k o u t \. / , "" ) ;
46+ } ;
47+
4048 useEffect ( ( ) => {
4149 if ( parsedData . success ) {
4250 if ( window . self !== window . top && window . top ) {
4351 if ( ! isInitialized ) {
44- const subUrl = parsedData . data . url . substring ( "https://securecheckout." . length ) ;
45- const arr = subUrl . split ( "/" ) ;
46- const domain = arr [ 0 ] ;
52+
53+ const domain = getDomainFromCheckoutUrl ( parsedData . data . url ) ;
4754
4855 init (
4956 parsedData . data . defaultLink || "" ,
You can’t perform that action at this time.
0 commit comments