[This is preliminary documentation and is subject to change.]

Validates user phone information as being correct for a given country. This includes phone number, carrier, country, phone model, and email address.

Namespace:  PhoneSherpa.Services
Assembly:  App_Code.fxrph_yi (in App_Code.fxrph_yi)
Version: 0.0.0.0

Syntax

C#
public WS..::.ValidateUserPhoneInformationResult ValidateUserPhoneInformation(
	string AccessKey,
	WS..::.UserPhoneInformation UserPhoneInfo
)
Visual Basic (Declaration)
Public Function ValidateUserPhoneInformation ( _
	AccessKey As String, _
	UserPhoneInfo As WS..::.UserPhoneInformation _
) As WS..::.ValidateUserPhoneInformationResult
JScript
public function ValidateUserPhoneInformation(
	AccessKey : String, 
	UserPhoneInfo : WS..::.UserPhoneInformation
) : WS..::.ValidateUserPhoneInformationResult

Parameters

AccessKey
Type: System..::.String
Security key allocated to a developer enabling access to the web service API.
UserPhoneInfo
Type: PhoneSherpa.Services..::.WS..::.UserPhoneInformation
UserPhoneInformation structure containing the information to be validated. UserPhoneInfo.EmailAddress is optional; passing in an empty string to ignore it.

Return Value

A validated UserPhoneInformation structure, including a validated phone number with the international dialing code.

Remarks

This function is typically used to validate input from a user interface form that is capturing phone number, carrier, phone model and email fields. UserPhoneInformation parameters are taken by several API functions in the platform. Though these functions perform validation themselves, the ValidateUserPhoneInformation(...) is designed specifically to support end user form field validation.

UserPhoneInfo.PhoneNumber accepts a phone number to be validated. International country dialing code is optional. Non-numerics are automatically removed from the input parameter.

Below is an example of how to use this function:

CopyVB.NET
Function Validate_UserPhoneInformation(ByVal UserPhoneNumber As String, ByVal CountryID As Integer, ByVal CarrierID As Integer, ByVal PhoneModelID As Integer, ByVal EmailAddress As String) As String
   Dim SherpaService As New PhoneSherpa.Services.WS
   'Phone Sherpa services use a standard structure for passing phone delivery information.
   Dim UserPhoneInfo As New PhoneSherpa.Services.UserPhoneInformation

   UserPhoneInfo.CarrierId = CarrierID
   UserPhoneInfo.CountryId = CountryID
   UserPhoneInfo.EmailAddress = EmailAddress
   UserPhoneInfo.PhoneModelId = PhoneModelID
   UserPhoneInfo.PhoneNumber = UserPhoneNumber

    Dim Validate_Response As PhoneSherpa.Services.ValidatedUserPhoneInformationResult = Nothing

    Validate_Response = SherpaService.ValidateUserPhoneInformation("My_WSAccessKey", UserPhoneInfo)

    If Validate_Response.Result.ErrorCode = 0 Then
        'Use the returned user phone information for whatever you need
        Dim ValidatedUserPhoneInfo As PhoneSherpa.Services.UserPhoneInformation = Validate_Response.UserPhoneInformation

        '...
    Else
        'error - failed validating user information or the user information is not valid.
        'Display validation specific failures to the user.  
        'Merchant code should use thier own messaging rather than the raw error message in the response
        Return Validate_Response.Result.ErrorMessage
    End If
End Function

See Also