Fix state code for payment from indonesia

This commit is contained in:
Laurent Destailleur 2018-05-25 16:21:13 +02:00
parent 37dcfe4a46
commit bf81b755f9
2 changed files with 17 additions and 2 deletions

View File

@ -271,6 +271,7 @@ if ($action == 'dopayment')
$PAYPAL_API_PRICE=price2num(GETPOST("newamount",'alpha'),'MT');
$PAYPAL_PAYMENT_TYPE='Sale';
// Vars that are used as global var later in print_paypal_redirect()
$origfulltag=GETPOST("fulltag",'alpha');
$shipToName=GETPOST("shipToName");
$shipToStreet=GETPOST("shipToStreet");
@ -283,6 +284,12 @@ if ($action == 'dopayment')
$email=GETPOST("email");
$desc=GETPOST("desc",'alpha');
// Special case for Paypal-Indonesia
if ($shipToCountryCode == 'ID' && ! preg_match('/\-/', $shipToState))
{
$shipToState = 'ID-'.$shipToState;
}
$mesg='';
if (empty($PAYPAL_API_PRICE) || ! is_numeric($PAYPAL_API_PRICE))
{
@ -1280,6 +1287,7 @@ if ($source == 'membersubscription')
$phoneNum=$member->phone;
if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip)
{
print '<!-- Shipping address information -->';
print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n";
print '<input type="hidden" name="shipToStreet" value="'.$shipToStreet.'">'."\n";
print '<input type="hidden" name="shipToCity" value="'.$shipToCity.'">'."\n";

View File

@ -195,7 +195,8 @@ if (GETPOST('action','aZ09') == 'dopayment')
$PAYPAL_API_PRICE=price2num(GETPOST("newamount",'alpha'),'MT');
$PAYPAL_PAYMENT_TYPE='Sale';
$origfulltag=GETPOST("fulltag",'alpha');
// Vars that are used as global var later in print_paypal_redirect()
$origfulltag=GETPOST("fulltag",'alpha');
$shipToName=GETPOST("shipToName");
$shipToStreet=GETPOST("shipToStreet");
$shipToCity=GETPOST("shipToCity");
@ -207,7 +208,13 @@ if (GETPOST('action','aZ09') == 'dopayment')
$email=GETPOST("email");
$desc=GETPOST("desc");
$mesg='';
// Special case for Paypal-Indonesia
if ($shipToCountryCode == 'ID' && ! preg_match('/\-/', $shipToState))
{
$shipToState = 'ID-'.$shipToState;
}
$mesg='';
if (empty($PAYPAL_API_PRICE) || ! is_numeric($PAYPAL_API_PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
//elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
//elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL);