Giter Club home page Giter Club logo

smartystreets-dotnet-sdk's People

Contributors

abbeynels avatar alrwarner avatar andrewjohnsonsmarty avatar asmorger avatar ckholt83 avatar duncanbeutler avatar dwhatcott avatar joliver avatar ky7m avatar landonsmarty avatar mdwhatcott avatar mouaying avatar oshionniemela avatar ryanlcox1 avatar savannah-ryan avatar smartybryan avatar smartycaroine avatar smartyjerry avatar smartyjohn avatar xansmarty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smartystreets-dotnet-sdk's Issues

Error on deserializing read-only members in the class: No set method for property 'Metadata' in type 'SmartyStreets.USStreetApi.Candidate'.

当我使用Unity2020.3.33环境 dotnet4.x 加入dll后遇到了如下问题
但是我在Editor下是没有问题的 在iOS端有问题

InvalidDataContractException: Error on deserializing read-only members in the class: No set method for property 'Metadata' in type 'SmartyStreets.USStreetApi.Candidate'.
at System.Runtime.Serialization.DataContract+DataContractCriticalHelper.ThrowInvalidDataContractException (System.String message, System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.JsonClassDataContract.get_JsonFormatReaderDelegate () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore (System.Runtime.Serialization.XmlReaderDelegator jsonReader, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson context) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue (System.Runtime.Serialization.XmlReaderDelegator jsonReader, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson context) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize (System.Runtime.Serialization.XmlReaderDelegator reader, System.String name, System.String ns, System.Type declaredType, System.Runtime.Serialization.DataContract& dataContract) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize (System.Runtime.Serialization.XmlReaderDelegator xmlReader, System.Int32 id, System.RuntimeTypeHandle declaredTypeHandle, System.String name, System.String ns) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.JsonFormatReaderInterpreter.InternalDeserialize (System.Type type, System.String name) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.JsonFormatReaderInterpreter.ReadCollection (System.Runtime.Serialization.CollectionDataContract collectionContract) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.JsonFormatReaderInterpreter.ReadCollectionFromJson (System.Runtime.Serialization.XmlReaderDelegator xmlReader, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson context, System.Xml.XmlDictionaryString emptyDictionaryString, System.Xml.XmlDictionaryString itemName, System.Runtime.Serialization.CollectionDataContract collectionContract) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.JsonFormatCollectionReaderDelegate.Invoke (System.Runtime.Serialization.XmlReaderDelegator xmlReader, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson context, System.Xml.XmlDictionaryString emptyDictionaryString, System.Xml.XmlDictionaryString itemName, System.Runtime.Serialization.CollectionDataContract collectionContract) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore (System.Runtime.Serialization.XmlReaderDelegator jsonReader, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson context) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue (System.Runtime.Serialization.XmlReaderDelegator jsonReader, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson context) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize (System.Runtime.Serialization.XmlReaderDelegator reader, System.String name, System.String ns, System.Type declaredType, System.Runtime.Serialization.DataContract& dataContract) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize (System.Runtime.Serialization.XmlReaderDelegator xmlReader, System.Type declaredType, System.Runtime.Serialization.DataContract dataContract, System.String name, System.String ns) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions (System.Runtime.Serialization.XmlReaderDelegator reader, System.Boolean verifyObjectName, System.Runtime.Serialization.DataContractResolver dataContractResolver) [0x00000] in <00000000000000000000000000000000>:0
at SmartyStreets.NativeSerializer.Deserialize[T] (System.IO.Stream source) [0x00000] in <00000000000000000000000000000000>:0
at SmartyStreets.USStreetApi.Client.Send (SmartyStreets.USStreetApi.Batch batch) [0x00000] in <00000000000000000000000000000000>:0
at AMPSDK.AviaSmartystreetsInstance.CheckUSAddress (AMPSDK.AviaSmartystreetsInstance+AviaAddressInfo addressInfo) [0x00000] in <00000000000000000000000000000000>:0
at UnitTest_Account.OnGUI () [0x00000] in <00000000000000000000000000000000>:0

NativeSender relies on obsolete WebRequest.Create

Hi, I noticed when looking through the code that NativeSender.cs relies on WebRequest.Create to make it's Http requests.

Microsoft recommends you switch this to use HttpClient:
https://learn.microsoft.com/en-us/dotnet/api/system.net.webrequest.create?view=net-7.0#system-net-webrequest-create(system-string)

It would be nice to have an overload in your API where I can provide my own instance of HttpClient, as that class is intended to only be initialized once:

https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-7.0#instancing

I'm evaluating Smarty right now for use in our application. If possible I would like to know if you are on board with making these changes and what your timeframe would be for implementing them?

Registering smarty streets with DI - Missing IInternationalStreetClient in 8.4.1 library?

I need to register two different clients in both my units tests (need to mock the client) and in my application. One for international addresses and one for US Street addresses)

