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

View File

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