diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 2b456e2d486..f5fb86c8bfa 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -372,6 +372,7 @@ if ($action == 'dopayment') } +// Called when choosing Stripe mode, after the 'dopayment' if ($action == 'charge') { // Correct the amount according to unit of currency @@ -384,20 +385,24 @@ if ($action == 'charge') $stripeToken = GETPOST("stripeToken",'alpha'); $email = GETPOST("stripeEmail",'alpha'); + $vatnumber = GETPOST('vatnumber','alpha'); dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); - dol_syslog("stripeEmail = ".$stripeEmail, LOG_DEBUG, 0, '_stripe'); + dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe'); + dol_syslog("vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe'); $error = 0; try { - dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe'); + dol_syslog("Create customer card profile", LOG_DEBUG, 0, '_stripe'); $customer = \Stripe\Customer::create(array( 'email' => $email, - 'description' => ($email?'Customer for '.$email:null), + 'description' => ($email?'Customer card profile for '.$email:null), 'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']), + 'business_vat_id' => ($vatnumber?$vatnumber:null), 'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?) )); + // Return $customer = array('id'=>'cus_XXXX', ...) // TODO Add 'business_vat_id' ? dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe'); @@ -773,6 +778,7 @@ if ($source == 'order') print ''."\n"; } print ''."\n"; + print ''."\n"; $labeldesc=$langs->trans("Order").' '.$order->ref; if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); print ''."\n"; @@ -899,6 +905,7 @@ if ($source == 'invoice') print ''."\n"; } print ''."\n"; + print ''."\n"; $labeldesc=$langs->trans("Invoice").' '.$invoice->ref; if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); print ''."\n"; @@ -1105,6 +1112,7 @@ if ($source == 'contractline') print ''."\n"; } print ''."\n"; + print ''."\n"; $labeldesc=$langs->trans("Contract").' '.$contract->ref; if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); print ''."\n"; diff --git a/htdocs/public/stripe/newpayment.php b/htdocs/public/stripe/newpayment.php index 03198ec8be6..5fd3924644e 100644 --- a/htdocs/public/stripe/newpayment.php +++ b/htdocs/public/stripe/newpayment.php @@ -16,6 +16,8 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * + * Page is called with payment parameters then called with action='dopayment', then called with action='charge' then redirect is done on urlok/jo */ /** @@ -216,19 +218,22 @@ if ($action == 'charge') $stripeToken = GETPOST("stripeToken",'alpha'); $email = GETPOST("stripeEmail",'alpha'); + $vatnumber = GETPOST('vatnumber','alpha'); dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); - dol_syslog("stripeEmail = ".$stripeEmail, LOG_DEBUG, 0, '_stripe'); + dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe'); + dol_syslog("vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe'); $error = 0; try { - dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe'); + dol_syslog("Create customer card profile", LOG_DEBUG, 0, '_stripe'); $customer = \Stripe\Customer::create(array( 'email' => $email, - 'description' => ($email?'Customer for '.$email:null), + 'description' => ($email?'Customer card profile for '.$email:null), 'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']), - 'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?) + 'business_vat_id' => ($vatnumber?$vatnumber:null), + 'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?) )); // TODO Add 'business_vat_id' ? @@ -577,6 +582,7 @@ if (GETPOST("source") == 'order') print ''."\n"; } print ''."\n"; + print ''."\n"; print 'ref.'">'."\n"; } @@ -687,6 +693,7 @@ if (GETPOST("source") == 'invoice') print ''."\n"; } print ''."\n"; + print ''."\n"; print 'ref.'">'."\n"; } @@ -886,6 +893,7 @@ if (GETPOST("source") == 'contractline') print ''."\n"; } print ''."\n"; + print ''."\n"; print 'ref.'">'."\n"; }