It appears your source contains IInternationalStreetClient and IUSStreetClient

But when using the 8.4.1 SDK I can't seem to find these anywhere in the library.

How to use with DI without these two interfaces (IInternationalStreetClient and IUSStreetClient)?

Match Strategy Missing?

I've taken a look at the current client and lookup objects for the US Street Address API and I can't seem to find anything to lines up with the Match Strategy parameter in the API documentation. Am I missing something?

OpenAPI Specification

It looks like you guys are maintaining 8 different SDKs. Wouldn't it be easier to just provide us with something like an OpenAPI spec so that we could generate clients in any language? Would you be open to a PR somewhere that added a basic OpenAPI spec yaml/json file?

Supported SSL / security protocol options?

Currently, we're getting an SSL related exception when we attempt to invoke Send method with ClientBuilder:

System.Net.WebException: The SSL connection could not be established, see inner exception. Authentication failed because the remote party has closed the transport stream. ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Security.SslState.ThrowIfExceptional()
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.b__47_1(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at System.Net.HttpWebRequest.SendRequest() at System.Net.HttpWebRequest.GetResponse() --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetResponse() at SmartyStreets.NativeSender.GetResponse(WebRequest request) at SmartyStreets.NativeSender.Send(Request request) at SmartyStreets.StatusCodeSender.Send(Request request) at SmartyStreets.RetrySender.TrySend(Request request, Int32 attempt) at SmartyStreets.RetrySender.Send(Request request) at SmartyStreets.USStreetApi.Client.Send(Batch batch) at LPS.Services.SmartyStreetsService.Verify(Address address) in C:\Jenkins\workspace\LPS_IIS_SOM_DEV (R2 Sprint)\src\LPS.Services\SmartyStreetsService.cs:line 60 at LPS.WebApplication.Controllers.SmartyStreetsController.Post(Address model) in C:\Jenkins\workspace\LPS_IIS_SOM_DEV (R2 Sprint)\src\LPS.WebApplication\Controllers\SmartyStreetsController.cs:line 28 at lambda_method(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext) at LPS.WebApplication.Middleware.ApiKeyMiddleware.Invoke(HttpContext context) in C:\Jenkins\workspace\LPS_IIS_SOM_DEV (R2 Sprint)\src\LPS.WebApplication\Middleware\ApiKeyMiddleware.cs:line 34 at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context) at LPS.WebApplication.GlobalExceptionHandlerMiddleware.InvokeAsync(HttpContext httpContext, ILogger1 logger, IHostingEnvironment environment) in C:\Jenkins\workspace\LPS_IIS_SOM_DEV (R2 Sprint)\src\LPS.WebApplication\GlobalExceptionHandlerMiddleware.cs:line 28

This seems to be a security protocol related issue that SmartyStreets endpoint is rejecting our request for. What are the supported SSL options?

Footnotes values are differents between enhanced and strict match-strategies

