Merge remote-tracking branch 'upstream/develop' into new_branch_10_10_2018
This commit is contained in:
commit
bdb09a7f43
@ -147,19 +147,22 @@ class InterfaceStripe
|
|||||||
if ($customer)
|
if ($customer)
|
||||||
{
|
{
|
||||||
$namecleaned = $object->name ? $object->name : null;
|
$namecleaned = $object->name ? $object->name : null;
|
||||||
$vatcleaned = $object->tva_intra ? $object->tva_intra : null; // We force data to "null" if empty as expected by Stripe
|
$vatcleaned = array(
|
||||||
|
"tax_id" => $object->tva_intra ? $object->tva_intra : null, // We force data to "null" if empty as expected by Stripe
|
||||||
|
"type" => 'vat',
|
||||||
|
);
|
||||||
|
|
||||||
// Detect if we change a Stripe info (email, description, vat id)
|
// Detect if we change a Stripe info (email, description, vat id)
|
||||||
$changerequested = 0;
|
$changerequested = 0;
|
||||||
if (! empty($object->email) && $object->email != $customer->email) $changerequested++;
|
if (! empty($object->email) && $object->email != $customer->email) $changerequested++;
|
||||||
if ($namecleaned != $customer->description) $changerequested++;
|
if ($namecleaned != $customer->description) $changerequested++;
|
||||||
if ($vatcleaned != $customer->business_vat_id) $changerequested++;
|
if ($vatcleaned != $customer->tax_info) $changerequested++;
|
||||||
|
|
||||||
if ($changerequested)
|
if ($changerequested)
|
||||||
{
|
{
|
||||||
if (! empty($object->email)) $customer->email = $object->email;
|
if (! empty($object->email)) $customer->email = $object->email;
|
||||||
$customer->description = $namecleaned;
|
$customer->description = $namecleaned;
|
||||||
$customer->business_vat_id = $vatcleaned;
|
$customer->tax_info = $vatcleaned;
|
||||||
|
|
||||||
$customer->save();
|
$customer->save();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -189,11 +189,17 @@ class Stripe extends CommonObject
|
|||||||
{
|
{
|
||||||
$dataforcustomer = array(
|
$dataforcustomer = array(
|
||||||
"email" => $object->email,
|
"email" => $object->email,
|
||||||
"business_vat_id" => $object->tva_intra,
|
|
||||||
"description" => $object->name,
|
"description" => $object->name,
|
||||||
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']))
|
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($object->tva_intra!=null)
|
||||||
|
{
|
||||||
|
$dataforcustomer["tax_info"] = array(
|
||||||
|
"tax_id" => $object->tva_intra,
|
||||||
|
"type" => 'vat');
|
||||||
|
}
|
||||||
|
|
||||||
//$a = \Stripe\Stripe::getApiKey();
|
//$a = \Stripe\Stripe::getApiKey();
|
||||||
//var_dump($a);var_dump($key);exit;
|
//var_dump($a);var_dump($key);exit;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -55,4 +55,4 @@ else
|
|||||||
|
|
||||||
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
|
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
|
||||||
\Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version
|
\Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version
|
||||||
\Stripe\Stripe::setApiVersion("2018-07-27"); // force version API
|
\Stripe\Stripe::setApiVersion("2018-09-24"); // force version API
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user