From 8b233cf91ab1c7b4a2d152633fbee612d4dc649b Mon Sep 17 00:00:00 2001
From: "Matthew Wire (MJW Consulting)" <mjw@mjwconsult.co.uk>
Date: Thu, 17 Oct 2019 11:24:56 +0100
Subject: [PATCH] Add CiviCRM version info to stripe customer.

---
 CRM/Stripe/Customer.php | 3 +++
 docs/contribution.md    | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CRM/Stripe/Customer.php b/CRM/Stripe/Customer.php
index f9f49b9d..34cfd81d 100644
--- a/CRM/Stripe/Customer.php
+++ b/CRM/Stripe/Customer.php
@@ -3,6 +3,8 @@
  * https://civicrm.org/licensing
  */
 
+use CRM_Stripe_ExtensionUtil as E;
+
 /**
  * Class CRM_Stripe_Customer
  */
@@ -202,6 +204,7 @@ class CRM_Stripe_Customer {
       'metadata' => [
         'CiviCRM Contact ID' => $params['contact_id'],
         'CiviCRM URL' => CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$params['contact_id']}", TRUE),
+        'CiviCRM Version' => CRM_Utils_System::version() . ' ' . civicrm_api3('Extension', 'getvalue', ['return' => "version", 'full_name' => E::LONG_NAME]),
       ],
     ];
     return $stripeCustomerParams;
diff --git a/docs/contribution.md b/docs/contribution.md
index fba9652c..9f540a79 100644
--- a/docs/contribution.md
+++ b/docs/contribution.md
@@ -47,8 +47,9 @@ The following metadata is created for a Stripe Customer:
 
 * Contact Name, Email address
 * Description (`CiviCRM: ` + site name).
-* Contact ID
-* Link to CiviCRM contact record
+* Contact ID.
+* Link to CiviCRM contact record.
+* CiviCRM version info (eg. `5.18.3 6.2`).
 
 ![Stripe Customer](/images/stripedashboard_customerdetail.png)
 
-- 
GitLab