@@ -18,6 +18,9 @@ Toolkit::test(function (): void {
1818 [
1919 'thepay ' => [
2020 'demo ' => true ,
21+ 'merchantId ' => 'test-merchant-id ' ,
22+ 'projectId ' => 3 ,
23+ 'apiPassword ' => 'secret ' ,
2124 ],
2225 ]
2326 );
@@ -26,13 +29,12 @@ Toolkit::test(function (): void {
2629 $ thePayConfig = $ thePayExtension ->getConfig ();
2730
2831 Assert::same (true , $ thePayConfig ->demo );
29- Assert::same ('https://www.thepay.cz/demo-gate/ ' , $ thePayConfig ->merchant ->gateUrl );
30- Assert::same (1 , $ thePayConfig ->merchant ->merchantId );
31- Assert::same (1 , $ thePayConfig ->merchant ->accountId );
32- Assert::same ('my$up3rsecr3tp4$$word ' , $ thePayConfig ->merchant ->password );
33- Assert::same ('my$up3rsecr3tp4$$word ' , $ thePayConfig ->merchant ->dataApiPassword );
34- Assert::same ('https://www.thepay.cz/demo-gate/api/gate-api-demo.wsdl ' , $ thePayConfig ->merchant ->webServicesWsdl );
35- Assert::same ('https://www.thepay.cz/demo-gate/api/data-demo.wsdl ' , $ thePayConfig ->merchant ->dataWebServicesWsdl );
32+ Assert::same ('test-merchant-id ' , $ thePayConfig ->merchantId );
33+ Assert::same (3 , $ thePayConfig ->projectId );
34+ Assert::same ('secret ' , $ thePayConfig ->apiPassword );
35+ Assert::same ('https://demo.api.thepay.cz/ ' , $ thePayConfig ->apiUrl );
36+ Assert::same ('https://demo.gate.thepay.cz/ ' , $ thePayConfig ->gateUrl );
37+ Assert::same ('cs ' , $ thePayConfig ->language );
3638});
3739
3840Toolkit::test (function (): void {
@@ -44,12 +46,9 @@ Toolkit::test(function (): void {
4446 [
4547 'thepay ' => [
4648 'demo ' => false ,
47- 'merchant ' => [
48- 'merchantId ' => 10 ,
49- 'accountId ' => 42 ,
50- 'password ' => 'abc ' ,
51- 'dataApiPassword ' => 'def ' ,
52- ],
49+ 'merchantId ' => 'prod-merchant-id ' ,
50+ 'projectId ' => 10 ,
51+ 'apiPassword ' => 'prod-secret ' ,
5352 ],
5453 ]
5554 );
@@ -58,11 +57,40 @@ Toolkit::test(function (): void {
5857 $ thePayConfig = $ thePayExtension ->getConfig ();
5958
6059 Assert::same (false , $ thePayConfig ->demo );
61- Assert::same ('https://www.thepay.cz/gate/ ' , $ thePayConfig ->merchant ->gateUrl );
62- Assert::same (10 , $ thePayConfig ->merchant ->merchantId );
63- Assert::same (42 , $ thePayConfig ->merchant ->accountId );
64- Assert::same ('abc ' , $ thePayConfig ->merchant ->password );
65- Assert::same ('def ' , $ thePayConfig ->merchant ->dataApiPassword );
66- Assert::same ('https://www.thepay.cz/gate/api/gate-api.wsdl ' , $ thePayConfig ->merchant ->webServicesWsdl );
67- Assert::same ('https://www.thepay.cz/gate/api/data.wsdl ' , $ thePayConfig ->merchant ->dataWebServicesWsdl );
60+ Assert::same ('prod-merchant-id ' , $ thePayConfig ->merchantId );
61+ Assert::same (10 , $ thePayConfig ->projectId );
62+ Assert::same ('prod-secret ' , $ thePayConfig ->apiPassword );
63+ Assert::same ('https://api.thepay.cz/ ' , $ thePayConfig ->apiUrl );
64+ Assert::same ('https://gate.thepay.cz/ ' , $ thePayConfig ->gateUrl );
65+ Assert::same ('cs ' , $ thePayConfig ->language );
66+ });
67+
68+ Toolkit::test (function (): void {
69+ $ thePayExtension = new ThePayExtension ();
70+
71+ $ compiler = new Compiler ();
72+ $ compiler ->addExtension ('thepay ' , $ thePayExtension );
73+ $ compiler ->addConfig (
74+ [
75+ 'thepay ' => [
76+ 'merchantId ' => 'custom-merchant ' ,
77+ 'projectId ' => 5 ,
78+ 'apiPassword ' => 'pass ' ,
79+ 'apiUrl ' => 'https://custom.api.thepay.cz/ ' ,
80+ 'gateUrl ' => 'https://custom.gate.thepay.cz/ ' ,
81+ 'language ' => 'en ' ,
82+ ],
83+ ]
84+ );
85+ $ compiler ->processExtensions ();
86+
87+ $ thePayConfig = $ thePayExtension ->getConfig ();
88+
89+ Assert::same (false , $ thePayConfig ->demo );
90+ Assert::same ('custom-merchant ' , $ thePayConfig ->merchantId );
91+ Assert::same (5 , $ thePayConfig ->projectId );
92+ Assert::same ('pass ' , $ thePayConfig ->apiPassword );
93+ Assert::same ('https://custom.api.thepay.cz/ ' , $ thePayConfig ->apiUrl );
94+ Assert::same ('https://custom.gate.thepay.cz/ ' , $ thePayConfig ->gateUrl );
95+ Assert::same ('en ' , $ thePayConfig ->language );
6896});
0 commit comments