Add business_vat_id in stripe payment
This commit is contained in:
parent
b11727885e
commit
39506df4dd
@ -372,6 +372,7 @@ if ($action == 'dopayment')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Called when choosing Stripe mode, after the 'dopayment'
|
||||||
if ($action == 'charge')
|
if ($action == 'charge')
|
||||||
{
|
{
|
||||||
// Correct the amount according to unit of currency
|
// Correct the amount according to unit of currency
|
||||||
@ -384,20 +385,24 @@ if ($action == 'charge')
|
|||||||
|
|
||||||
$stripeToken = GETPOST("stripeToken",'alpha');
|
$stripeToken = GETPOST("stripeToken",'alpha');
|
||||||
$email = GETPOST("stripeEmail",'alpha');
|
$email = GETPOST("stripeEmail",'alpha');
|
||||||
|
$vatnumber = GETPOST('vatnumber','alpha');
|
||||||
|
|
||||||
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
|
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;
|
$error = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe');
|
dol_syslog("Create customer card profile", LOG_DEBUG, 0, '_stripe');
|
||||||
$customer = \Stripe\Customer::create(array(
|
$customer = \Stripe\Customer::create(array(
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'description' => ($email?'Customer for '.$email:null),
|
'description' => ($email?'Customer card profile for '.$email:null),
|
||||||
'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']),
|
'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 ?)
|
'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' ?
|
// TODO Add 'business_vat_id' ?
|
||||||
|
|
||||||
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
|
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
|
||||||
@ -773,6 +778,7 @@ if ($source == 'order')
|
|||||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||||
}
|
}
|
||||||
print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n";
|
print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n";
|
||||||
|
print '<input type="hidden" name="vatnumber" value="'.$order->thirdparty->tva_intra.'">'."\n";
|
||||||
$labeldesc=$langs->trans("Order").' '.$order->ref;
|
$labeldesc=$langs->trans("Order").' '.$order->ref;
|
||||||
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
|
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
|
||||||
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
|
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
|
||||||
@ -899,6 +905,7 @@ if ($source == 'invoice')
|
|||||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||||
}
|
}
|
||||||
print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n";
|
print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n";
|
||||||
|
print '<input type="hidden" name="vatnumber" value="'.$invoice->thirdparty->tva_intra.'">'."\n";
|
||||||
$labeldesc=$langs->trans("Invoice").' '.$invoice->ref;
|
$labeldesc=$langs->trans("Invoice").' '.$invoice->ref;
|
||||||
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
|
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
|
||||||
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
|
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
|
||||||
@ -1105,6 +1112,7 @@ if ($source == 'contractline')
|
|||||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||||
}
|
}
|
||||||
print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n";
|
print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n";
|
||||||
|
print '<input type="hidden" name="vatnumber" value="'.$contract->thirdparty->tva_intra.'">'."\n";
|
||||||
$labeldesc=$langs->trans("Contract").' '.$contract->ref;
|
$labeldesc=$langs->trans("Contract").' '.$contract->ref;
|
||||||
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
|
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
|
||||||
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
|
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
|
||||||
|
|||||||
@ -16,6 +16,8 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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');
|
$stripeToken = GETPOST("stripeToken",'alpha');
|
||||||
$email = GETPOST("stripeEmail",'alpha');
|
$email = GETPOST("stripeEmail",'alpha');
|
||||||
|
$vatnumber = GETPOST('vatnumber','alpha');
|
||||||
|
|
||||||
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
|
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;
|
$error = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe');
|
dol_syslog("Create customer card profile", LOG_DEBUG, 0, '_stripe');
|
||||||
$customer = \Stripe\Customer::create(array(
|
$customer = \Stripe\Customer::create(array(
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'description' => ($email?'Customer for '.$email:null),
|
'description' => ($email?'Customer card profile for '.$email:null),
|
||||||
'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']),
|
'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' ?
|
// TODO Add 'business_vat_id' ?
|
||||||
|
|
||||||
@ -577,6 +582,7 @@ if (GETPOST("source") == 'order')
|
|||||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||||
}
|
}
|
||||||
print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n";
|
print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n";
|
||||||
|
print '<input type="hidden" name="vatnumber" value="'.$order->thirdparty->tva_intra.'">'."\n";
|
||||||
print '<input type="hidden" name="desc" value="'.$langs->trans("Order").' '.$order->ref.'">'."\n";
|
print '<input type="hidden" name="desc" value="'.$langs->trans("Order").' '.$order->ref.'">'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,6 +693,7 @@ if (GETPOST("source") == 'invoice')
|
|||||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||||
}
|
}
|
||||||
print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n";
|
print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n";
|
||||||
|
print '<input type="hidden" name="vatnumber" value="'.$invoice->thirdparty->tva_intra.'">'."\n";
|
||||||
print '<input type="hidden" name="desc" value="'.$langs->trans("Invoice").' '.$invoice->ref.'">'."\n";
|
print '<input type="hidden" name="desc" value="'.$langs->trans("Invoice").' '.$invoice->ref.'">'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,6 +893,7 @@ if (GETPOST("source") == 'contractline')
|
|||||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||||
}
|
}
|
||||||
print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n";
|
print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n";
|
||||||
|
print '<input type="hidden" name="vatnumber" value="'.$contract->thirdparty->tva_intra.'">'."\n";
|
||||||
print '<input type="hidden" name="desc" value="'.$langs->trans("Contract").' '.$contract->ref.'">'."\n";
|
print '<input type="hidden" name="desc" value="'.$langs->trans("Contract").' '.$contract->ref.'">'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user