We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c05aca commit 66a9141Copy full SHA for 66a9141
src/Services/VatDetailsFromVatID.php
@@ -2,6 +2,9 @@
2
3
namespace TantHammar\LaravelRules\Services;
4
5
+use TantHammar\LaravelRules\Enums\BusinessNameLookupError;
6
+use TantHammar\LaravelRules\Rules\VatNumberFormat;
7
+
8
/**
9
* eu format or uk format:<br>
10
*
@@ -25,6 +28,11 @@ public static function lookup(string $vatID): object
25
28
return $empty;
26
29
}
27
30
31
+ //do simple validation before calling external api
32
+ if (! (new VatNumberFormat)->passes(null, $vatID)) {
33
+ return $empty;
34
+ }
35
36
// Do not use Facade. Configure VatCalculator to throw an error when country != GB, else only bool false is returned
37
$calculator = new \Mpociot\VatCalculator\VatCalculator(['forward_soap_faults' => true]);
38
try {
0 commit comments