From 90de2698c3668bc50e75eb34a5b3597963b39748 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 28 Aug 2018 13:34:59 +0200 Subject: [PATCH 1/2] Fix for new stripe API 2018-08-23 Fix break of change API --- htdocs/stripe/class/stripe.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index b8472d0b821..bf4103e51a8 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -166,7 +166,10 @@ class Stripe extends CommonObject { $dataforcustomer = array( "email" => $object->email, - "business_vat_id" => $object->tva_intra, + "tax_info" => array( + "tax_id" => $object->tva_intra ? $object->tva_intra : null, // We force data to "null" if empty as expected by Stripe + "type" => 'vat', + ), "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'])) ); From 25be9f59896ebe323a034abd0255a2db87580cc3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 29 Aug 2018 13:19:03 +0200 Subject: [PATCH 2/2] fix if null --- htdocs/stripe/class/stripe.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index bf4103e51a8..e8c0d7a3f12 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -166,13 +166,16 @@ class Stripe extends CommonObject { $dataforcustomer = array( "email" => $object->email, - "tax_info" => array( - "tax_id" => $object->tva_intra ? $object->tva_intra : null, // We force data to "null" if empty as expected by Stripe - "type" => 'vat', - ), "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'])) ); + + if ($object->tva_intra!=null) + { + $dataforcustomer["tax_info"] = array( + "tax_id" => $object->tva_intra, + "type" => 'vat'); + } //$a = \Stripe\Stripe::getApiKey(); //var_dump($a);var_dump($key);exit;