USPS IntlRateV2 - country list - usps

I'm using USPS IntlRateV2 API to retrieve shipping rates for international customers.
The problem I'm facing is that USPS requires to fill in a country name (not the 2 characters code for it, but the full name) that causes me troubles getting rates for countries that have no straightforward name, for example: south Korea and there are many of such countries.
Does anyone can come up with a list of all USPS supported countries?
I've tried contacting the USPS but no reply given.
I appreciate any help.

I found a nice snippet to get the list off USPS website:
https://github.com/tajmorton/extract_usps_countries/blob/master/extract_countries.py
Credit goes to: taj morton

Related

CakePHP4 - idea for database across multiple tables

I'm creating a body-wax comparison website for my own project with cakephp4 and I'm stuck with a problem right now and I dunno what to do.
Situation:
There are multiple body-waxing companies, each company has many options for waxing like legs, arms,
beard etc. And each company has different price range for each waxing part.
CompanyA->arms = $60
CompanyA->legs = $30
CompanyB->arms = $50
I already connected to the Companies-table and Parts-table like the image below. Additionally, I came up with the idea of Prices-table too but I'm not sure if it's doable or I need to come up with something else.
Hopefully, I want to edit the price in the companies edit/add pages.
Any help I would appreciate.

Multiple language (but same value) count in Laravel

My Goal: To find out which University has the larger amount of user (DISTINCT and COUNT in MySQLi).
I've been developing a survey website for Portugal, England and France.
In the survey some questions answer has predefined answer options.
For example: Gender, Living Country, Graduation Level (undergraduate, graduate, PhD, BBA etc)
But I also have questions where users need to write down the answers.
For example, University Name (where the user studied).
Two users filled the form as follow:
In this case the text "University of Glasgow" in English and the text "Universidade of Glasgow" in Portuguese is difference but it's the same institute.
So, these two institute has one user but the truth is this (as both are originally same University) University has two users.
My Question: How can I get the expected result?
I was planning to use Google translate but I it won't be accurate.
I also thought about to have all the University name in 3 languages but there are more than thousands of University, so it may not be efficient.
The structre I thought for table is,
survey_table
id, que_en, que_fr, que_pt, university_name
statistics_table
id, university_name, count
You could use localization for the university name. Check the docs here:
https://laravel.com/docs/5.7/localization
Make your users choose from a drop down list based on their locale (language)

Zip code/Postal Code and location Database

Can you please suggest me a good provider for "City, State, Country, Zip code/postal code and geocode" Database. We have a requirement in our project for location search autocomplete. So, we need a database with complete locations list for US and Canada on priority and other countries in future.
Please suggest a location database provider with above mentioned fields, which has accurate data.
For Canada and the US see: https://geocoder.ca/?register=1&capostal=1
(
The Canadian Postal Code Dataset, last updated on 2018-07-01 00:15:15, with 5371 new records, has a total of 995676 unique postal codes.)
For your task you will most likely need: 2. Complete File - Canada Postal Address Database (20363095 records as of 2018-06-26 16:28:27)
As for the USA, fro the same source: the US Zip+4 Database Containing over 30Million Records
For USA you can populate data from the link below :
http://gomashup.com/cms/usa_zipcode_json

SKProduct localizedDescription in different languages

I have in app purchase in my app. I am testing a thai language device with a test account that is in the thai store. I have both English and thai in app purchase titles and descriptions.
SKProductsResponse (product details[localizedDescription, localizedTitle] of SKProduct)always returning in English.
What am I doing wrong?
My Test Device setup in the Thailand store with Thai as the language, but product details returning in english, i want to show user in thai format .
how it is possible, i tried so many way but i didn't find any solution till now.
You should create a test user account on iTunes Connect, and set it's iTune Store to Thailand. Then sign out your apple id from your device, but don't sign in with your test user account here. When you start purchasing your product, iTune account dialog will prompt you to sign in your Apple ID. After you sign in with your test account here, you should see the product details in Thai.
You can get more information in detail from here.

How many address fields would you use for a UK database?