Hi team,
Currently we are using smarty sdk with a match strategy= enhanced but for street address like bellow the sdk/api is returning a null value for Footnotes (and should be L#E#I# for the example bellow)

var streetAddress= new StreetDto()
            {
                City = "BALTIMORE",
                State = "MD",
                Street = "1 ROSEDALE",
                Street2 = null,
                ZipCode = "21229",
                MatchStrategy = Lookup.ENHANCED
            };

The strange behaivor is that if we change the strategy to Strict the problem is gone and we get a good result (L#E#I#)

why we get different results? (not sure if this a issue with sdk or the smarty street api).

a complete example of this issue is there: https://github.com/rolando-overactive/smartystreets/blob/main/SmartyStreetsTests/SmartyStreetsServiceTests.cs

thank you for your support!

TLS 1.2 Compliance

If we are using this library to execute API calls currently does the most recent version (8.3 as of this post) cover the TLS issues mentioned in this blog post? Or are there additional changes we need to make in our app

SmartStreets blog post

Smartystreets - Smarty Streets SDK returns null when the direct call to API return value

Hi team!
we are having an issue using .Net SDK.. Basically:

  1. Open https://www.smartystreets.com/products/single-address
  2. Open Network tab in Chrome DevTools
  3. Input and submit the next address 948 Gorham St Mount Dora FL 32777 (invalid ZIP)
  4. We get a response where the zip was corrected.

if you use the same address with the SDK this return null.
Actual result:
Smarty Streets SDK returns null when the direct call to API return value

Expected result:
Smarty Streets SDK returns the same value as a direct call to API does

Any advice?

InternationalStreetApi.Lookup does not implement ILookup

The InternationalStreetApi.LookUp class does not implement the ILookUp interface - is this intentional? I found this issue in a method that returns an ILookUp object. This method can't return an InternationalStreetApi.Lookup without explicitly casting the LookUp first.

Latitude/Longitude

Hi Team,
I am getting different results related with fields Latitude/Longitude from the API here: https://www.smartystreets.com/products/apis/us-street-api and the sdk.

Basically I am asking for this address:

 var streetAddress = new StreetDto()
            {
                City = "RIVIERA BEACH",
                State = "FL",
                Street = "1221 BIMINI LN",
                Street2 = null,
                ZipCode = "33404",
                MatchStrategy = Lookup.ENHANCED
            };

Where the API respond with: latitude: 26.792206 / longitude: -80.037132

But using the sdk I got this: latitude: 26.792180, longitude: -80.036310.

I am attaching the next image for some extra material:

image

and a unit test with name SearchPlacesAsync_ReturnLatitudAndLongitute_Fail (check this file: https://github.com/rolando-overactive/smartystreets/blob/main/SmartyStreetsTests/SmartyStreetsServiceTests.cs)

cc: @joliver

Autocomplete geolocate when going through a proxy

The documentation of the autocomplete API suggests that it's possible to geolocate when going through a proxy:

Whether to prefer address suggestions in the user's city and state, based on their IP address. (If the request to the Autocomplete API goes through a proxy, you will need to set an X-Forwarded-For header specifying the user's IP address.)

Is this supported by the C# SDK?

Missing columns

Hi,
I would like use the sdk in order to fill the next properties:

public class PropertyResult
    {

        public string City { get; set; }
        public string StateName { get; set; }
        public string StateCode { get; set; }
        public string Longitude { get; set; }
        public string Latitude { get; set; }
        public string PostalCode { get; set; }
    }

I've done a small example with the sdk but I found that some properties doesn't exist in the SDK

public static PropertyResult ToPropertyResult(this Candidate candidate)
        {
            return new PropertyResult()
            {
                City= string.Empty, // should exist something candidate.components.default_city_name
                Latitude = candidate.Metadata.Latitude.ToString(),
                Longitude = candidate.Metadata.Longitude.ToString(),
                StateCode = string.Empty, //candidate.Components.state_abbreviation
                StateName = string.Empty, //candidate.Components.state_name
                PostalCode = string.Empty // I think we must to call a second api 
            };
        }

then only propeties that I can get correctly are Latitude and Longitude but not the others.. any advice?

Send Requests async

Have you been thinking about adding SendAsync method ti IClient?
I've made a quick research and the biggest this is, that it would require cutting off .NET 3.5 as it does not support Task.

Not fully compatible with .NETCoreApp v2.0

I'm running a project in .NET CORE 2.0, and I'm constantly getting an error when I build:
smartystreets-dotnet-sdk 7.1.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
Apparently you're working on compatibility with 2.0. Your package seems to work fine so far, but you never know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.