I am using UPS API for address validation. I am very new to this API and have just started learning.
I want to validate an address based on only zipcode i.e. I don't want to suppy the State name. It is not working in Test Integration environment. Any help?
I want to validate address using only Street Address and Zipcode. I don't want to supply State & City name. Is that possible? So far not working.
If I provide both State & Zipcode it is working nice.
How committed are you to the UPS API? My experience is that if they don't have it in the API already, it won't happen soon. There are other APIs available that will let you verify an address based on only the address and the ZIP code. typically, it is not necessary to provide a city or state if you have the correct ZIP code. The minimum required for address validation is street address and zip code or street address and city/state. how many addresses to need to verify each month? If you don't need a whole lot, there are a number of free APIs available. National address server is one, SmartyStreets.com is another. (I work for SmartyStreets.com.)
If you provide blank values for PoliticalDivision1 and PoliticalDivision2 the result back should include the city and state. You must still provide a valid address.
In a C++ application the following XML input used in street level address validator UPS API. Please use appropriate licence number, user id and password.
<?xml version=\"1.0\"?>
<AccessRequest xml:lang=\"en-US\"><AccessLicenseNumber>{LicenceNo}</AccessLicenseNumber><UserId>{UserId}</UserId><Password>{Passwd}</Password></AccessRequest>
<?xml version=\"1.0\"?>
<AddressValidationRequest xml:lang=\"en-US\">
<Request><TransactionReference><CustomerContext>Your Test Case Summary Description</CustomerContext><XpciVersion>1.0</XpciVersion></TransactionReference><RequestAction>XAV</RequestAction><RequestOption>3</RequestOption>
</Request>
<AddressKeyFormat><AddressLine>608 E. Evergreen Rd</AddressLine><PoliticalDivision2>LEBANON</PoliticalDivision2> <PoliticalDivision1>PA</PoliticalDivision1><PostcodePrimaryLow>17042</PostcodePrimaryLow><CountryCode>US</CountryCode> </AddressKeyFormat>
</AddressValidationRequest>
and following output received.
<?xml version=\"1.0\"?>
<AddressValidationResponse>
<Response>
<TransactionReference><CustomerContext>Your Test Case Summary Description</CustomerContext> <XpciVersion>1.0</XpciVersion></TransactionReference> <ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription>
</Response>
<ValidAddressIndicator/>
<AddressClassification><Code>1</Code><Description>Commercial</Description></AddressClassification>
<AddressKeyFormat><AddressClassification><Code>1</Code><Description>Commercial</Description></AddressClassification><AddressLine>608 E EVERGREEN RD</AddressLine><Region>LEBANON PA 17042-7925</Region><PoliticalDivision2>LEBANON</PoliticalDivision2><PoliticalDivision1>PA</PoliticalDivision1><PostcodePrimaryLow>17042</PostcodePrimaryLow><PostcodeExtendedLow>7925</PostcodeExtendedLow><CountryCode>US</CountryCode></AddressKeyFormat>
</AddressValidationResponse>
Another potential solution besides the UPS API is the Service Objects address validation web service. Full disclosure, I work for Service Objects, but the web service objectively fits your needs.
It can process addresses with just the address1 and zipcode fields. The web service can validate the information, append the city, state, zip+4, note any corrections/changes, and provide a Delivery Point Validation (DPV) code indicating the address's deliverability. Below is an example input and output showing the actual service response.
If you are interested in trying out the API a free trial key is available for testing. You want to get more information about the nitty gritty technical details check out the Developer Guide
Example Input:
Address1: 27 E Cota St Ste 500
Zipcode: 93101
{
"Addresses":[
{
"Address1":"27 E Cota St Ste 500",
"Address2":"",
"City":"Santa Barbara",
"State":"CA",
"Zip":"93101-7602",
"IsResidential":"false",
"DPV":"1",
"DPVDesc":"Yes, the input record is a valid mailing address",
"DPVNotes":"26,28,39",
"DPVNotesDesc":"The input address matched the ZIP+4 record,The input address matched the DPV record,Highrise apartment\/office building address",
"Corrections":"10,23",
"CorrectionsDesc":"City change,State change",
"BarcodeDigits":"931017602254",
"CarrierRoute":"C006",
"CongressCode":"24",
"CountyCode":"083",
"CountyName":"Santa Barbara",
"FragmentHouse":"27",
"FragmentPreDir":"E",
"FragmentStreet":"Cota",
"FragmentSuffix":"St",
"FragmentPostDir":"",
"FragmentUnit":"Ste",
"Fragment":"500",
"FragmentPMBPrefix":"",
"FragmentPMBNumber":""
}
],
"IsCASS":true
}
Related
I am developing a Mozilla Thunderbird plug-in and need to get the user's email address.
Question: How do I retrieve this address?
I will use it inside a JavaScript.
You should first keep in mind that a user can have multiple e-mail addresses (from multiple accounts or even multiple identities for one account), and you have to decide in which one you are interested.
Note: there may exist an easier way then described below, e.g. a helper function in the existing Thunderbird Code. You could try to search comm-central for it
You somehow have to get the nsIMsgIdentity for the identity you are interested in. It has an email property, with the e-mail adress as a string.
One way to get all Identities should be via the allIdentities of nsIMsgAccountManager (didn't test it).
Use the follwing code to get the nsIMsgAccountManager:
Components.utils.import("resource:///modules/mailServices.js");
let accountManager = MailServices.accounts
If you have an nsIArray of nsIMsgIdentity, you can use the following code to loop over them:
for (let identity in fixIterator(identities, Components.interfaces.nsIMsgIdentity)) {
}
References which could be useful:
Overview of some interesting interfaces:
https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Account_interfaces
Some account example Code:
https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Account_examples
require 'braintree'
# set credentials
Braintree::Configuration.merchant_id = 'XXX'
Braintree::Configuration.public_key = 'YYY'
Braintree::Configuration.private_key = 'ZZZ'
Braintree::Configuration.environment = :sandbox
# see the raw messages going to and from the Braintree server
Braintree::Configuration.logger = Logger.new(STDERR)
Braintree::Configuration.logger.level = Logger::DEBUG
customer = Braintree::Customer.create!(first_name: 'John', last_name: 'Doe')
begin
address = Braintree::Address.create!(customer_id: customer.id, locality: 'London')
pmethod = Braintree::PaymentMethod.create(customer_id: customer.id, billing_address_id: address.id, payment_method_nonce: 'fake-valid-visa-nonce')
p pmethod
ensure
# always delete the Customer in order not to leave much rubbish
# behind the testing session
Braintree::Customer.delete(customer.id)
end
I create a Customer, than an Address for him. When I attempt to create a PaymentMethod, using a nonce representing a credit card, and provide a billing address (by means of an ID of the previously saved Address), the PaymentMethod is not saved and error result is returned. The p pmethod line prints
#<Braintree::ErrorResult params:{...} errors:<credit_card:[(91701) Cannot provide both a billing address and a billing address ID.]>>
The error message doesn't make sense, as I only provide billing address ID. I have also checked that the SDK doesn't e.g. forge an empty address and send it to the server together with the PaymentMethod data provided in my code.
Creating a PaymentMethod without billing address works, but I really want to specify one.
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
Bottom-line: At this time, you cannot test the billing_address_id with a test nonce, but it will work with a nonce generated for the sandbox from a Drop-in or Custom Integration at the client side.
This is a limitation of the testing API itself. When you submit one of the test nonces, it pre-populates with data that is commonly required for various checks. One of those pre-populated fields is that of billing_address=>zip_code which you can see if you do a vanilla payment method create with the fake nonce you are using. billing_address can be overwritten with whatever test values you want, but you can't undo it or zero it out.
I'm trying to create a new charge via the Go API. I have a shipping address and a payment token. But the Go API doesn't seem to support sending the shipping address. The documentation indicates that it should support it but there isn't a direct mapping between the arguments described in the docs and the Go ChargeParams arguments and some are missing.
type ChargeParams struct {
Params
Amount uint64
Currency Currency
Customer, Token string
Desc, Statement, Email string
NoCapture bool
Fee uint64
Fraud FraudReport
Source *SourceParams
}
Is there some other way that I'm supposed to add the address that I'm missing?
I know nothing about Stripe's API but if you follow the fields of the struct, you find Charge ➜ Source ➜ Card ➜ Address1, Address2, City, State, Zip, Country. Is that what you are after?
Answer from Stripe support.
Thanks for writing in about this, I'm happy to help! Unfortunately our
go bindings don't support that parameter at the moment which is why
you couldn't find it in the source. The temporary solution would be to
create the POST request yourself when you need to send the shipping
details along with the charge.
I've forwarded this internally to make sure it gets addressed in the
future but unfortunately I don't have any timeline to share with you
at the moment. We are definitely open to a Pull Request from one of
our users so if that's something you'd feel comfortable building
yourself that would be awesome!
Here's how to use ChargeParams to include shipping infomation https://github.com/stripe/stripe-go/blob/master/charge/client_test.go
charge, err := New(&stripe.ChargeParams{
Amount: stripe.Int64(11700),
Currency: stripe.String(string(stripe.CurrencyUSD)),
Source: &stripe.SourceParams{Token: stripe.String("src_123")},
Shipping: &stripe.ShippingDetailsParams{
Address: &stripe.AddressParams{
Line1: stripe.String("line1"),
City: stripe.String("city"),
},
Carrier: stripe.String("carrier"),
Name: stripe.String("name"),
}
})
I've added several Subjects under the Admin section of Dynamics CRM. I'd really like to add one of these "Subjects" to the Regarding field within an Activity. E.g. someone called, and it was related to "ProductX".
Strangely, the entity type "Subject" does not appear when trying to select an item for the field. A range of other entity types such as "Contacts" and "Accounts" appear.
Does anyone know why Subjects can't be selected here? I would have expected this was OOB functionality.
That because it doesn’t really make sense to have activities regarding a subject.
An activity only really makes sense in the context of something else, and that something else is generally a real thing in the world or a piece of work. The Regarding field really says: "This Activity involves working on this thing".
For example, if John Smith rings your company, it makes sense to create a new Phone Call activity that Regards the Contact record of John Smith. With this approach you can see the entire activity history against a Contact. By making the Phone Call regard the Contact you are saying this piece of work is about the Contact.
If the Phone Call was Regarding a Subject, it would be saying, "This Phone Call involves working on the Subject", which isn’t true, its work about the Contact. Also you lose the ability to track correspondence with the contact.
So my suggestion would be, use the Regarding field to link to people and things, and add a relationship between your activities and subject if you want to classify your phone calls.
As a side, there is a product entity in CRM (it can’t be Regarding however), so perhaps you should create a relationship to that.
What is the most up to date, accurate, turn-key code to inject into a page to automatically read a user's IP and spit out their city... on this page we are borrowing from goingtorain.com I want it to display ... within 3 miles of (dynamic city)
http://www.drillavailable.neighborrow.com/
Another one we've been looking at to use is http://www.maxmind.com/app/geolitecity. Looks to be fairly simple to setup and is open source/free with apis for most popular languages.
Not done much other than play with it for 5 mins but looks promising.
I'd go with location aware browsing. Look into the W3C GeoLocation API.
For example, try Google Gears Geolocation module.
These technologies allow your clients to be geolocalized not only by looking and their IP (which can have 200km offsets) but also by triangulating SSID information from nearby wireless Access Points, and this can be extremely precise.
Once you have the (lon,lat) coordinates, it's just a matter of calling some webservice to get the nearest city's name.
I would choose the locator API at http://ipinfodb.com You can access it via XML or JSON, send it your API key and an IP and it will return the city, state, zip, country, etc. You can then parse the results in your language of choice. Its the simplest way to achieve this without actually storing any information about IP/location routing.
Yes, you only need to use the ClientLocation object in the google.loader namespace. In total the whole code is.
<script src="http://www.google.com/jsapi" language="javascript"></script>
<script language="javascript">
if (google.loader.ClientLocation != null) {
alert(google.loader.ClientLocation.address.city);
} else {
alert("Not found");
}
</script>
The properties available are
google.loader.ClientLocation.latitude
google.loader.ClientLocation.longitude
google.loader.ClientLocation.address.city
google.loader.ClientLocation.address.country
google.loader.ClientLocation.address.country_code
google.loader.ClientLocation.address.region