Address records are probably used in most database, but I've seen a number of slightly different sets of fields used to store them. The number of fields seems to vary from 3-7, and sometimes all fields are simple labelled address1..addressN, other times given specific meaning (town, city, etc).
This is UK specific, though I'm open to comments about the rest of the world too. Here you need the first line of the address (actually just the number) and the post code to identify the address - everything else is mostly an added bonus.
I'm currently favouring:
Address 1
Address 2
Address 3
Town
County
Post Code
We could add Country if we ever needed it (unlikely).
What do you think? Is this too little, too much?
The Post Office suggests (http://www.postoffice.co.uk/portal/po/content1?catId=19100182&mediaId=19100267) 7 lines:
Addressees Name
Company/Organisation
Building Name
Number of building and name of thoroughfare
Locality Name
Post Town
Post Code
They then say you do not need to include a County name provided the Post Town and Postcode are used.
The BSI have BS 7666 - that covers all addressing. I recommend you look there.
The 2000 version recommends
An address shall be based upon a logical data model comprising the following entities:
addressable object, with sub-types:
primary addressable object;
secondary addressable object;
street;
locality;
town;
administrative area, a.k.a. district;
county;
postcode.
See: http://landregistry.data.gov.uk/def/common/BS7666Address
I don't know whether this is minimal (I doubt it) but the heading on my cheque book says something pretty close to:
Lloyds TSB
Isle of Man Offshore Centre
Peveril Buildings
Peveril Square
Douglas
Isle of Man
IM99 0XX
United Kingdom
This causes fits when I try to enter it into the US banking system.
If I were you, I'd call Royal Mail and ask them... or look on their website for postcode lookup as a best practice.
There's different types of addresses, and each different type has a slightly different structure. Forward sorting offices have a different postal address structure than a residential home with a street number. What if the house has a name instead of a number? There are so many factors to consider.
Since I moved to Canada I had to do something similar and it's far more complicated than a straightforward residential address which generally has:
Street Number if applicable
Street Number Suffix if applicable
House Name
Street Name
Street Type
Street Direction if applicable
Unit Number for flats, townhouses or other types of building/location
Minor Municipality (Village)
Major Municipality (Major Town/City)
County
PostCode
Country if you include Scotland, Wales, Northern Ireland (and now I noticed Eire)
Then you get businesses that have their own Delivery Route, PO Boxes, Forward Sortation Offices...
It gets complicated in a real hurry.
Best bet - give Royal Mail a call and they should be able to give you information on their standard address templates.
EDIT: Your 3 field method isn't a bad one...particularly. However, data sanitization may be a significant issue using the field setup you have and you may need a fairly complex strategy for making sure that the address entered is valid. It's far easier to sanitize single dedicated fields to make sure input is correct than it is to parse various address tokens out of combined fields.
Another simpler way to gain this info is to go on the Royal Mail website and check their postcode lookup page.
On their main postcode lookup, they use 4 fields and I guess they have some form of validation on the street name/type field. They separate the house number and name and I guess they only allow major municipality. I'm assuming the county/country are assumed. If you break out their advanced search, they give you two extra fields for flat number and business name.
Given that some fields are combined on their site, you have to assume that there's some amount of validation to make sure that data entered can be gainfully used.
Premises elements
Sub Building Name
Building Name
Building Number
Organisation Name
Department Name
PO Box Number
Thoroughfare elements
Dependent Thoroughfare Name
Dependent Thoroughfare Descriptor
Thoroughfare Name
Thoroughfare Descriptor
Locality elements
Double Dependent Locality
Dependent Locality
Post Town
Postcode element
Postcode
This answer may be a few years late, but it's aimed at those like myself looking for guidance on how to correctly format postal addresses for both storing in a database (or the likes of it) and for printing purposes.
Taken from Royal Mail Doc, link below - conveniently titled the 'Programmers Guide'
Technical specififcation for users of PAF
Page 27 - 42 was most helpful for me.
It's very likely that a "UK" will be opened to Eire as well, and in some lines of business there will be legal differences, generally between Scotland / NI / the channel islands and England and Wales.
In short, I would add country to the list. Otherwise it's fine (no fewer certainly), though of course any address is traceable from a building reference, a post code and a country alone.
Where we live in France its just 3 lines:-
myname
village/location name
6 digit postcode followed by post town name in uppercase
Even from UK that's all that is required

Resources