From f6bc48e6d7a40e3dd983997b0eae6b5f6c28a264 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 22:13:11 +0100 Subject: [PATCH 1/5] FIX minimal stripe update for compatibility cf https://stripe.com/guides/important-update-for-connect --- htdocs/stripe/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 17ca74b7955..3eb7feae0d5 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -55,4 +55,4 @@ else \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version -\Stripe\Stripe::setApiVersion("2019-05-16"); // force version API +\Stripe\Stripe::setApiVersion("2019-09-09"); // force version API From b9c0f961c9d890330c2027e7566f440fe2cc0c02 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 22:17:49 +0100 Subject: [PATCH 2/5] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 626f5533da4..d1b661841db 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -393,7 +393,7 @@ class Stripe extends CommonObject "currency" => $currency_code, "payment_method_types" => array("card"), "description" => $description, - "statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) //"save_payment_method" => true, "metadata" => $metadata ); @@ -683,7 +683,7 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, @@ -693,7 +693,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, @@ -721,7 +721,7 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata, From 16d08bd9031f6e50cde860a8a11018dd0bd9872a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 22:19:52 +0100 Subject: [PATCH 3/5] Update newpayment.php --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index dbceb483f97..a3667af0c6a 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -495,7 +495,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) 'metadata' => $metadata, 'customer' => $customer->id, 'source' => $card, - 'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + 'statement_descriptor_suffix' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) ), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc")); // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) From 753439efee7b0f21f8f023778b11263afa02afc4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 28 Nov 2019 23:23:08 +0100 Subject: [PATCH 4/5] Update stripe.php --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index c3c008a5874..4444dd4c540 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -161,7 +161,7 @@ print ''; dol_fiche_head($head, 'stripeaccount', '', -1); -$stripearrayofwebhookevents=array('payout.created','payout.paid','charge.pending','charge.refunded','charge.succeeded','charge.failed','payment_intent.succeeded','payment_intent.payment_failed','payment_method.attached','payment_method.updated','payment_method.card_automatically_updated','payment_method.detached','source.chargeable','customer.deleted'); +$stripearrayofwebhookevents=array('account.updated','payout.created','payout.paid','charge.pending','charge.refunded','charge.succeeded','charge.failed','payment_intent.succeeded','payment_intent.payment_failed','payment_method.attached','payment_method.updated','payment_method.card_automatically_updated','payment_method.detached','source.chargeable','customer.deleted'); print $langs->trans("StripeDesc")."
\n"; From 4bd4719aa660984a4d381f1cd5725d80d0e16566 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 1 Dec 2019 10:03:29 +0000 Subject: [PATCH 5/5] Fixing style errors. --- htdocs/stripe/class/stripe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index ef902b6164c..48127874e12 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -969,10 +969,10 @@ class Stripe extends CommonObject if (!in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100); else $stripefee = round($fee); - $paymentarray = array( + $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "description" => "Stripe payment: ".$description, "capture" => $capture, "metadata" => $metadata,