10
10
namespace FAPI \Sylius \Api ;
11
11
12
12
use FAPI \Sylius \Exception ;
13
- use FAPI \Sylius \Exception \Domain as DomainExceptions ;
14
13
use FAPI \Sylius \Exception \InvalidArgumentException ;
15
14
use FAPI \Sylius \Model \Checkout \PaymentCollection ;
16
15
use FAPI \Sylius \Model \Checkout \ShipmentCollection ;
@@ -64,15 +63,7 @@ public function updateAddress(int $cartId, array $shippingAddress, bool $differe
64
63
65
64
// Use any valid status code here
66
65
if (204 !== $ response ->getStatusCode ()) {
67
- switch ($ response ->getStatusCode ()) {
68
- case 400 :
69
- throw new DomainExceptions \ValidationException ();
70
- break ;
71
- default :
72
- $ this ->handleErrors ($ response );
73
-
74
- break ;
75
- }
66
+ $ this ->handleErrors ($ response );
76
67
}
77
68
}
78
69
@@ -94,15 +85,7 @@ public function updatePaymentMethod(int $cartId, array $params = [])
94
85
95
86
// Use any valid status code here
96
87
if (204 !== $ response ->getStatusCode ()) {
97
- switch ($ response ->getStatusCode ()) {
98
- case 400 :
99
- throw new DomainExceptions \ValidationException ();
100
- break ;
101
- default :
102
- $ this ->handleErrors ($ response );
103
-
104
- break ;
105
- }
88
+ $ this ->handleErrors ($ response );
106
89
}
107
90
}
108
91
@@ -124,15 +107,7 @@ public function complete(int $cartId)
124
107
125
108
// Use any valid status code here
126
109
if (204 !== $ response ->getStatusCode ()) {
127
- switch ($ response ->getStatusCode ()) {
128
- case 400 :
129
- throw new DomainExceptions \ValidationException ();
130
- break ;
131
- default :
132
- $ this ->handleErrors ($ response );
133
-
134
- break ;
135
- }
110
+ $ this ->handleErrors ($ response );
136
111
}
137
112
}
138
113
@@ -154,15 +129,7 @@ public function getShippingMethods(int $cartId)
154
129
155
130
// Use any valid status code here
156
131
if (200 !== $ response ->getStatusCode ()) {
157
- switch ($ response ->getStatusCode ()) {
158
- case 400 :
159
- throw new DomainExceptions \ValidationException ();
160
- break ;
161
- default :
162
- $ this ->handleErrors ($ response );
163
-
164
- break ;
165
- }
132
+ $ this ->handleErrors ($ response );
166
133
}
167
134
168
135
return $ this ->hydrator ->hydrate ($ response , ShipmentCollection::class);
@@ -186,15 +153,7 @@ public function getPaymentMethods(int $cartId)
186
153
187
154
// Use any valid status code here
188
155
if (200 !== $ response ->getStatusCode ()) {
189
- switch ($ response ->getStatusCode ()) {
190
- case 400 :
191
- throw new DomainExceptions \ValidationException ();
192
- break ;
193
- default :
194
- $ this ->handleErrors ($ response );
195
-
196
- break ;
197
- }
156
+ $ this ->handleErrors ($ response );
198
157
}
199
158
200
159
return $ this ->hydrator ->hydrate ($ response , PaymentCollection::class);
0 commit comments