FIX support for stripeconnect mode

This commit is contained in:
ptibogxiv 2018-03-14 12:01:15 +01:00 committed by GitHub
parent cc9a6ee6e0
commit e179161bfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr> * Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
@ -76,7 +76,7 @@ if (! empty($conf->stripe->enabled))
if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox','alpha')) if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox','alpha'))
{ {
$service = 'StripeLive'; $service = 'StripeLive';
$servicestatus = 0; $servicestatus = 1;
} }
$stripe = new Stripe($db); $stripe = new Stripe($db);
@ -397,7 +397,7 @@ if (empty($reshook))
if ($action == 'setassourcedefault') if ($action == 'setassourcedefault')
{ {
try { try {
$cu = \Stripe\Customer::retrieve($stripecu); $cu=$stripe->customerStripe($object->id, $stripeacc, $servicestatus);
$cu->default_source = (string) $source; $cu->default_source = (string) $source;
$result = $cu->save(); $result = $cu->save();
@ -413,7 +413,7 @@ if (empty($reshook))
elseif ($action == 'deletecard') elseif ($action == 'deletecard')
{ {
try { try {
$cu = \Stripe\Customer::retrieve($stripecu); $cu=$stripe->customerStripe($object->id, $stripeacc, $servicestatus);
$cu->sources->retrieve("$source")->detach(); $cu->sources->retrieve("$source")->detach();