public function testVerifyAddress() { $request = new \jdavidbakr\AddressVerification\AddressRequest(); $request->delivery_line_1 = '1600 Pennsylvania Ave NW'; $request->city_state_zip = 'Washington DC 20500'; $result = \jdavidbakr\AddressVerification\AddressVerificationService::Verify($request); $this->assertEquals($result->ZipAddon, '20500-0003'); }
public static function Verify(AddressRequest $request) { // Cache? if (config('address-verification.cache_time') > 0) { $key = 'jdavidbakr/AddressVerification' . md5(json_encode($request)); return Cache::remember($key, Carbon::now()->addDays(config('address-verification.cache_time')), function () use($request) { return AddressVerificationService::Query($request); }); } else { return AddressVerificationService::Query($request); } }