@@ -36,28 +36,34 @@ class Service {
36
36
return url . replace ( "-live" , "-test" ) ;
37
37
}
38
38
39
+ if ( config . environment === "LIVE" ) {
40
+ if ( config . liveEndpointUrlPrefix === undefined || config . liveEndpointUrlPrefix === "" ) {
41
+ throw new Error ( "Live endpoint URL prefix must be provided for LIVE environment." ) ;
42
+ }
43
+ }
44
+
39
45
if ( url . includes ( "pal-" ) ) {
40
- if ( this . client . liveEndpointUrlPrefix === "" )
46
+ if ( this . client . config . liveEndpointUrlPrefix === "" )
41
47
{
42
48
throw new Error ( "Please provide your unique live url prefix on the setEnvironment() call on the Client." ) ;
43
49
}
44
50
return url . replace ( "https://pal-test.adyen.com/pal/servlet/" ,
45
- `https://${ this . client . liveEndpointUrlPrefix } -pal-live.adyenpayments.com/pal/servlet/` ) ;
51
+ `https://${ this . client . config . liveEndpointUrlPrefix } -pal-live.adyenpayments.com/pal/servlet/` ) ;
46
52
}
47
53
48
54
if ( url . includes ( "checkout-" ) ) {
49
- if ( this . client . liveEndpointUrlPrefix === "" )
55
+ if ( this . client . config . liveEndpointUrlPrefix === "" )
50
56
{
51
57
throw new Error ( "Please provide your unique live url prefix on the setEnvironment() call on the Client." ) ;
52
58
}
53
59
54
60
if ( url . includes ( "/possdk/v68" ) ) {
55
61
return url . replace ( "https://checkout-test.adyen.com/" ,
56
- `https://${ this . client . liveEndpointUrlPrefix } -checkout-live.adyenpayments.com/` ) ;
62
+ `https://${ this . client . config . liveEndpointUrlPrefix } -checkout-live.adyenpayments.com/` ) ;
57
63
}
58
64
59
65
return url . replace ( "https://checkout-test.adyen.com/" ,
60
- `https://${ this . client . liveEndpointUrlPrefix } -checkout-live.adyenpayments.com/checkout/` ) ;
66
+ `https://${ this . client . config . liveEndpointUrlPrefix } -checkout-live.adyenpayments.com/checkout/` ) ;
61
67
}
62
68
63
69
return url . replace ( "-test" , "-live" ) ;
0 commit comments