New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[resolu] Paypal US Account > State is required ! #17
Comments
Bonjour, |
Effectivement, c'est une lacune de Thelia. Le problème va être corrigé mais pas rapidement. ...
$this->getProvince($address->getCountry()), // state
... la fonction à ajouter /**
* fixme: waiting for province in Thelia
*/
protected function getProvince(Country $country)
{
$provinces = [
'CAN' => [
'AB' => ['alberta'],
'BC' => ['british columbia', 'colombie britannique'],
'PE' => ['prince edward island', 'ile du prince edouard'],
'MB' => ['manitoba'],
'NB' => ['new brunswick', 'nouveau brunswick'],
'NS' => ['nova scotia', 'nouvelle ecosse'],
'ON' => ['ontario'],
'QC' => ['quebec'],
'SK' => ['saskatchewan'],
'NL' => ['newfoundland and labrador', 'terre neuve et labrador'],
'NU' => ['nunavut'],
'NT' => ['northwest territories', 'territoires du nord ouest'],
'YT' => ['yukon'],
],
'USA' => [
'AL' => ['alabama'],
'AK' => ['alaska'],
'AZ' => ['arizona'],
'AR' => ['arkansas'],
'CA' => ['california'],
'NC' => ['north carolina'],
'SC' => ['south carolina'],
'CO' => ['colorado'],
'CT' => ['connecticut'],
'ND' => ['north dakota'],
'SD' => ['south dakota'],
'DE' => ['delaware'],
'FL' => ['florida'],
'GA' => ['georgia'],
'HI' => ['hawaii'],
'ID' => ['idaho'],
'IL' => ['illinois'],
'IN' => ['indiana'],
'IA' => ['iowa'],
'KS' => ['kansas'],
'KY' => ['kentucky'],
'LA' => ['louisiana'],
'ME' => ['maine'],
'MD' => ['maryland'],
'MA' => ['massachusetts'],
'MI' => ['michigan'],
'MN' => ['minnesota'],
'MS' => ['mississippi'],
'MO' => ['missouri'],
'MT' => ['montana'],
'NE' => ['nebraska'],
'NV' => ['nevada'],
'NH' => ['new hampshire'],
'NJ' => ['new jersey'],
'NM' => ['new mexico'],
'NY' => ['new york'],
'OH' => ['ohio'],
'OK' => ['oklahoma'],
'OR' => ['oregon'],
'PA' => ['pennsylvania'],
'RI' => ['rhode island'],
'TN' => ['tennessee'],
'TX' => ['texas'],
'UT' => ['utah'],
'VT' => ['vermont'],
'VA' => ['virginia '],
'WV' => ['west virginia'],
'WA' => ['washington'],
'WI' => ['wisconsin'],
'WY' => ['wyoming'],
]
];
$transliterator = Transliterator::create('NFD; [:Nonspacing Mark:] Remove; NFC;');
if (null !== $country) {
$name = $country->getTitle();
$name = $transliterator->transliterate($name);
$name = strtolower($name);
$name = preg_replace('#\s+#', ' ', $name);
if (array_key_exists($country->getIsoalpha3(), $provinces)) {
foreach ($provinces[$country->getIsoalpha3()] as $code => $provinceNames) {
foreach ($provinceNames as $provinceName) {
if (false !== strpos($name, $provinceName)) {
return $code;
}
}
}
}
}
return null;
} |
Merci ;) Maintenant l'erreur est : Une idée ? |
Transliterator est une classe standard : http://php.net/manual/fr/class.transliterator.php Essaie ça : |
Nickel, merci ça marche ;) |
Bonjour,
Faisant un test de paiement Paypal en tant que faux client américain, j'ai rencontré une erreur, cad l'apparition de la page "gotopaypalfail.html".
Les log de Paypal informe que l'état est manquant :
17: INFO [PaypalApiLogManager.php:logTransaction()] {59} 2015-03-16 17:04:00: 2015-03-16 16:04:00 Transaction Failure correlationId: 3da19670a1a2c error: [10729] The field Shipping Address State is required
Le pb est le même que ce soit "USA - New York" ou "USA - Alabama", etc...
Le fameux champ state si cher aux ricains doit aussi poser problème pour les clients canadiens...
Oups, ça ne semble pas être un bug mais une lacune, state est laissé vide...
Thelia 2.1.2
Module Paypal/Controller/GotoPaypal.php ligne 137 :
The text was updated successfully, but these errors were encountered: