Update interface_99_modStripe_Stripe.class.php
This commit is contained in:
parent
3dd90a1f1a
commit
d6e8872af4
@ -122,17 +122,26 @@ $langs->load('other');
|
|||||||
/** Users */
|
/** Users */
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$stripe=new Stripe($db);
|
$stripe=new Stripe($db);
|
||||||
|
if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || empty($conf->global->STRIPECONNECT_LIVE) || GETPOST('forcesandbox','alpha')))
|
||||||
|
{
|
||||||
|
$service = 'StripeTest';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$service = 'StripeLive';
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'COMPANY_MODIFY') {
|
if ($action == 'COMPANY_MODIFY') {
|
||||||
dol_syslog(
|
dol_syslog(
|
||||||
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
);
|
);
|
||||||
if ($stripe->GetStripeAccount($conf->entity)&&$object->client!=0) {
|
if ($stripe->getStripeAccount($service) && $object->client!=0) {
|
||||||
$cu=$stripe->CustomerStripe($object->id,$stripe->GetStripeAccount($conf->entity));
|
$cu=$stripe->CustomerStripe($object->id,$stripe->getStripeAccount($service));
|
||||||
if ($cu) {
|
if ($cu) {
|
||||||
if ($conf->entity=='1'){
|
if ($conf->entity=='1'){
|
||||||
$customer = \Stripe\Customer::retrieve("$cu->id");
|
$customer = \Stripe\Customer::retrieve("$cu->id");
|
||||||
}else{
|
}else{
|
||||||
$customer = \Stripe\Customer::retrieve("$cu->id",array("stripe_account" => $stripe->GetStripeAccount($conf->entity)));
|
$customer = \Stripe\Customer::retrieve("$cu->id",array("stripe_account" => $stripe->getStripeAccount($service)));
|
||||||
}
|
}
|
||||||
if (!empty($object->email)) {$customer->email = "$object->email";}
|
if (!empty($object->email)) {$customer->email = "$object->email";}
|
||||||
$customer->description = "$object->name";
|
$customer->description = "$object->name";
|
||||||
@ -143,12 +152,12 @@ elseif ($action == 'COMPANY_DELETE') {
|
|||||||
dol_syslog(
|
dol_syslog(
|
||||||
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
);
|
);
|
||||||
$cu=$stripe->CustomerStripe($object->id,$stripe->GetStripeAccount($conf->entity));
|
$cu=$stripe->CustomerStripe($object->id,$stripe->getStripeAccount($service));
|
||||||
if ($cu) {
|
if ($cu) {
|
||||||
if ($conf->entity==1){
|
if ($conf->entity==1){
|
||||||
$customer = \Stripe\Customer::retrieve("$cu->id");
|
$customer = \Stripe\Customer::retrieve("$cu->id");
|
||||||
}else{
|
}else{
|
||||||
$customer = \Stripe\Customer::retrieve("$cu->id",array("stripe_account" => $stripe->GetStripeAccount($conf->entity)));
|
$customer = \Stripe\Customer::retrieve("$cu->id",array("stripe_account" => $stripe->getStripeAccount($service)));
|
||||||
}
|
}
|
||||||
$customer->delete();
|
$customer->delete();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user