From f0c572717f0ef5a15338a52c17d01c449e2880a2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 21 Apr 2018 01:08:22 +0200 Subject: [PATCH 1/2] fix getcountry note: stripe account may just be call with customer not card or source --- htdocs/stripe/payment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 7e551965df7..a97d5eb4d71 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -32,6 +32,7 @@ // Load Dolibarr environment $res=@include("../main.inc.php"); // For root directory if (! $res) $res=@include("../../main.inc.php"); +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; @@ -305,7 +306,6 @@ if (empty($reshook)) { $stripeacc = $stripe->getStripeAccount($entity); $customer2 = \Stripe\Customer::retrieve($customer->id, array("stripe_account" => $stripeacc)); - //$src = $customer2->sources->retrieve("$source", array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided $src = $customer2->sources->retrieve("$source"); if ($src->type=='card') { @@ -395,7 +395,7 @@ if (empty($reshook)) } else { - $loc = dol_buildpath('/stripeconnect/payment.php?facid='.$facid.'&action=create&error='.$e->getMessage().'', 1); + $loc = DOL_URL_ROOT.'/stripeconnect/payment.php?facid='.$facid.'&action=create&error='.$e->getMessage(); $db->rollback(); header('Location: '.$loc); From f5ef0441fd1bf50851e9202566bbd9a50c8104df Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 21 Apr 2018 11:23:02 +0200 Subject: [PATCH 2/2] fix for customer rereive and charge with sources --- htdocs/stripe/payment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index a97d5eb4d71..1bf278965b8 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -304,8 +304,8 @@ if (empty($reshook)) } elseif (preg_match('/src_/i',$source)) { - $stripeacc = $stripe->getStripeAccount($entity); - $customer2 = \Stripe\Customer::retrieve($customer->id, array("stripe_account" => $stripeacc)); + + $customer2 = $customerstripe=$stripe->customerStripe($facture->thirdparty, $stripeacc, $servicestatus); $src = $customer2->sources->retrieve("$source"); if ($src->type=='card') {