Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stripe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Extensions
Stripe
Commits
87833fda
Commit
87833fda
authored
8 years ago
by
Andie Hunt
Browse files
Options
Downloads
Patches
Plain Diff
processor_id on subscriptions
parent
69f6e004
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Core/Payment/Stripe.php
+8
-5
8 additions, 5 deletions
CRM/Core/Payment/Stripe.php
CRM/Stripe/Upgrader.php
+1
-0
1 addition, 0 deletions
CRM/Stripe/Upgrader.php
stripe.php
+1
-0
1 addition, 0 deletions
stripe.php
with
10 additions
and
5 deletions
CRM/Core/Payment/Stripe.php
+
8
−
5
View file @
87833fda
...
...
@@ -600,11 +600,12 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
// Prepare escaped query params.
$query_params
=
array
(
1
=>
array
(
$stripe_customer
->
id
,
'String'
),
2
=>
array
(
$this
->
_paymentProcessor
[
'id'
],
'Integer'
),
);
$existing_subscription_query
=
CRM_Core_DAO
::
singleValueQuery
(
"SELECT invoice_id
FROM civicrm_stripe_subscriptions
WHERE customer_id = %1 AND is_live = '
{
$this
->
_islive
}
'"
,
$query_params
);
WHERE customer_id = %1 AND is_live = '
{
$this
->
_islive
}
'
, and processor_id = %2
"
,
$query_params
);
if
(
!
empty
(
$existing_subscription_query
))
{
// Cancel existing Recurring Contribution in CiviCRM.
...
...
@@ -613,6 +614,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
// Prepare escaped query params.
$query_params
=
array
(
1
=>
array
(
$existing_subscription_query
,
'String'
),
2
=>
array
(
$this
->
_paymentProcessor
[
'id'
],
'Integer'
),
);
CRM_Core_DAO
::
executeQuery
(
"UPDATE civicrm_contribution_recur
...
...
@@ -632,21 +634,22 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
$query_params
=
array
(
1
=>
array
(
$stripe_customer
->
id
,
'String'
),
2
=>
array
(
$invoice_id
,
'String'
),
2
=>
array
(
$this
->
_paymentProcessor
[
'id'
],
'Integer'
),
);
// Insert the new Stripe Subscription info.
// Set end_time to NULL if installments are ongoing indefinitely
if
(
empty
(
$installments
))
{
CRM_Core_DAO
::
executeQuery
(
"INSERT INTO civicrm_stripe_subscriptions
(customer_id, invoice_id, is_live)
VALUES (%1, %2, '
{
$this
->
_islive
}
')"
,
$query_params
);
(customer_id, invoice_id, is_live
, processor_id
)
VALUES (%1, %2, '
{
$this
->
_islive
}
'
, %3
)"
,
$query_params
);
}
else
{
// Add the end time to the query params.
$query_params
[
3
]
=
array
(
$end_time
,
'Integer'
);
CRM_Core_DAO
::
executeQuery
(
"INSERT INTO civicrm_stripe_subscriptions
(customer_id, invoice_id, end_time, is_live)
VALUES (%1, %2, %3, '
{
$this
->
_islive
}
')"
,
$query_params
);
(customer_id, invoice_id, end_time, is_live
, processor_id
)
VALUES (%1, %2, %3, '
{
$this
->
_islive
}
'
, %3
)"
,
$query_params
);
}
return
$params
;
...
...
This diff is collapsed.
Click to expand it.
CRM/Stripe/Upgrader.php
+
1
−
0
View file @
87833fda
...
...
@@ -67,6 +67,7 @@ class CRM_Stripe_Upgrader extends CRM_Stripe_Upgrader_Base {
$this
->
ctx
->
log
->
info
(
'Applying civicrm_stripe update 4601. Adding processor_id to civicrm_stripe_customers and civicrm_stripe_plans table.'
);
CRM_Core_DAO
::
executeQuery
(
'ALTER TABLE civicrm_stripe_customers ADD COLUMN `processor_id` int(10) DEFAULT NULL COMMENT "ID from civicrm_payment_processor"'
);
CRM_Core_DAO
::
executeQuery
(
'ALTER TABLE civicrm_stripe_plans ADD COLUMN `processor_id` int(10) DEFAULT NULL COMMENT "ID from civicrm_payment_processor"'
);
CRM_Core_DAO
::
executeQuery
(
'ALTER TABLE civicrm_stripe_subscriptions ADD COLUMN `processor_id` int(10) DEFAULT NULL COMMENT "ID from civicrm_payment_processor"'
);
}
return
TRUE
;
}
...
...
This diff is collapsed.
Click to expand it.
stripe.php
+
1
−
0
View file @
87833fda
...
...
@@ -52,6 +52,7 @@ function stripe_civicrm_install() {
`invoice_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`end_time` int(11) NOT NULL DEFAULT '0',
`is_live` tinyint(4) NOT NULL COMMENT 'Whether this is a live or test transaction',
`processor_id` int(10) DEFAULT NULL COMMENT 'ID from civicrm_payment_processor',
KEY `end_time` (`end_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment